26 December 2007

Ruby's require is lacking

I wrote a Ruby gem recently and named the gem 'publication_search'. It contained a single module called 'Publication' which, in turn, contained a class hierarchy. One such class was named 'Search'.

To use this gem, once it is installed, one could type within a Ruby program or the irb:
gem 'publication_search'
require 'Publication'
p = Publication::Search.new()
The problem is that in Ruby on Rails, one may decide to define a model (a class) called Publication. If you then try to use my publication_search gem you'll get all sorts of errors. The issue is that because of the way that classes and modules are stored internally by the Ruby interpreter you cannot have a module and a class with the same name. (See this blog entry for the details.)

The solution in this particular case is to rename the gem's module to something that is non-conflicting such as 'PublicationSearch'. But that's short-sighted because what if a Rails developer now wants to have a model named...you guessed it...PublicationSearch? The problem would be back.

It's not reasonable to rename the gem's module since the gem could be used widely in many different applications but the Rails app. only exists in one place even if it is distributed widely. It's also not reasonable to ask the Rails developer to rename his model so as not to conflict with the gem's module name.

Coming from the Python world, this kind of module namespace clash is a non-starter because you would simply write something like:
import publication_search.Publication as PubSearch
p = PubSearch.Search()
and this aliases the entire module as PubSearch. (You could alias it with whatever name you wanted -- I chose PubSearch.) From my research there does not appear to be anything analagous in Ruby. (If I am wrong, PLEASE let me know.)

17 December 2007

Goodbye Ubuntu

Ubuntu failed to run my VMWare images. That was a death sentence for Ubuntu for my laptop computer. It failed in other areas too which were not really its fault. XP went back onto my computer at 9am this morning. Bummer. XP is lame but at least all of my stuff will run on it.

In the end, I feel like I could have gotten everything working in Ubuntu...eventually. I just don't have time in my life for that kind of non-productive configuration work. There's no justification for that kind of time spent when I could be doing other things.

What a bitter ending...

13 December 2007

Ubuntu disaster

Previously, I had blogged that installing VMWare Server on Ubuntu would be no problem because I had installed it before on CentOS and it worked beautifully. Oh, cruel fate! Not only did it not go well but I had to reinstall Ubuntu from scratch. But first, a little of the backstory...

First off, I downloaded the tarball from VMWare, extracted, and installed from source. It went flawlessly, Next, I fired up VMWare Server and tried running one of my VMs. The guest VM was really slow. What's going on here? I did some googling and tried a few things but had no luck. My instinct was to turn off the host OS's graphical effects but I didn't do that for some reason.

OK, fine. I'll uninstall VMWare and then install the packages from Synaptic. Maybe they'll be optimized for Ubuntu. Well, they were but they also broke my XServer so that my graphics fell back to Windows 3.1 levels (aka VGA). The guest VM under VMWare ran at the correct speed but at the cost of messing up the host OS graphics. Grrr. I tried reinstalling the ATI drivers from Envy and the xserver-xgl packages but had no luck. I tried uninstalling VMWare but no luck.

Finally, in a fit of desperation early this morning, I decided to reinstall Ubuntu. After all, I had ironed out the kinks with configuring it already so it should go smoothly, right? It HAS NOT gone smoothly. I'm actually on my second reinstall since last night. This time, however, I have written down every step I had made in the configuration since I started. I'll post those up here if it makes sense.

I'm heading down the path of being a VMWare/Ubuntu/ATI hater. If I can't get this $#**#/ computer stable by next week, I'm going back to boring but stable XP for at least another year. I don't have time for this foolishness. By next year I'll have a new laptop, new graphics card, and Ubuntu will probably have released a new version.

A piece of advice...if you're in the office today you'd best avoid me since I feel like my temper is on a hair trigger!

12 December 2007

Ubuntu Install, pt. 6

After using Compiz for about a dozen hours, I'm convinced that the driver for my ATI card is now stable. There have been no lock-ups of the computer. Glad to have that unpleasantness behind me so that I can enjoy all of the eye-candy that my 3D card can render up.

In a previous post I complained about the Ubuntu Eclipse package being 3.2 while the latest stable release was 3.3. Well, I decided to do something about it and downloaded and configured the 3.3 Eclipse. Dang, that was easy. Now all that's left to do is uninstall the 3.2 package (mostly just to reclaim space and prevent later confusion on my part).

RDT and PyDev plugins function perfectly under 3.3 and I get the Mylyn plugin for free as well as the XPlanner connector. I'm back to liking Eclipse again (PyDev is sweet!). Eclipse is a memory hog, however. It regularly consumes 350Mb of RAM but that was more or less true on Windows too.

Last night, I downloaded and installed VMWare server. I haven't had a chance yet to run any of my VMs that I need. That'll come a little later. I fully expect them to work with no problem.

As each day goes by I'm becoming more satisfied with my switch away from Windows for my desktop OS. My most recent joy with Ubuntu was the awesome packages and their integrations. Specifically, I needed to install both Python 2.4 and 2.5 and keep them seperate and didn't want a lot of configuration hassles. It was no problem at all with Synaptic. That's handy and something Windows does not have.

11 December 2007

Ubuntu Install, pt. 5

My colleague and fellow linux aficionado, Grant L., sent me an email about my ATI woes after reading my previous blog entries. Besides encouraging me he also pointed me to compiz to get the really cool eye-candy effects. That inspired me to fix my ATI driver problems once and for all.

