Steve Ross Kiting with Mike Campanaro and Fred Wasson in the Florida Keys at Anne’s beach and Whale Harbor. All Shot on the GoPro 2.

Check out: All Out Kiteboarding
Shinn Kiteboards
Switch Kites
Mike Campanaro

Kiteboarding in Savannah

March 1st, 2012

A few shots from a very windy day in Savannah with the new GoPro 2

I upgraded to lion and in process postfix (for just sending mail via localhost ie: programatic mail etc) was broken. So I googled and saw that you needed to add a “submit.cred” file. That’s true if you use the out of the box setup but, if you just want to relay mail go and edit your /etc/postfix/

comment out:
imap_submit_cred_file = /etc/postfix/submit.cred

add the following to the bottom of the config:
mydomain_fallback = localhost
message_size_limit = 10485760
myorigin = localhost
inet_interfaces = loopback-only
local_transport = error:local delivery is disabled
mynetworks =

now stop/restart postfix:
sudo postfix stop (if you are running it as a daemon it will auto restart)
sudo postfix start

you should be all set!

It turns out after hours of searching and trial and error that this task is relatively simple.

In your controller you simply do this:

$session = Mage::getSingleton('core/session');
$session->addError($this->__('My error Message'));

in your template file you then call the message like this:

<?php echo $this->getMessagesBlock()->getGroupedHtml(); ?>
I recommend creating some helper methods you can call in your controller:
    private function add_error($error)
        $session = Mage::getSingleton('core/session');

    private function clear_errors()
        $session = Mage::getSingleton('core/session');

A co-worker of mine commented that Tortoise has an easy way to export out the diff between two revisions and wondered if there was an easy way to do this on his mac. I replied “well you could write a script to parse an svn diff”. So here it is, ready for you to snag from github.

Instructions attached below from the README in github.

This file is designed to export the files that were modified or added between two svn revisions. It will output a corresponding zip file with the directory structure intact. Useful for when you need to push code but the server you are pushing to doesn’t have access to your repository.


It is reccomended that you set this to executable and add it to your path in your .profile (otherwise you will have to copy it to each repo)


OSX is not required but, it is a requirement that “svn” and “zip” are installed in the OS.


cd [/repo_root]

export_changes.rb 1550:1560


Annoyed that the Flex Keyboard shortcut reference was multiple pages, I recreated this so I could print it out and hang it on the wall.

Download Flex Shortcut Reference

Coldfusion Help ⌥⌘L

This command is bound to option-command-L (lookup). Simply click on a coldfusion method (function) ie: StructAppend or a tag and you will be taken to the help documentation for that tag or method.

There are support files required for this command which includes all of the html help for Coldfusion (the same html files that are part of the Homesite Help files for CF 8 Download). You can download just the part that is needed and extract them to the html folder in your Downloads folder as it is looking for the files in ”~/Downloads/html”

Go to File ⌥⌘G

This command is bound to option-command-G (goto) Simply click on a line that has a cfinclude, a javascript script src tag or a css link rel tag and whether it is a relative link ”../somefile.css” or if it is a link off of the root of your project (a project must be defined for this to work) the file will open after you execute the command.


You can grab the files here Steven Ross Bundle and The Help documents for ColdFusion 8

Ok ignore the title, SQL is all business so lets get back to the “serious” SQL train.

So maybe you have a table that is very flat, someone did something like data1, data2, data3 as column names and you want to loop over it and insert it into a new table that can hold an infinite amount of meta-data with a relationship. Hey after all we are programming with relational databases these days.

So here are the basics, the loop (from 1 to 10):

SET @intFlag = 1
WHILE (@intFlag <11)
SET @intFlag = @intFlag + 1

So that is useful and all but, how do we create some dynamic sql with lovely concatenations?

Like so:

Declare @SQL VarChar(1000)
Select @SQL = 'INSERT new_table_name(description, status, date_due, date_complete, date_start, ref_id)'
Select @SQL = @SQL + ' SELECT descrip' + CAST(@intFlag AS varchar) + ', status' + CAST(@intFlag AS varchar) + ', due' + CAST(@intFlag AS varchar) + ', complete' + CAST(@intFlag AS varchar) + ', start' + CAST(@intFlag AS varchar) + ', old_id'
Select @SQL = @SQL + ' FROM old_table_name'
Select @SQL = @SQL + ' WHERE required_column' + CAST(@intFlag AS varchar) + ' IS NOT NULL'
Exec ( @SQL)

So now we just combine it all:

