Archive for the Category Uncategorized

 
 

Google: a coder’s dream.

Flash is one of the most rewarding platforms.  With it, you can apply mathematics, art, and programming to create some really beautiful things.  Yet, while coding, I find myself trying to remember the name and signature of methods from the vast Flash library.

“Hmm… what’s the signature for creating a gradient again?”

“Remind me.  What’s the simplest way to type cast?  I’ve been hacking Ruby all day and my fingers forgot.”

Switching languages is a natural part of being a Web engineer.  On any given day, I’ll touch ActionScript, Java, PHP, Ruby, JavaScript, CSS, the Bourne Shell, C, and more.  When all else fails, I type in a few words into the Google toolbar.  Within a split second I’m presented with the right page from php.net, a Rails forum, Adobe’s online help, etc.  Google has become invaluable to me.  I use it hundreds of times a day in the edit-compile-debug loop.

I’ve got Flex Builder, CS4, fancy name completion, Flash documentation, the works.  Google still rules.

Admit it.  You do it, too…

Why I almost love Scribd

Scribd taking 8-9 hours to process a resume.  WTF.

This morning I polished off a resume and wanted to share it with some companies and recruiters. Writing furiously on my Macbook at 5am in the guest bedroom, I said to myself,

“Self, let’s put this on Scribd and use the cool, new Flash viewer for documents.”

I used my Macbook Pro to choke out a Word document, then printed to a PDF. I dutifully uploaded the PDF to a brand spankin’ new account at Scribd.com. Then, S3 started to break on me at Scribd, sending me spurious XML errors. I tried my own S3 connections on iZoomr.com at 5am and, sure enough, they seemed to be misbehaving. Grrr… So, I uploaded it again using the sleep deprived mantra of, well, if it doesn’t work the first time, just whack it and try again. (I know, stupid, but we’ve all done it…)

Nine hours later my resume is still stuck in line. That must be like the lines I see here in Manhattan, wrapped around city blocks, swelled with good people who just lost their jobs on Wall Street. Nine hours. Man, I hate that. I really want to love Scribd. It has such promise.

You’re Awesome! Have my Pocket Protector!

My Rockstar Gift

My Rockstar Gift

As a kid playing my Gibson SG in a rock band, I had dreams of being a rockstar. I used to practice for hours with a friend, Keith Howland. Keith was far better than me, his fingers moving across his Les Paul like liquid lightning, playing “Freebird” to the swaying masses. I’d strum along and do my best to not lose the beat. That was then. Today Keith is a rockstar, playing for Chicago. I’m a CTO/VPE for early stage companies, like Photobucket and Heavy.

Way too many years later, I had my first rockstar experience. Its not what I had in mind. VC Mike from Polaris introduced me as a “rockstar CTO” in Boston’s Amazon Web Services meetup. That’s quite humbling, especially from Mike, who I deeply respect. As the Rolling Stones say so poetically, you can’t always get what you want, but you get what you need.

I was scheduled to talk on migrating from managed hosting to Amazon’s new web services. A few minutes before I was called to the podium, I was sitting next to an engineer who specialized in SEO. We chatted for a bit, exchanging backgrounds, talking shop. He handed me his card and I stuffed in it my shirt pocket. He looked at me, puzzled.

“If you’re going to give a talk, you need to do it right. I’ve been doing some research on membranes to optimally protect your pens and cards you collect, without causing your Listerene strips to melt from body heat. I have some rather interesting results with different composite materials.”

What the… this guy reaches into his bag, shuffles around. His hand emerges, holding a flimsy piece of transparent plastic. “Ah, this is the one! Here, you need this.”

He hands me a pocket protector. I gave my talk. He came to see me afterwards. “Loved your talk, Scott! Please keep the membrane as my gift.” I was floored.

Note to VC Mike: Rockstars have screaming girls throw underwear on stage and paper airplanes with phone numbers written in lipstick. What do I get? A limp pocket protector. I can only hope Keith is faring better with his fans.

Wicked-fast geographic targeting


I’ve long been an admirer of Maxmind, a company that provides a free database for mapping IP addresses to geographic locations. Its more than sufficient for most applications, and I use it frequently in side projects as well as my day job at companies like Heavy and Photobucket.

Yesterday I paid $15 to buy a new version of their software that maps IP addresses to company names and known “proxies” used by warez providers. We need this to start tracking click fraud at work. What surprised me most was the release of an Apache 2.0 plugin using apxs, where the geographic lookups are now handled in C vs. a higher level scripting language. The performance improvement is dramatic. Further, it makes lookups dirt simple. The plugin stores the geographic IP, city, state, company and more in environment variables and internal Apache tables. It took me about 30 minutes to set everything up, including a compile and install on a CentOS box running on Amazon’s EC2.

The end result is a set of C libraries in /usr/local/lib and data files in /usr/local/shared that can be easily integrated to your C application:

  1.  
  2. #include <GeoIP.h>
  3. int main (int argc, char *argv[]) {
  4.   GeoIP * gi;
  5.   gi = GeoIP_new(GEOIP_STANDARD);
  6.   printf("code %s\n",
  7.     GeoIP_country_code_by_name(gi, "yahoo.com"));
  8. }
  9.  

Pinch effect in ImageMagick

Rihanna with a pinch.fx headache

Rihanna with a headache

Here’s another ImageMagick hack inspired by PhotoBooth on my Mac. Create a file named “pinch.fx” with the following content, without line numbers:

  1. kk=w*0.5;
  2. ll=h*0.5;
  3. dx=(i-kk);
  4. dy=(j-ll);
  5. aa=atan2(dy,dx);
  6. rr=hypot(dy,dx);
  7. rs=sqrt(rr*200);
  8. px=kk+rs*cos(aa);
  9. py=ll+rs*sin(aa);
  10. p{px,py}

As with the fisheye effect, we first compute the polar coordinates of the current pixel in lines 1-7. Next, I compute a scaled radius as the square root of the current radius. This forms a cone. Now, I project the pixel corresponding to the cone pixel (px,py) onto the current pixel (i,j) in lines 8-11.

Let’s have fun with Rihanna. First I grabbed a normal looking image:

Rihanna, as we know her

Rihanna, as we know her

Now apply

  1. convert -fx @pinch.fx rihanna.jpg pinch.jpg

“Its just coding”

This is a blog about building software.  Its what I do for a living, for a hobby.  To me, great software is still an art form, finessed through solid engineering practices.   Yet it seems to be lost in the corporate world of outsourcing.  If I hear another executive say, “its just coding,” I’ll cringe.