That’s right, the “for (x in y)” used by JavaScript is dumb. And what is more, they can’t change it without royally screwing up people who have worked around it.
When used with arrays, the “x” will represent the index of the array, not the value (as is common in most languages).
Sure, I agree that this is a useful feature to have, but why must it do it by default.
So to recap: To iterate through an array in Javascript using this control structure you must do it as shown below:
[js]
for (key in SomeArray) {
theValue = SomeArray[key];
}
[/js]
Stupid.
As has been mentioned by Paul, and demanded by Will, the full IRC convo and our astonishing predictions of how the convo would “go down” are now available thank to The Mill.
First of course, is our prediction (Nov 25, 2005):
<divzero> Why won’t Michael D. Cameron Confess?
<spiff> Ok, I confess.
<Rhys> I confess too
<chief> Fine, I confess.
<divzero> so which one of you was it then?
<spiff>Paul _Michael_ Doessel
<dave> _D._ Schiefelbein
<Rhys> Rhys _Cameron_ Parry
*divzero falls off chair
And then the actual conversation (Nov 27, 2005):
[19:32] divzero: I have narrowed it down to three (hmm maybe I should
add Trish to the list?)
[19:33] spiff: I don’t think so
[19:33] Cameron: Maybe it was Paul’s friend Michael{
[19:34] Dave: Or Rhys friend Cameron
[19:34] Cameron: or that D_ fellow?
[19:34] spiff: or all 3
[19:35] Cameron: That’s absurd Paul, then the price of the prank would
be split three ways and it isn’t evenly divisible by 3.
[19:35] divzero: This conversation almost feels choreographed
[19:35] Cameron: Why would you say that?
[19:35] divzero: All three of you were in on it wern’t you?
[19:35] Dave: yeah - and one of them wouyld have to have a credit card…
[19:36] divzero: But what signifigance did “Michael D. Cameron” have?
[19:36] spiff: Paul *Michael* Doessel
[19:36] Dave: D. Schiefelbein
[19:36] Cameron: Rhys *Cameron* Parry
[19:36] Cameron: Now that *was* choreographed
[19:37] spiff: wait for it
[19:37] Dave: cmon will - you can do it
[19:37] divzero: Michael D. Cameron?
[19:37] spiff: DAMNIT
[19:38] * divzero falls off chair
[19:38] spiff: close enough
[19:38] divzero: ?
[19:38] divzero: *clap clap* nice one guys, you got me good
[19:38] spiff: wow Rhys, you sure you don’t have prescience?
[19:39] Dave: that bit was coreographed
Ah, a thing of beauty. Will, you really do need a seatbelt for your chair.
I have temporarily disabled the RSS feeds on the side because it was occasionally preventing the site from viewing completely. I will be rewriting the entire plugin to get around the problem that occurs when it can’t contact one of the sites.
Sorry for any inconvenience.
Update (15-12-2005):
This does not affect the RSS feeds that are used to syndicate i-think Twenty-Two content on other sites, only the syndication of other sites onto the i-think Twenty-Two page.
When I made some changes to this site recently I used the great little FTP program, Transmit. I was very happy with its useability then and I still am. I particularly liked the little dashboard widget you could set up so you could simply drag your files to the widget, it would load Transmit and send your files all while the truck rolls along.
Of course, FTP isn’t the most secure of protocols and I certainly wouldn’t be eager to open up FTP on the server at work. Fortunately Transmit does Secure FTP (through SSH) right out of the box. And using it is as simple as normal FTP.
So if you have a Mac and use FTP for more than just basic transfers (which the commandline client does superbly, even including tab-completion for remote filenames, something severely lacking from other commandline FTP implementations), get Transmit. It is money well spent.
Sourceforge Direct Download is a great little extension for Firefox 1.5. If you download from sourceforge a lot it sets a default mirror and you completely avoid those horrible intermediate pages.