--- Log opened Tue Nov 15 00:00:57 2016 |
00:04 | | himi [sjjf@Nightstar-u2k.974.56.130.IP] has joined #code |
00:04 | | mode/#code [+o himi] by ChanServ |
00:37 | | Derakon[AFK] is now known as Derakon |
00:48 | | macdjord|wurk is now known as macdjord |
01:26 | <@celticminstrel> | I can't remember the exception through by iostreams and XCode is not being helpful, and my browser is currently closed. |
01:27 | <@celticminstrel> | If only the standard C++ library had man-pages too. :/ |
01:27 | <@celticminstrel> | ^thrown |
01:27 | | * celticminstrel assumes XCode is being unhelpful due to missing a header or something. |
01:31 | <@celticminstrel> | Ah. A nested class named "failure". |
01:58 | <&Derakon> | Man, the difference between foo.bar() and foo:bar() in Lua keeps screwing me up. |
02:00 | <&ToxicFrog> | It becomes second nature after a while, I find. |
02:01 | <&Derakon> | I'm sure it does, I just haven't reached that point yet. |
02:09 | | * Derakon mentally reminds himself to commit early, commit often. |
02:09 | <&Derakon> | Just because this project is only 214 lines long right now doesn't mean I won't appreciate having source control handy. |
02:28 | <@celticminstrel> | I wonder if ios_base::failure::what() gives a useful message... probably not, right? |
02:31 | <@celticminstrel> | Given how it's triggered, it probably can't give anything better than "badbit set" or "failbit set". |
02:58 | <&Derakon> | Hey, ToxicFrog: is there some equivalent to *args in lua? |
02:59 | <&Derakon> | Like, I want to arrange the parameters to a function as a table, and then pass that table. |
02:59 | <@celticminstrel> | Yes. |
02:59 | <@celticminstrel> | ... |
02:59 | <@celticminstrel> | Like function f(a, b, c, ...) print(...) end |
03:00 | <&ToxicFrog> | Derakon: ... expands to the varargs as though they were comma-separated literals; {...} is thus the varargs as a table. |
03:00 | <&Derakon> | So if there's love.graphics.setColor(r, g, b), then can I pass it {"a" = 255, "g" = 255, "b" = 0} and have it work? |
03:00 | <&ToxicFrog> | No. |
03:00 | <@celticminstrel> | There's no keyword arguments. |
03:00 | <&ToxicFrog> | Oh, I see |
03:01 | <&ToxicFrog> | You don't want the varargs as a table, you want the equivalent of (apply) |
03:01 | <&Derakon> | CM: I'm coming at this from the caller side, not the implementor side. |
03:01 | <@celticminstrel> | There's table.unpack. |
03:01 | <&Derakon> | Not familiar with apply() |
03:01 | <@celticminstrel> | But that'd require an array-like table, not a dictionary-like table. |
03:01 | <&ToxicFrog> | Which means you want unpack() |
03:01 | <&Derakon> | Array-like is fine. |
03:02 | <&ToxicFrog> | Derakon: most functional languages have "apply f list" to mean "call f with the contents of list as individual arguments" |
03:02 | <&Derakon> | Ah, then yes. |
03:02 | <@celticminstrel> | f(table.unpack{a, b, c}) is the same as a,b,c |
03:02 | <&ToxicFrog> | Python has special syntax for this (f(*list)) |
03:02 | <@celticminstrel> | ^ f(a,b,c) |
03:02 | <&Derakon> | So, something like this? |
03:02 | <&Derakon> | color = is_selected and {255, 255, 0} or {255, 255, 255} |
03:02 | <&Derakon> | love.graphics.setColor(table.unpack(color)) |
03:02 | <&ToxicFrog> | Yep |
03:02 | <&Derakon> | Awesome, thanks. |
03:02 | <@celticminstrel> | Note that you can't add additional arguments after the unpacked ones IIRC. |
03:03 | <&Derakon> | I guess I could move the ternary into just setting the blue component. |
03:03 | <&ToxicFrog> | (you can also: function apply(f, args) return f(table.unpack(args)) end) |
03:03 | <&ToxicFrog> | Yeah, that's probably how I'd write that in practice. |
03:03 | <@celticminstrel> | (Because table.unpack{a,b,c}, d would expand to just a,d.) |
03:03 | <&Derakon> | ... "is_selected and 0 or 255" has problems though~ |
03:03 | <@celticminstrel> | 0 is truthy in Lua IIRC. |
03:03 | <&ToxicFrog> | ...what problems? |
03:03 | <&Derakon> | What, really? |
03:03 | <&ToxicFrog> | Yes. |
03:03 | <&Derakon> | Huh. |
03:03 | <@celticminstrel> | Only false and nil are falsy. |
03:04 | <&ToxicFrog> | nil and false are falsy, everything else is truthy. |
03:04 | <&Derakon> | Okay, that is definitely good to know. |
03:04 | <&ToxicFrog> | Including 0, {}, and "" |
03:04 | <&ToxicFrog> | (and it constantly trips me up in python that it considers 0 and [] to be false) |
03:04 | <@macdjord> | Derakon: !is_selected and 255 or 0 |
03:04 | | Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has joined #code |
03:04 | <@Azash> | Also always a good idea to put in parenthesis in serial truth checks to make the intent clear |
03:04 | <@Azash> | Wait |
03:05 | <@Azash> | Does that actually work? Like does that check if color equals either value? |
03:05 | <&ToxicFrog> | ...no? |
03:05 | <@Azash> | Oh |
03:05 | <&ToxicFrog> | It's eqv to |
03:05 | <&ToxicFrog> | (if is-selected 0 255) |
03:05 | <&ToxicFrog> | Which is to say, it evaluates to 0 if is_selected is true, and 255 otherwise |
03:05 | <@Azash> | Ohhhh |
03:06 | <@Azash> | Yeah I get it |
03:06 | <@Azash> | Ternary |
03:06 | <@celticminstrel> | It's a fake ternary operator, yes. |
03:06 | <@Azash> | I read it as a && b || c |
03:06 | <&ToxicFrog> | Lua boolean operators (a) short-circuit and (b) evaluate to the last value evaluated when short-circuiting occurred |
03:06 | <@Azash> | And I was wondering what kind of sense that made |
03:06 | <&ToxicFrog> | Yes, it is. |
03:06 | <@Azash> | ToxicFrog: No I mean just as a truthy expression, not as ternary |
03:07 | <@Azash> | That was the confusion |
03:07 | <@celticminstrel> | Well, it is a && b || c. |
03:07 | <@celticminstrel> | But with the loose definition of && and || that return the true operand rather than returning true or false. |
03:07 | <@celticminstrel> | Or something like that/ |
03:07 | <@Azash> | Yes |
03:07 | <@Azash> | 05:07 <@Azash> That was the confusion |
03:08 | <@Azash> | Sorry for butting in |
03:08 | <&Derakon> | No worries, we're all learning here. |
03:08 | | * Azash woke up at 2:30 in the morning to roll20 with people, is not operating properly |
03:08 | <&Derakon> | I need a Lua compiler. |
03:09 | <&Derakon> | To beat me about the head with "used . to call a member function". |
03:10 | <~Vornicus> | I've become less and less enamored with no-compile-step languages lately |
03:12 | <&Derakon> | ...and 1-indexing can fuck right off. |
03:13 | <@celticminstrel> | What. |
03:14 | <@celticminstrel> | There's nothing wrong with 1-indexing. |
03:14 | <&Derakon> | Except that 99% of languages don't use it. |
03:14 | <@celticminstrel> | Pascal does IIRC. |
03:14 | <&ToxicFrog> | celticminstrel: gotta say, that used to be my stance, but after 13 years of using lua it's changed to |
03:14 | <&Derakon> | Which means that any language that does use it is mostly just being pointlessly contrary. |
03:14 | <@celticminstrel> | And Pascal is far from a new language. |
03:14 | <&ToxicFrog> | - the number of times that 1-indexing has been more useful to me than 0-indexing is massively outweighed by the number of times it's been less useful, and |
03:15 | <&McMartin> | Nitpick: Pascal is actually arbitrarily indexed |
03:15 | <&ToxicFrog> | - since Lua is intended to interface with C, which uses 0-indexing, it was a terrible idea because it means all your lua/C collection interfaces have an extra layer of "fuck, did I translate all the indexes properly" |
03:15 | <@celticminstrel> | One advantage of 1-indexing: arr[arr.len] is the last element. |
03:15 | <&McMartin> | And in 0-indexing, arr.len is the loop termination condition. |
03:15 | <&ToxicFrog> | celticminstrel: I didn't say it has no advantages, just that the number of times it's an advantage are outweighed by the times it's not. |
03:16 | <&ToxicFrog> | For example, you can't just go arr[(n+1)%len] |
03:16 | <&McMartin> | (If you want in Pascal you can totally make your array 2-indexed) |
03:16 | <&ToxicFrog> | Which is something I want to do quite often! |
03:16 | <&ToxicFrog> | IIRC, Lua originally went with 1-indexing because they thought it would be easier for nonprogrammers; its original audience was scientists with no software background |
03:17 | <&ToxicFrog> | I'm not sure why they still use it. It can't be for backwards compatibility, because they are not at all shy about breaking that with major version releases. |
03:18 | <&Derakon> | Matlab did the 1-indexing thing for ease of use too. |
03:18 | <&Derakon> | And it was also a terrible decision there. |
03:18 | <&Derakon> | But then, Matlab is not short on terrible decisions~ |
03:18 | <&ToxicFrog> | Considering what a trainwreck matlab is in general, that's not really a recommendation |
03:19 | <&ToxicFrog> | Derakon: re compiler, I believe there is actually a lua linter, although I've never used it |
03:19 | <&McMartin> | BASIC suggests pretending you are 1-indexed, but it secretly isn't. |
03:19 | <&Derakon> | Good to know. |
03:19 | <&McMartin> | It just boosts all dimensioned array sizes by 1. |
03:19 | <&ToxicFrog> | Also, you can use 0 as your starting index, and I do that in some places; e.g. ttymor's map grid |
03:20 | <&ToxicFrog> | It's just that the table.* library and the # operator assume 1-indexing |
03:20 | <&ToxicFrog> | So it's usually not what you want |
03:20 | <@celticminstrel> | Also there's an optimization for array indices or something. |
03:20 | <&Derakon> | Anyway, I now have a combat grid with two actors, and a menu that pops up when one of the actors gets to the DECIDE point in the IP bar, at which point they can choose between a slow-charging and a fast-charging action. |
03:20 | <&Derakon> | It doesn't do anything yet, but that's still significant progress~ |
03:20 | <@celticminstrel> | And 0 is not included. |
03:20 | <&Derakon> | 306 lines of Lua so far. |
03:21 | <&ToxicFrog> | celticminstrel: that's implementation dependent anyways; it might be included depending on version, and it almost certainly is in luajit |
03:21 | <&ToxicFrog> | If It's Not In The Standard, Don't Rely On It⢠|
03:37 | | catadroid [catalyst@Nightstar-srva2h.dab.02.net] has joined #code |
03:39 | | catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has quit [[NS] Quit: Leaving] |
03:58 | | catadruid [catalyst@Nightstar-hq7.159.132.82.IP] has joined #code |
04:01 | | catadroid [catalyst@Nightstar-srva2h.dab.02.net] has quit [Ping timeout: 121 seconds] |
04:01 | | catadruid is now known as catadroid |
04:47 | | Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has quit [Connection closed] |
04:56 | | catadroid [catalyst@Nightstar-hq7.159.132.82.IP] has quit [[NS] Quit: Bye] |
05:07 | | Derakon is now known as Derakon[AFK] |
05:45 | | himi [sjjf@Nightstar-u2k.974.56.130.IP] has quit [Ping timeout: 121 seconds] |
06:10 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has quit [[NS] Quit: Kernel upgrade] |
06:12 | | McMartin [mcmartin@Nightstar-rpcdbf.sntcca.sbcglobal.net] has joined #code |
06:13 | | mode/#code [+ao McMartin McMartin] by ChanServ |
06:45 | | catadroid [catalyst@Nightstar-hq7.159.132.82.IP] has joined #code |
06:45 | | catadroid [catalyst@Nightstar-hq7.159.132.82.IP] has quit [The TLS connection was non-properly terminated.] |
06:47 | | catadroid [catalyst@Nightstar-hq7.159.132.82.IP] has joined #code |
06:47 | | catadroid [catalyst@Nightstar-hq7.159.132.82.IP] has quit [The TLS connection was non-properly terminated.] |
07:48 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
07:48 | | mode/#code [+o himi] by ChanServ |
08:27 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds] |
08:43 | | celticminstrel [celticminst@Nightstar-5boimd.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
08:46 | | Kindamoody[zZz] is now known as Kindamoody |
09:00 | | Kindamoody is now known as Kindamoody|afk |
10:24 | | Tarinaky [Tarinaky@Nightstar-ak1gaj.programmingresearch.com] has joined #code |
10:24 | | mode/#code [+o Tarinaky] by ChanServ |
12:34 | | * TheWatcher bleeghs at SQL and LIMITs |
12:40 | | catadroid [catalyst@Nightstar-00tu63.dab.02.net] has joined #code |
12:44 | | Emmy-werk [NSkiwiirc@Nightstar-41pbej.static.chello.nl] has joined #code |
12:44 | <@TheWatcher> | Oi, Reiv, any idea how given a table of the form { id, some_fk_id, user_id, unixtimestamp, data } I can craft an SQL query that'll give me the N most recent rows for each user for some_fk_id = 10? |
12:46 | <@TheWatcher> | Sort of a 'SELECt * FROM foo WHERE some_fk_id = 10 ORDER BY unixtimestamp DESC LIMIT N' except that the limit is per user_id rather than overall? |
12:56 | | * TheWatcher eyes this, suspect he's going to resort to row numbering and horrible hackiness |
13:10 | <@TheWatcher> | ahahaha, ohgods this is horrible |
13:10 | <@TheWatcher> | It works, but it's horrible |
13:12 | < Emmy-werk> | what did ya end up with? |
13:14 | <@TheWatcher> | A subquery that builds a temporary table, numbering each row per user, and then the outer query just selects rows with numbers less than the required limit |
13:14 | < Emmy-werk> | hmmmh. shame it's not possible to do something like 'SELECT first(10) Field FROM Table or something like that |
13:15 | < Emmy-werk> | Also, would it not be possible to have each user to be a new subquery? |
13:15 | < Emmy-werk> | Or would you run into the limits of SQL code |
13:15 | <@TheWatcher> | https://gist.github.com/TheWatcher/febb487fc69875ccd736495cf8b843e7 - this thing |
13:15 | < Emmy-werk> | With how many subqueries are allowed |
13:16 | <@TheWatcher> | I could, in theory, single-pass the job by using appropriate indexes and black magic, but I'm not sure it's worth it |
13:17 | < Emmy-werk> | Voodoo |
13:17 | < Emmy-werk> | ~~ |
13:18 | | Irssi: #code: Total of 37 nicks [33 ops, 0 halfops, 0 voices, 4 normal] |
13:24 | <&Reiver> | I don't know if you have the right functions |
13:25 | <&Reiver> | But rank or rownumm or equivalent OVER (PARTITION BY user_id ORDER BY user_id ASC) |
13:25 | <&Reiver> | WHERE rankfunction <= 10 |
13:25 | <&Reiver> | Will do it, possibly with a subquery somewhere, but that's the general method |
13:27 | <&Reiver> | You can also use row_number() or rownum or whatever your system calls it raw, with group by and order by all in a subquery, but yes, that's how you end up having to do it. |
13:27 | <&Reiver> | Sorry I didn't see the query earlier! |
13:28 | <@TheWatcher> | No worries |
13:28 | <@TheWatcher> | You were busy :) |
13:29 | | * Emmy-werk points at the topic, specifically the high latency part :P |
14:05 | | * Emmy-werk blinks. |
14:05 | < Emmy-werk> | Oops. I think i used a < instead of <= in my input validation mask. |
14:06 | < catadroid> | put invalidation |
14:07 | < Emmy-werk> | yup. that was it |
14:08 | | * Emmy-werk validates catadroid's put, decides he should've used a smaller iron. |
14:08 | < catadroid> | She* |
14:08 | < Emmy-werk> | 0.0 |
14:08 | < Emmy-werk> | lies. lies and slander, heresy! |
14:09 | < Emmy-werk> | there are no women on the internet. |
14:11 | | Emmy-werk [NSkiwiirc@Nightstar-41pbej.static.chello.nl] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client] |
14:12 | | Emmy-werk [NSkiwiirc@Nightstar-41pbej.static.chello.nl] has joined #code |
14:13 | < Emmy-werk> | Ah, there we go. What was my last message? |
14:14 | < catadroid> | There are women on the Internet |
14:14 | < catadroid> | Please don't percolate that meme, it hurts |
14:17 | < Emmy-werk> | It was sarcastic, silly. You even missed my following message, which was even more outrageously sarcastic. :) |
14:17 | < catadroid> | I didn't see the next message |
14:17 | < catadroid> | It still hurts to read it |
14:17 | < Emmy-werk> | Yeah, it got lost in my internet disconnection |
14:21 | < Emmy-werk> | Don't worry though, it's even more disrespectful of minorities. :) |
14:25 | < catadroid> | That's not exactly any better |
14:39 | < Emmy-werk> | I'm sorry, i can't help having a rather cynical sense of humour. |
15:14 | | * Emmy-werk notes to self: when locking down a form against editing, make sure its' subforms are locked down as well\ |
15:37 | | macdjord is now known as macdjord|wurk |
15:58 | | Emmy-werk [NSkiwiirc@Nightstar-41pbej.static.chello.nl] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client] |
16:07 | | celticminstrel [celticminst@Nightstar-5boimd.dsl.bell.ca] has joined #code |
16:07 | | mode/#code [+o celticminstrel] by ChanServ |
16:40 | | Vash [Vash@Nightstar-uhn82m.ct.comcast.net] has joined #code |
16:46 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
16:46 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
16:59 | | catadruid [catalyst@Nightstar-fic9mf.dab.02.net] has joined #code |
17:01 | | catadroid [catalyst@Nightstar-00tu63.dab.02.net] has quit [Ping timeout: 121 seconds] |
17:02 | | celticminstrel [celticminst@Nightstar-5boimd.dsl.bell.ca] has quit [Ping timeout: 121 seconds] |
17:19 | | catadruid is now known as catadroid |
17:21 | | celticminstrel [celticminst@Nightstar-5boimd.dsl.bell.ca] has joined #code |
17:21 | | mode/#code [+o celticminstrel] by ChanServ |
17:33 | | gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [[NS] Quit: Reboot] |
17:34 | | celticminstrel [celticminst@Nightstar-5boimd.dsl.bell.ca] has quit [Ping timeout: 121 seconds] |
17:36 | | gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has joined #code |
17:36 | | mode/#code [+o gnolam] by ChanServ |
17:44 | | celticminstrel [celticminst@Nightstar-m1asbe.dsl.bell.ca] has joined #code |
17:45 | | mode/#code [+o celticminstrel] by ChanServ |
18:23 | | gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has quit [[NS] Quit: Reboot] |
18:24 | | gnolam [lenin@Nightstar-t1tbf0.cust.bahnhof.se] has joined #code |
18:24 | | mode/#code [+o gnolam] by ChanServ |
18:26 | | Tarinaky [Tarinaky@Nightstar-ak1gaj.programmingresearch.com] has quit [Connection closed] |
18:46 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code |
18:47 | | mode/#code [+o Emmy] by ChanServ |
19:27 | | celticminstrel is now known as celmin|away |
21:17 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
21:31 | | celmin|away is now known as celticminstrel |
22:22 | | Kindamoody|afk is now known as Kindamoody |
22:34 | | * abudhabi prods at Amazon. |
22:34 | <@abudhabi> | Is their CDN down? |
22:34 | <@abudhabi> | Because the site works, except all the images and styles and whatnot seem fucked/non-loading. |
22:38 | | catalyst [catalyst@Nightstar-bt5k4h.81.in-addr.arpa] has joined #code |
22:42 | <&[R]> | WFM |
23:05 | | himi [sjjf@Nightstar-jrq.t8n.56.130.IP] has joined #code |
23:05 | | mode/#code [+o himi] by ChanServ |
23:08 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Connection closed] |
23:29 | | catadruid [catalyst@Nightstar-iv842m.dab.02.net] has joined #code |
23:31 | | catadroid [catalyst@Nightstar-fic9mf.dab.02.net] has quit [Ping timeout: 121 seconds] |
23:37 | | Kindamoody is now known as Kindamoody[zZz] |
--- Log closed Wed Nov 16 00:00:13 2016 |