Thursday, February 28, 2008

Programming Unglued

Some who started their careers in the days of punch cards, think of programs and data as one stack of cards, data after program, all queuing as jobs for the CPU, printed output to follow. That was their paradigm, for then and for now.

Then came the command line or shell, interactive dialog. Workbench and toolbox metaphors predominated. UNIX a smash, ran for cash, until GNU gave us all free bash.

These alternative conceptions of "programming" (queuing lengthy "self sufficient" programs vs. enriching a namespace with tools) come to bear as we move on from just calculators, and really start using technology in the classroom, for real this time, not just Zoombinis (cool games).

In math world, we're used to little snippets, dense thickets, all floating in a haze of discursive prose. Functions abutt sigma notation. Diagrams obtrude (graphics). The vista is fragmented.

MathCad and Mathematica have done wonders to acclimate pro math users to the interactive and/or spreadsheet environment. On the other hand, both of these successful commercial products are themselves "big code" in the sense of reams of source all glued together by a mouse-and-keyboard event driven framework.

The user is "in" a game-like environment, just like "in" a Python shell (i.e. something is running, an interpreter we call it).

Python's modular format brings both worlds together: big iron executables; a more loose fitting, seat of your pants, command line experience. Programming is like typing, like novelists and journalists experience. Except your machine talks back to you, and you're allowed to actually tell people that it does.

Functions are like fish in the tank, with mouth-like parenthetical syntax, just waiting for arguments. Python's own math module is a great example: the trig functions just sit there, waiting to be fed. And you feed them through parentheses, even if there's a GUI at some desktop level.

( click for larger view )
Big code runs in the background, but you also want that responsive interface in the foreground, a sense of driving, even if the steering wheel isn't connected to anything, that Fisher-Price like experience, kinda Stephen King like in some contexts (disconcerting).

In Python, that need for "glue" to bring it all together is typically expressed in the form of a testing regimen at the end of the module. If this code is actually being run as a main process (if __name__ == '__main__'), versus imported for random accessing from outside, then fire up a whole lot of tests, giving every feature of this module a miniature workout. Show what it'll do.

In sum, the in vogue eXtreme Programming "test as you go" techniques -- already satisfying to mathematicians because like proving up from axioms -- fit well with the more interactive, unglued aesthetic, wherein you don't necessarily want an obtrusive framework, making you pick from menus for everything, pestering you with questions, prompts or whatever.

Sometimes entering "just do it" is the most direct way.

Tuesday, February 26, 2008

New Entries

"clever disguise"

"2nd line: not centered, indented"

"cool hook"

Friday, February 22, 2008

Evening TV

Last night I dove into Lost mid-episode, having missed the previous (queued), while trying to eyeball an O'Reilly book on my laptop in Safari about the Linux kernel, trying to get some bang for my buck (I pay a subscription) -- all mildly disorienting. Kate always gets my attention though, plus all these intense others. Lost is quite riveting. We hope Sayid is OK.

Earlier we were attuned to the news (CBS). This election season is being plenty interesting. Like there's Kosovo all of a sudden, right on cue it seems, complete with a carefully staged rampage in Belgrade, go figure.

The chatter on the radio is about how we're back on track for an Academy Awards worth remembering. Hollywood is in a much better mood these days, what with the writers' strike being over.

The job of an operating system is to schedule the use of resources in an intelligent way, so that hardware, a scarce resource, though quite typically ample if well managed, is put to good use.

Processes get the illusion of having the computer all to themselves (within a process are threads), but in the multi-tasking paradigm, concurrency is more the fiction than the reality.

However, this was about an older version of the kernel on younger architectures, as true multi-processing has become normative in many computing environments, as we might say in modern geek (one of them "yawner talks" as we might say in hillbilly (a focus of Simpsons on Fox 49, an episode wherein Lisa helps the Spuckler kids become more urbane)).

Thursday, February 21, 2008

US 193

:: artist's conception ::
Early press reports suggest the eclipse-night missile firing might have saved our bacon here in Portland, given the wayward spy sat's rapidly decaying trajectory.

Lots of journalists were saying how NASA needed to get its act off the stage, or risk taking a bullet, but now with the shuttle safe on the tarmac... it was show time at last!

Or did the projectile just clip off a rabbit ear? Hard to tell from this distance.

