Nov 18 2007

Box2D

Thanks to Steve Dekorte’s blog, I just ran across Box2D , an open-source 2D physics engine for games. In other words, it simulates the motion over time of convex polygons, taking into account inertia, gravity, collisions, friction, angular momentum, torque — all the things I once painstakingly learned in college and then completely forgot. Now they’ve suddenly become fascinating again, since Box2D does all the hard work. The app just has to describe the objects, then call Box2D in a loop to find out how their coordinates change over time.

Box2D comes with some demos that are bare-bones graphically, but amazingly realistic in motion, including a swinging chain, a web of springs, and a pyramid of blocks that you can undermine and collapse:

A far more sophisticated usage of Box2D is in the indie game Crayon Physics Deluxe, “in which you get to experience what it would be like if your drawings would be magically transformed into real physical objects.” You must watch the amazing video on that site. (Then cry, because it’s only for Windows.)

Speaking of Windows, the official Box2D package only builds on that platform, so far. But the core library is platform-independent C++, and the demos use OpenGL, so [...]


Jul 7 2007

Apricot Jam Recipe

Here’s my family recipe for apricot jam, handed down through generations. One generation, really — my mom got it from a pamphlet put out by some local womens’ group, after we moved to an old ramshackle house in the middle of a huge but disused apricot orchard. The trees were old, but a lot of them still produced fruit, and it was no trouble to walk around and collect bucketsful. So we needed some way to make use of all that fruit…

This recipe is different from the usual one you find packed in a box of pectin, because, well, it doesn’t use pectin. Instead, you thicken the jam by cooking it a lot longer. This means it tastes less like fresh fruit; but it has a wonderful taste of its own, a bit like dried apricots, and a nice gloopy texture. As a bonus, putting an apricot kernel1 in every jar gradually adds an almond-y aroma2.


Mar 2 2007

May I Nominate Mary Bono For “Jackass Of The Week”?

Daring Fireball has an occasional feature called “Jackass Of The Week” that highlights exceptionally stupid or misleading public statements made about Apple. Lately it seems like “analyst” Rob Enderle has established a lifetime lock on the award, but on the off chance it’s still in play, I’d like to nominate Rep. Mary Bono (R, CA) based on “her rhetorical questions to Tim Berners-Lee (!) at a Congressional hearing yesterday”:http://www.macworld.com/news/2007/03/01/bernerslee/index.php :

Bono questioned if [removing DRM] would prevent mass stealing of copyright materials. “Is that not the equivalent of having a speed limit but not enforcing the speed limit?” she asked.

We do have a speed limit that’s not generally enforced. How often do you see a Highway Patrol car? How often do you see someone get pulled over? Based on my commute, my answers are “maybe once a week” and “maybe once a month”. And yet the highways of Silicon Valley have not devolved into “Mad Max” or “Death Race 2000”. Most people speed a little bit (don’t tell anyone, but I usually drive 70 instead of 65, and sometimes I kick it up to 73 when Underworld or Led Zeppelin come up on my iPod.)

Some people drive much too fast, or [...]


Jan 21 2007

In Which I Think About Java Again, But Only For A Moment

It’s amusing how Steve Jobs’ remarks disparaging the idea of Java on the iPhone have ignited controversy. His point was, obviously, that the iPhone’s browser won’t support Java applets; which is a no-brainer because applets were killed dead-dead-dead by Flash and Ajax. But this seems to have riled up everyone who still cares about non-server-based Java, leading to the weird situation of seeing “Java” and “Mac” in the same sentence again*. Apparently some people still cling to the glorious dream of writing cross-platform GUI applications, waving tattered “Write Once Run Anywhere!” banners and clutching ‘Little’ Red Books with Duke’s picture on the front.

Flashback

Me, I defected long ago. I’m another of those Apple Java engineers who dropped out. I spent five years as a raving Java fanboy, but I gave up after optimizing AWT, implementing drag and drop, and trying to make 1,200 pages of crappy APIs do the right thing on the Mac. Then I took a one-week Cocoa training course, and wrote the first prototype of iChat.

Desktop Java never worked because Sun tried to build their own OS on top of the real OS, duplicating every API and feature. This led to terrible bloat, making every app as heavyweight [...]