19
Jan 12

Memorable Moments at Thunderhill

Look ma, no hands!


06
Jan 12

Let’s dive into it…


50mm f/1.2


05
Jan 12

Gallardo Perfection

The prefect combination of JDM and Euro.

 


01
Jan 12

Shaolin Monk


31
Dec 11

Stanford Photowalk


27
Dec 11

A California Winter

 

 

 

 


25
Dec 11

The Londre Wedding


 


05
Jul 11

Putting the Miata through her paces

A few photos from the last event at Thunderhill.

 

 


15
Feb 11

uninitialized constant MysqlCompat::MysqlRes…getting Snow Leopard, Rails, and MySQL to play nicely

You’ve probably done it…set up your machine, updated Rails, installed MySQL, then attempted to start your server. You’re cruising…then blam!

 uninitialized constant MysqlCompat::MysqlRes

Then you’ve probably hit Google a few times…tried specifying  x86_64 ARCHFLAGS, installing and reinstalling MySQL and the MySQL gem, and even trying the MySQL 2.7 gem.

No dice. You and I both.

Well, hear this…you might have another out! A few weeks ago I was working with the guys over at Blue Box Group to get a Memcached instance up. They had suggested I install Homebrew, a package manager for OS X. I suggest you install it too.

Be sure to uninstall the any copies of your mysql gem; then, once you have it Homebrew running, try the following.

icarus$ sudo brew install mysql
==> Downloading ftp://ftp.cwru.edu/pub/bash/readline-6.1.tar.gz
################################################## 100.0%
==> Downloading patches
################################################## 100.0%

** snip **

icarus$ sudo gem install mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/bin/mysql_config

Supplies!


19
Jan 11

Using regular expressions? The Devil is in the details.

Recently, I ran into a little roadblock as I’ve been cleaning up some bugs for one of my applications. I rely heavily on cross pollination of data between sites to drive traffic across my network. In this particular situation, a simple collection of linked image thumbnails accomplishes this task.

One of the helper methods that I use returns the file name of a supplied post object. To do this, I perform a regular expression match against the post’s URL and return the result.

# post.url(:icon) = id/10/icon/foo.jpg
# returns "icon/foo.jpg"

def filename_from_post(post)
  return post.image.url(:icon).match(/icon\/.*\.jpg)/)[0]
end

That worked great until my application would randomly throw a NoMethodError. I spent a while scratching my head, looking over my code, checking my SQL queries, and so on and so forth. Finally, I figured it out…I had forgotten to specify a case insensitive search!

# post.url(:icon) = id/10/icon/bar.JPG
# returns nil

>> post.url(:icon).match(/icon\/.*\.jpg/)
=> nil

>> post.url(:icon).match(/icon\/.*\.jpg/i)
=> #<MatchData "icon/bar.JPG">

I guess what they say is true…the Devil is in the details.