SET @intFlag = 1
WHILE (@intFlag <11)
Declare @SQL VarChar(1000)
Select @SQL = 'INSERT new_table_name(description, status, date_due, date_complete, date_start, ref_id)'
Select @SQL = @SQL + ' SELECT descrip' + CAST(@intFlag AS varchar) + ', status' + CAST(@intFlag AS varchar) + ', due' + CAST(@intFlag AS varchar) + ', complete' + CAST(@intFlag AS varchar) + ', start' + CAST(@intFlag AS varchar) + ', old_id'
Select @SQL = @SQL + ' FROM old_table_name'
Select @SQL = @SQL + ' WHERE required_column' + CAST(@intFlag AS varchar) + ' IS NOT NULL'
Exec ( @SQL)
SET @intFlag = @intFlag + 1

Ask away if there are any questions.

OOP - it's not perfect

March 13th, 2009

Ok, not trying to start a flame war but, I’m republishing this, it was from an interview with Rob Pike (works for google, really smart, had his hands in the early days of Unix). This is a great response to a question posed to him and for the record the original article is here Rob Pike Responds but, I am just publishing one part of it. I’d encourage you to read it as we should always try to solve a problem the best way possible and that is what this is about.

Question Hello!

Maybe this is an overly-asked question, but I still often ponder it. Does object-oriented design negate or diminish the future prospects of Unix’s continuing popularity?

I’ve developed in C (which I still love), but lately, I’ve been doing a lot of purely object-oriented development in Java. Using things like delegation and reusable classes have made life so much easier in many respects. Since the *nixes are so dependent upon C, I was wondering what future you see in C combined with Unix. Like I said, I love C and still enjoy developing in Unix, but there has to be a point where you build on your progress and the object-oriented languages, in my opinion, seem to be doing that.

Thank you for all your contributions!!!


The future does indeed seem to have an OO hue. It may have bearing on Unix, but I doubt it; Unix in all its variants has become so important as the operating system of the internet that whatever the Java applications and desktop dances may lead to, Unix will still be pushing the packets around for a quite a while.

On a related topic, let me say that I’m not much of a fan of object-oriented design. I’ve seen some beautiful stuff done with OO, and I’ve even done some OO stuff myself, but it’s just one way to approach a problem. For some problems, it’s an ideal way; for others, it’s not such a good fit.

Here’s an analogy. If you want to make some physical artifact, you might decide to build it purely in wood because you like the way the grain of the wood adds to the beauty of the object. In fact many of the most beautiful things in the world are made of wood. But wood is not ideal for everything. No amount of beauty of the grain can make wood conduct electricity, or support a skyscraper, or absorb huge amounts of energy without breaking. Sometimes you need metal or plastic or synthetic materials; more often you need a wide range of materials to build something of lasting value. Don’t let the fact that you love wood blind you to the problems wood has as a material, or to the possibilities offered by other materials.

The promoters of object-oriented design sometimes sound like master woodworkers waiting for the beauty of the physical block of wood to reveal itself before they begin to work. “Oh, look; if I turn the wood this way, the grain flows along the angle of the seat at just the right angle, see?” Great, nice chair. But will you notice the grain when you’re sitting on it? And what about next time? Sometimes the thing that needs to be made is not hiding in any block of wood.

OO is great for problems where an interface applies naturally to a wide range of types, not so good for managing polymorphism (the machinations to get collections into OO languages are astounding to watch and can be hellish to work with), and remarkably ill-suited for network computing. That’s why I reserve the right to match the language to the problem, and even – often – to coordinate software written in several languages towards solving a single problem.

It’s that last point – different languages for different subproblems – that sometimes seems lost to the OO crowd. In a typical working day I probably use a half dozen languages – C, C++, Java, Python, Awk, Shell – and many more little languages you don’t usually even think of as languages – regular expressions, Makefiles, shell wildcards, arithmetic, logic, statistics, calculus – the list goes on.

Does object-oriented design have much to say to Unix? Sure, but no more than functions or concurrency or databases or pattern matching or little languages or….

Regardless of what I think, though, OO design is the way people are taught to think about computing these days. I guess that’s OK – the work does seem to get done, after all – but I wish the view was a little broader.

Been working a lot with rails lately and I needed to import a large dataset (almost 3200 records). If you do something like this in rails you have to use the fastercsv gem, as, well it is faster. The thing is though, ActiveRecord isn’t. So although I can read the csv file in about 2-3 seconds creating the records ends up taking about 10-12. I didn’t really like this performance wise so I poked around on the web and found this method using “LOAD DATA INFILE” – a feature in mysql that lets you specify a csv to load and map to columns and boy, it is fast. The whole process takes about as long as it takes fastercsv to read the file (2-3 seconds now).

