code logs -> 2013 -> Tue, 28 May 2013< code.20130527.log - code.20130529.log >
--- Log opened Tue May 28 00:00:35 2013
00:09 You're now known as TheWatcher[T-2]
00:15 You're now known as TheWatcher[zZzZ]
01:00 himi [fow035@D741F1.243F35.CADC30.81D435] has joined #code
01:01 mode/#code [+o himi] by ChanServ
01:11 Turaiel[Offline] is now known as Turaiel
01:57 Typherix [Typherix@Nightstar-7dc8031d.mi.comcast.net] has quit [[NS] Quit: ZNC - http://znc.in]
01:58 Turaiel [Brandon@Nightstar-7dc8031d.mi.comcast.net] has quit [[NS] Quit: ZNC - http://znc.in]
02:09 Typherix [Typherix@Nightstar-7dc8031d.mi.comcast.net] has joined #code
02:09 Turaiel[Offline] [Brandon@4FC299.73A3B2.CFE685.2739EF] has joined #code
02:10 Turaiel[Offline] is now known as Turaiel
03:32 Kindamoody[zZz] is now known as Kindamoody
03:35 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [[NS] Quit: Program Shutting down]
04:46 * Derakon eyes his backup hard drive, tries to remember what exactly it is that he transfers to backup.
04:46
<&Derakon>
The last tarball is 194GB, so clearly not everything ends up there.
04:50
<&ToxicFrog>
...this is generally why you use backup software that lets you easily examine the backup contents, like obnam or zfs snapshots
04:50
<&Derakon>
I'm not very organized about backups, I must admit.
04:50
<@Reiv>
ToxicFrog: What do you reccomend for backups in Windows boxen?
04:50
<@Reiv>
("Run liunx instead" will get you slapped~)
04:51
<@celticminstrel>
... is "max of coordinates" a normal metric?
04:51
<&Derakon>
What was it, "rsync -avvPh source1 source2 ... dest"?
04:51
<&Derakon>
CM: the max of a vector, being a scalar, cannot be perpendicular to anything~
04:51
<&ToxicFrog>
Derakon: to just copy the stuff, yeah
04:51
<&Derakon>
More seriously, define "normal".
04:51
<&ToxicFrog>
Reiv: fuck if I know, my windows backup regime consists of running GameSaveManager whenever I remember
04:51
<@celticminstrel>
Um, common, usual. <_<
04:52
<&ToxicFrog>
obnam might work on windows, in which case I recommend it
04:52
<@celticminstrel>
Sorry, didn't mean normal in the mathematical sense.
04:52
<&Derakon>
Yeah, I was being silly.
04:52
<&Derakon>
I could see max-val-of-coordinate being potentially useful in some contexts, but they wouldn't be common ones.
04:52
<&ToxicFrog>
But yeah, my approach pretty much is "run linux instead". The windows machine is just a gaming box and all he important stuff is on linux-hosted network drives.
04:52 * Derakon decides to back up his music, applications, and proj folder.
04:53
<&Derakon>
Guess I should probably grab my Sites folder as well; it's only 3.7GB.
04:53
<@celticminstrel>
I seem to need a metric which places the corners of a square equidistant...
04:53 * McMartin flips through backscroll
04:53
<&McMartin>
The default commandline super-backup tool is called something like "ROBOCOPY" in Windows.
04:55
<&ToxicFrog>
Yeah, that's windows's closest analogue to rsync IIRC
04:55
<&ToxicFrog>
Which means it isn't really a backup tool, it's a mirroring tool
04:55
<&McMartin>
Mmm, true.
04:56
<@celticminstrel>
Which seems really odd, but... if something is diagonally six tiles away, then it can do things that require a max range of six tiles, so...
04:56
<&Derakon>
Yeah, motion-on-a-grid is one of those uncommon uses I was thinking of.
04:57
<@celticminstrel>
Hm, okay...
04:57
<@celticminstrel>
...so would it work correctly if the coordinates are both non-zero and non-equal?
04:58
<&Derakon>
Uh, I'm lacking context here.
04:58
<&Derakon>
What is "it"?
04:58
<@celticminstrel>
Um... good question. >_>
05:04
<@celticminstrel>
Okay, so... I'm using distances to... a) Determine the next "ring" (actually a rectangle) of an area effect spell. b) Decide how far teleporting monsters teleport. c) Determine whether a monster can perform ranged attacks. d) Determine whether a non-ranged monster needs to move closer. e) Determine which monster is closest to the player.
05:08
<@celticminstrel>
a) would work with a max-of-coordinates metric, I think... not 100% sure.
05:09
<@celticminstrel>
I think for c) it would give false positives...
05:09
<&Derakon>
Hm, several of those will require field-of-view calculations.
05:09
<&Derakon>
Explosions shouldn't hit things on the other sides of walls, for example.
05:09
<@celticminstrel>
It would probably work fine for d) and e), and b) is really a special case of d).
05:09
<&Derakon>
And monsters can't use ranged attacks unless they can see the player.
05:10
<@celticminstrel>
Yeah, I do field-of-view calculations first, then check whether they're in range.
05:10
<@celticminstrel>
As for the explosions... I want to check now...
05:11
<&Derakon>
My FOV code in Pyrel includes a range value which I can use to effectively generate "circles".
05:11
<&Derakon>
(Since diagonal movement cost is the same as orthogonal, circles are actually square, but never mind~)
05:11
<@celticminstrel>
Heh.
05:13
<&Derakon>
Pyrel's FOV code: https://bitbucket.org/derakon/pyrel/src/bf4869202b15c7817fda99be113e3175e31668e1 /util/fieldOfView.py?at=master
05:15
<@celticminstrel>
...as I thought, the explosion hits through walls. I guess I should change that at some point.
05:17 * Reiv stares at the FOV code, remembers that he's no longer a True Programmer once again.
05:17
<&Derakon>
Ehh, that FOV code is not the cleanest stuff in the world.
05:17
<&Derakon>
I tried to fix it up a bit but only made limited progress.
05:19
<@Reiv>
More the sight of Real Code.
05:19
<@Reiv>
The best I've managed of late was a pentuple-nested set of moderately eldritch analytic functions in SQL. >_>
05:20
<&Derakon>
Heh. I'd probably look at that and go "bwuh?", especially at first glance.
05:20
<@celticminstrel>
That's what I did. <_<
05:21
<@celticminstrel>
Though I did note it looks superficially similar to my FOV code... but that might just be because they're both FOV code... >_>
05:22
<&Derakon>
FOV code does tend to consist of "draw lines out, check for obstructions".
05:22
<@celticminstrel>
Bright side: there are only two explosions, one of which should hit through walls, so I'll only need to fix the explosion thing in one place.
05:23
<@celticminstrel>
Anyway... the conclusion I seem to be drawing from this is that max-of-coordinates may not be as useful metric as it seemed at first glance...
05:24 Kindamoody is now known as Kindamoody|afk
05:25 Derakon_ [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
05:26 Derakon__ [Derakon@Nightstar-a3b183ae.ca.comcast.net] has joined #code
05:26 Derakon [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [NickServ (GHOST command used by Derakon__)]
05:26 Derakon__ is now known as Derakon
05:26 mode/#code [+ao Derakon Derakon] by ChanServ
05:27
<@celticminstrel>
Hmm...
05:27
<@celticminstrel>
^as useful a
05:28
<@celticminstrel>
It seems it would work fine for everything except the thing I'm currently focusing on, which is determining whether they can use ranged attacks.
05:29 Derakon_ [Derakon@Nightstar-a3b183ae.ca.comcast.net] has quit [Ping timeout: 121 seconds]
05:43
<@celticminstrel>
Well, I seem to have done something that works, at least...
05:43
<@celticminstrel>
Without changing the metric, even.
05:49 Kindamoody|afk is now known as Kindamoody
05:50
<@celticminstrel>
Basically, I had a function to locate the nearest point from which the monster could throw at a given distance... but sometimes that point would wind up being further from the player than the monster already was, so I added a recursive call if it was.
05:52
<@celticminstrel>
It still doesn't quite handle it correctly (creatures on a diagonal won't attack until they're a bit closer than they need to be), but at least they do attack instead of getting stuck... and how on earth did I just bring up the spelling suggestion list? I can't seem to replicate it...
05:54
<&Derakon>
Mmm, if the monster wants to throw something at the player, they should check a) that they have a clear firing line, and b) that their distance to the player is <= their max throwing distance. What else do you care about? Why bother locating the nearest point?
05:54
<@celticminstrel>
So that they can move to a point from which they can throw something...
05:54
<&Derakon>
But they can just pathfind to the player instead.
05:54
<@celticminstrel>
If they're not already on such a point, obviously.
05:55
<@celticminstrel>
I think that tends to put them one column/row/diagonal away from a clear firing line...
05:55 * celticminstrel probably has very poor pathfinding.
05:55
<&Derakon>
Oh, there's only 8 firing lines?
05:56
<@celticminstrel>
Yeah.
05:57
<&Derakon>
Yeah, then encourage your monsters to approach on a straight line / diagonal line. :)
05:57
<&Derakon>
Or add more firing lines!
05:58
<@Reiv>
I'd recommend the latter, really.
05:58
<@Reiv>
But then that's sorta what I'm like. :p
05:58
<@celticminstrel>
Eh, that seems like lots of work. <_<
05:58
<&Derakon>
The way Angband (and thus Pyrel) handle ranged combat is that the player can specify a target tile or creature, and then the game calculates the path to the target using IIRC Bresenham's line algorithm.
05:59
<&Derakon>
Yeah, see getLineBetween here: https://bitbucket.org/derakon/pyrel/src/bf4869202b15c7817fda99be113e3175e31668e1 /util/geometry.py?at=master
05:59
<@celticminstrel>
Encouraging them to approach on a firing line would probably mean they can no longer be stuck around a corner, unable to get at the player who's one row/column away...
05:59
<@celticminstrel>
It'd also mean the player needs to do less work to ensure they're on a firing line with the monster.
05:59
<@celticminstrel>
Not sure whether those are good things or not.
06:01
<@Reiv>
Can monsters only attack along the same firing lines?
06:01
<@celticminstrel>
Yeah..
06:06 Derakon is now known as Derakon[AFK}
06:23 Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has quit [[NS] Quit: Going dooooown...]
06:40
< Turaiel>
Anyone familiar with OpenVPN?
06:45 Kindamoody is now known as Kindamoody|out
06:50
< Turaiel>
Never mind, all good
07:22 RichyB [richardb@Nightstar-86656b6c.cable.virginmedia.com] has quit [Connection closed]
07:27 Orthia [orthianz@3CF3A5.E1CD01.B089B9.1E14D1] has joined #code
07:27 mode/#code [+o Orthia] by ChanServ
07:46 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
07:52 himi [fow035@D741F1.243F35.CADC30.81D435] has quit [Operation timed out]
07:56 Turaiel is now known as Turaiel[Offline]
08:28 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has joined #code
09:03 You're now known as TheWatcher
10:13 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
10:13 mode/#code [+o himi] by ChanServ
10:36 AverageJoe [evil1@Nightstar-4b668a07.ph.cox.net] has quit [[NS] Quit: Leaving]
10:45 RichyB [richardb@58734C.5279B7.EA7DF8.107330] has joined #code
10:52 * TheWatcher urghs, tries to work out how the hell to pull out articles that users have edit access to
10:53
<@TheWatcher>
I just know I'm going to have to do this the hard way: pull out each article in turn and do a full capability check on each one.
10:53
<@TheWatcher>
That is going to be a pain
10:54
<@Azash>
At least you can automate it, right?
10:54
<@TheWatcher>
Well, yeah.
10:56
<@TheWatcher>
Each article has a metadata ID, I just need to do a $self -> {"metadata"} -> check_permission("editarticle", $article -> {"metadata_id"}) for each entry
10:57
<@TheWatcher>
But that's potentially hundreds of calls.
10:58
<@TheWatcher>
I can't take shortcuts either, as editor access could be granted higher up the metadata tree
11:01
<@TheWatcher>
Sod it, I'll make it work first, make it work faster later. These servers have enough grunt that it may not be noticeable anyway.
11:05
<@Azash>
\o/
12:05 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
12:47
<&McMartin>
Oh dang
12:48
<&McMartin>
That old .it file by Virt? The "Classical Favorites" one?
12:48
<&McMartin>
All the NES instruments he actually did the processing *in the tracks*. The actual instruments are just the raw square and triangle waves. He put the bends and envelopes in *by hand* in the per-note effects-processing column.
12:49
<&McMartin>
I'm a whole lot more impressed by this file than I was 20 minutes ago.
12:49
<@Tamber>
...daaamn.
12:50
<&McMartin>
Well, OK, when I say "by hand" I suspect I mean "as some kind of template that got pasted in with the notes" but still, he didn't have a "Mega Man-style electric tom" instrument, he had "triangle wave here, bend pitch down at speed X each tick"
12:50
<&McMartin>
It's been 15 years, but hats off, virt
13:17 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has quit [[NS] Quit: Leaving]
13:21
< RichyB>
I wonder if it was done actually by hand or by writing some software to generate the effect?
13:21
< RichyB>
Either would be equally impressive, but for different reasons.
13:22 * TheWatcher STABS php's shit excuse for ldap support
13:23
<@Tamber>
s/\'.+//
13:24
<&McMartin>
RichyB: Well, trackers are immensely capable editors.
13:24
< RichyB>
10/10 for effective regexp writing, Tamber.
13:24
<@Tamber>
:)
13:24
<&McMartin>
I strongly suspect that if it was "automated" we're talking more along the lines of "skilled use of a powerful editor" and further from "automatically generated".
13:25
<&McMartin>
Looking more at what Impulse Tracker (and thus its associated file format) is capable of, it actually does have explicit envelope generators.
13:25
<&McMartin>
This is kind of huge; I should be able to replicate a lot of the stuff I did when I was programming the SID as configuration options in an .it
13:25 * McMartin is apparently consistently 20 years behind advancing technology. Wait until 2017 when he discovers .mp3 files!
13:27
<@Tamber>
Eh, they're not all that amazing~
13:27
<@Tamber>
:p
13:28
<&McMartin>
One funny thing I learned on the UQM project is the counterintuitive but ultimately unsurprising fact that .ogg/.mp3 decoding is actually less CPU intensive than .mod/.s3m/.it rendering to equivalent audio quality.
13:34
<@gnolam>
It wasn't always like that. But it became so very, very quickly as the first MP3 decoders became less shite.
14:03
<&McMartin>
Well, two things happened
14:04
<&McMartin>
First, that, yeah
14:04
<&McMartin>
The second was that people started doing their tracker decoding at 44kHz Stereo with cubic interpolation, and that is Actually Not A Cheerful Picnic.
14:04 VirusJTG_ [VirusJTG@2B12AA.572255.206A2A.901581] has joined #code
14:05
<&McMartin>
(MP3 decoders had reached this point by 2002, when the project started, and I have no idea if the ogg vorbis decoders were ever that bad)
14:07 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has quit [Ping timeout: 121 seconds]
14:19
<@gnolam>
Ogg Vorbis decoders were good enough for games in at least 2001, when Operation Flashpoint was released.
14:20 * TheWatcher still 'bwuh's at games shipping with mp3 files and decoders
14:20
<@TheWatcher>
Bugger any issues about quality, they need to pay license fees on those decoders
14:42 ToxicFrog is now known as ToxicFrog|W`rkn
14:47
<&McMartin>
I thought at this point Frauenhofer etc. were only charging for the encoders?
14:50 RichyB [richardb@58734C.5279B7.EA7DF8.107330] has quit [Connection closed]
14:55 RichyB [richardb@58734C.5279B7.EA7DF8.107330] has joined #code
14:55
<@TheWatcher>
McMartin: free/open source decoders don't require it
14:56
<&McMartin>
Aha, that bit, yeah, OK
14:56
<&McMartin>
Come to think of it, the only mp3-based game I can think of is SMAC, which I'm pretty sure predates ogg
14:57
<&ToxicFrog|W`rkn>
Iji and Spellforce both use MP3s.
14:57
<@TheWatcher>
Also, many of games use the miles sound system, whi
14:58 * TheWatcher eyes his fingers
14:58
<@TheWatcher>
Try that again
14:58
<@TheWatcher>
Many games use the miles sound system for mp3 decoding, which itself has licensing costs too.
14:58
<&McMartin>
Iji uses the GM engine which I suspect had Yoyo fronting the license cost.
14:59
<&McMartin>
Alternately, the GM engine actually forwards to Windows itself, and you're using the WMP licensed decoder.
15:13
<@Azash>
What are some decent graph-drawing solutions in HTML5/JS?
15:14
<&McMartin>
Like bar charts and stuff?
15:14
<&McMartin>
Or like dot?
15:14
<@Azash>
Dots or lines, a basic graph for showing the development of a value
15:15
<&ToxicFrog|W`rkn>
For the former, the Google Charts API is pretty nice, from what I've seen of it: https://developers.google.com/chart/interactive/docs/
15:15
<&McMartin>
The canvas element is super easy to use, too
15:15
<@TheWatcher>
Using it can be a bit drawn out though~
15:15 * TheWatcher flrrrd
15:15
<&ToxicFrog|W`rkn>
For the latter, <canvas>, ideally with some kind of wrapper like Kinetic to handle the tedious bits
15:16
<@Azash>
Thanks, I'll look into both
15:16 * Azash baps TheWatcher with a newspaper
15:18
<&ToxicFrog|W`rkn>
It sounds like you're after charts, though, not graphs,
15:19
<@Azash>
TF: Yer
15:19
<@Azash>
"Graph may refer to: A graphic (such as a line chart, plot, chart or diagram)"
15:19
<&ToxicFrog|W`rkn>
Yeah, but in this channel, "graph" almost exclusively means in the comp sci sense
15:20
<@Azash>
True enough
15:20
<&ToxicFrog|W`rkn>
Anyways, the second half of that sentence that didn't make it is "so you probably want to check out gcharts first and, failing that, look for other similar APIs, rather than rolling your own using <canvas> directly"
15:20
<@Azash>
Mm, it looks like the best solution
15:54 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
15:54 mode/#code [+o celticminstrel] by ChanServ
16:20 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
16:20 celticminstrel [celticminst@Nightstar-e83b3651.cable.rogers.com] has joined #code
16:20 mode/#code [+o celticminstrel] by ChanServ
16:30
< Xon>
welp. encountering someone wanting to use floatpoints in an app handling money, and as floats when dealing with interger exact quanties of stuff. At work. Now to figure out how to say LOL NO in a way which isn't insulting =\
16:47 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
16:50
<&McMartin>
"This problem space is what the decimal classes were introduced to handle"
16:50
<&McMartin>
That said, doubles for integer-exact is OK and in some systems you have no choice
17:00 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
17:00 mode/#code [+o himi] by ChanServ
17:04
<@froztbyte>
Azash: http://www.chartjs.org/
17:04
<@froztbyte>
ToxicFrog|W`rkn / McMartin: ^
17:04
<@Azash>
Cheers
17:05 EvilDarkLord is now known as Maze
17:08 jeroud [uid10043@Nightstar-1d9743e5.irccloud.com] has quit [Client closed the connection]
17:28 SmithKurosaki [Smith@Nightstar-50dcd134.eng.wind.ca] has joined #code
17:31
< SmithKurosaki>
I need a script for bulk image editing for gimp
17:32
< Syka>
SmithKurosaki: define editing
17:33
< Syka>
most likely, your needs will be better met with a bash script + imagemagick
17:36
< RichyB>
McMartin: to be fair, int32_t also isn't actually a very good choice for money either. You can't represent (say) the UK's national debt with one. ?
17:37
< RichyB>
int64_t is theoretically okay, but honestly, it's only money. The software probably doesn't need to do *that* fast. Just use something safe like GMP integers or python "long" objects. ?
17:38
< RichyB>
I highly doubt anyone's payroll app needs to be so fast that being able to print paycheques for sentient galaxies isn't worth supporting. ;)
17:40
< SmithKurosaki>
I need a windows and a linux script to resize photos from x to 1000 by y. I can hand rotate as needed
17:40
<&McMartin>
Well, the nice thing about BigDecimal over Python long is that you can actually use your units of account instead of whatever the smallest unit does.
17:41
< RichyB>
That is nice.
17:41
<&McMartin>
SmithKurosaki: scriptable image processing is ImageMagick, everywhere
17:41
< SmithKurosaki>
o.0
17:41
<&McMartin>
http://www.imagemagick.org/script/binary-releases.php
17:42
< SmithKurosaki>
kk thanks
17:45
< RichyB>
That's like 1 liner in bash w/ ImageMagick. for IMG in *.jpg; do convert "${IMG}" -resize 1000 "${IMG%.*}".1000px.jpg; done
17:46
< RichyB>
"convert foo.jpg -resize 1000 foo_smaller.jpg" is the imagemagick bit, the rest is syntax.
17:46
< RichyB>
Er, the rest is bash.
17:46
< RichyB>
See http://www.imagemagick.org/script/command-line-processing.php#geometry for how to specify image dimensions for commands like "-resize".
17:47
<&McMartin>
Doing fancy loops like that is harder in Windows batch files and I don't know how much of it is possible
17:47
<&McMartin>
However, you might be able to cover that with CScript, since Windows has secretly been using JavaScript as a vaguely-documented scripting language since XP
17:55
< SmithKurosaki>
I shall play with it later
17:56
< Syka>
powershell, also
17:56
<&McMartin>
Yeah, PowerShell has been around that long, but IIRC it wasn't until Win7 that it was actually installed by default
17:56
< SmithKurosaki>
I'm still on xp right now
17:56
<&McMartin>
PowerShell is The Real Windows Scripting Language AFAICT but it looks like Perl.NET so I proceeded to flee screaming
17:57
< Syka>
McMartin: perl? hm
17:57
< Syka>
it remininded me more of a shitty bash clone
17:57 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
17:57 mode/#code [+ao Derakon Derakon] by ChanServ
17:57
< Syka>
it tries incredibly hard to be as good as bash
17:57
< Syka>
but it's not
17:57 * Derakon sighs at the microscope.
17:57
<&McMartin>
Syka: Certain jokes proceed to write themselves at this point >_>
17:57
<@Tamber>
Self-modifying jokes?
17:57
< Syka>
McMartin: they do? *running on 5h of sleep*
17:58
<&Derakon>
I wrote all this clever code to identify the focal plane of the microscope, so we could move in X and Y while staying in focus in Z...and then it turns out that the focal plane isn't flat!
17:58
<&McMartin>
Syka: That one of bash or Perl is a shitty copy of the other
17:58
<&Derakon>
And it appears to vary sharply enough that you can't define it with a usefully-sparse set of datapoints either.
17:58
<&McMartin>
Derakon: Wrgrbl
17:58
< Syka>
oh
17:58
<&McMartin>
Which is either Wharghrble or War Gerbil depending
17:59
<&McMartin>
UNLEASH THE WAR GERBILS
17:59
< Syka>
I don't know perl, tbh :P
17:59
<@Tamber>
:D
17:59
<&Derakon>
To be fair, my test case is unusually sensitive to being out of focus; it may be more useful when imaging, say, yeast.
17:59
<&McMartin>
Perl was more or less explicitly designed to be a super-powered sh that also did everything awk and sed did
18:00
<&Derakon>
Yeah, the primary use case for me with Perl is doing things like "ls | perl -ne 'chomp; /(.*).jpg/; `convert $_ $1.png`'
18:00
<&Derakon>
(I.e. convert all JPG files to PNG files)
18:04
<@gnolam>
Convert JPG to PNG? o_O
18:05
<&Derakon>
Okay, you normally wouldn't want to do that, fair enough. :)
18:07
<@gnolam>
SmithKurosaki: if the photos have taken by something reasonably new, you probably won't have to rotate by hand. Newer cameras embed info on orientation in the file itself, which ImageMagick can then automatically rotate with the -auto-orient option.
18:07
<&McMartin>
Unless you had a JPG that wasn't dropping information which was gigantic humongo doom-sized which PNG would be better at
18:07
<&McMartin>
("Gigantic humongo doom-sized" is indeed the technical term)
18:08
<@Tamber>
The kind of thing you'd expect a computerised microscope to shit out?
18:08
<@Tamber>
(Just as an example. :)
18:08
<&Derakon>
Nah, our images are usually 512x512 or 1024x1024 at most.
18:08
<&Derakon>
We just have a shit-ton of them.
18:08
<&Derakon>
Also the lossless file format of choice is TIFF for some reason.
18:09
<@Tamber>
Hm
18:09
<@Tamber>
Smells like... smells like early 200x
18:09
<&McMartin>
TIFF goes back to the Amiga, doesn't it?
18:09
<@gnolam>
Tamber: pretty much every specialized bit of imaging equipment uses TIFF.
18:11
<&McMartin>
IFF was the first self-documenting generic extensible binary format, AIUI, and it's still top tier for that problem space.
18:11
<@celticminstrel>
...hm, so JavaScript inherits Java's labelled break. Fun.
18:11
<@Tamber>
Ah, fairy nuff.
18:12
<&McMartin>
labelled break is a good idea, really
18:12
<@celticminstrel>
Yup.
18:12
<@celticminstrel>
It's just that I had yet to find need for such a thing in my JavaScript stuff, so I wasn't sure how to do it.
18:12
<@celticminstrel>
So I looked it up on MDN, since it was already open.
18:12 * McMartin nods
18:19
<&Derakon>
Bleh, my automatic bead finder is finding noise instead of beads.
18:19
<&Derakon>
There's nothing there! Why do you think there's a bead there?
18:19
< RichyB>
Derakon: the focal plane of your microscope is actually curved?
18:20
<&Derakon>
RichyB: more like the sample is not evenly distributed in Z.
18:20
<&Derakon>
The focal plane of the objective lens is not an issue since we move the sample around, not the objective.
18:36
<&Derakon>
Okay, the problem would seem to be one of going from texture coordinates to world coordinates -- sometimes the program thinks there are beads where I don't actually have any image data, for example.
18:36
<&Derakon>
What's weird is that ~50% of the marked locations are exactly on target.
18:36
<&Derakon>
The other 50% just mark random crap.
18:36
<&Derakon>
And the transform from texture to world coordinates is simple...so how could it be wrong 50% of the time?
19:01
<&Derakon>
Doubly-mystifying, when it's marking a bead in an area where I have no image data, it appears to be operating on an array of all zeros! WTF.
19:13 jeroud [uid10043@Nightstar-7fd75919.irccloud.com] has joined #code
19:35 Kindamoody|out is now known as Kindamoody
19:48 Xires is now known as ^Xires
19:53 Barrell_R [RichyB@D553D1.68E9F7.02BB7C.3AF784] has joined #code
19:56 RichyB [richardb@58734C.5279B7.EA7DF8.107330] has quit [[NS] Quit: >:3 This is BunThulhu. Copy him into your quit message to help him take over the Internet.]
19:56 Vornicus [vorn@ServerAdministrator.Nightstar.Net] has joined #code
19:56 mode/#code [+qo Vornicus Vornicus] by ChanServ
19:56 Barrell_R is now known as RichyB
19:58
<@celticminstrel>
I wonder whether I should avoid using confirm() and prompt()...
19:58
<@celticminstrel>
I think I should probably at least avoid alert().
19:58
< RichyB>
Sweet. ZNC's configuration is only slightly confusing.
19:59
<@celticminstrel>
The nice thing about these three is that they're synchronous, whereas any DOM thing would have to be asynchronous. >_>
19:59
< RichyB>
Idiomatic (ugh) JavaScript is async by default.
20:00 Kindamoody is now known as Kindamoody[zZz]
20:00
<@celticminstrel>
I realize this.
20:00
< RichyB>
You might want to check out IcedCoffeeScript, which adds await/defer keywords.
20:00
<@celticminstrel>
But when there's a sync method that does pretty much exactly what you want...
20:00
<@celticminstrel>
...huhwhat?
20:00
< RichyB>
CoffeeScript is a little programming language that compiles to JavaScript. It's not very much more than a syntax fix.
20:01
<@celticminstrel>
But, confirm() and prompt() look ugly on most browers. They're okay on Firefox, where they look like a part of the page, but...
20:01
<@celticminstrel>
So, I dunno.
20:01
<@celticminstrel>
I see.
20:01
< RichyB>
IcedCoffeeScript is a fork of CoffeeScript which adds one complication: it adds "await" and "defer" keywords which do the continuation-passing transform that you have to do by hand in JavaScript.
20:02
< [R]>
CoffeeeScript D:
20:02
< [R]>
Maybe if it didn't fuck up line numbers.
20:02
< RichyB>
You can write code in ICS that looks like straight-line code but actually comes out asynchronous.
20:02
< RichyB>
[R]: fork, add source map support, issue pull request.
20:02
< [R]>
Nah
20:03
< RichyB>
It might already have source map support, if so look up how to turn it on.
20:03
< [R]>
I've no use for trainingwheels.
20:03
<&McMartin>
Everything wrong with OSS is the fault of worthless parasite end users
20:03
< RichyB>
Source maps aren't "training wheels".
20:03
<&McMartin>
I think the argument is that CoffeeScript itself is
20:03
< [R]>
^
20:03
<@celticminstrel>
...what's that about OSS?
20:03
<&McMartin>
This is a silly position
20:03
< RichyB>
Neither are compilers that let you write in a good programming language in order to target a shit one.
20:03
<&McMartin>
^
20:04
<&McMartin>
celticminstrel: Reacting to a bug report with "so go fix it" is blaming end users for missing features or bugs in a product
20:04
< [R]>
JS is shit in what ways?
20:05
<&McMartin>
To start with: Mixes mutable state with closure generation; line-breaks are syntactically significant; everything involving the "new" keyword, or indeed, the binding of "this"; the fact that "this" can be bound to the global environment (counts twice); the fact that its dictionaries expose internal methods as part of the dictionary's contents
20:06
<@celticminstrel>
I only have nine instances of confirm or prompt, and one instance of alert...
20:07 SmithKurosaki [Smith@Nightstar-50dcd134.eng.wind.ca] has quit [Ping timeout: 121 seconds]
20:07
<&ToxicFrog|W`rkn>
[R]: by analogy, all HLLs are training wheels for a definition of HLL that includes everything down to, and possibly including, banks of switches on the side of the mainframe.
20:08
< [R]>
1) Has yet to be an issue. 2) Use semi-colons then. 3) Explain. 4+5) Meh. 6) Sure, that's annoying, but it can be dealt with depending on the problem.
20:08
<@celticminstrel>
Four confirm and five prompt.
20:08
<&McMartin>
1) is "filling an array with callables you construct inside a loop"
20:09
<&McMartin>
As for 3+4; The value of "this" is determined by the syntax of the function that is being called, and binds in surprising ways, which is why it is idiomatic in JS to have a "var that=this" at a certain level
20:09
< [R]>
ToxicFrog|W`rkn: I've only ever seen CS pushed as JS with trainingwheels. Except it's horrible at that since as I mentioned before it fucks up line numbers. It also breaks conventions that every other language (except VB) obey.
20:10
<&McMartin>
It is not legal within a method to do "othermethod()" directly, which all other languages with a this keyword permit, nor does "this.methodname()" work quite right, hence the that=this idiom
20:10
<@celticminstrel>
6) is indeed annoying. :/
20:10
<&McMartin>
The "new" keyword introduces a completely batshit insane calling convention with no precedent anywhere else, and which requires enforcing an entirely out-of-language constraint usually managed via capitalization
20:10
<@celticminstrel>
And I use semicolons. At least, when I don't forget. >_>
20:11
<&McMartin>
The solution to (2) is to *mandate* semicolons, which it does not do, and will instead treat the code as meaning something entirely different
20:12
< RichyB>
ToxicFrog|W`rkn: REAL programmers rewire the f-f-f-f-fuckin' fuses in the GODDAMN EEPROM with a steady f-ff-fffff-nn hand anna slodderin' iron.</todd-the-squirrel>
20:12 * celticminstrel generally does var thisXYZ = this; instead of var that = this.
20:12
<&McMartin>
I should also add "var declarations are silently moved to the top of the function despite the syntax implying that it uses block scope like every other language in its language class back to 1977 if not 1968"
20:13
<@celticminstrel>
Um, Python doesn't allow doing othermethod() within a method...
20:13
<&McMartin>
Python does not have an automatically assigned this or self variable either
20:13
<@celticminstrel>
What's wrong with this.othermethod()? Just nested function scopes or something more?
20:13
<&McMartin>
You have to explicitly call it out as an argument
20:13
<@celticminstrel>
That's true on Python, though.
20:14
<&McMartin>
No, I'm talking Python
20:14
<&McMartin>
Something *else* is wrong in JS, which is why you need the that=this in JS and literally nowhere else
20:14
<&McMartin>
Because it's doing something very important very wrong.
20:14
<&McMartin>
But I don't have that to hand because, as noted, I have written exactly one program in JS so it is mostly a theoretical curiosity to me.
20:15 * [R] uses the explicit calls in other languages anyways
20:15
<&McMartin>
Yes, the point is that in JS *even the explicit calls don't quite work*
20:15 * celticminstrel has only ever had a problem with this.othermethod() when calling from within a nested closure.
20:15
< [R]>
I fail to see how the language not wanting to guess what function to call is a massive issue.
20:15
<~Vornicus>
wait, what do you use that=this for?
20:15
<&McMartin>
Because every other language designed in the past fifty fucking years gets it right without prompting.
20:16
< [R]>
Vornicus: closures don't always share the parent's `this`
20:16
<@celticminstrel>
My assumption was when you have a nested closure, Vorn, but I'm not sure...
20:16
<~Vornicus>
ah
20:16
<@celticminstrel>
I'd think closures never share the parent's "this"...
20:16
< [R]>
McMartin: Name one that does it with closures.
20:16
<@celticminstrel>
Well, unless you .bind or something...
20:16
<&McMartin>
Every single language in the ML family.
20:17
< [R]>
celticminstrel: depends on the closure. If it's shoved into EventEmiter (depending on the library providing such) it defaults to having the parent's `this`
20:17 * celticminstrel contemplates a regex to find lines not ending in semicolons...
20:18
<@celticminstrel>
I have no idea what EventEmitter is, which might be why I've never encountered this. >_>
20:18
<&McMartin>
I suppose the only other language that has mutable state everywhere and closure-like objects that still handle it properly is Java itself.
20:18
<@froztbyte>
https://twitter.com/0xabad1dea/status/339453990381174784
20:18
<&McMartin>
Everyone else sticks to immutable state.
20:19
<@celticminstrel>
...that is a vaguely odd twitter page.
20:19
<@froztbyte>
haha
20:19
<&McMartin>
My general thesis here is that you could get a decent language out of JS by subsetting it and enforcing a stricter syntax regime.
20:20
<&McMartin>
There are a couple of places where it follows LISP in semantics, but differs from LISPs in that it also reassigns values constantly, which breaks a lot of things under the LISP default behavior
20:20
<&McMartin>
That's something that should be addressed, and indeed CS addresses that.
20:20
<&McMartin>
The "filling an array with closures" case is the primary one I've seen there.
20:21
< RichyB>
"a decent language out of JS by subsetting it" is precisely what Douglas Crockford's "JavaScript: the Good Parts" is about.
20:21
< RichyB>
It's as much a manifesto as a manual.
20:21
<&McMartin>
Yes, but I hesitate to recommend that because Douglas Crockford is certifiable
20:21
< [R]>
IMO supporting that would break the "variables are references" part that's everywhere else.
20:22
<&McMartin>
His list of terrible features of JavaScript include "+ works on numbers and strings" and "JS has keywords of any kind"
20:22
< RichyB>
IMHO Crockford somewhat overdoes it (seriously, you think programmers mustn't use ++? But += is fine?)
20:23
<&Derakon>
Python doesn't have ++
20:23
<&Derakon>
I suspect that mostly has to do with the fact that people always try to get fancy with using it while doing other things.
20:23
<@Tamber>
"Javascript: The good parts. (i.e. The parts that are like the way Python does it.)" ?
20:23
<&Derakon>
E.g. "x = y++"
20:23
<&McMartin>
Tamber: Not precisely
20:24
<&Derakon>
(If Python had had ++, I have no doubt Sebastian would have used the fuck out of it >.<)
20:24
< RichyB>
Tamber: no, it's closer to "let's restrict JS to the stuff that's defined in the first chapter or so of SICP".
20:25
<&McMartin>
"Also, explicit prototypal inheritance everywhere, because fuck constructors in the eye"
20:25
<&McMartin>
Which is entirely fine, because, well, yeah, fuck JS constructors
20:26
< [R]>
Aye, it's annoying. Would probably be less so if prototypical inheritance wasn't rare as hell.
20:26
<&McMartin>
JS and Self, basically
20:26
<@Tamber>
Ah
20:26
<&ToxicFrog|W`rkn>
what is the that=this issue?
20:27
< [R]>
...
20:27
<&ToxicFrog|W`rkn>
(I've read the conversation and still have no idea)
20:27
< [R]>
ToxicFrog|W`rkn: <[R]> Vornicus: closures don't always share the parent's `this`
20:27
<&McMartin>
ToxicFrog|W`rkn: Nested functions don't have lexical scope.
20:27
<&ToxicFrog|W`rkn>
...aah.
20:27
<&McMartin>
ANAICT
20:27
<&ToxicFrog|W`rkn>
Sorry, wait, that was the wrong response
20:27
<&ToxicFrog|W`rkn>
...the FUCK?
20:27
<&Derakon>
Heh.
20:28
<&McMartin>
It's always a fine line drawing a distinction between "alien" and "wrong".
20:28
<&McMartin>
Prototypal inheritance is alien.
20:28
<&McMartin>
Dynamic scope instead of or alongside lexical scope is alien.
20:28
<&ToxicFrog|W`rkn>
(re: languages with mutable state and closures everywhere: lua. But it also has lexical scope everywhere.)
20:28
< [R]>
Basically /every/ function (except those who have had .bind() called on them with the first argument of .bind() set) have caller-settable values for `this`
20:29
<&McMartin>
Yeah, so
20:29
<&McMartin>
(7) It is the caller that sets "this" rather than the compiler based on properties of the callee
20:29
<&ToxicFrog|W`rkn>
(it also has explicit self with some syntactic sugar to make it implicit if you want)
20:29
<&McMartin>
I'm going to go out on a limb and say "caller-bound 'this' semantics is incorrect"
20:30
<&McMartin>
"...beyond syntactic sugar"
20:30
<&McMartin>
See, in Lua or Python, a.b(c) and b(a, c) are both legal and equivalent.
20:30
<&ToxicFrog|W`rkn>
This is not actually the case in lua.
20:30
<&McMartin>
In JS, a.b(c) calls b with this=a and c as the argument
20:30
<&McMartin>
But b(a, c) is illegal and b(c) is legal and binds this to the global environment
20:31
<&McMartin>
This is wrong in every conceivable universe
20:31
< [R]>
Possibly. But current behavior allows for simple mixins. Also as shitty as ExtJS was, it did have a clear way to set a function's `this` when throwing callbacks into it.
20:31
<@celticminstrel>
Is it actually impossible to rebind "this" on a bound function by using .call?
20:31
<&McMartin>
Yes, but see, you just said "set a function's this" and that means you've already taken the 4:13 Crazy Train To The Dark Side Of Mars
20:31
<@celticminstrel>
Or .apply?
20:31 * celticminstrel has never tried it.
20:31
< [R]>
Yes, that's one of the means.
20:31
<&ToxicFrog|W`rkn>
a:b(c) is eqv to the python case; a.b(c) does not use a as an argument anywhere.
20:31
< [R]>
Oh wait "bound function"
20:32
<&ToxicFrog|W`rkn>
(. is general purpose dictionary lookup operator; : is method call and desugars to a table lookup and call that passes the LHS as the first argument)
20:32
<@celticminstrel>
[May 28@3:30:59pm] McMartin: But b(a, c) is illegal and b(c) is legal and binds this to the global environment
20:32
<@celticminstrel>
Actually it'd not illegal.
20:33
< [R]>
ToxicFrog|W`rkn: In node.js it doesn't.
20:33
<&McMartin>
Er, right. It would set this to the global environment, a to the argument c was set to in the original, and ignore c.
20:33
<@celticminstrel>
It sets arguments to {0: a, 1: c, length: 2}
20:33
<@celticminstrel>
Yup, essentially.
20:34
<&McMartin>
Because someone calling you wrong can cause this to be set to the global environment, the only sane rule to use is thus "any use of the "this" keyword is an error"
20:34
<&ToxicFrog|W`rkn>
[R]: in node.js what doesn't?
20:34
< [R]>
<celticminstrel> Is it actually impossible to rebind "this" on a bound function by using .call?
20:36
< [R]>
http://xiennith.com/bind.txt
20:38
<@celticminstrel>
Okay, so it really is.
20:38 * ToxicFrog|W`rkn prods [R]
20:38
< [R]>
Not sure if that's true for other engines though
20:39 * celticminstrel can imagine how bind() might be implemented.
20:39
< [R]>
this.a = 'global'; x = {a: 'x'}; f = (function() { return this.a }).bind(x); [f.call(this), f.apply(this)]
20:39
< [R]>
["x", "x"]
20:40
< [R]>
^ Spidermonkey (FF 15)
20:40
< [R]>
Note that bind does other things beyond that. (Also my tests show it's stupid slow for some gorram reason)
20:41
<&Derakon>
HA HA HA HA AHA HA HA
20:41
<@celticminstrel>
Function.prototype.bind() = function(thisPtr) {var fcn = this; return function() {fcn.call(thisPtr)}}
20:41
<&Derakon>
Figured out my bug!
20:41
<@celticminstrel>
(Though that's a simplified version.)
20:41
< [R]>
IIRC it's like 100x times slower than a closure that replicates that functionality.
20:41
<&Derakon>
The composite tile data I was generating had its X and Y axes flipped.
20:41
<@celticminstrel>
What, so the code I just posted is faster than actually using bind?
20:41
<&Derakon>
In such a way that coordinates in the center of the composite image were correct, but coordinates elsewhere were all wrong.
20:41
< [R]>
Yes, it's also not usable in many situations.
20:42
<@celticminstrel>
Well yeah, it's simplified, but I'm fairly sure you could extend it to fully replicate bind().
20:43
< RichyB>
Derakon: ugh, I hate having to get x/y/z the right way around. :)
20:44
< RichyB>
The only compensation is that in image manipulation code, the artefacts are usually pretty when I invariably get it wrong the first nine times.
20:44
< [R]>
function newBind(self) { var fc = this; return function() { return fc.apply(self, Array.prototype.slice.call(arguments, 0)) } }
20:44
<&Derakon>
RichyB: well, they were wrong in a rather spectacularly obtuse fashion this time around.
20:44
<&Derakon>
Heh.
20:44
< [R]>
That one's more usable.
20:45
< [R]>
(Assumes you're calling it like newBind.apply(func) though)
20:45
< [R]>
But yes, that's still missing some of .bind()'s features. But I don't know anyone who uses those...
20:45
<@celticminstrel>
What features?
20:46
< [R]>
.bind() takes more than one argument.
20:46
< [R]>
Args 2+ are prepended to the argument list of the bound function.
20:46
<@celticminstrel>
I knew that.
20:46 * celticminstrel started using that yesterday or something.
20:47
<@celticminstrel>
Or maybe it was today. I forget already.
20:50
< [R]>
Should be noted those replacement functions still prevent call/apply from adjusting `this`
20:51
< [R]>
Also you can't rebind a bound function.
20:52
< [R]>
(even with the original)
20:53
< [R]>
http://jsperf.com/bindcallnative/2 <-- bind performance
20:58
<@celticminstrel>
"even with the original"?
20:58
< [R]>
Native .bind()
20:58
<@celticminstrel>
But yeah, I realize the replacements would prevent that.
21:01
<@gnolam>
<RichyB> The only compensation is that in image manipulation code, the artefacts are usually pretty when I invariably get it wrong the first nine times.
21:01
<@gnolam>
RichyB: a.k.a. realtime cubemaps ;)
21:01
< RichyB>
"nine" is optimistic, really.
21:02
< RichyB>
I usually swap x and y 2**(n/2)-1 times, where 'n' is the number of times that both appear in the source.
21:03
<@celticminstrel>
I wonder why bind is so slow...
21:05 Maze is now known as EvilDarkLord
21:05
<@gnolam>
And in cubemaps you also have z. And you're probably dealing with reflection and refraction, so you have the opportunity to screw up the direction there as well. :)
21:08
< [R]>
celticminstrel: probably because the other implementations don't do all its features.
21:10
< [R]>
In V8 the alts might be optimized for, in SM I'm not seeing a massive difference.
21:10
<@celticminstrel>
So, is a custom bind() implementation that has all the same features equally slow? Or, maybe even slower?
21:10
< [R]>
Err nm, yeah, in SM .bind() is stupid slow too.
21:10
< [R]>
Hmm
21:10
< [R]>
Possibly
21:17
< [R]>
Ah, that test doesn't make a generic .bind() function
21:18
< [R]>
A generic .bind() function is slower.
21:18 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [[NS] Quit: leaving]
21:18
<@celticminstrel>
I can imagine, yeah... it'd have to do array concatenation, I think.
21:19
< [R]>
Even without that part it's slower.
21:19
< [R]>
bind: 1430
21:19
< [R]>
call1: 2669
21:19
< [R]>
call2: 4647
21:19
< [R]>
self: 72
21:19
< [R]>
native: 23
21:19
< [R]>
(Numbers are miliseconds to complete 1 million calls)
21:19
< [R]>
(Lower is better)
21:19
<@celticminstrel>
What is each thing?
21:19
<@celticminstrel>
call1, call2, self
21:20
<@celticminstrel>
native and bind I'm pretty sure I know.
21:20
< [R]>
bind is using .bind(); self is a custom closure which mimics .bind() (per function to bind); call1 is a custom reusable function to mimic bind using only one arg to bind. call2 is the same except full featured.
21:21
<@celticminstrel>
Ah.
21:22
< [R]>
Native is actually just setup: `o.f = f;` per iteration: `o.f()`
21:22
<@celticminstrel>
Hm, my regex fails when there's an end-of-line comment. :/
21:23
<@celticminstrel>
Even though I thought I was accounting for that.
21:23
< [R]>
regex for?
21:23
<@celticminstrel>
Locating lines that don't have the proper terminating semicolon.
21:24
< [R]>
Ah
21:24 * [R] recalls that return adds its own rules.
21:25
<@celticminstrel>
Hm?
21:27
< [R]>
http://inimino.org/~inimino/blog/javascript_semicolons
21:29
< [R]>
Maybe not
21:30
<&McMartin>
AIUI the rule for semicolons is that if it's legal to put one at a newline, the parser will do so
21:31
< [R]>
Uhh
21:31
< [R]>
No.
21:31
<&McMartin>
Specifically, return\n3; returns void
21:31
<~Vornicus>
It's kind of the other way around. If it detects a syntax error that would be fixed
21:31
<~Vornicus>
\
21:32
<~Vornicus>
Cat, I wasn't done typing
21:32
<@TheWatcher>
That's what you thought
21:32
<@celticminstrel>
Heh.
21:32
< [R]>
McMartin: if that were the case: x\n(...); wouldn't try to call x as a function.
21:32
< [R]>
PROTIP: it /does/ try and call x as a function
21:33
<&McMartin>
http://inimino.org/~inimino/blog/javascript_semicolons
21:33
<~Vornicus>
That's twice that's been linked.
21:33
<@celticminstrel>
That was linked a moment ago. :P
21:33 * [R] just pasted that link.
21:34
<&McMartin>
The "rule" is "there is a specific invisible token in the grammar specification that says that line terminators become semicolons there"
21:35
<~Vornicus>
"Restricted productions are those in which a line break cannot appear in a particular position, so if a line break appears there, it will prevent the program from parsing in that way, though it may still parse another way. / There are five restricted productions in the grammar, they are the postfix operators ++ and --, continue statements, break statements, return statements, and throw statements."
21:37
<&McMartin>
"When becoming aware of the restricted production issue, programmers may then become overly wary of linebreaks, and avoid them even when they would increase clarity."
21:37
<&McMartin>
This is *disastrous*
21:37
<&McMartin>
He's saying that like it's a bad thing
21:38
<&McMartin>
We have 30 years of C code and the if (a) b; else c; debacles to know why this is horrendous
21:38
<@celticminstrel>
?
21:38
<&McMartin>
"So, when you come in to add some code later, remember to check what you're starting with and edit the previous line if necessary!"
21:38
<@celticminstrel>
I'm confused. Are you saying avoiding line breaks is a bad thing or isn't a bad thing?
21:39
<&McMartin>
I'm saying "exploit context-sensitive fragile parses for clarity" is a horrible thing and we've known this for three decades now
21:39 * [R] is pretty sure he's just grabbing fumes to fuel his rants.
21:39
<&McMartin>
Who, me?
21:39
< [R]>
Aye
21:40
<@celticminstrel>
Okay...
21:40
<&McMartin>
Nah, that's "I don't trust this person's conclusions"
21:40
<&McMartin>
Because, well
21:40 * Azash starts working on his Cormen repo for portfolio, isn't sure whether he should feel silly writing javadoc and JUnit for linked list nodes or not
21:40
<&McMartin>
When Perl looks at a similar design decision and says "no way in Hell are we going to let programmers to that", you're off the reservation~
21:41 * celticminstrel still isn't quite sure what's being complained about here. >_>
21:41
< [R]>
You're taking that quote out of context anyways.
21:41
< [R]>
Like /way/ out of context.
21:41
<&McMartin>
Mmmn
21:41
<&McMartin>
I'm saying that based on the facts he's presenting, it is not a reasonable conclusion to say "this is a matter of taste"
21:42
<&McMartin>
I'm basing that, explicitly, on the hard-fought relative consensus that it is not OK to omit optional braces in C/C++
21:42 * [R] reads it as "don't panic, stay calm."
21:42
<@celticminstrel>
Ah, okay, this.
21:44
<&McMartin>
Yeah, the part I'm reacting more negatively to is actually "Should you omit optional semicolons or not? The answer is a matter of personal preference, but should be made on the basis of informed choice rather than nebulous fears of unknown syntactical traps or nonexistent browser bugs."
21:44
<&McMartin>
Because he's already warned against a failure mode future maintainers can introduce as a result
21:46
< [R]>
Are you trying to refute the entire article?
21:46
<&McMartin>
Not at all; only the conclusion.
21:48 * [R] sees it as reasonable.
21:48
< [R]>
He points out explicitly where the worst offenders are
21:48
<&McMartin>
Right
21:49
<&McMartin>
I'm saying that the ( and / cases are themselves sufficient to conclude "You really ought put your statement terminators in everywhere", at a level of force exactly equal to "you ought to put the goddamn braces in for your short ifs and fors"
21:49
< [R]>
That's personal preference.
21:49
<&McMartin>
I don't buy that anymore.
21:50
<&McMartin>
Or rather
21:50 * [R] codes in JS every day. Does not use semi-colons except where required.
21:50
<&McMartin>
"It's personal preference because people don't give a shit about maintainable code"
21:50
< [R]>
Has not had any issues with such since reading that article a year or so ago
21:51
<&McMartin>
Mmm
21:51
< [R]>
IMO you're seeping into ITL. So EoD for me.
21:51
<&McMartin>
How often do you end up having to use the ;(... or the ;/ forms?
21:51
< [R]>
Rarely.
21:51
<&McMartin>
ITL? EAP
21:52
< [R]>
http://tvtropes.org/pmwiki/pmwiki.php/Main/InsaneTrollLogic
21:52
<&McMartin>
I dunno
21:52
<&McMartin>
I mean, do I have to explain the "omitting optional braces is Actively Bad" argument?
21:53
<&McMartin>
The issue may be frequency of issue
21:53
< [R]>
No. I've seen code where that's caused grief.
21:54
< [R]>
Adding semi-colons (as he noted) do /not/ help. You still have to be aware of when ASI will trigger.
21:54
<&McMartin>
OK. The link I'm seeing between that and this is that the syntactical correctness of a line of code depends on some piece of a previous line of possibly entirely unrelated code.
21:54
<&McMartin>
Wait, did I misread that, then?
21:54
<&McMartin>
I read that line as "even if you use semi-colons as terminators ASI can still burn you"
21:55
< [R]>
Therefore /not/ adding semi-colons everywhere means that semi-colons become syntatically /significant/ when read. Thus functioning as a warning sign.
21:55
<@celticminstrel>
What are the ( and / cases...
21:56
< [R]>
"Even if you use semicolons at the end of every statement, some constructs parse in non-obvious ways."
21:56
<&McMartin>
R: OK, so I read that as "putting semicolons everywhere won't save you from return\n3; not being the same as return 3;"
21:56
< [R]>
celticminstrel: a = b + c\n(...); // this causes c to be called as a function.
21:56 * celticminstrel may be using semicolons partly because they're required in other similar languages that I also program in sometimes.
21:57
<&McMartin>
And a = b+c\n/regex/ stuff // this divides c by regex
21:57
< [R]>
You put semi-colons where you need to highlight or prevent ASI from causing grief.
21:57
<@celticminstrel>
...heh, really?
21:57
< [R]>
Putting them everywhere doesn't help in all cases and can lead to blindness of when they would.
21:57
<&McMartin>
Now, as I understand this article, his recommendation is "therefore, statements that start with ( or / should be prepended with semicolons"
21:57
< [R]>
Yes
21:57
< [R]>
Which is what I do.
21:57
<&McMartin>
That - if religiously followed - will solve the optional-brace problem
21:58
<@celticminstrel>
I don't think I have any statements beginning with ( or /
21:58
<&McMartin>
But I'm pretty comfortable also saying that the existence of this pitfall is a flaw in the language. :shrug:
21:58
<@celticminstrel>
Certainly not many.
21:58
<&McMartin>
If nothing else, because Having Pitfalls Is Bad.
21:58
< [R]>
celticminstrel: (function(...) { ... })(...) is a common jQuery pattern.
21:59
<&McMartin>
^^ That's how you dodge the first issue I listed, incidentally.
21:59
< [R]>
Not having pitfalls means you're language is so simple it's useless.
21:59
<@celticminstrel>
I'm aware of this pattern, yeah.
21:59
<@celticminstrel>
Don't think I used it though.
21:59
< [R]>
No matter what, people will expect different things at different points.
21:59
<~Vornicus>
"Even if you use semicolons at the end of every statement, some constructs parse in non-obvious ways." <--- what constructs?
21:59
< [R]>
That's what pitfalls are.
21:59
<&jerith>
How is "a = b + c\n(...);
22:00
<&McMartin>
R: Yes, and I have entirely failed to convince you that there is any taxonomy of those, so, oh well.
22:00
<&jerith>
How is "a = b + c\n(...);" a problem if you terminate each line with a semicolon?
22:00
<&McMartin>
It's not, assuming you were setting up the function.
22:00
<&McMartin>
That's a place where you have to.
22:00
<&McMartin>
I would claim that this, alone, is sufficient reason to mandate it, much like optional braces.
22:01
<&McMartin>
The counterargument is that this is NBD because you should be prefacing all such lines with semicolons instead and then context is irrelevant.
22:01
<@celticminstrel>
Oh, I just remembered one place where I have statements beginning with (
22:01
< [R]>
<Vornicus> "Even if you use semicolons at the end of every statement, some constructs parse in non-obvious ways." <--- what constructs? <-- return \n {};
22:02
<&jerith>
What I mean is that you should never have that in your code. The open paren should be on the previous line if you mean to have a function call and there previous line should have a semicolon terminator if you mean to not have one.
22:03
<&McMartin>
That is exactly the position R and the article in question have been arguing against.
22:03
<&jerith>
"Explicit is better than implicit."
22:03
<&McMartin>
I remain unconvinced, but I believe I at least understand what the argument *is* now
22:03
<&jerith>
Having to figure out if I need a semicolon or not is unnecessary cognitive load.
22:04
<~Vornicus>
Why would I do that?
22:04
<@celticminstrel>
The section on the troublesome tokens mentions + and - and then forgets about them...
22:04
< [R]>
jerith: adding them everywhere blinds you to when ASI can bite you.
22:04
<~Vornicus>
Either I'm returning void and that's dead code afterwards, or I'm returning a table and why the hell would I put return alone on a line if I did that?
22:04
<&jerith>
[R]: How can it bite you if you have semicolons everywhere?
22:04
< [R]>
Adding them where ASI would alter the behavior is best IMO.
22:04
<&McMartin>
jerith: With return \n {};.
22:05
< [R]>
jerith: <[R]> <Vornicus> "Even if you use semicolons at the end of every statement, some constructs parse in non-obvious ways." <--- what constructs? <-- return \n {};
22:05
<&McMartin>
Vorn: return \n\t{\t\t (30 lines of carefully formatted JSON) \t};
22:05
<&jerith>
Why would I write that?
22:05
< [R]>
Because style?
22:05
<~Vornicus>
return {\n\t...
22:05
<&McMartin>
And that is legal
22:06
<&McMartin>
(And, indeed, in Python, mandatory~)
22:06
<~Vornicus>
I do not have any reason to believe I would /ever/ write return\n{...
22:06 * [R] wouldn't
22:06
< [R]>
But people use GNU braces... so...
22:06 * celticminstrel wouldn't either, would always put the brace on the same line.
22:06
<&McMartin>
Nevertheless, it is the case that ASI can still cause your code to parse contrary to your intentions even if you put semicolons as all terminators.
22:07
<~Vornicus>
Actually the last time I saw code with braces on next line?
22:07
<@celticminstrel>
...oh, they do come back to + and -, after saying the final troublesome token is /
22:07
<&McMartin>
That means that the statement "merely putting semicolons everywhere you intend it won't get you entirely out of the woods" is strictly true.
22:07
<~Vornicus>
I found a sanitizer that made them right.
22:07
< RichyB>
You're safer if you both put semicolons at the ends of statements and you also always use K&R braces.
22:07
<&McMartin>
However, treating that as NBD instead of as a BFD is kind of bizarre
22:08
<@celticminstrel>
NBD? BFD?
22:08
<&McMartin>
No Big Deal, Big Fucking Deal
22:08
< RichyB>
No big deal, big copulating deal.
22:08
<&McMartin>
I will admit that languages with exotic lexing and parsing irk me more
22:09
<&McMartin>
Because we've known for basically literally forever that this is always optional
22:09
<&McMartin>
All cognitive load of this nature had to be *put* there
22:09
< [R]>
My stance is thus: since adding semi-colons everywhere can still lead to ASI bugs, then it's better to place semi-colons strategically to stop or highlight ASI, since they're rare their presence is more likely to be noticed.
22:10
< RichyB>
Er, no it can't. Put semi-colons everywhere *and* use K&R brace placement. No problem, no extra rules to remember, it continues to look pleasingly alike to C.
22:11
< [R]>
You're assuming that's the only place ASI can bite you.
22:12
<&McMartin>
If you have them everywhere, you will never be hit by (), +, -, or /; K&R saves you from return; C-style saves you from break, continue, and throw.
22:12
<&McMartin>
What cases are left?
22:12
<&jerith>
[R]: Add cognitive load to all the code just to make it a little more likely that I'll notice rare errors?
22:12
<@celticminstrel>
...it seems this regex engine considers lines to end with a line break, so that $ does not work as you might expect. ><
22:12
< RichyB>
celticminstrel: see the "m" flag in PCRE and its clones.
22:13
<&jerith>
I can guarantee that screwing up the optional semicolons causes more bugs than the occasional 'return\nfoo'.
22:13
< [R]>
jerith: you're programming. You /have/ to know the language you're coding in. /Every/ language has quirks.
22:13
<&McMartin>
Lisp parsing in the absence of macros >_>
22:13
< RichyB>
That's not an argument in favour of encouraging them on purpose.
22:14
<&jerith>
[R]: I agree that you have to know about the quirks.
22:14
< RichyB>
You're programming. You already have to keep the problem domain in your head. You will not gain anything by making the amount of crap that you need to keep track of larger.
22:14
<&jerith>
[R]: That doesn't mean you have to write code that relies on them all over the place.
22:14
<~Vornicus>
why would you have + or - or / at the beginning of a statement? I know what they /do/, but seeing them at the beginning of a statement strikes me as odd.
22:15
<@celticminstrel>
...this doesn't make sense. ><
22:15
<&jerith>
Vornicus: '-' is a unary operator.
22:15
<&McMartin>
The stuff quoted implies that / can be used for regex-like things?
22:15
<&McMartin>
jerith: But not one that produces lvalues.
22:15
<&jerith>
'/' is a regex literal delimiter.
22:15
<@celticminstrel>
It's matching multiple lines even though it starts with ^ and ends with $...
22:15
<&McMartin>
celticminstrel: Does your matcher have "." also match \n?
22:15
<~Vornicus>
jerith: I know that's what they do.
22:15
<~Vornicus>
But
22:16
<~Vornicus>
Why would I put them at the beginning of a statement?
22:16
<@celticminstrel>
It can, but I think that's what (?m) does which is off otherwise.
22:16
<@celticminstrel>
Or wait, not m.
22:16
< [R]>
/.../.replace(str, function() {...}) // side-effects can also occur.
22:16
<@celticminstrel>
The other flag.
22:16
<&jerith>
Does JS have C's ternary operator?
22:16
<@celticminstrel>
dotall
22:16
< [R]>
Yes
22:16
<@celticminstrel>
I forget the short form
22:17
< [R]>
Also JS' regex functions all shove stuff into Regex
22:17 * [R] doesn't like that as it prevents nested regex's from working right.
22:17
<&jerith>
Nested regex?
22:18
< [R]>
Where you have regex replace closures calling other replace closures.
22:19
< [R]>
Also, not sure how "follow style guidelines" == "cognitive load"
22:19 * celticminstrel wants a "don't match if at start of line" thing here...
22:20
<&McMartin>
In most languages, violation of style guidelines cannot cause the code to silently begin doing something else.
22:20
< [R]>
Pytho.
22:20
<&McMartin>
Python is not most languages, in many ways
22:21
<&jerith>
[R]: Having to think about whether to terminate a line with a semicolon or not means I'm not thinking about the problem I'm actually trying to solve.
22:21
<&McMartin>
jerith: Note that in the style proposed by this article, the question is not about terminating lines with semicolons
22:21
<&McMartin>
In this system, semicolons go at the beginning of lines.
22:21
<&jerith>
About the only style-violation-equals-unexpected-behaviour thing I can think of in Python is mixing tabs and spaces.
22:22
< [R]>
jerith: having to think about whether to terminating a line with a semicolon will actually be what I meant to say means I'm not thinking about the problem I'm trying to solve.
22:22
<&McMartin>
R: Right, see
22:22
<&McMartin>
In no other language do you ever have to think about this at all
22:22
< [R]>
Instead semi-colons always go at the start of lines with ( or /
22:22
<&jerith>
[R]: When is ternimating a line with a semicolon the wrong thing to do?
22:22
<&McMartin>
Even with Python, the closest you get is "can I put an *extra* line break here"
22:22
< [R]>
FFS
22:22
< [R]>
jerith: scroll up and read.
22:23
<&McMartin>
R: If nothing else, I'd like to humbly submit that I'm not in ITL land here =P
22:23
<&jerith>
[R]: All I've seen is "newlines and implicitly terminate statements".
22:23
<&jerith>
Err, s/and/can/
22:24
< [R]>
McMartin: sure. But every language /has/ something you have to think about.
22:24
< [R]>
In JS you can style-guideline /one/ of those away.
22:24 * [R] isn't saying JS is a perfect language.
22:24 * [R] is saying that approaching any language like it's some other language /wil/ /cause/ /grief/
22:25
<&jerith>
Sure.
22:25
<&McMartin>
R, you and I are now disagreeing over whether this is a bit that's alien or wrong
22:25
<&McMartin>
You're claiming it's merely alien; I'm claiming it's wrong
22:25
< [R]>
I can accept that.
22:26
<&McMartin>
(Meanwhile, I've been claiming Object.create is alien but *right* and you've challenged me to show a compelling use case, which I do still owe you at some point)
22:26
< [R]>
Oh, I was more interested on /when/ you'd use it.
22:26
<&McMartin>
(My off-the-cuff half-answer to that one is "you can use object literals as prototypes that way, and this is awesome")
22:26
< [R]>
Actually sorry I mispoke
22:26
<@celticminstrel>
You can't do that already?
22:26
< [R]>
I was more interested in /how/ you were using it. The design pattern was interesting.
22:27
<@celticminstrel>
Function.prototype = {...}?
22:27
<@celticminstrel>
Though that might not be quite what you meant.
22:27
<&McMartin>
It's not, not really
22:27
< [R]>
celticminstrel: this is all wrapped up in a function call. Presumably he's making a bunch of similar but not objects.
22:27
<&McMartin>
I consider basically everything about the "new" keyword to be a horrible botch, and I'm not alone in this; it's possible to restrict its usage to the implementation of Object.create() if it's not already there
22:28
<&McMartin>
But yeah, that implementation involves an inner function with a directly assigned prototype that you then call as a constructor, IIRC.
22:29
<&McMartin>
JS has dynamic and duck typing, so I consider the "pretending to have classes" thing a disservice when it could instead just use objects like Python does and construct them with its prototype mechanism
22:30
<&McMartin>
(This is also part&parcel with "JS becomes a better language the more you remove from it")
22:31
<&McMartin>
As for where I'm using it, I'm not using it in JS, I've been using it in GameMaker which is indeed, the "making a bunch of similar but not identical objects, but which bits vary itself varies"
22:31
<&McMartin>
use case
22:31
< [R]>
GM is EMCAScript though no?
22:31
< [R]>
Or is it non-standard?
22:32
<&McMartin>
Unless it's changed very recently, it is nonstandard
22:32
<&McMartin>
In particular, it does not have properly compliant objects in any sense
22:32
<&McMartin>
They exist partially outside the language interface
22:32
<&McMartin>
This has gotten messy enough for me that it's part of why I've been migrating my prototypes out of it into C++
22:34
<&ToxicFrog|W`rkn>
Why C++?
22:35
< [R]>
Presumably that's what the bindings require
22:35
<&McMartin>
Because it's a language I'm very good at, and it produces stuff that's easy to redistribute.
22:36
<&McMartin>
I'm not using anything right now that Python doesn't bind, but getting Python to bind it in a way that works on more than one system is a nightmare.
22:42
<&ToxicFrog|W`rkn>
Fair enough.
22:43
<@celticminstrel>
...heh.
22:44
<&McMartin>
(I'm using SDL, SDL_image, SDL_mixer, and zlib. I hope to allow it to transparently bind PhysicsFS later.)
22:44
<&McMartin>
(I think I'm actually already there, but I don't need it, so whatever)
22:44
<&McMartin>
(PhysicsFS was added after-the-fact by Dungeons of Dredmor~)
22:49
<&ToxicFrog|W`rkn>
My go-to for this has been Lua for a good long while now, via love2d - altho until recently loading external modules on it in windows was All Of The Spiders.
22:49
<&McMartin>
Yeah, I've regularly found that I'm happier in C++ for much of this stuff
22:49
<&ToxicFrog|W`rkn>
(this has been fixed in 0.8.0)
22:49 * ToxicFrog|W`rkn nods
22:50
<~Vornicus>
I still need to stop falling over on Lua
22:50
<&ToxicFrog|W`rkn>
I decided some years ago that I was happiest when not using anything in the C family
22:50
<&McMartin>
I'm planning on setting up a strictly scoped and reference-counted resource system and then having that be accessible ideally with a C-level interface
22:50
<&McMartin>
Once I have that I can bind anything I want to to it
22:50
<&McMartin>
... which will still probably be C++ for me because of the aforementioned distrospiders
22:52
<&ToxicFrog|W`rkn>
One of the nice things about love2d is that as long as you aren't bringing in external modules - which, in the vast majority of cases, you won't need to - distribution is spiderless.
22:52
<&ToxicFrog|W`rkn>
Less so even than C/++ since it involves no faffing about with a cross-compiler.
22:53
<&ToxicFrog|W`rkn>
This is a huge relief after working mostly in C and JVM languages~
22:56
<&ToxicFrog|W`rkn>
Vornicus: as always I am pleased to answer questions about the language.
23:02 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Ping timeout: 121 seconds]
23:08 Turaiel[Offline] is now known as Turaiel
23:11
<~Vornicus>
TF: it's mostly a problem of feel at this point
23:12 Turaiel is now known as Turaiel[Offline]
23:12 ToxicFrog|W`rkn is now known as ToxicFrog
23:16 Turaiel[Offline] is now known as Turaiel
23:16
< Xon>
<RichyB> Idiomatic (ugh) JavaScript is async by default.
23:16
< Xon>
Don't forgot it's just single-threaded events
23:18
< RichyB>
Yes, so it even falls over if you have enough of those to saturate one core. :P
23:25 VirusJTG_ [VirusJTG@2B12AA.572255.206A2A.901581] has quit [[NS] Quit: Program Shutting down]
23:25 VirusJTG [VirusJTG@Nightstar-09c31e7a.sta.comporium.net] has joined #code
23:26 * celticminstrel blinks.
23:27
<@celticminstrel>
I'm confused. Why does inserting a new div suddenly cause things to align left instead of centre?
23:27
< RichyB>
Because FUCK CSS WITH A RAKE, that's why.
23:27
<@celticminstrel>
...oh. Wait. Because I have mismatched tags. Duh?
23:30
< RichyB>
That would also do it.
23:54
<@celticminstrel>
I'm probably doing something wrong... I want to give a field focus and select its text...
23:55
<@celticminstrel>
Maybe because it's still hidden when I do it...
23:55
<@celticminstrel>
No, that doesn't seem to be it.
23:56
< RichyB>
Interacting with text selections in javascript is a little flaky in versions of IE below, uh, either 9 or 10, I'm not sure which.
23:57
<@celticminstrel>
Eh, this won't work in IE anyway because IE doesn't have the setTimeout extension and possible also lacks __proto__.
23:57
< RichyB>
If whatever you're trying to do with text selections doesn't work in IE the first time you try it, dig up the library called "Rangy".
23:58
<@celticminstrel>
I'm not testing this in IE, because I'm on a Mac.
23:58
<@celticminstrel>
But I'll try to remember that, I guess.
23:58
< RichyB>
Yes. I was continuing to blather because you reminded me of it.
23:58
<@celticminstrel>
Okay.
--- Log closed Wed May 29 00:00:50 2013
code logs -> 2013 -> Tue, 28 May 2013< code.20130527.log - code.20130529.log >

[ Latest log file ]