Ryan Kanno: The diary of an Enginerd in Hawaii

Everything you’ve ever thought, but never had the balls to say.

2008 Archives

Got Toes? The Vibram FiveFingers Review

Let me first preface this blog by stating that no, I’m not dead. I’ve been a little really busy with work. Don’t worry, I have a bunch of new blogs planned around all the useless pieces of software that I’m working on. Until then, check out some of my latest buys.

I finally succumbed to peer pressure.

Vibram FiveFingers
After some careful online research (like here, here, and here) and being persuaded by my co-worker Stephane, I finally mozied on down to get myself a pair of Vibram FiveFingers. After all, being named one of Time Magazine’s Inventions of the Year couldn’t be all that bad… right? :)

After perusing their website, I found only two retailers on Oahu that sold them.

  • Uyeda Shoe Store across from Puck’s Alley (map)
  • The Wheatgrass Center behind the Bank of Hawaii on Waialae (map)

After calling Uyeda’s several times and being greeted with one of those funky fax feedback tones each time (note - please update your online phone number), I finally decided to ring up The Wheatgrass Center. For those of you instructionally-impaired like myself, just take a left on Waialae Ave. before the Bank of Hawaii heading Kahala bound. Located behind the bank, The Wheatgrass Center is quite an interesting store selling both the Vibram FiveFingers and of course… wheatgrass. (Why people want to ruminate like cows is still truly beyond me.)

Review

When I first saw the Vibram FiveFinger, I did what any other (semi) normal human being would do - I laughed. Not any normal laugh, mind you - but a “there’s no f-in way I’m wearing that in public” laugh. They resemble footwear of a ninja-in-training, and since I’m neither of the two (a ninja or in training), I really couldn’t fathom seeing myself in a pair.

But after trying them on, I was immediately taken back; back to small kid time when I ran barefoot and carefree in the red dirt hills of Mililani. The Vibram FiveFingers not only allows you to feel the contour of the ground, but also provides protection to the soles of your feet. After being given the sales pitch by Mr. Fukuda, I was sold. There’s a few models; I ended up purchasing the Classic. (Check out their website to see the entire product line). Not to mention, Mr. Fukuda instructed ordered me to wear the pair out the door. After a full weekend’s worth of wear and tear, here’s a few images of them on my feet - along with a short list of my pros and cons.

Vibram flat on the kitchen floorVibram side profileVibram angleVibram overhead view

The Pros

  • It’s surprisingly comfortable. Sometimes my toes still feel weird being separated, but it’s pretty neat to actually feel the ground without fear of having a rock in your foot. Btw, if you like the separated toe thing, check these socks out from Injini.
  • If everything the Internet world says is true (like we all know it is!), I’ll have crazy leg/toe muscles, damnit! And, not to mention, it promotes a more natural walking motion. To learn more, read this article about barefoot running.

The Cons

  • I developed a blister on the back of my foot near my Achilles from the back strap. It’s pretty sore, but after reading other reviews, I’m sure I’ll get used to it.
  • Since I’m fairly self-deprecating and a non-fashionista (you should see my car), the design doesn’t faze me one bit - but I could see how embarrassment could set in.
  • The price. $73 bucks isn’t a drop in the bucket in this economy. Damn, do you know how many beers I’m giving up for this?

I’ll tell you in December how the Honolulu Marathon goes with these on!

Tagged: , , , , , , .


ERB block comments in RHTML templates using Ruby on Rails

This blog is simply a reminder to myself more than anything else.

After searching the great Googs and reading here, here, and here about commenting out regions in your RHTML templates, I couldn’t find a (good) solution aside from the (<... if false ...>) paradigm. Using Rails 1.2.3 (I know, I know… we’re old school), to get block comments in Rails, the following worked for me, but unfortunately, still wasn’t recognized by NetBeans 6.0 (Boo!).

1
2
3
4
5
6
7
8
9
10
11
12
13
<table>
  ...
  <tbody>
    <tr id="<%= "photographer_#{photographer.id}"%>">
      <td><% 
=begin %>
<%= h photographer.first_name unless photographer.blank? %><% 
=end %>
      </td>
    </tr>
  </tbody>
  ...
</table>

Happy Coding!

Tagged: , , , , , , , , , .


Google App Engine on Win2K (using django-yui-layout-templates)

Update

After finally getting time to play around with the Google App Engine Django helpers, here’s a few more steps to integrate nicely with the helper suite.

  • Move the appengine installation from C:\AppEngine\ to where the Windows installer would have installed it to: C:\Program Files\Google\google_appengine (make sure to clean up your .pyc files)
  • Add the following to your PYTHONPATH system variable: %APPENGINE%\;%APPENGINE%\lib;%APPENGINE%\lib\yaml\lib;%APPENGINE%\lib\webob;