The Pentagon is doing some fancy signature analysis to see if the toxic payload of (N2H4)n leaves spectral traces in space, which'd be more like proof positive. Other agencies, observatories, have their eyes pointed skyward as well, checking for fallout.

In the meantime, I'm giving the navy my vote of confidence by walking outdoors, on a cold bright sunny day in late winter. Portland is beautiful this time of year. Last night's lunar eclipse was grand.

That being said, I was somewhat dismayed to learn that none of this recent rocket science counts as "already paid for" by the Star Wars initiative, as that was about building an anti-ballistic missile system (ABM), whereas this anti-satellite stuff (ASAT) is a whole different ballgame and required lots of last minute modifications.

Getting into this new business of shooting down friendly but out of control satellites, keeping humans safe from their toxic payloads, will cost a lot extra, the navy has been very emphatic about that.

Portlanders should be easy to persuade, in light of what's just been averted.

"moment of impact"
(click for larger view)

Wednesday, February 20, 2008

Py3K

Py3k + IDLE, checked out via svn, running on Ubuntu
Py3K was in some ways named in spoof of Y2K, which sounded dated as soon as it was over. Python 3000, on the other hand, would at least stay in the headlights a lot longer.

But in practice, the jump alluded to is not measured in solar years. Instead, it's a break point in the Python language's development, accomplished with a lot of smooth maneuvers, including a 2to3 converter (runnable in 2.5).

Yes, I see why apply was taken out. Instead of going apply(f,(1,2)) we just go f (*(1,2)) i.e. the asterisk unpacks the contents, makes 'em two arguments.

And no, and I won't miss reduce either, and so far no sign little lambda is going away (I bet Mary is really happy about that).

