Sometimes, you just don’t have what anything that pressingly requires an entire blog post. Back in the day, when I was pushing the boundaries of what I knew with Flash/Flex and Ruby every day, and picking up Erlang, I was bubbling over with joy every time I figured out some hidden magic about the Flash player or some little tidbit about gen_tcp in Erlang. Everything was all new and exciting. And not that it’s old hat, but the things that I’m learning are, well, more subtle, less thrilling and more a matter of recollecting and reconfiguring knowledge that I already had rather than new knowledge. It’s not as exciting, and it feels a little strange to say: “Well, I was thinking about doing it this way, but then I realized that I already knew that was the wrong way to do it, so I started doing it another way, but then I remembered this, and read this, and then I got it right.” Lots of things are like that though. When you mess around with multiple languages and multiple idioms in multiple problem domains (service, server, client, desktop) a lot of what you’re doing is recalling and recontextualizing. It’s that recontextualizing that’s most important I think. I can recall something semi-obscure about Erlangs gen_fsm or about rtAudio playback or about some tuple values in Python, but recalling them at the right time, when they’re actually useful, is trickier. Knowledge is contextual: I find myself getting muddled up now and again when people ask me things, not because I don’t know it, but because I’m not thinking around that sort of thing, or in order to think of that sort of thing, I have to have myself thinking of something slightly off topic. Mnemonic devices are great, but if you’re sort of mumbling “Bad Boys Ruin Our Young Girls, But Violet Goes Willingly” when someone asks you something point blank, you look like a lunatic. So that’s what I’ve been doing: getting things in their right places, seeing the relationships between things, and figuring out what’s important to know when and what isn’t so important to know. I still find lots of interesting little tidbits here and there during my daily browsing and reading, and I just put those things up on my tumblr account. Maybe once I really have to learn the new Flash Player 10 APIs a little better I’ll get more re-bloggy. Or maybe once I start building some things out with merb or django or mochiweb or any one of the other frameworks that I love to mess around with. But for the time being, I’m writing plenty on Programming Interactivity and I’m thinking plenty on many an other thing, so the blog remains fairly quiet.

Oh, and Happy New Year.

What is Pachube? Well, it’s just a webservice. That said though, a webservice, just like a data format, is only as interesting as the data it streams out and the processor processing it. Pachube sends out what they call EEML (which is just XML) of real time sensor data from objects, devices, buildings and environments all around the world. That makes it a slightly more interesting project, because the big problem with getting this kind of data is not that it’s hard to find, but that it’s hard to find lots of it all in one place. I can get the surf report from Melbourne, the temperature of a house in SF, and the water level of the Colorado river. Moreover, if i wanted to report this sort of data, I would have to set up my server and my service to receive and the publish (not that this is particularly difficult), determine a data protocol, and probably never know what anyone was doing with it. Pachube just centralizes this, makes it searchable, and provides tools like an Processing library, Sketchup plugin, OpenFrameworks integration, and a few other nice addons.
As with many things I’ve been writing about and thinking about in the past few months, the trick of this is not the technical sophistication of the project, but rather, what it simplifies and by simplification, what it brings into view. Big problems often obscure what their solution provides. Pachube makes publishing and accessing data about the physical world easier, which means that the things you can do with data come into sharper focus.

Check it out here

On another note, the rough cuts for Programming Interactivity are making their way onto the O’Reilly Rough Cuts site. I’m not sure when they’ll be up but it should be rather soonish.

Glancing at the Rough Cuts page, there’s some pretty cool stuff up there: Hadoop, CouchDB, the High Performance Python all look interesting. Guess I’ll have some reading to do over the christmas break.

Well it did. And it’s here And just to get you ready for the joy:

Python 3.0 (a.k.a. “Python 3000″ or “Py3k”) is a new version of the language that is incompatible with the 2.x line of releases. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places.

Sounds like fun, don’t it :) The docs are here and the “what’s new”, by the bdfl, is here


Interactive Video Object Manipulation from Dan Goldman on Vimeo.

Sanguino: built :)

“a board that is more powerful, yet still compatible with the Arduino software.”

Let’s see those specs:

  • atmega644P core
  • 32 total general purpose I/O pins (some are multipurpose)
  • 8 analog pins
  • 6 PWM pins
  • 64K flash memory
  • 4K RAM
  • 2K EEPROM
  • completely through-hole construction
  • breadboard compatible
  • 100% open source
  • compatible with Arduino 0012 with minimal hacking

On OSX it can, you bet. Thanks to the Apple Type Server, which some people will know from the wierd ATSServer related error loops that they see when their OS refuses to start up, spinning instead at the happy little beach ball right after Finder starts up, any bad fonts loaded in any files, but particular in PDFs, will kill your OS. So if you download a mangled PDF from a website like I did an hour ago, get ready for the fun to start (I’m typing this on my Linux machine, btw). These things all seem to start from PDFs, so if you’ve just downloaded one and had your whole computer die, here’s what you can do:

1) Turn off indexing for Spotlight. That’s part of why you’re getting the crashes. Editing /etc/hostconfig and adding the line:

SPOTLIGHT=NO-

and then doing

sudo mdutil -i off /
sudo mdutil -E /

should help a lot.

2) Find the file and delete it. You’ll probably have to be booted into safe mode to do this, so restart your Mac and hold down the shift key the whole time. Once you’ve done that you can trash any and all PDF files out of your downloads and make sure you delete them. Then restart and you should be good.

This apparently only happens on 10.5.5 and not the earlier versions, so I guess it might get fixed soon-ish.

It only took 162 tries and ~8 years :) But they did it. Congrats guys!