After following the instructions, you should be good to go with Django + AppEngine! FTW! Whee. :)


So I finally get an hour or so to play around with the Googs App Engine and luckily for me, all my machines decided to puke except for my Windows 2000 Server. How ironic is that? In disbelief, I downloaded the Google App Engine SDK Windows installer and what do I get?

Google App Engine Windows installer

I sense some pure, unadultered haterade. (j/k)

Since Python is one of those insert_any_synonym_for_fun languages that just works, here’s how to get the Google App Engine SDK working in Win2K.

  • Download the Linux/Other platform package and unzip to somewhere neat.
  • Add a System Environment variable called ‘APP_ENGINE_HOME’ that points to your App Engine installation. (Notice, I installed mine into C:\AppEngine)

    Add system variable

  • Add the System Environment variable to your System Path so the Windows shell can execute the included Python files.
  • Make sure you have .py files associated with the python.exe executable located in your Python installation. (Check file types under folder options)
  • Follow the tutorials: here and here, or learn with others - just to name a few.
  • Oh, and before I forget, if you develop an application and realize that you can’t kill the development appserver (dev_appserver.py) by pressing Ctrl-C, I found a solution here. Basically, press Ctrl-C, hit the server with your browser one more time and voila, the development application server dies. Thanks Frank!

As an added bonus…

Checkout my my previous post using the Yahoo UI library to create a set of default Django templates. I’ve updated django-yui-layout-templates with patches and suggestions, and I’ve also created a few branches to support the Googly App Engine. Check out the branches directory in the Subversion repository!

Last but not least…

Big ups to Mr. Fitz for solving all my Google App Engine issues and thanks to Mr. Harper for causing them. ;)

Voila! (Enjoy)

Tagged: , , , , , , , .


Yahoo! UI (YUI) + Django templates == Google Code project! FTW!

Let me first preface this blog by saying that I’m not a designer. When it comes to art and creativity, I’m so left brained, I actually wonder if my right brain even partakes in the process.

Three things spurred me to release django-yui-layout-templates.

  1. I’ve always wanted to see what GoogleCode offered in relation to SourceForge / RubyForge.
  2. I’m so caught up in corporate America staring at Java / Ruby code all day, not only haven’t I blogged about anything Django related in quite a while, but it’s nice to get some commentary from the community, i.e. “your code sucks”. (Brings me back to reality)
  3. I found myself using the same templates on a variety of projects and figured that I could do my part and help eliminate unncessary cruft/duplication.

So without further adieu, check out the project here. I know, I know - nothing revolutionary here, but I figure since Django is picking up some steam, these templates might help a Djangonaut get a head start on their next million dollar idea. :)

Voila! Enjoy!

Tagged: , , , , , , , , , .


Backing up your Subversion (SVN) repository on Dreamhost with cron

Two events spurred me to write this blog.

First, my 2 year old “Subversion + Dreamhost + Post-Commit” blog still gets quite a number of hits. Second, after the latest Dreamhost outage move, I’m beginning to feel a little more vigilant about backing up my data.

As a standard disclaimer, if you’re not familiar with the Unix shell, I highly suggest you not try this unless under the supervision of someone who reads Perl books for fun. By accessing your Dreamhost shell, you can seriously f-up your account and I will not fix it for you. You have been warned. :) (Don’t you just love smileys?)

Setup

There are a few prerequisites to being able to back up your SVN repository.

  1. First and foremost, you must have already installed a SVN repository into your Dreamhost account via the control panel.
  2. Second, you must know how to SSH into your Dreamhost account. As a FYI, you sorta-kinda-need to know what that means in order to follow this tutorial.

Grabbing the backup script

Wait, you didn’t think I was writing my own right? In any case, if you actually installed/compiled Subversion on your own, it would’ve contained this file, hotbackup.py. Fortunately for us, Dreamhost has this file conveniently available at: /usr/bin/svn-hot-backup, but it’s an older version of the backup script. There are some subtle differences like being unable to pass in the number of backups you want the script to manage. Personally, I like to be on the edge, so let’s get the latest version. Execute the following commands from your home directory.

$ cd ~
$ mkdir scripts
$ cd scripts
$ wget http://svn.collab.net/repos/svn/trunk/tools/backup/hot-backup.py.in
$ mv hot-backup.py.in svn-hot-backup.py

The commands issued above created a directory called scripts in your home directory, switched into the directory, downloaded the latest hot-backup.py file from CollabNet, and renamed it to svn-hot-backup.py. Now that you have the file, you’ll need to make a few edits. Personally, I’m accustomed to vi, but pick your poison (pico, nano, text editor of your choice) and find these two values (they should be close to the top of the file in consecutive lines).