We're going to think in a more organized way about bytes and strings, by making these the two principal encoding types. In string world, we default to Unicode, but that's really a complicated standard, so utf-8 is more like it (not complaining -- as a user of Latin-1, I'm already privileged).

Making print a function: yeah, seems like the right idea. Guido is good at this stuff. I'll reserve comment on some of the more esoteric innovations, until some more opportune time.

Were I to start teaching new Pythoneers tomorrow, I'd stay with production 2.5.x, as learning core Python means learning core concepts, and these only get reinforced, not abandoned, i.e. one's comfort level only increases with future versions. In other words, learning 2.5 today means you still have 2.6 and 3.x to look forward to, and that's a good thing.

We've added another Ubuntu laptop to the family, given the Sony had to go off to meetings in Philly. True, Sims 2 doesn't easily run on this distro (right?), but Lost at abc.com certainly does.

Background reading:
Re: minimalist vs. maximalist spectrum (Feb 18)

Sunday, February 17, 2008

More Rocket Science

Yeah, the Russians are right, there's an ASAT aspect to this USA-193 story, and the military'd rather have kept the whole op covert, rather than make a public spectacle of itself.

But this is an election year, and a leap year, and the public wants a reality check. Just what have we been paying for with all this Star Wars stuff since Reagan? Now is a chance to find out. And given it's not so clear why we fight, in the old fashioned way, old conventions about cover-ups have evaporated. Too many privatized civilian agencies, ready to blow the whistle -- and so it's official news then, can't have it both ways.

Indeed, it's spun as not so hopelessly staged, like one of those test shots from Vandenburg, but as still with plenty of variables (almost realistic): an expensive piece of equipment, lost in a risky game of chance, is plummeting towards Earth filled with toxic fuel, no predicting where it'll hit (Moscow? London?). Hollywood couldn't have done it better, and I'm not saying I don't believe it, even if Britney doesn't.

Whereas the old Pentagon might've just said "fuck 'em" (and what else could they say? -- no sense running around like Chicken Little, setting off a public panic), the new Pentagon has to put some walk behind its talk and actually try and shoot the sucker (because sometimes stray sats need to be shot?), or else fess up that rocket science is still pretty darned hard to get right (we knew that already). At least there's a window for more than one shot (80%, the declassified figure, is hardly for sure).

Also, in my view, orbiting space junk full of poison / toxic stuff is already a "weapon in space" so it's not a matter of if / when. Another victory for military intelligence, to have that thing out there, being evil. Or does Hubble have that same 'zine stuff inside? I like Hubble. Time to go Google and bone up on "sat guts" (satellite anatomy). I'll see some of you out there.

Oh, and put a self-destruct feature in next time guys (we've all seen those movies) -- not really spies are ya, or you'd've thought of that (or did the failsafe break this time? Malesh).

Tuesday, February 12, 2008

Pythonic Art




Various graphic designers have been putting forward some alternative designs for a EuroPython logo.

Above, some examples.

Below: what Pycon USA is using these days.

Saturday, February 09, 2008

The Holy Mountain (movie review)

This movie gets attention for the meta story behind it, appropriate given the finish, wherein Jodorowsky tries to frame the frame, an exercise in self-consciousness for the viewer, who by this time may be fairly drawn in.

According to this back story, which adds to its mystique, this Mexican film (1973) was suppressed for the longest time (to avoid scandal), and is still almost impossible to find. Anyway, isn't the collective unconscious supposed to be suppressed? -- that's what makes it unconscious after all.

Our protagonist is engaged in a quest for enlightenment, also billed as a search for immortality. He struggles to escape identification with Jesus, difficult given his crucified appearance (which tourists appreciate), yet he remains within the alchemical tradition, wherein even excrement (raw film) might be turned into gold (through smart editing and enlightened commentary).

In the alchemist's lab, each avatar on the team gets to explain his or her planet.

On Venus, our Don Juan type makes the accouterments of love, while on Mars it's all about weapons (naturally). There's a police state planet, with eternal executions and mowings-down, and a another planet (different from Mars) devoted to the manufacture of war toys for kids, always carefully crafted with the next enemy in mind (Peru in this case). On the architecture planet (Pluto) we find some foreshadowing of those Japanese capsule hotels.

One could choose to look at all this as an acting troupe, director-alchemist included, in the process of bonding, getting comfortable emoting and disrobing together, clowning around for the benefit of an observer-voyeur -- fun stuff to look back on at the end of the day. Others see it as a "spoof of religion" and indeed the wisdom clichés get thickly applied, like too much makeup.

Thursday, February 07, 2008

Pacific Shift

Tests on 500 trailers, finally begun last month, are being performed by CDC, the lawmakers noted. "The Committee is concerned about the independence and scientific integrity of any indoor air testing for formaldehyde levels in these trailers done under the auspices of FEMA," Miller and Samson wrote.

"For those who are too poor to live elsewhere, FEMA's position remains as it was in 2006: there are no possible adverse health effects that can't be cured by opening the windows," they added.

[Lawmakers Fault FEMA on Trailers, Washington Post, January 29, 2008; Page A03]

Perhaps the silver lining to this story is it has become obvious to even casual observers that Washington DC is paralyzed when it comes to taking meaningful action in the face of emergencies, either domestically or overseas.

DC is no more than a sandbox for puffed up bureaucrats, powerless and ineffective, playing blame games with Congress. Brain dead self-described "strategists" manage a killing machine in Iraq, with no clue as to why they're there or what their real mission is (big ideas anyone?).

This is all very helpful to our economy out west, when it comes to attracting investment and new talent, as it reinforces what we've been saying all along: the east coast is for losers (an exaggeration of course, but then advertising is supposed to be pithy).

Tuesday, February 05, 2008

More Grid Talk

[me commenting on a 2006 blog post by journalist William Shepherd]

Interesting post. The argument about insurgents seems off base as we already have plenty of long line transmission where that's not really a problem. Generally insurgents want to make a political point, want the PR, and have other more visible ways to attack than to head for Alaska or Siberia. When was the last time the Alaska pipeline was blown up?

The idea that we get plenty of energy is more compelling, and will be the strategy of smaller communities. However, huge urban areas often snarf so much Kwh that the only realistic way to provide is by importing from a long distance away. Hauling coal by locomotive is a chief way of doing that today. Economies of scale should be compared, apples with apples.

Would the Siberia connection make it more affordable to power Calgary or Detroit? These are the kinds of questions (some of them already answered in the minds of the author's "monopolists" I suspect, given recent patterns of investment).

I like the point about the war with Iraq not really being about oil, but the spread of western banking. I wouldn't call that initiative "victorious" at this point however. It's more of a blending that's going on, like a Vulcan mind meld. Telling "east" from "west" is becoming increasingly difficult and those who over-indulge in such talk brand themselves as children of the 20th century (Fuller was more from the 21st).