The Processing software runs on the Mac, Windows, and GNU/Linux platforms. With the click of a button, it exports applets for the Web or standalone applications for Mac, Windows, and GNU/Linux. Graphics from Processing programs may also be exported as PDF, DXF, or TIFF files and many other file formats. Future Processing releases will focus on faster 3D graphics, better video playback and capture, and enhancing the development environment. Some experimental versions of Processing have been adapted to other languages such as JavaScript, ActionScript, Ruby, Python, and Scala; other adaptations bring Processing to platforms like the OpenMoko, iPhone, and OLPC XO-1.

Processing was founded by Ben Fry and Casey Reas in 2001 while both were John Maeda’s students at the MIT Media Lab. Further development has taken place at the Interaction Design Institute Ivrea, Carnegie Mellon University, and the UCLA, where Reas is chair of the Department of Design | Media Arts. Miami University, Oblong Industries, and the Rockefeller Foundation have generously contributed funding to the project.

My fun time at MAX

I had a good time at MAX, learned a few new things about some Flash Player 10 internals, learned some new things about performance tuning from Sean Christmann, and found out that there’s a lot of stuff going on with getting the Flash Player to run on ARM, which you should read as “on powerful Mobile phones”, which you can read however you would like.

I’m also going to lay out a quick note of how I solved the “AIR communicate with the System” problem. I wrote a wrapper application that launched the AIR app when it was started up, nothing new or exciting there. Then I just wrote commands that looked like:

“ls -a {0}”

where I would just fill {0} with the value passed from the AIR app. I encrypt those so that the command can’t be tinkered with and unencrypt them at runtime. Then, in a very lightweight (i.e. ~4kb) process I just check the file to see if it exists and whether it’s locked, if it’s not locked, then we read it, fill the command with the parameters, and then pass it to the system to be executed.

The meat of the OSX version of this looks more or less like so:

// this is the threaded method
void *process( void *data )
{
while(run) {
checkFile();
usleep(500000);
}
char buffer[1024];
sprintf(buffer, "rm -f %s", f->cfile);
system(buffer);
return (void*) 1;
}

int main(int argc, char *argv[])
{
char* lockFile;
char* commFile;
char* result;
//
printf(" starting up ");
commFile = (char*) malloc(1024 * sizeof(char));
lockFile = (char*) malloc(1024 * sizeof(char));
result = (char*) calloc(1024, sizeof(char));
//
pthread_t thread;
int threadi;
//
// you'll want to encrypt your system commands just in case
// so you could do
// xorUnencrypt(addToSafe);
// start up the air app, if it works we'll create the thread
if(startAIRApp(commFile, lockFile) == 1)
{
run = true;
// thread identifier
threadi = pthread_create(&thread, NULL, process, NULL);
// go ahead and make the thread
pthread_join(thread, NULL);
//
free(commFile);
free(result);
free(lockFile);
}
}

Is this beautiful C? Nah, not really. But it works. The rest of the OSX version (extremely sanitized for the sake of my future employment) is here.

The hardest part of all of this was finding where the app wasn so that I could launch it. On OSX that requires that you make use of the FSRef object. Essentially, you do the following:

1) create a FSRef object
2) pass is to LSFindApplicationForInfo along with the name of the bundle from the plist file of your app
3) call FSRefMakePath along with a string that the path can written into

that looks pretty much like so:

OSStatus err;
FSRef appRef; // this is the OSX application object that you can get the app path from
char *appPath = (char*)malloc(1024); // just go ahead and do the max
//
err = LSFindApplicationForInfo(0, CFSTR(TARGET_APP_BUNDLE_ID), NULL, &appRef, NULL);
if (err != 0) { return err; }
appPath = NULL;
// note the wierd cast, ick
err = FSRefMakePath(&appRef, (UInt8*) appPath, appPathSize); // now your application path is written to appPath

And that’s really all there is to it.

Should be fun, we (by which I mean myself, Todd Anderson, Chafic Kazoun, and (tentatively) Yakov Fain), will be talking about Flex Architectures and architectural strategies for developing Flex applications. I can’t deeplink into the session locator, but it’s here on Monday at 2pm and it should be a very interesting presentation. Swing by if you’re interested, and, I’ll be bringing my bike, so if you’re attending and interested in going for a little ride up to Marin County or somewhere else interesting one morning drop me a line.

Looking through the trac source today and I needed to find a good example of where trac uses the TemplateLoader…so how do I do that without setting up a new project in Komodo and all that? Grep. You just grep it:
$ grep -r "TemplateLoader" *

And that gives me back

web/chrome.py:from genshi.template import TemplateLoader, MarkupTemplate, TextTemplate
web/chrome.py: self.templates = TemplateLoader(self.get_all_templates_dirs(),
Binary file web/chrome.pyc matches
web/main.py:from genshi.template import TemplateLoader
web/main.py: loader = TemplateLoader(loadpaths, variable_lookup='lenient')
Binary file web/main.pyc matches

How nice is that. There are sooooo many tools that I just don’t make good use of, and I’m trying to get better about that. You can regex in grep, which menas conditional matches, wildcarding, all kinds of goodness. Of course, this is all kind of irrelevant if you’re on Windows but, well, whatever, I’m sure you can figure something out.

On another note, I got a 15″ MacBook last week and I like it. A lot. It’s a really nice computer and I’ve enjoyed it a ton. So much lighter than my 17″, so much faster, and the 10.5 XCode is a really welcome upgrade to the old one, as I’ve been doing a lot of C++ on my nights and weekends working on my book. Speaking of the book, I’ve sort of started a blog for my book where I’ll be putting more and more stuff as the writing progresses. It’s at programminginteractivity.com. There’s not really anything there, but it’s coming soon, so check it out if you’re interested (publication is roughly scheduled for April of next year, from O’Reilly again)