August, 2006
75 posts under this date.
This is from Douglas Crockford’s Survey of Javascript (never program JS without your Crockford!). I thought it quirky at first, surprisingly helpful later. (Emphases added.)
The && operator is commonly called logical and. It can also be called guard. If the first operand is false, null, undefined, ”” (the empty string), or the number 0 then it returns the first operand. Otherwise, it returns the second operand. This provides a convenient way to write a null-check:
var value = p && p.name; /* The name value will
only be retrieved from p if p has a value, avoiding an error. */
The || operator is commonly called logical or. It can also be called default. If the first operand is false, null, undefined, ”” (the empty string), or the number 0, then it returns the second operand. Otherwise, it returns the first operand. This provides a convenient way to specify default values:
value = v || 10; /* Use the value of v, but if v
doesn't have a value, use 10 instead. */
Short-circuit logical operators are a well-known, simple idiom in several languages, but they can sometimes be confusing to read, specially when nested. What I want to point out here is that next time you have to go through code that uses them, try reading them as guard or default, as the case may be. You’ll grokEE them immediately, trust me.
Isn’t it striking, the power of names?
I love deadlines. I love the whooshing noise they make as they go by…
— Douglas Adams WP
Oh boy, can you hear the whoosh yet again? For the first deadline (August 5) my excuse was mostly several huge, polished posts (1, 2, 3) that I just started pouring out possessedly one afternoon after another. For the second deadline (August 12—yesterday!), well, no excuse other than that I’m in thrall with Domburi, and despite sleepless nights (day? night? they’ve lost all meaning to me), I’m happily obsessing with details and trying all sorts of innovative things. I’ve reached a strange state of scripting satori: I’m writing HTML through Javascript like no one has before. I swear it’s so weird and powerful that in a way it’s funny. It’s big stuff.
So yes, it’s better to think of my previous Road Map as broad guidelines for what’s to come. Just trust me, when Domburi’s finally out (August 31), it’ll be heart-breakingly beautiful. Till then and thanks for keeping in touch.
I don’t know exactly when or how the thought came into my mind but this morning the epiphany was there: wouldn’t it be cool to see Gmail’s half MB Javascript source1 a la matrix code viewIY? Indeed it would, and so for the next half hour I became a man posessed. It was amazingly easy (“ya sabiendo es facil”) to hack it up in JS and it makes for an interesting screensaver.
When I finished I realized it would be really easy to make my makeshift Matrix code generic and so here’s a quick stab at it. Type whatever text you want matrixified and a new window will (hopefully) popup with it. (Though be warned, it’s pretty rough, unpolished code and it’ll surely be too slow if you don’t have a fast computer.) Anyway, enjoy.
Next time you see Gmail,
think,
Por diversos avatares del destino tuve hoy que imprimir incontables resmasRAE a doble cara y me sorprendio mucho que fuera una extraña odisea. Desesperado acudi a la red y lo unico que encontre digno de destacarse es este articulo de HP España confuso, rollero, y comercialoide (“Impresión a doble cara en Microsoft Word 2000, por los árboles, por su espalda, por su dinero”). Para colmo, ni un pinche diagramilla perdido. Despues de muchas iteraciones y mucha hoja perdida, le haye el feeling a esto, asi que aqui va, por todo aquel que venga:
People flaunting their sexuality are no different from people who flaunt anything else.
Whether you wear a T-Shirt from your favourite band’s latest tour, a Leatherman™ Supertool on your belt or an Armani suit, whether you pepper your words with TechSpeak references or four syllable words from the world of philosophy, your behaviour is in many ways a reflection of what you would like people to think of you.
For some people the emphasis is on “smart”, for others it’s “rich”, and for many it’s “sexy” or “sexual”.
What’s the big?
Pues si, Cecilia Marquez anda perdida politicamente, y si, es otro caso mas de exhibicionismo perredista gratuito (con el que se las dan de muy “izquierda moderna”1), pero, vamos, como quejarse?
“¿Dónde trabajas, pinche vieja?” le eructo un anciano, intuyendo sanjuanera a la ex responsable de prensa del PRD en Jalisco.
Now that I think of it, I’d seen similar contraptions before but this one is particularly elegant and interesting: you throw it in the air and it changes color! Pure witchcraft. And the forms—the forms!—are beautiful in that uniquely arresting way that only mathematics can give. It’s our generation’s geodesic domeWP.
I remember one high school philosophy class where our fantastic teacher (James Kurtz) had nothing prepared but a smooth, solid piece of metal he had found inside his car engine. The assignment for the one-hour class was to write an essay on what we could infer from the alien civilization that created the artifact if we suddenly found it on its own on a faraway planet, with no cues whatsoever of its purpose. It was jolly good fun with a pretty nondescript ferrous blob, so I wonder what I’d have said had he brought this color-changing whatchamacallit.
To begin with, I guess it’s fair to assume such civilization had to know its math pat. Perhaps several alien PhDs went into the theory of this ball and its theoretical inspiration even carries the name of some great alien topologistWP, à la Poincaré sphereWP. I’d be willing to bet that they have computers, there’s no way they could have built this without CADWP. And the material itself, plastic, and the way it’s shaped, is nothing trivial—it shows some deep knowledge of chemistry, materials scienceWP, and manufacturing techniques.
And had I known that the whole thing was available for the alien equivalent of one dollar in the alien equivalent of a flea-market, and that it had no application than to be amusing, well, I’d have gasped!
At any rate, don’t (don’t!) let my babbling discourage you, go buy one!
Design is art under constraints. But turning the tables is the hallmark of design’s greatest pieces. They make you think constraints are what they are so that it, the design piece, could be as good as it is.
It’s the “thank-god-we-have-ears-at-both-sides-of-our-head-to-support-our-eyeglasses!”-effect.
Finally, in the richest country of the world, dumb matter’sEE last stalwart has fallen. A new U.S. study commisioned by Oxygen found that, given the choice, women would opt for tech items rather than luxury items like jewelry or vacations.” (via Yahoo! News) More precisely, “3 of 4 women would prefer a new plasma TV to a diamond necklace” and “86 percent would prefer a new digital video camera to a pair of designer shoes.” It’s all downhill for dumb matter now (and all down the rabbit hole for us).
How’s that for jargony singularity reporting?
Simile is a simple, snappy AJAX timeline from MIT. To keep with the space-time musings of late, it’s a Google Maps for time.
|