A Tip for Webrat

I had my first experiences with Webrat last Thursday and I came across this error: NoMethodError: You have a nil object when you didn't expect it! The error occurred while evaluating nil.fields (eval):2:in `choose' Not being able to decipher that, I turned to the web and found this helpful link which didn't completely solve my problem but did point me in the right direction: check the markup. Looking at what I had:
<tr>
<td>
  <input type="radio" value="1" name="my_radio_btn" id="my_radio_btn">
</td>
<td id="l">
  <label for="my_radio_btn">My Radio Button</label>
</td>
</tr>
...there wasn't a <form> anywhere in sight. Once I fixed the markup to be:
<tr>
<td>
  <form id="better_markup">
      <input type="radio" value="1" name="my_radio_btn" id="my_radio_btn">
  </form>
</td>
<td id="l">
  <label for="my_radio_btn">My Radio Button</label>
</td>
</tr>
... Webrat worked like a charm.

Shop It To Me: My First Day

There was a point today, sometime in-between the deluge of new-hire paperwork, getting to know a new office-space, having to configure a new Microsoft system because my Macbook Pro hasn't yet arrived, the multitude of new names, and a code overview for (just one) part (of many) of an intricate Rails system, when I thought: "this is exactly what I was looking for."

Today ranks as one of the best first days I've had since starting as a software engineer. I like the people I'll be working with, I like the company, I like the product, and I like the numerous challenges before me.

Although, I'll admit that I didn't sleep very well last night. It was mostly due to the heat in San Francisco but partially due to one nightmare I had about showing up unprepared. I don't exactly remember what happened in the dream; I either wore shorts or didn't have any pants on when walking into the office. One is certainly worse than the other, but considering the magnitude of change from my previous position, only one (fairly harmless) nightmare is doing pretty well for the night before a new job.

There was, however, a funny moment at lunch today. The question came up: "so how did someone from Yahoo! get a job at a rails shop?" (alluding to the fact that Yahoo! is primarily a PHP shop.) It reminded me of the time just over three years ago when I caught the Yahoo! shuttle bus back into San Francisco after a day of interviewing in Sunnyvale (which ultimately resulted in my first job at Yahoo!.)

On the shuttle, I started chit-chatting with the guy next to me. He asked if I had snagged the interview through a friend or relative and when I responded that I had landed it after an application through HotJobs, he jolted a bit and responded, rather surprised: "you must have some pretty special skills, then..."

Special enough, I guess...

On the Future of RIAs

At work, I'm transitioning off of the Mail team into a project where we'll be prototyping some new functionality in HTML5.

While I originally thought we would be analyzing HTML5 as it will affect organizational strategy (can you imagine how much impact that would have?) it turns out that we'll be implementing prototypes for a very specific need. Either way, it's very exciting to be working in this emerging space in a team of top-notch FEs along with one of Yahoo's top UEDs. Although not an explicit thought-leadership effort per se, I'm sure engineering will inform strategy will inform engineering.

On that note, I've started to reflect on the Adobe vs. Apple fight and future of RIAs, particularly in the online advertising space. According to the Apple iPhone OS 4 keynote:

"Users spend 30 minutes a day in apps. Say an ad every 3 minutes...10 ads per day. We'll be at 100 million devices soon, so that's 1 billion ad opportunities per day."

1B impressions/day, as achieved with HTML5/CSS3/JavaScript?!? That's certainly nothing to sneeze at. Is Flash really on its way out as the default interactive media platform? How long before it's replaced by HTML5, if at all?

I don't personally think that the move by Apple will completely eliminate the need for Flash, ever, even if the company continues its rapid growth in the mobile hardware sector. As much as I - as a web developer - would like to simplify my life by having one language (for both client and server-side) on one platform, I know we won't ever get there (proof? that would imply a monopoly and current US regulation prohibits that, no?)

After some reflection on just how much has been invested in Flash as an industry standard in the last 14 years in addition to reading this article and its comments, I would tend to agree with this assessment on the future of Flash.

I have found myself wondering: "for all those developers and businesses who have legacy systems built around Flash, how will they transition from Flash to HTML5?" and that's when I remembered OpenLaszlo. It's been a while since I've looked at it, but I was duly impressed by its ability to generate both SWF and DHTML output.

For all of you developers who have never touched Flash in your life and are jumping on the HTML5 band-wagon right now, you have bright futures in 3-5 years when HTML5 matures and you're already experts on it. For all of you SMBs (and enterprises?) who have heavy investments in Flash and want to migrate to capture more market-share, I wonder if it wouldn't make sense to port your current solutions to OpenLaszlo and "compile" for both Flash- and non-Flash-enabled platforms. I think there's a real opportunity for OpenLaszlo and the company behind it - Laszlo systems - to assist in the transition and/or bridge the gap as HTML5 becomes more of an industry standard.

Disclosure: I am an Apple fanboy, in spite of everything that's happened recently with their developer policies, but I do not have any interest in Laszlo Systems.

Isn't Hindsight 20/20? RE: Zynga's Recent Valuation

