I just signed up for a slicehost account today and am trying to setup my new server according with the deprec capistrano recipes according to the free bonus peepcode video: Building a Full Rails Stack on Ubuntu 6.06.

The first capistrano task you have to run is really hard to read since the free video download is pretty poor quality, so you can’t read the underscores very well at all.

cap setup ssh keys

should be

cap setup_ssh_keys

running it the wrong way got me the error

command "sudo  chgrp -R deploy /var/www/apps/rails_app" failed on www.servername.com

If you haven’t been doing test driven development, and you should be, you may not be sure how well tested your rails application is. You can use rake stats to get your code to test ratio, but that only gives you a general sense of how you’re doing, but just knowing that your ratio is 1.0 to .7 doesn’t really ensure anything. You can write some tests in one line that test dozens of lines of code fairly well.

This is where using rcov comes in to save the day. Thankfully Coda Hale has written a rails plugin to make running rcov on your projects super easy. The instructions on his page tell you to install rcov by downloading it, but there’s a prepackaged gem that makes installation even easier. Let’s install it:

gem install rcov

Now Coda Hale recommends installing the plugin using -x to add and svn:externals entry, but I can’t stand having svn:externals since every time I want to update or commit I become dependent on someone else’s svn repository. You’re better off using piston if you need to keep your plugins up to date. So go ahead and run:

ruby script/plugin install http://svn.codahale.com/rails_rcov

Now you’re pretty much done for installing. Just run rake with a little change

rake test:units:rcov

You’ll now find a folder in your rails project called coverage. Look in there and find the index file and open it up. You now can see how well covered all your models are. If you open the individual model coverage file you can see exactly which lines aren’t covered and begin writing tests for them. There’s other options you can pass to rcov too, so take a look at the documentation if you want to get fancy. The only other command I run is

rake test:functionals:rcov RCOV_PARAMS="--sort=coverage"

So the difference there is I’m testing the controllers with functionals instead of the models with units and sorting the output by code coverage. This way I can easily see the models and controllers I need to do the most work on.

I thought this would be easy, and it was – once I figured out one little thing. You’ll probably come across Microsoft’s KB Article 236621 which got me most of the way there. The second method listed says to search the registry and replace all instances of “Documents and Settings”. This works fine if you’re just moving the folder to somewhere else on the same drive with a different name. However I wanted to move all the user profiles from the C drive to the same folder name on the D drive on a terminal server.

First of all, trying to do this with the regular old regedit program is awful since it doesn’t do search and replace. I found a free program called Blade’s Registry Replacer that worked great for doing search and replace on the registry and generating an undo file.

Now that you’ve got that you’ll want to replace all instances of “C:\Documents and Settings” AND all instances of “%SystemDrive%\Documents and Settings” (this is the part I was missing earlier) with “D:\Documents and Settings” or whatever you want to call the folder on the D drive.

I don’t know what possessed me to upgrade before this is technically even in beta, but Kubuntu’s update manager asked if I wanted to with a nice easy to click ‘yes’ button. What’s it doing tempting me like that? For a prebeta it went pretty well. It had to download over a Gig of new files. Once that was finally done it started installing, and something went wrong. It then notified me I needed to reboot. I wish I hadn’t.

kernel panic : not syncing; VFS: Unable to mount root fs on unknown-block(0,0)

I found tons of articles on google, but it took a while to find something helpful. Finally I found the following advice:

  1. boot from live cd
  2. open a terminal
  3. mkdir /mnt/linux
  4. mount /dev/hda1 /mnt/linux
  5. chroot /mnt/linux /bin/bash
  6. mount -t proc /proc /proc

What this does is essentially give you a terminal working on your hard drive that isn’t booting. From there I just ran

sudo apt-get dist-upgrade

to finish the install process, and amazingly linux boot up and the new artwork looks very nice. So far every time I’ve upgraded Ubuntu it breaks my wireless, so I’m getting pretty good at fixing it. My built in wireless card on my Inspiron 9300 is Network controller: Broadcom Corporation BCM4309 802.11a/b/g (rev 03). I have to use ndiswrapper to install drivers. Running

ndiswrapper -l

