Conan O’Brien, the scientist!

Conan O'Brien, the scientist

Years ago I participated in the Westinghouse Science Talent Search, and was lucky enough to win a place in the final 40. Back then, we’d get a trip to Washington, DC, where we met Ted Kennedy, the President, nobel laureates, the National Science Foundation, and more. But we never had Conan O’Brien!

Conan O’Brien recently visited the latest version of this competition, the Intel Science Talent Search, in Reno Nevada. His version of science involves a cocktail, a slot machine, trash talking nerds, and a product to block see-through cameras. Check it out, starting at 6 minutes and 30 seconds (6:30).

Objective C education

Educational awesomeness

Educational Awesomeness

Stephen Kochan recently published a good book on Objective C and the iPhone. Its a fast read, chock full of neat exercises to test your rapidly growing knowledge of the iPhone platform. I highly recommend it.

At the same time, I stumbled across a nice cheat sheet for Objective C today. Its a handy reminder for seasoned programmers who are new to the Objective C world. It makes a nice companion to Stephen’s book though I, too, wish it had more info on the iPhone.

Taylor Swift’s new metric for scalability

Taylor Swift

Taylor Swift

Meet the new face of scalability — Taylor Swift.   Taylor sold out Madison Square Garden in 60 seconds today.  I heard it on the radio while driving home from the grocery store.  A quick glance at Wikipedia reveals that the Garden can hold 20,000 people center stage, plus an additional 19,522 end-stage (whatever that means).  That’s 39,522 transactions in 60 seconds, where each transaction costs $100 to $2369.  She earned more than $3.95M per minute.

That’s more than Amazon.com.  Say Amazon earns $20B a year.  Divide that by 6 days of sales (Monday-Saturday) and you get roughly $2.5M per hour. I used to like designing sites that can handle “partial Amazons.”  The new mantra should be “partial Taylors,” where a Taylor is $4M per minute or 40,000 transactions per minute.

ObjectiveC on the iPhone: Flash, but faster?

Objective C on the iPhone:  Flash, but faster?

A few months ago I started playing with XCode and the iPhone development environment.  I plunked down the $99 fee to join Apple’s development program.

Guess what.

The very same classes we see in flash — Graphics, BitmapData, BlurFilter — are mirrored by Quartz 2D and the Foundation classes of the iPhone.  Its not exactly a perfect match, but the algorithms, data structures, and graphics pipeline are quite close.  That’s exciting news for hardcore Flash developers!  iPhone also gives us OpenGL for some truly amazing effects on a tiny device (e.g. Koi Pond).

I’ll start posting my adventures here in moving from Flash and widgets to iPhone development. Already my iPhone 3.0 is running with a number of experiments.  To me, the iPhone is just like hardcore Flash.  Except its a lot faster, and potentially more lucrative.

TwitVideo: Not what you expect

My head hurts on Twitpic

I’ve been watching people follow TwitPic, trying to become the Youtube of Twitter. I sure hope they have a good business model. When I was at my last company, video serving cost us roughly $4 per CPM, including hosting, storage, and bandwidth for a thousand 3-minute video clips. Basic ad networks can pay you a few pennies per CPM. That means you lose nearly $4 for every 1000 video views in an ad model. Maybe they can make it up in volume?

For yucks I put a webcam on the twitvideo.com domain (which I bought back in 2007 after iJustine introduced me to Twitter). The webcam uses the mesh tricks seen on this blog, reading a simple equation I threw together that mimics fisheye effect. The effect is modified by time and the position of your mouse. Go to twitvideo.com, play with the Flash 10 cam, click the picture, and send a tweet. I’d love to meet some of my readers (or at least meet a morphed version of their face).

Visualizing Twitter: song.ly meets twitpic

The other day I was fascinated by the volume of pictures uploaded to twitpic.  They appear to be on a similar trajectory to Photobucket back in the early days of MySpace.  I bet twitpic rides Twitter to quite a handsome sale!  I also came across song.ly, a relatively new service for tweeting music.  For fun, I mashed the two feeds up.  The result is a surreal experience, watching people tweet pictures while listening to the music from others, set against a backdrop of music visualization.

HTML 5, jQuery, REST: is it client server redux?

Don’t get me wrong.  I love jQuery.  The elegant language feels reminiscent of LISP, APL and other great languages of days long gone. HTML 5 and the canvas hackery makes me giddy.  Just feast your eyes on Jacob Seidelin’s beautiful hack where he ported a chunk of Milkdrop to JavaScript and Canvas. 

Less we fret that Canvas will replace Flash, ActionScript 3.0 finally has direct access to the GPU. Jesse Freeman and I shared lunch recently, where he showed me some slick tricks with augmented reality, which treat the webcam as a 3D input device. 3D will soon proliferate in Flash, just as HTML starts eating away at the 2D low-end Flash has dominated for a decade.

My head has been swirling with this onslaught of powerful, client-side tools. As you see on this blog, I’ve also been hacking with them on the commute to and from New York.

Then it hit me.

This past Friday I was pouring through the details of a sharding project at work. Sharding is hard work. You have to move highly centralized data and services to a distributed model, both in data and functionality… while keeping a current site alive. The engineers walked me through details of how web requests were routed, dispatched, and handled. Slowly a picture started to emerge.

These engineers were moving nearly all of the display logic, and a lot of the business logic, to the edge. Gone were Smarty templates and Ruby on Rails views. In their place they began to use Google’s EJS — embedded JavaScript. The browser was now assembling pages, downloading templates from a CDN, pulling JSON data from a bank of highly scalable data services. The backend looked like a giant, screamingly fast JSON service farm.

