Wednesday, October 24, 2007

Why Keynote is Better than Powerpoint

I had the opportunity to try Apple's Keynote for a presentation where I might normally have used Powerpoint or even OpenOffice. Rather than do a lengthy review, why don't I just summarize why the results are better than I might get from Powerpoint? After all, that's the ultimate goal with presentation software -- to do something Powerpointish, but faster and/or higher quality.

Let's leave aside interface polish in the UI (the Inspector windows) and the output (slick animated transitions). I don't think those are fundamental to the results.

IMHO, the strong points for Keynote are:

The outline view with slides down the left side in filmstrip style lets you nest slides into an expanding/collapsing tree. You can see the outline showing only the major sections of a long presentation, or see all the slides, or just expand certain sections. I immediately noticed when I exported in PPT format and viewed in Powerpoint, that the equivalent view there was incredibly cluttered, with all the slides plus all the bullet points from the slides visible in a single long list. The expanding/collapsing tree let me organize the slides more easily than with Powerpoint. Nesting related slides under a "key frame" (a slide with just a giant-sized title) helped propel the actual presentation, i.e. establishing that some slides were just going to come up for a second or two, with no exposition.

The font controls lead you very gently into the habit of writing concise text, and elaborating only as needed. Let me explain what I mean. With Powerpoint, it's a race to see how many bullet points you can cram onto each slide, by resizing the text box to allow more text. The generous spacing on Keynote slides sends the subliminal message that you're only going to get a few bullets on each slide, so make the text punchier. Then, if you're desperate to fit 1-2 more lines, you can adjust the paragraph and line spacing in very small increments until the extra lines fit. The page still doesn't look cluttered, and you don't have to endlessly shrink the font into unreadability.

The export options let you choose output formats like PPT, Quicktime movie, PDF file, individual images, even Flash. Although I didn't use these, I can see that they would be tremendously useful. I exported to PPT so my audience could view the slides with Powerpoint or OpenOffice. Depending on the context of the presentation, I might have chosen Quicktime movie or Flash, to post the presentation on the web for viewing directly in the browser.

Sunday, October 14, 2007

Learn PHP In 5 Minutes

Maybe you've noticed a theme in some of my blog posts, the idea of switching back and forth between languages, or quickly transitioning from one language to another.

Recently, I found myself writing some PHP code after a long stretch of doing nothing but Perl, Python, and Javascript. I decided to make it more challenging by writing the syntax from hazy, long-ago memory, and only looking anything up after the fact, to fix the syntax errors. That experience reinforced my feeling ever since Perl came out, that every recent language can be thought of as a series of small deltas to existing languages. (C'mon, don't tell me you didn't look at the little-used report format of Perl, and say to yourself "hey, this is straight out of COBOL!" :-)

So, here's my 5-minute quickstart for PHP. (No APIs, just basic language features.)

Semicolons are mandatory as in Perl, not optional as in Javascript.

Inclusion is via the 'require' keyword, or 'require_once' if everything is requiring everything else. What goes in the included files is flexible as in C and Perl.

Variables are done like Perl, introduced by $. Unlike Perl, arrays and hashes are also notated with $, no @ or % to be found. All subscripts are square brackets.

If, braces, for, while, arithmetic, etc. are like C, C++, Java, and Javascript. No "elsif", it's "else if". Comparison operators are == et. al.

Just to confuse you, HERE documents are introduced by a <<<, 3 instead of 2 like normal. There's a semicolon after the final HERE / EOF / END / etc., but none on the initial line.

Output is largely echo as in shell scripts. Variable interpolation the same as shell scripts and Perl, i.e., the meaning of double quotes and single quotes. String concatenation is . like in Perl, not + like in Javascript. (Use + with strings and you'll get a numeric 0 result.)

Ternary conditions require more quoting than in Javascript, if you're used to stringing together several object-detection tests in a single assignment statement.

Comments are a mishmash of several languages. /* */ like everything except Perl, // like Javascript, # like Perl.

Functions are introduced with the 'function' keyword, and parameters are named (including the $) but not typed. E.g. 'function myfunc($myparm) {...}'.

And that's it. Regular expressions, the other interesting aspect of most language syntax, are done with function-style notation, so on a technicality I don't consider them part of the 5-minute tour.