Posted on January 24th, 2008
A while back I wrote about using Ruby on Rails to develop noise reduction headphones. Tonight, we made the move to the Zend Framework. We did this for a variety of reasons including the fact that we are now hosting our site on a dedicated server with RackSpace. RackSpace is the absolute best hosting company on the planet provided you can afford their rates. RackSpace does not “officially” support Ruby on Rails. This was one of the significant factors in choosing the Zend Framework. Check back soon and I will have a fairly comprehensive comparison of our experience in developing an ecommerce website with the PHP Zend Framework versus our experience building the exact same site with Ruby on Rails.
In the meantime, we have two new products on the website. By popular demand, we now have an amazing set of speakerless noise reduction headphones. We also have a great budget set of noise canceling headphones that are smaller than our premier EX-29 Extreme Isolation Headphones. This makes them great for travel!
Posted on January 17th, 2008
I have been writing several Zend_View_Helpers to aid in the development of my Zend Framework Application. The helpers are very generic and are used in many of my Views throught my applications. So, naturally, I want an easy way to configure my Views to have access to my custom View Helpers. You don’t want to override the init() function in ALL of your controllers to set the View Helper path. Instead, set it in the bootstrap file – your index.php file in the root directory of your website. You do it like this:
$view = new Zend_View();
$view->addHelperPath("DU/View/Helper", "DU_View_Helper");
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
Put those lines of code in your index.php file somewhere before you call dispatch() on your front controller and all of you view scripts will have access to your own library of View Helpers.
My company’s name is Digital Underware so I have my library set up just like the Zend library in the lib directory of my application. The path to my View Helpers is lib/DU/View/Helper just like the path to the built-in Zend View Helpers is lib/Zend/View/Helper.
If you are interested in seeing a complete example, take a look at this bootstrap file.
Posted on January 8th, 2008
I was trying out a plugin in my Ruby on Rails application and decided not to use it. Apparently, when I installed the plugin, a reference to it was added to my subversion repository. Since the reference was not to a working directory, my capistrano deployments got debackled and died. Here is how you can remove external repositories from subversion.
If you get a message like this one when you are working with subversion:
Fetching external item into 'vendor/plugins/...'
Change directories so that you are in the root of your Rails application and issue the following command:
svn propedit svn:externals vendor/plugins
A list of the external plugins will appear in your default editor. Mine is vim. Delete the link that you no longer want, save the file and commit your changes.
Posted on August 29th, 2007

I have been using vim for a couple years and every week it seems I learn some new feature or trick you can do. Recently I learned how to convert a selection to either all uppercase or all lowercase letters.
Convert a visual selection to all uppercase letters.
gU
Convert to lowercase letters
gu
Posted on August 20th, 2007
I have been developing PHP applications professionally for over 7 years. About a year ago, I decided to try developing some Ruby on Rails applications. My main Ruby on Rails projects have included an e-commerce site QuietHeadphones.com and an online application for synchronizing medical records with USB thumb drives. Of course, I have also worked with the Ruby on Rails blogging engine Mephisto which is what runs this website. So while I have worked with PHP for more time than I have worked with Ruby on Rails, I have worked with Ruby on Rails long enough to have noticed some significant differences between the two languages. My comparison is going to focus on the language differences between PHP and Ruby and not as much on the Rails framework.
Read the rest of this entry »
Posted on August 5th, 2007
I have a custom little utility that I wrote that uses ImageMagick and Zenity to take a screen shot. I have the script hooked up to Z keyboard command. This is the bash script.
#!/bin/bash
fn=$(zenity --entry --title='File Name' --text='File Name Prefix');
dt=`date '+%Y%m%d'`;
screenshot="/home/USERNAME/Desktop/$fn-$dt.png";
import -frame +repage $screenshot;
Be sure to change USERNAME to your actual username so the path to your desktop will be correct. Also, for the sake of your sanity, please note the +repage switch that we pass to ImageMagick’s import command. Without that, Gimp will be very unhappy with the offset of the PNG. The layer will appear outside of the image and you won’t be able to see your screen shot in Gimp. If you happen to have that problem already, you can zoom out in Gimp, then use the move tool to drag your image back into view.
The screen shot utility, when invoked, will first prompt you for a little file name prefix using zenity. That prefix will have a date appended to the end of the saved file name. So, for example, if you ran this script today and typed in “receipt” as the file name prefix, the final saved image will be named “receipt-20070804.png” since today is August 4th, 2007. After typing in your file name prefix, you will see a + style cursor. Either click on a window or click and drag a selection on your screen to take the screen shot. The sreen shot will be saved to your desktop.
Posted on August 1st, 2007
My scanner (Canoscan N676U) suddenly stopped responding when I upgraded to Ubuntu Feisty. I first noticed the problem when I was unable to import a scan through Gimp. Well it took a couple hours to figure this one out, but the sollution turned out to be easy to implement. From what I understand, the problem comes from the USB suspend functions built into the new kernel. I also understand that this isn’t just an Ubuntu problem. So if you are on another distro, this tip may work for you also.
Read the rest of this entry »
Posted on July 20th, 2007
I’ve been asked several times how I have my Ruby on Rails development environment set up. The most frequently misunderstood aspect of a Rails development environment is that you do not have to have your Subversion repository physically located on the same server as your deployed application. The only requirement is that all the pieces of your development environment puzzle need to be able to access one another over the internet. So, here’s how I have myself setup. It works on both linux (Ubuntu) and Windows XP.
Read the rest of this entry »
Posted on June 13th, 2007
If you are using ISPConfig to manage the virtual hosts on your web server, you will notice that there is no way to separate SSL vs non-SSL Apache directives using the standard web interface. This is a problem if you are writing Ruby on Rails applications and proxying requests through Apache to a Mongrel cluster because Mongrel won’t know what type of requests it is receiving. Being behind the proxy, Mongrel doesn’t know if the original requests are coming via HTTP or HTTPS. The solution is to add RequestHeader set X_FORWARDED_PROTO ‘https’ as a line in your Apache virtual host configuration for the SSL virtual host. I will tell you how to get ISPConfig to handle that for you. I will also show how to get GoDaddy.com ssl certificates working and how our Apache 2.0 randomized proxy balancer works.
Read the rest of this entry »
Posted on June 11th, 2007
I manage serveral servers and – for the most part – they are all set up using the Perfect Setup for Ubuntu. Overall the setup is great, but I have been noticing a very annoying delay when trying to log in via FTP. Everything works, but when I initially connect, 5 – 10 seconds pass by before I’m prompted for my login credentials. After many hours of pain and sadness, I finally discovered the solution.
Read the rest of this entry »