Ruby
No, You Probably Don’t Need Ruby on Rails
Feb 12th
I’ve taken some flack before for being on the side of the fence that usually doesn’t favor the use of Ruby on Rails for small projects.
What have I got against Rails? Absolutely nothing! It’s my platform of choice for developing medium and large web applications.
But Rails is generally not a good fit for a small project, especially a blog or simple website. There’s many reasons why it isn’t, but some of the main ones are:
- Why re-invent the wheel? If you need a blog or simple CMS without a huge amount of complexity or customization WordPress and Drupal deliver nicely here. Even Joomla, if you feel brave enough to tackle that mess.
- Even with Passenger, deploying a Rails application is more of a hassle than setting up a WordPress site.
- Maintaining a Rails application is a commitment, not just a casual task. Rails depreciates things so quickly that means you will have to dig into the code from time to time to bring things current.
Now that’s not to say Rails can’t handle small projects, because it can, but if you want a set-and-forget type system for a small task, Rails isn’t it.
I deploy a Ruby on Rails-based project when I know I’m going to be maintaining that application for the long haul. It makes things so much easier in the long run for complex tasks, but you really have to commit to it.
The Rails community could help this by not depreciating support so quickly for older releases of code, and keeping updates fewer with more purposeful and thoughtful features that don’t break everything 2 versions back. Plugin and gem authors too need to be mindful of older releases of code, when possible.
This may work itself out as Rails matures (it’s come a long way already), but it still isn’t a good system for the casual website or project you can’t afford to babysit. This is a real shame, because Rails really has a ton of advantages over many of the other ways.
Hamilton C Shell 2009 – The Missing Shell for Windows
Sep 19th
Rather than get right down to the details with Hamilton C Shell 2009, I’d like to take a moment to give a bit of software history. The reason I feel this is imperative is that most people buying software today that didn’t use computers until just 3-5 years ago don’t know about the quality of software that used to exist. When you bought software, you got a big thick manual, a solidly built product that was meticulously optimized for speed and reliability, and a product that didn’t need an upgrade every few days or weeks via some sort of automatic upgrade mechanism because it wasn’t well tested and well delivered.
If you choose to buy Hamilton C Shell 2009, you’ll get such a wonderful product. That’s rare these days. I purchase quite a bit of software in my line of work, both for my own use, my companies use, and my client’s use. The quality of the non-open souce software that I’ve been obtaining has gone downhill considerably. Gone are the manuals and the optimizations. To keep the product running, I have to update it sometimes on a weekly basis.
When I first downloaded the demo of Hamilton C Shell 2009, I was wondering how I was going to really put its paces at 10 commands per session. I’d start digging in then have to restart it. However the author, Nicole Hamilton, was very helpful and kind and provided me a full copy for evaluation. Once I installed the full version, I was able to put it though quite a bit.
I should note first that I’m using Windows 7, x64 edition. I’m not sure if the product has been tested on this platform, but it works on all Windows platforms from modern editions back to Windows 95. You’d really be hard pressed to find any product for Windows that has such amazing backwards compatibility.
I do a lot of Ruby / Rails development, PHP work, and some occasional C programming as well, so I’m almost always in the shell when I’m in Windows. When doing Ruby work, I’ve found it easier to just use a Linux machine that I have setup for all of my programming tasks, mainly because of bash, my favorite shell, but also because many of the UNIX tools are there too.
That’s the interesting part about Hamilton C Shell though. It’s not as a UNIX emulator like Cygwin. The author states that she didn’t want to emulate UNIX, rather design a shell specifically for Windows. I’ll have to admit, at first, I wasn’t sure if this was a good thing or not, but my opinion quickly changed once I started using the product. I found myself using UNIX commands to navigate my Windows file system. Never before had I been able to do that natively. Sure, Cygwin let me do this on Windows, but not in Windows, natively working with the files and directories in the way that Windows deals with them, not trying to make them bend to the UNIX way.
Being the UNIX/Linux fan that I am, I really had trouble at first adopting to this paradigm. Soon though, I had sort of a software epiphany (and yes, you’re truly a computer geek if you have software epiphanies). I realized that all of my searching for the perfect way to balance the UNIX and Windows world was over, and it was finally time to quit making Windows do things it shouldn’t be doing.
It’s really rare for a piece of software to dramatically change my outlook on a platform or on how I do my daily tasks. This was the command prompt that I’d always been missing in Windows. Before I was trying to take bash, the proverbial square peg, and trying to make it fit into the roundish hole that is Windows. Little did I know the answer to most of my command prompt problems was there all along – since 1988!
The only learning curve I suffered with the product was in that I’m used to the GNU convention on some command line switches. For example, I’m used to clobbering together command line arguments without separate minus signs (i.e. ls -la instead of ls -l -a), but this isn’t a right/wrong way, it’s just different. The performance of the native utilities like tar is wonderful, and while I didn’t perform a proper full benchmark, it seems faster than the Cygwin emulation of tar.
One other item I noticed is that when firing up Mongrel on a Rails project, the CTRL+C didn’t work correctly to terminate it. I had to use the Task Manager in Windows to terminate it. No big deal really, I suspect it’s something simple to fix, and likely not Hamilton C Shell’s fault, or even Mongrel’s, but an artifact of the Windows Console. I’ll dig a bit deeper and figure out what’s going on there, but its a minor problem, and one that’s very easy to work around.
I was able to do all of my usual tasks while working with my files and with Ruby without any other problems, and got them done much more efficiently. I will have to dig into the manual a bit more to find out about customizing the prompt more to my taste, but I’ll get to this eventually.
This software has even got me to thinking about writing and/or porting some clones of commands that don’t exist in Windows yet, like rsync and top. Yes, I know you can use rsync with Cygwin, but it’s not the same. It’s not native to Windows. Before the author told me about her product, I would have said this was fine. Now I see it’s not, and it has honestly excited me about using Windows again. The author also told me that she’s working on adding full UNICODE and better UTF-8 support.
As for the price of Hamilton C Shell 2009, at first I thought it was a bit steep at $350 US. Then I realized that you really do get what you pay for here, and that this product is worth every penny of that price.
Even as I write this, I’m trying to think of the last time a software product changed a paradigm for me. It’s happened many times for sure, but not lately, and not anything on Windows in recent times. This review has honestly left me grateful to the author and to her product for breathing fresh air into the Windows console for me again.
Windows command line users and developers, your days of UNIX envy are over. You now (have had for nearly 20 years, I just didn’t realize it) have a command line to be proud of!
Install MySQL Gem on CentOS 5
Nov 13th
There’s a lot of conflicting information out there on how to install the MySQL gem on CentOS 5, but it’s very easy to do. On a clean CentOS 5 install, as root, run:
yum install mysql-devel gcc make gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
That’s pretty much it. Compile should work fine.
Can't activate rubyforge (= 0.4.5) problems
Jun 20th
If you recently updated your gems, you may see this nasty error:
can't activate rubyforge (= 0.4.5), already activated rubyforge-1.0.0]
or similar. If you do, the fix is simple. Simply run:
sudo gem uninstall -a rubyforge
Run the command twice just to be sure it’s removed. Then run:
sudo gem install rubyforge
This will clear up the issue.
Installing Ruby on Debian and Ubuntu
Feb 9th
While you can use the version of Ruby that comes with Debian and Ubuntu's repositories, you'll find it to be a bit out of date. It's probably fine for most usage, but if you're like me and like to keep Ruby and its gems up to date, you'll want to install it from source.
Fortunately it's easy. Simply run:
sudo apt-get remove ruby libruby libruby1.8 ruby1.8 irb rdoc ri sudo apt-get install libssl-dev libreadline-dev mkdir ~/sources cd ~/sources wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.gz tar xfz ruby-1.8.6-p111.tar.gz cd ruby-1.8.6-p111 ./configure --prefix=/usr make sudo make install
This will install Ruby. Now, to install Ruby Gems:
mkdir ~/sources cd ~/sources wget http://rubyforge.org/frs/download.php/29548/rubygems-1.0.1.tgz tar xfz rubygems-1.0.1.tgz cd rubygems-1.0.1 sudo ruby setup.rb
Now you can use gem install to install any gem you want. If you want to install RMagick, note the article RMagick on Ubuntu Gusty (the instructions also work for Debian).
This method of installing Ruby and Ruby Gems is completely portable, you can upgrade to the latest release of both easily by simply substituting the version numbers of the packages in the instructions above.
<!–break–>
RMagick on Ubuntu Gusty
Jan 17th
If you're trying to install RMagick on Ubuntu Gusty, you won't have much luck, as the new RMagick doesn't support the version of ImageMagick that Gusty currently has.
To install RMagick on Gusty, run:
sudo apt-get remove librmagick-ruby librmagick-ruby1.8 librmagick-ruby-doc sudo apt-get install libmagick9-dev sudo gem install rmagick -v 1.15.12
These commands assume you have Ruby and RubyGems installed already.
These instructions also work for Debian 4.