Modal windows, cart updates, product views, pagination. It was all happening at the edge. Templates were no longer produced live. Instead, they were being produced in a measured cadence, published to the CDN from a content management system.

Is the future of the web replaying history, what we’ve seen so often in computer science? Is the highly decentralized nature of the Web swinging back, closer to client server, with fat clients and backend data, but now loosely coupled with RESTful interfaces?

Yum Repositories for Fedora Core 8

I just spent a lot of time Googling around for the URLs of various Yum reposotories for Fedora Core 8.  Amazon has a number of basic Fedora Core 8 server AMIs available.  I later discovered that this release of the OS just reached end of life in January.  Nice.  For the life of me I couldn’t find a web page that just listed the basic repo information for Yum.  Here it is.

Place the following text as a file at /etc/yum.repos.d/base.repo:

  1. [fedora]
  2. name=Fedora $releasever – $basearch
  3. failovermethod=priority
  4. #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
  5. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
  6. enabled=1
  7. gpgcheck=1
  8. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
  9.  
  10. [fedora-debuginfo]
  11. name=Fedora $releasever – $basearch – Debug
  12. failovermethod=priority
  13. #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
  14. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
  15. enabled=0
  16. gpgcheck=1
  17. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
  18.  
  19. [fedora-source]
  20. name=Fedora $releasever – Source
  21. failovermethod=priority
  22. #baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
  23. mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
  24. enabled=0
  25. gpgcheck=1
  26. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
  27.  

Liqwid: a visualizer plugin for Flash



My music visualizer and mashup code is starting to gel. Its one of those classic technologies that starts in the lab, driven by a fascinated researcher, who keeps plowing ahead. I started this in 2007 trying to learn Flash by writing a version of Milkdrop. For those old enough to remember, Milkdrop was the visualizer for Winamp, the music player many used to play Napster-downloaded content.

Yet in 2007 Flash 9 had very little market penetration. Laptops chugged at the intense mathematics of a visualizer running in a virtual machine.

Fast forward 18 months. Flash 10 is out, Flash 9 is entering the land of the 90th percentile deployment, and many laptops are shipping with fast, dual processors and 4GB of memory. The compilers have also improved (as have my Flash skills, thanks to great coaching from designers like Jesse Freeman).

What frustrated me, though, was the real lack of easy support for pictures. In the midst of slide.com and Animoto, pretty little waveforms and textures were interesting but they didn’t mesmerize. I tried slapping an image onto the waveform distortion fields. It sort of worked. It still felt lame.

I kept experimenting. Last night I tried something new. What if we replaced the core waveform with a frame for a picture, then texturemapped photographs and their transitions into this space? For fun I also encoded a few dozen of the standard wipe effects from the Society of Motion Picture and Television Engineers. [ed: Funny, I didn't even know wipes could be standardized. Apparently so!]

Next, I took the picture and layered on top a waveform, a motion vector field, and a 2d mesh. From there I hooked into an FFT analyzer for music with some additions for beat detection. With a bit of tweaking I came up with this preset for animation:

  1. zoom=min(0.9*zoom+0.1*amp,6)*(1+sin(time*3.14)*0.25); zoom_exp=min(2,0.9*zoom_exp + 0.1*amp);
  2. dx = 0.5*(sin(time*3.1415/4)+1);

This preset picks a zoom around 1:1, zooming in when the overall sound amplitude “amp” increases, up to 6:1. I then modulate this a bit with a sine waveform so that the picture doesn’t jump around as much. Next, I kick up a “zoom exponent” or zoom_exp. This exponent adds extra oomph to the zoom, by taking the radial distance from a pixel to the center of the image, squaring (or cubing, or..) it in tune with the sound levels. This gives us a nice distortion effect popularized by Ryan Geiss in Milkdrop. Finally, I move the image around in the x direction by changing “dx.” I tweaked a few more parameters so that the motion vector field becomes brighter and more intense with louder sound, and the crawling waveform dances in tune to the music, appearing now and then when the images shrink. Its a digital roach!

As I started to wrap this up into something I could post online, I needed a playlist, a media player, controls, and more. Great coders integrate.

In the last few days I’ve spent some time on longtailvideo.com. I really liked their business model. Its open source GPL. You can use the source for free, but you need a commercial license to resell or generate cash. The JW player is popular, too, and jw’s code is uber-clean.

I ripped out my code that was starting to deal with playlists and media playing. Sigh. I could do it, but why? Then, I began to wire up a plugin using his API. I’m still having trouble getting my playlists to show up in his little box that floats underneath the player. I think the .fla file I downloaded is missing some key elements on the “playlist” button.

Nevertheless, I’ve put the player here for your amusement. I’ve mashed up the flickr interesting images with a Project Playlist. I run these media clips through a proxy to skate around cross-domain issues during this demo. The proxy is like sipping through a straw. My apologies for the error messages and slow start while your browser cache fills up. That’ll be gone in the production version.

Picture mesh in Flash

The animated picture mesh in action

A snapshot of the animated picture mesh

I’m continuing to work on my mashup of Milkdrop, slideshows and music while commuting on the train. This is an evolution of the previous post. You can see my progress here. I really don’t know what this thing is… yet. Its a fascinating combination of visualization, math, music and pictures all written in ActionScript 3, Flash Player 9. Its part slide.com, part longtailvideo, part milkdrop. And soon it will be open source using the GPL license.