--- Log opened Tue Apr 24 00:00:45 2018 |
00:51 | | celmin|away is now known as celticminstrel |
01:03 | | Derakon[AFK] is now known as Derakon |
01:05 | | Vorntastic [uid293981@Nightstar-oju.p8m.184.192.IP] has joined #code |
01:20 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has quit [Ping timeout: 121 seconds] |
01:21 | | himi [sjjf@Nightstar-68d.2ni.203.150.IP] has joined #code |
01:21 | | mode/#code [+o himi] by ChanServ |
01:23 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has joined #code |
01:23 | | mode/#code [+o Alek] by ChanServ |
01:52 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds] |
01:54 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code |
01:54 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
02:31 | | Kindamoody is now known as Kindamoody[zZz] |
02:34 | | Degi [Degi@Nightstar-npfpr0.dyn.telefonica.de] has quit [Connection closed] |
03:00 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has quit [[NS] Quit: bbl berooting, there's weird load on the system freezing up the mouse every few seconds.] |
03:34 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has joined #code |
03:34 | | mode/#code [+o Alek] by ChanServ |
03:35 | | Vorntastic [uid293981@Nightstar-oju.p8m.184.192.IP] has quit [[NS] Quit: Connection closed for inactivity] |
04:31 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds] |
04:44 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code |
04:44 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
05:10 | | Derakon is now known as Derakon[AFK] |
05:23 | | celticminstrel is now known as celmin|sleep |
06:36 | | Vorntastic [uid293981@Nightstar-om40rg.irccloud.com] has joined #code |
07:13 | | himi [sjjf@Nightstar-68d.2ni.203.150.IP] has quit [Ping timeout: 121 seconds] |
07:17 | | Vornotron [Vorn@Nightstar-oe1443.res.rr.com] has joined #code |
07:17 | | mode/#code [+qo Vornotron Vornotron] by ChanServ |
07:20 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds] |
07:34 | | Vornotron [Vorn@Nightstar-oe1443.res.rr.com] has quit [Ping timeout: 121 seconds] |
07:40 | | macdjord [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
07:40 | | mode/#code [+o macdjord] by ChanServ |
07:40 | | macdjord is now known as macdjord|slep |
07:42 | | mac [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
07:54 | | mac [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
07:54 | | mode/#code [+o mac] by ChanServ |
07:56 | | macdjord|slep [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
08:23 | | Kindamoody[zZz] is now known as Kindamoody |
08:52 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has quit [Ping timeout: 121 seconds] |
08:52 | | Alek [Alek@Nightstar-7or629.il.comcast.net] has joined #code |
08:53 | | mode/#code [+o Alek] by ChanServ |
08:56 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
08:56 | | mode/#code [+o himi] by ChanServ |
09:09 | | Emmy-zZz [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code |
09:09 | | Emmy-zZz is now known as Emmy |
09:38 | <@TheWatcher> | Ugh |
09:39 | <@TheWatcher> | Is there some kinds of Web Developer Bingo I missed the memo for? |
09:39 | <@TheWatcher> | Because of late, almost every bloody project I deal with seems to be trying to play either bingo - or pokemon, one or the other - with languages |
09:40 | < simon_> | TheWatcher, how so? |
09:44 | <@TheWatcher> | At this point, the ones that are just using PHP+Javascript are actually looking sane and restrained. One project I'm working with at the moment is using python, ruby, go, shell scripts, and node.js on the backend (and obviously javascript with jquery on the front, but that's a given these days). Another is using python, node, and a bunch of custom node modules including |
09:44 | <@TheWatcher> | some c++ code. |
09:45 | <@TheWatcher> | I'm just like... choose a fucking language and use it. |
09:48 | <@TheWatcher> | And if you're finding that language can't do what you want, perhaps _you chose the wrong one and should start over_ rather than bolting bits together into some teetering frankenstien monster of a system that seems to work more by chance than good design |
09:49 | <@TheWatcher> | But maybe I'm just a curmudgeon who doesn't get the modern agile development paradigm |
09:58 | < simon_> | TheWatcher, haha, wow. |
09:58 | < simon_> | TheWatcher, my current employer has been using Perl and a few shell-scripts. for the first time in 25 years they hired a Python programmer to do ML, so he's building micro-services. |
10:00 | < simon_> | going all polyglot is very atypical for steady business. typically managers get really scared at language diversity, is my impression. maybe the managers were programming language enthusiasts? |
10:06 | <@TheWatcher> | Well, all but one of the systems I'm thinking about are FOSS projects - like, to name a random example, gitlab - the other, I'm not sure what's going on there. But as someone who not only develops but has to set up, admin, and generally maintain a shitton of web services, I totally agree with the 'typical managers'. Polyglot systems just end up being a massive headache. |
10:23 | < simon_> | well, as long as you don't maintain your own fork of those... |
10:23 | < simon_> | we use RT as issue tracker, which happens to also use Perl/MariaDB like the rest, but then we use Phabricator for reviewing, and that's written in PHP, it seems. |
11:05 | | crystalclaw [crystalclaw@Nightstar-12q9ui.xyz] has quit [Ping timeout: 121 seconds] |
11:05 | | crystalclaw [crystalclaw@Nightstar-12q9ui.xyz] has joined #code |
11:05 | | mode/#code [+o crystalclaw] by ChanServ |
11:43 | | Degi [Degi@Nightstar-5lqj0p.dyn.telefonica.de] has joined #code |
11:46 | | Kindamoody is now known as Kindamoody|afk |
12:40 | | Attilla [sid13723@Nightstar-0bi4dv.irccloud.com] has quit [[NS] Quit: ] |
12:40 | | Attilla [sid13723@Nightstar-31scpi.irccloud.com] has joined #code |
12:40 | | mode/#code [+o Attilla] by ChanServ |
13:19 | | macdjord|slep [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
13:19 | | mode/#code [+o macdjord|slep] by ChanServ |
13:21 | | mac [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
13:40 | < simon_> | I'm writing some functions that show a random banner. to be able to properly test them I've split the function in two; one that generates the list from which to draw, and the other that is a shallow wrapper around rand(). |
13:41 | < simon_> | the thing is, the list I'm drawing from is partly generated using rand(), too. |
13:42 | < simon_> | like... if there's less than 4 elements, add a random element from a fallback list. if there's still less than 4 elements, add another random element from another default list. |
13:43 | < simon_> | so while it would have been very convenient to test that the list-generating function generated a list with the right elements in it (testing the uniform distribution instead of the outcome of rand()), this distribution can't be modelled with a single list. |
13:43 | < Vorntastic> | I'm confused here |
13:44 | < simon_> | oh? |
13:45 | < simon_> | I've got generate_choices() -> [a, b, c, d] and choose([a, b, c, d]) -> b. |
13:46 | < simon_> | but if there's only three choices, generate_choices() -> [a, b, c, fallback]. and if there's only two choices, generate_choices() -> [a, b, fallback, default]. the fallback and default banners are chosen randomly, too. |
13:47 | < Vorntastic> | Okay |
13:48 | < Vorntastic> | So, generate_choices, where does it get a,b,c,d |
13:48 | < simon_> | from an input list, actually, but one where the objects have a 'weight' property. its main job is then to multiply the occurrence of each element by its weight. |
13:49 | < simon_> | weight 0 means fallback. |
13:49 | < simon_> | i.e. [(a, 1), (b, 2) (c, 0), (d, 0)] -> [a, b, b] + random_of([c, d]), e.g. |
13:53 | < simon_> | so I wonder if this function should return something other than a uniform list to represent its distribution, e.g. three lists: the main banners, the fallback banners (if they apply), and the secondary fallback ("default") banners (if they apply). then generate_choices() is fully deterministic, but the logic in choose() is not just rand(). |
13:54 | | Degi [Degi@Nightstar-5lqj0p.dyn.telefonica.de] has quit [Connection closed] |
13:56 | < simon_> | or if I should just use rand() in generate_choices() and test the deterministic parts: e.g. that there aren't any (randomly chosen) fallback banners when there are enough main banners, that there is one when there aren't enough main banners, etc. |
13:58 | < simon_> | I find that unit tests that are non-deterministic are frowned upon (and our test framework doesn't do stuff like print the seed for replaying, like QuickCheck does), and unit tests with a mocked rand() for single tests (not a bunch of generated ones) proves very little. |
13:59 | < simon_> | Vorntastic, what would you do? |
14:02 | < Vorntastic> | Thinking |
14:17 | < simon_> | the probability distribution contains two conditionals, basically. |
14:18 | < simon_> | so I can't even think of a good way to imagine a library that does it "the right way". |
14:38 | < simon_> | I think I'll go with the former of letting generate_choices() call rand() and accept that my test framework doesn't support random testing the way I like it. |
14:54 | < Vorntastic> | Will be home soon, can write something up. Also what language is this |
14:54 | < simon_> | it's Perl. |
14:55 | < Vorntastic> | Ok so I won't give you stuff in perl because I know nothing about it. Nevertheless! I'll have some toys for you |
14:57 | < simon_> | so I've got Test::Random which isn't currently in the codebase, but lets me do TEST_RANDOM_SEED=12345 perl tests/FooTest.pm to replay with a specific seed, Test::MockRandom which lets me hijack rand(), and Test::MockObject which lets me mock class methods (which shouldn't be necessary as generate_choices() and choose() are both public for now). |
14:58 | < Vorntastic> | Do you have assertcontains or something that could be named that |
14:58 | < simon_> | yeah. |
14:58 | < simon_> | and thanks! |
14:58 | < Vorntastic> | Good that's all I need |
15:54 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has joined #code |
15:54 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
15:57 | | mac [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
15:57 | | mode/#code [+o mac] by ChanServ |
15:57 | <~Vornicus> | Ok, confirming contract: you are given a sequence of (item, weight)s; you wish to expand this into a table you can use with random.choice(); if the resulting table is 1 item too small (the target is 4), select a random item from the "fallback" items, those with weight zero; if the resulting table is 2 items too small, select a random item from the "fallback" items and also a "default" item |
15:59 | <~Vornicus> | i3s the "default" item also selected from a list |
16:00 | | macdjord|slep [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
16:34 | <~Vornicus> | https://gist.github.com/DUznanski/70c623303293ba21bc68a0c33549422d one of the things you can do is take advantage of statistics to get nigh-guarantees on otherwise random processes. Here I use the law of large numbers to get a situation where it's highly likely that you'll see all the fallbacks |
17:59 | | Degi [Degi@Nightstar-5lqj0p.dyn.telefonica.de] has joined #code |
18:16 | <~Vornicus> | But really the goal here is a bunch of smaller methods |
18:19 | <~Vornicus> | Make one that splits a weight list into heavy and light objects; one that given a weight list will come up with a sampleable list; one that given a sampleable list, a list of light items, and a target length will fill out to that length |
18:19 | <~Vornicus> | etc etc etc |
18:22 | <~Vornicus> | Each of these functions *does one really simple thing* and your unit tests for "later" functions should relax and trust that the functions beneath are doing the right thing |
18:28 | <~Vornicus> | Where's jerith when you need him. Jerith is the guy who knows testing |
18:29 | <&jerith> | I am here. |
18:31 | <&jerith> | How far back should I start? |
18:32 | <~Vornicus> | 13:40 by tw's logs, 5 hours ago. |
18:34 | <&jerith> | Thanks. |
18:35 | <&jerith> | simon_: You almost certainly want a property testing library to get useful results. |
18:37 | <&jerith> | Basically, run a bunch of iterations wil the RNG and assert that you have things of the right kinds in the resulting output. |
18:38 | <~Vornicus> | Which I was alluding to |
18:39 | <~Vornicus> | But being Very Rinkydink about |
18:39 | <&jerith> | Then your properties/assertions would be things like "if the sum of the weights is greater than or equal to the sample size, the choice list will never contain fallbacks/defaults". |
20:05 | | Vornicus [Vorn@Nightstar-oe1443.res.rr.com] has quit [[NS] Quit: Leaving] |
20:06 | | Vorntastic [uid293981@Nightstar-om40rg.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity] |
20:31 | | Kindamoody|afk is now known as Kindamoody |
21:06 | | macdjord|slep [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
21:06 | | mode/#code [+o macdjord|slep] by ChanServ |
21:08 | | macdjord [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has joined #code |
21:08 | | mode/#code [+o macdjord] by ChanServ |
21:08 | | mac [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
21:11 | | macdjord|slep [macdjord@Nightstar-a1fj2k.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
22:20 | | Jessikat [Jessikat@Nightstar-rni0d8.dab.02.net] has joined #code |
22:47 | | Jessikat` [Jessikat@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code |
22:49 | | Jessikat [Jessikat@Nightstar-rni0d8.dab.02.net] has quit [[NS] Quit: Bye] |
22:58 | | Touric [NSkiwiirc@Nightstar-lla6be.hnremote.net] has joined #code |
23:05 | | Touric [NSkiwiirc@Nightstar-lla6be.hnremote.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client] |
23:10 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds] |
--- Log closed Wed Apr 25 00:00:47 2018 |