# Path to svnlook utility
svnlook = r"@SVN_BINDIR@/svnlook"

# Path to svnadmin utility
svnadmin = r"@SVN_BINDIR@/svnadmin"

and change them to the following:

# Path to svnlook utility
svnlook = r"/usr/bin/svnlook"

# Path to svnadmin utility
svnadmin = r"/usr/bin/svnadmin"

(If you’re wondering, if and when you compile/install Subversion yourself, these two variables would have been automagically filled in for you.)

The python script we downloaded not only performs a hotcopy of your svn directory, but also can archive it and manage a set number of copies. Pretty neat right?

Preparing for the backups

Before you can actually back up your SVN repository, you’ll want to create a directory structure to manage your backups. Execute the following commands from your home directory.

$ cd ~
$ mkdir backup
$ cd backup
$ mkdir svn
$ cd ~/scripts

The commands issued above created a directory called backup in your home directory, switched into the directory, and created another directory called svn within the backup directory. We’ll be using this directory to store all your backups. Finally, we switched back into the scripts directory created in the previous steps. Now that we have the backup script and directory structure to manage the back ups, let’s test it out!

Before you can back up your repository, you’ll have to know the name of the Subversion repository you’re trying to back up. To find the name of your repository, you can either look in the svn directory in your home directory, or you can check out the ID value in your Subversion Goodies control panel. In any case, remember the name of your SVN repository and issue the following commands.

$ cd ~/scripts/
$ python2.4 svn-hot-backup.py --archive-type=zip --num-backups=10 ~/svn/REPOSITORY_NAME_HERE/ ~/backup/svn/
Notice, change the value of REPOSITORY_NAME_HERE to the id of the SVN repository you want backed up.

You should see the following in the console:

Beginning hot backup of '/home/USERNAME/svn/lkg/'.
Youngest revision is REVISION_NUMBER
Backing up repository to '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701'...
Done.
Archiving backup to '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701.zip'...
Archive created, removing backup '/home/USERNAME/backup/svn/REPOSITORY_NAME_HERE-701'...
If you see the following, the backup was a success! You can even check on the file by changing into the backup/svn directory!

Voila! (But there’s more)

Automating the backups

Now that you actually have the script backing up your SVN repository, let’s automate them! To do so, we’ll use the handy cron daemon. Cron has similarities to the Windows task scheduler in that it provides a service that enables a user to execute commands at a specified date/time or set intervals. To tell cron the tasks you want to execute, you’ll need to load a configuration file called a crontab. You can read more about it here and here. In any case, here’s what my crontab configuration file looks like.

MAILTO=ryankanno@CHANGE_TO_YOUR_EMAIL.com
# minute (0-59),
# |      hour (0-23),
# |      |       day of the month (1-31),
# |      |       |       month of the year (1-12),
# |      |       |       |       day of the week (0-6 with 0=Sunday).
# |      |       |       |       |       commands
  0      0       *       *       *      /usr/bin/python2.4 /home/USERNAME/scripts/svn-hot-backup.py --archive-type=zip --num-backups=10 /home/USERNAME/svn/REPOSITORY_NAME/ /home/USERNAME/backup/svn/

Create a file in your scripts directory called svn_backup_once_a_day.cron and copy the contents above into your file. I’ve setup my crontab to backup my svn repository once a day.

Notice, change the value of ryankanno@CHANGE_TO_YOUR_EMAIL.com to your email address (or comment the line out with a # if you don’t want emails sent to you), USERNAME to your Dreamhost username, and REPOSITORY_NAME to your Subversion repository.

Once you have this file called svn_backup_once_a_day.cron in your scripts directory, load the file into your crontab by issuing the following command:

$ crontab svn_backup_once_a_day.cron

As a FYI, this will replace your old crontab. If you have other items already running on cron, it’s a good idea to list them via the crontab -l command first. If you want to make sure that your cron will run, you can test it out by setting the values in the crontab to the time you want it to run. I’ll leave this as an exercise to the reader. :)

Storing your backups

Though out of scope of this blog, you’ll still have to store your backups somewhere. Please just don’t leave them in your Dreamhost account. Your best bet is probably to get an Amazon S3 account and store your backups there. Personally, I like to run another script immediately after the hotcopy finishes that pushes the backup to my S3 account. Other options include scp/sftp’ing the backups to your home machine. Here’s a link to read more about that option.

Voila! Enjoy!

Tagged: , , , , , , , , .


Powered by Wordpress. Stalk me.