Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Using Flash 8 ExternalInterface for JavaScript Interaction

Jan 30

If you’ve done any Flash/JavaScript interaction then I’m sure you’re well aware of the different approaches you can take.  There’s getURL, fscommand, and the JavaScript Integration Kit.  While I’ve tried all three my new favorite is Flash 8′s ExternalInterface class.  This is by far the cleanest way to do Flash/JavaScript integration.

While this article goes into good detail of how to communicate in both directions, there’s one MAJOR piece missing.  I spent a good deal of time trying to debug my code thinking there was something wrong, but it turns out one of my object/embed parameters was incorrect.  Be sure to set the allowScriptAccess parameter to “always” because it’s set to “sameDomain” by default. I struggled with this in both Safari and Firefox.  After changing this parameter my code ran perfectly.

Read More

Dallas Building Implosion

Jan 29

This morning a good friend of mine invited me to watch a Dallas building get demolished. Unfortunately I didn’t get to witness the event in person, but was able to catch it on channel 5 news. Luckily I was able to Tivo the implosion and am posting it here for your enjoyment.

The implosion took place about 5 miles from our house and we could hear the explosions from our house. It was pretty cool to watch it on TV and then hear the delay as it came through our living room.

Supposedly the largest Whole Foods Market in the country will be built at this location. That’s pretty exciting news and what’s even more suprising is that it will be open in just over a year.

The video file runs about 7.5MB and lasts approximately 3 minutes. I ran it through FFmpeg to bring the size and quality down because the original was well over 600MB!  Please forgive the spotty audio since I’m trying to master FFmpeg’s audio settings.

[kml_flashembed movie="http://www.db75.com/videos/implosion_012906.swf" height="285" width="325" /]

Read More

Ruby on Rails Command Line Access

Jan 29

I’ve been digging around for a while trying to find a way for Ruby on Rails to access the command line. To be more specific, I’ve been trying to get RoR to kick off an FFmpeg process. My objective has been to allow video uploads through a rails app and then kick off a process to convert the file to flv format.

Luckily I stumbled across this post where the author was using RoR to perform mysql database functions. I created a function that calls the ffmpeg process to encode an uploaded video. The function looks like:

def encodeVideo opts, stream
IO.popen(“ffmpeg #{opts}”, ‘w’){ |io| io.puts stream}
end

A pipe is opened and written to in the form of a command. Options are then passed to the function that tell it which video to encode, the encoding options, and the output file. The call looks like this:

encodeVideo “-i /home/dennis/swing.avi -ar 22050 -ab 64 -f flv -s 320×240 /home/dennis/swing.flv”, <<-END

If you’ve experimented with accessing the command line from other web frameworks you’ll see that it doesn’t get much easier than this. Kudos to Sam for showing me the light.

Read More

Using mysqlimport with CSV Files

Jan 28

It’s been a good while since I’ve imported data into mysql using the command line.  In the past I’ve used the load data infile syntax, but this time decided to use the mysqlimport client instead.  The raw data from the csv file looked like the following:

“Microsoft”, “MSFT”
“Macromedia”, “MACR”
“Google”, “GOOG”

and to actually parse this data and load it into mysql I used the following command:

mysqlimport –fields-enclosed-by=’”‘ –fields-terminated-by=’,’ –lines-terminated-by=”\n” –columns=name,symbol –user=root stocks nasdaq.csv

Also note that the name of the database was stocks and table was nasdaq.  The mysqlimport client automatically looks for a table name that matches the name of the file….before the extension.

Read More

Microsoft Expression Graphic Designer

Jan 26

I stumbled across this ZDNet article talking about the beta versions of Microsoft’s next generation of designer tools.  While I’m a huge fan of Macromedia’s and Adobe’s web tools, I decided to download Microsoft’s Expression Graphic Designer.  It seems to be very functional and have all the sorts of features you’d expect in a graphics package.  One cool thing that I noticed at first glance was a thumbnail tooltip that pops up when you mouse over a layer in the layer list.  This is extremely useful to know what layer you’re referencing without actually having to show & hide it.

The Expression Designer will probably never run on the Mac OS so I’ll be sticking to Fireworks and Photoshop.  It will be interesting to see what type of market share Microsoft will gain in the web design arena.  Most serious designers/developers stick with Macromedia and Adobe tools.

The beta version is free to download so give it a run.  I can’t see M$ charging more than $300 for the designer once it goes commercial.  This would put it at a price point that would make it more approachable than Photoshop, which currently runs around $650.

Hopefully this announcement means I’ll never have to look at a piece of Frontpage code again!

Read More