showed the driver was still installed but running but iwconfig had the incorrect card showing. Thank goodness for ndiswrapper’s driver list that took me forever to find before. It has links straight to the driver downloads. I figured I’d reinstall the drivers, but once I did running dmesg showed

bcm43xx: Error: Microcode "bcm43xx_microcode5.fw" not available or load failed.

Looks like the new wireless drivers I downloaded needed a newer firmware. I found running

sudo aptitude install bcm43xx-fwcutter
sudo /usr/share/bcm43xx-fwcutter/install_bcm43xx_firmware.sh

took care of that for me. Phew. And now I’m running Feisty Fawn with working wireless. I’m not seeing a lot of differences so far, but this is the first thing I’ve done.

There’s a great article that touches on something I mentioned in my previous Linux post. While I usually perceive a benefit from being able to endlessly tweak Linux, sometimes I don’t and very few other people ever will. Kathy Sierra makes the best graphs and graphics for her article, and one that applies here is the “Is your product worth the users effort?”. The perceived payoff for Linux is still fairly low, and the learning curve very high. While the perceived payoff for upgrading to Windows Vista might also be low, at least the perceived learning curve and pain is also low.

Some free Linux distribution really needs to address the “canyon of pain” that users have to cross to make the switch. As much as advanced users often hate things like wizards, something like this could really help out a lot of new Linux users. Or even something as silly as the welcome to Windows movie that comes with new Dells. I can’t wait to get these things turned off considering I’ve bought and built dozens to hundreds of computers in my work, but when I hand over those new computers to users who aren’t computer savvy, the first thing they really want is desktop icons linking to tutorials. For most users just learning how to check their email would be kicking ass on a new operating system, forget about piping commands or using awk.

I know something I’d love to see is a bunch of peepcode style screen casts that come preloaded. I’ve been loving these things lately for learning some Rails stuff even though I already most of the stuff in them. I wish I had known about them before to save myself hours of combing through blog articles and api documentation to get the basic concepts. The articles and API documentation are great for reference once I understand basically what I’m doing, but man are they a slow way to feel like you’re ready to kick ass. And that’s exactly where new windows users are. There’s plenty of articles and forums out there, but they take a long time to wade through. Even some great concise places like ubuntuguide are great for getting software installed, but past that you’re pretty much on your own.

In summary, all the control users have in Linux is great in the long run, but there needs to be a way to easily just get new users started that doesn’t leave them feeling overwhelmed and lost.

I’ve been running mostly Ubuntu Linux for a few months now and am finally starting to feel comfortable with it. I can navigate around in the command line better than I used to in DOS, and after using vi a few times without getting stuck and unable to even close it, it doesn’t seem totally bizarre. I’ve decided that I much prefer KDE to Gnome, even though I initially liked Gnome better. I think just figuring out how to turn off single clicking opening crap in KDE helped a lot. Things that I like better than Windows

  • It’s faster. Booting is faster. Logging on is faster. Doing a lot of things from the command line is faster – once you get used to it.
  • Things are endlessly tinkerable (I’m sure that’s not really a word) and more transparent. Everything seems easy to explore and I have more control. There’s no windows warning telling you not to view files in the Windows folder. There’s no place where you can’t see how the pieces fit together if you spend enough time looking, even if upon deciding you would like to view the source code you’re hopelessly lost.
  • I have more choices for the most part. More choices in software, more choices in look and feel.
  • It’s free and open source. It’s a kind of freedom most people don’t even know is important yet.

I actually realize that the middle 2 things may not even be a positive for some people. I can understand that. Most people just want their computers to solve problems in other areas. They want important tools to be obvious and chosen for them without spending a lot of time learning them or tinkering with them. Sometimes that’s true for me as well, which brings me to my next list. Things I don’t like better

  • The wireless support sucks!. And people can’t just cop out and complain about driver makers not supporting Linux, cause even the UI is bad. It’s so much better than it was last time I tried it thanks to Network Manager, but it’s still somewhat painful. Even once you get Network Manager working properly, you have to type in your root password and either your WEP password or your keyring password every dang time you logon. And lately I have to log on to Gnome to get wireless running before I logon to KDE since something went wrong with KDE’s wireless utility, even after I’ve uninstalled and reinstalled it.
  • Tax software unavailable. I just realized this as I’ve started my taxes. Not Linux’s fault, but lame all the same. Most Windows software has a Linux alternative. I think the government should write an open source web based version anyway, but that’s for a different rant.
  • Cryptic file system. Most people take a long time to learn that there’s such a place as a Documents and Settings folder, or a Programs folder. Moving to Linux it’s home, and usr, or maybe opt or maybe somewhere else. Honestly, why hasn’t Linux come up with a file system naming scheme that’s a little easier to understand? Once you know your way around, which I’m just beginning to, I suppose having shorter folder names would be nice, but the command line autocomplete really renders that argument lame. How the hell do people look at folders with names like lib, proc, mnt, etc (and I mean the etc folder not etcetera) and know what in the world is in them! Rant done.
  • General unfamiliarity. This is getting better for me, but I know most people will consider this one of the biggest stumbling blocks.