After a few falty attempts, I got my compiz effects working in full 3D by installing the xserver-xgl package from Syanptic. That seemed to do the trick. Now, I'll just use the laptop all day and see if the computer freezes up any. (Keeping my fingers crossed.)

Thanks, Grant!

Time to get back to working on my Ruby gem in Eclipse. Oh, and Eclipse did not suck yesterday at all. Whew.

10 December 2007

Ubuntu Install, pt. 4

So, as I booted up for the first thing this morning I had two consecutive kernel panics during the boot process. Both had to do with ACPI. ACPI is the bios tool for suspending and hibernating a computer. I found a simple fix but am going to hold off applying it unless I get more panics. It was strange that it panicked on boot now after dozens of boots with no panics.

While I was researching the panic issue I happened to find the fix to my missing splash screen at boot. Turns out that it was simply a resolution problem. The splash config was specifying 1280x1024 but my laptop's resolution is actually 1280x800. The fix was simple and now I get to see the splash screen. Joy.

Finally, I noticed that I no longer had the eye-candy visual effects that I had been drooling over. Under the System->Preferences->Appearance tab I saw that they were turned off so I turned them back on. Within a few minutes my computer locked up. That's great news because now I know that the problem with the computer freezing had nothing to do with Firefox and everything to do with my ATI Radeon graphics card. So, for now, I'll file that information away and deal with it later. Back to the no-visual-effects Gnome. Sigh.

Today, I really need to get work done on a Ruby gem that I'm writing that searches Medical and Scientific publications. Hopefully Eclipse won't get in my way like it did last week. Wish me luck!

09 December 2007

Ubuntu Install, pt. 3

Day three of the switch to Ubuntu just about put me over the edge and running back to Windows. Basically, my computer would lock up randomly when I was using Firefox. Fortunately, I got some sense and decided that if its just a Firefox issue then I just wouldn't depend upon Firefox and would later try a different browser like Opera or something. What really mattered to me though and the key measures of success was whether I could 1) get Eclipse running, 2) get the Juniper SSL running, and 3) get VMWare server running and be able to use the Cicso VPN within it.

Getting Eclipse running turned out not to be a big deal as long as I used the eclipse package from Ubuntu. That and I had to also use the sun-java6-jre package. Actually, that was kind of nice having those things install so smoothly and not having to install by hand like I would with Windows. The only negative and its pretty slight is that the packaged Eclipse was at version 3.2 and the latest, stable Eclipse is 3.3. So what, you ask? Well, Mylyn comes bundled with 3.3 and not in 3.2. I had to install v. 2.0 of Mylyn instead of the latest 2.2. In the big picture, that's not a big deal.

There are some implications, however, of not being at the latest releases of Eclipse and Mylyn. My company uses XPlanner as our project management software. There is a Mylyn connecter for XPlanner but it won't be available to me in this version of Eclipse/Mylyn. That's really not a big deal since Mylyn is nice to use but is not yet critical to me. I have used the XPlanner connecter before and found it to be pretty handy to have all of my development tasks including bugs from bugzilla in one view within Eclipse.

08 December 2007

Ubuntu Install, pt. 2

Imaging the windows partition went fine and took about 1.5 hours. I verified that I could mount the image and read data from it and then proceeded with the Ubuntu installation. The installation took a little over an hour, including downloading and installing 145 updates. On the reboot, however, it took about 5 minutes for the GUI login to appear all the while the disk light was blinking and I was facing a blank screen.

I rebooted again and this time it didn't take 5 minutes but, instead, took about 25 seconds. On the third reboot, I pressed Ctrl+Alt+F1 to look at the console. No errors there and everything that went by looked normal. Oh, well. I guess I'll get around to troubleshooting the blank screen on boot later although I really wanted to see the Ubuntu logo while it was starting up. Not off to a good start.

Next, I fired up Firefox while I had a little breakfast just to do some surfing. I opened up Firefox's preferences and started to make a few changes like removing underlining and setting a master password. When I got to the master password function, the computer completely froze up. Neither the power button nor the three finger salute yielded any response. All I could do was to unplug it and then remove the battery to stop the computer. Ugh.

This isn't the first time this laptop has locked up while running Linux. I have had Fedora Core 8 on this machine and have had it freeze up occassionally. This is really unnerving. So far, as much as I hate to say it, Windows has been more stable and predictable.

My next priority is to get a Java VM installed so that I can test out my company's VPN. I don't have high hopes since it didn't work under FC8. In that case, it may have been because it was using the Gnu Java VM and not the one from Sun.

After that, I'll install Eclipse and the RadRails and PyDev plugins. Those must work for me to use Ubuntu since I need them for my work.

Ubuntu Install

I decided to drop Ubuntu onto my laptop. So far, not good. It failed to resize my partition correctly and I know that Ubuntu can do that since I just helped a client do it. So, right now, I'm making an image of the HD using dd. Once that's done I'll wipe the drive and start fresh with Ubuntu...well, not exactly. I'm actually imaging all of /dev/sda so that I can completely recover if Ubuntu is no good for me (unlikely). I'll also want to image /dev/sda1 so that I can actually mount that partition using mount's loopback option. That'll give me the ability to grab my data files as needed.