In February 2010, I hit the GDC when I came to SF with the hopes of finding a job. I thought, "surely, with my web skills... I'll be in-demand" but oh how sobering of an experience it was.

A few months later in July 2010, Zynga was formed.

Fast forward three years and I just caught the other day that Zynga's been reportedly valued at $5B. A $5B business in three years?!? Amazing.

My First Ruby Script

This last weekend I was finally able to sit down and pound out my first Ruby script. Now I can grab the 790 pics I have in my Gallery installation and thanks to the B-Tree, order them by the upload date.

(There must be a better way to do the regexs in Ruby but I think it's not too bad for a first stab.)

The next step is to make use of the Flickr API to upload all the pics and set info accordingly.

What to do about tags? In the next iteration, I think I'm going to put a "tags.txt" file in each Gallery album directory in order to ascribe at least a few tags to the photos as they're being uploaded.

Just for fun, here's a taste of the Gallery metadata files (photos.dat) that serve as the input for parsing. Good times.

a:17:{i:0;O:9:"AlbumItem":19:{s:5:"image";O:5:"Image":12:{s:4:"name";s:8:"100_0559";s:4:"type";s:3:"jpg"; s:5:"width";i:640;s:6:"height";i:480;s:11:"resizedName"; s:14:"100_0559.sized";s:7:"thumb_x";N;s:7:"thumb_y";N; s:11:"thumb_width";N;s:12:"thumb_height";N; s:9:"raw_width";i:1200;s:10:"raw_height";i:900; s:7:"version";

Beginning With Ruby

I didn't really want to pay $333/month to hone my Python chops so I decided to get my hands dirty with some Ruby instead (on a side note, I am currently looking to recruit Front-end Engineers and a Front-end Engineer manager if you know of any...)

I decided to formulate a different task for myself:

TASK: Given a set of albums in a 1.4.4-pl4 version of Gallery, write a script that uploads them to Flickr and sets properties accordingly so that they appear in the correct chronological order.

Background

I've been using Gallery for a long time to curate my photos, long before Flickr came on the scene. I'm a big believer in YDYS (Your Data is Yours) and didn't like uploading my photos to big servers in the ether so I hosted my own photos with Gallery.

Well, time marches on and when you manage your own photo gallery online then you have to manage the software that manages your photo gallery. I have to admit (and you can pretty much tell when it happened by the version number,) my gallery fell into disarray and I didn't tend to it as much as I should.

Now that I don't have quite as much time for outside projects as I once did, I thought "it's time to upgrade to a service like Flickr and let them manage the infrastructure while I take care of capturing and sharing memories."

DISCLAIMER: I get the Flickr Pro upgrade for free because of where I work. It's probably necessary to have the Pro account before you attempt the uploads using the techniques that I'm eventually going to use.

I'll have some time to get started this weekend, but here are some initial steps as to what I think I'll need to do to parse photo data out of the Gallery files.

=begin
- Create a B-Tree (we'll need it for date-tracking as we process each of the photos)
- Glob a list of photos.dat files recursively
- Foreach photos.dat file...
-       Open file
-       Slurp file (can do in Ruby?)
-       Parse syntax
-       Foreach photo
-               Find uploadDate
-               Do lookup in B-Tree on uploadDate and/then...
-               Stick Album Name and File Name in B-Tree for uploadDate
-       Close file
- Traverse the B-Tree and print out: "Album Name, File Name"
=end

First (Attempt at a) Python Script

In a way, I have HotJobs to thank for getting into Yahoo. It’s on HotJobs where I first saw the job that eventually became mine (I actually found a couple of jobs there that I applied and interviewed for…) Anyway, I’ve been wanting to try something against the HotJobs API for a while now so I sat about doing so in Python.

TASK: Create a simple script that takes two arguments, a job title and a zip code, and then query HotJobs for resumes containing that job title near the zip code. After retrieving the resumes, output a list of job titles representing the *next* jobs people held after holding the job title passed in the query.

Unfortunately, the Web services license key registration process is not instantaneous, so shortly after I got these steps in place…

  1. Hello world in Python. Check.
  2. POST Web service calls in Python. Hey! Check!

… I started getting IOError: ('http error', 401, 'Authorization Required', ) so I realized I probably needed to put in for a Web services license key. Looks like they’ll be getting back to me.

Notes (so-far) on Python:

  • semi-colons: I thought everyone liked them…
  • here-docs with triple apostrophe? clever.

And for My Next Trick...

When I arrived in the bay area about three years ago, I felt like somewhat of a pariah given that I had been most recently working with Microsoft technologies and was trying to get a job amongst LAMP developers in the most competitive place in the world to do so. I fell back on my previous Perl experience and found a sweet gig at Yahoo in what essentially is the dev tools part of the organization.

A few years later, now that I've been able to come up for some air and take a look around, I've noticed that the world has gone the way of RoR and Python. I was telling a friend recently, "it sure is hard to find web dev positions for Perl developers" and he responded (because he's looking to fill some reqs,) "it sure is hard to find Perl developers for our web dev positions."

So, which of RoR and Python to learn first? I'm a big believer in learning by doing, so now I just need to sit down and develop a service in one of the two. Python, bring it on.