I use Linux for between 80 and 90 % of everything computer related now, both at home and at work, switching back to windows occasionally to use Active Directory, Yahoo Music or do taxes and such. As much as I love the ideas of breaking Microsoft’s monopoly with free and open source software, I still just don’t see people having enough compelling reasons to switch. Even though Linux is easier to setup than ever before, and man do I mean easy even when compared to Windows, almost nobody installs Windows themselves! If Linux came preinstalled with some decent defaults, it would be a whole different story. The free price tag isn’t even a benefit for almost anyone because they’re going to pay for Windows anyway with almost every new computer.

I’m hoping to be without Windows by my next computer, except in the form of a virtual machine if necessary. Having switched over feels good now that I’m mostly done with the process, but the process isn’t easy or comfortable. Neither are a lot of other things that are good for you :–)

I’m currently working on a sort of cookbook rails application for my wife, who is in culinary school, and just for fun. I’ve just started, but I’m feeling fairly ambitious with plans for searchable and rateable recipes, automatic food costing, meal planning and maybe nutrition information. Heck, maybe I’ll even open source it or sell it as a subscription service.

However, I’ve barely begun and quickly run into a problem: how to deal with all those crazy imperial units! Pounds or lbs, ounces or ozs, floz, cups, quarts and everything else with weird abbreviations and conversion systems that suck. Of course, like most problems, somebody else out there already has a great solution. Kevin Olbrich at SciWerks.com has created Ruby-Units.

gem install ruby-units

At first I wasn’t sure I liked the way it used strings to create Units, but after a bit of use I really started to dig it, especially when I saw you could put in mishmash units like happens so often in cooking.

"4lbs 6oz".unit # => 4.375 lbs
"4pounds 6oz".unit # => 4.375 lbs

Also very cool and helpful to me was the ability to check to see if units were compatible with each other.

"2 cup".unit.compatible? "qt".unit # => true
"2 cup".unit.compatible? "lb".unit # => false

One of my only complaints/problems with this so far is that I don’t see a built in method to return all compatible units. If there was one, I imagine that it would work like this:

"2 cup".unit.compatible_units # => ["tbsp", "tsp", "pint", "qt", "gal"] etc

Also I may need to at some point build in my own conversions for specific food types. For example, 1 gallon of water = 8.33 pounds. I’m not sure how easy these sort of conversions will be to implement.

There are a few other unit libraries for ruby that I found. There’s a package simply called Units that doesn’t look like it’s active anymore, but it did have some documentation right up front about adding conversion types. There’s also the Ruby Facets libraries, but I haven’t looked through them much yet. They only mention SI units, so I don’t know if they support Imperial units.

I figure it’s time for me to start a blog for tech stuff only, and separate that stuff from my personal blog. My friends and family never really cared about my Rails posts, although a very few were interested in the Linux stuff. Plus this will give me a chance to play with actually having a hosted rails app, and the price couldn’t be beat – FREE! I don’t know how hostingrails.com can offer such a great deal, especially for something that seems as complicated and memory hungry as a rails deployment, but I’ll take it, along with this sweet domain name that I’m surprised isn’t bought or parked by one of those annoying domain parking companies.

So far the first step has been setting up Mephisto as a blogging engine. It looks interesting, but I’m not sure I like it better than wordpress yet. I failed miserably installing it at first because I tried to load the schema myself instead of running the recommended ‘rake db:bootstrap’. For such a young blogging system it does look very mature though.