So here is the method:

def fast_import
    csv_string = FasterCSV.generate do |csv| 
      FasterCSV.foreach( absolute_path, {:headers => true, :return_headers => false, :header_converters => :symbol} ) do |row|
        csv << [row[:firstname],row[:lastname],row[:doctor_name],row[:homephone],,row[:insurance],row[:mi],row[:dob],row[:address1],row[:address2],row[:city],row[:state],row[:zip],row[:id],row[:salutation],row[:survey_result_code] ]
    tmp_file = absolute_path + '.tmp', 'w') {|f| f.write(csv_string) }
    system("rm", tmp_file) # remove the temp file

def load_data_infile(temp_path)
                 LOAD DATA INFILE "#{temp_path}" 
                          INTO TABLE attendees
                          FIELDS TERMINATED BY ','
                             (first_name, last_name, doctor_name, home_phone, event_id, insurance, middle_initial, date_of_birth, address, address_continued, city, state, zip_code, barcode_id, salutation, survey_result_code)
                            SET created_at = '#{Time.current.to_s(:db)}',
                            updated_at = '#{Time.current.to_s(:db)}';

Ok all we are doing is using fastercsv to parse the uploaded file, read it and then write it back to the disk so that mysql can import it. The first method is rails specific but the second could be used in any language as it is really just some mysql code. It is pretty self explanatory. If you need some help getting it working, just leavea comment!

Well St. Pats is officially on its way and just in case you haven't heard Savannah is crazy for St. Patrick's Day. Check out the video of the fountain being dyed green.

Learning git? This might help.

February 24th, 2009

I stumbled upon this after browsing some podcasts on rails the other day. The learning rails podcast has an episode on git (a distributed version control system). If you have heard the buzz (git is basically the new SVN, at least in hype). Go check it out

Quick tip for mysql speed

February 23rd, 2009

I was doing some query tuning the other day (live search on a page and I needed it to go as fast as possible) I was searching about 3000 records and seeing how much performance I could squeeze out of mysql and a simple LIKE search. Put it simply if you want the most fastest (yes I just said that) you need to switch your tables from InnoDB to MyIsam because MyIsam doesn’t use transactions. Could be a no go for you but, if you need to do a fast search against the db it is your best bet. I saw my searches improve in speed about 2-3 times (however your mileage may vary).

Ok, this is directed at a fan, well 3 comments to my dribble, I consider that a fan, hah! Anyway, Diane posed the question in response to my kitesurfing experience: “Where do you get the time?” So I thought heavily about the question (really I didn’t, I immediately knew the answer). The answer is simple, I consider my free time more valuable than anything else and one day while I was working on-site in Cleveland, OH I was telling someone about kiteboarding. Then it just struck me, why haven’t I taken lessons? It was something that I wanted to try the first time I saw it and I just let it fester in the back of my mind. So I did it, I made a call and scheduled a lesson, end of story.

So the long and short of it is that I just figured that at the end of my life I don’t want to say “I wish I had tried that” so I don’t, I just try it and man am I ever glad that I did. Well there is one drawback, kiteboarding is like crack apparently and I am hooked!

So here is an update from my kiteboarding experience: I can now jump, do back rolls (sort of an off axis flip/360) and this cool thing called a railey. Ok, now when I say jump I really mean fly, because a jump is probably a few feet off the water and with the kite attached to you on a windy day (like yesterday) my “jumps” were 20-30 feet off the water.

I’m also on twitter now so give me a follow if you want. Adios!

If you use rails, or are considering it, it just got a whole lot easier to deploy using apache and mod_rails a.k.a Phusion Passenger

I think the best part of the experience was the installer, if you have ever compiled anything on linux you know it can be a pain when you don’t know if you have the required libraries. So the Phusion Passenger folks wrote their installer in ruby and it tells you what is missing (if there is anything). Sweet stuff.

Its much easier than running on mongrel, especially dealing with restarts and reboots (if you ever have to reboot, typically apache is already configured to start on startup). So how to restart an app? no shutdown you just navigate to the rails directory and issue a “touch tmp/restart.txt” next request the app will restart. Slick, wish everything was that simple.

So all in all (with out ruby enterprise) it took me 15 mins to install it and switch all my apps over from Mongrel to Phusion Passenger.