Blog

During the course of the day I encounter lots of challenges, some of which take minutes to solve and others that take much longer. My goal for this section is to keep track of these challenges and their solutions. I will turn the longer ones into articles, while the shorter ones will stay as blog entries. You can expect topics to range from very specific programming challenges to broader topics like life.

Below is a list of the recent blog entries. You can also browse the blog by using the tags on the right side, or if you know what you are looking for then you can use the search box at the top right.

Rails, is it really all that?

Question of the day: Is Ruby On Rails (RoR) really that?

Good question! I have been playing around with RoR for about a month now and finally I am starting to get a good hang of it. When you first look at RoR you will think it’s very cool but at the same time you will be thinking, "is this a good candidate for complicated websites?" The answer that I am finally starting to understand is yes. But as with everything you must understand it well before diving into a grand project.

The biggest problem that I see with RoR is the learning curve. First I (and probably majority of the developers) had never touched ruby before so that had to be a part of the learning. Even bigger is the actual framework; there are a lot of assumptions, almost all of which make complete sense, but you do have to be aware of them. Also since this is a framework you have to learn the functions and it’s way of doing things.

Once you get over the learning curve the wait, and sometimes frustration, does pay off. So far I haven’t had to worry about SQL much, in fact I haven’t had to write a single SQL statement! (aahh, no more insert, update or deletes :))

Currently I am working on uploading the my newest work to a host. The host for the site, ICDSoft, claims that they support RoR but infact their current setup can’t possibly work for a RoR site. So I finally ended signing up with RailsPlayground, and am currently learning what all is involved in uploading a RoR site. I know now you are probably thinking, "Leanring what?!?!" Well, I could have just uploaded the files directly to the site and be done with it but there is a better solution. RoR developers have come up with program, SwithTower, to automate this repetitive process. So I am learning SwitchTower before I move the site to production. This tool is supposed to come really handy when you have an application that is using multiple servers and multiple database. Unfortunately my first site isn’t one that will be distributed across multiple servers so I can’t really test or comment on that functionality but it sounds promising. The part that I am planning on utilizing the most is the support for SVN which I will leave as a topic for another day.

Computer Hardware Madness!!

So I have been looking for new desktop computer. I like to build desktops myself just because of the experience, but right now there is a hardware madness going on! Oh you have to believe me… 🙂 Until a few days ago I had only thought I knew about the current state of processors and hardware in general, but, was I wrong!! Currently there are at leaset a gazillion different processors and amazingly there are only two companies that are making these processors. Just take a look at this article by Tom’s Hardware that discusses mainly the intel processors, the fact that there are a dozen pages talking about the processor models is just plain nuts! Now what makes the choice even more tough is that a lot of these options are way too close for going with one or the other. On Intel’s side the new dual core processors are starting only $30 more than the current Pentium 4 600’s.

Now its not just the processors that are like this. On the graphics side you have SLI, PCI-Express, AGP, some of which play hand-in-hand but can also work as a standalone so you have to watch out for those. Last night I found two video cards both eVGA 6600LE, one 256MB and the other 128MB for the same $89 price. After some detailed browsing of the specs I found out that the 128MB version has a faster memory (500MHz vs 400MHz). Which one is better, who knows? Just means more research.

On the storage side you have ATA, Ultra ATA, SATA-I (Serial ATA), SATA-I with NCQ (Native Command Queuing), SATA-II 3.0Gb/s… So you have to consider not only the size but also the rotation speed, buffer, interface and any other features (like NCQ). Again the the thing that makes this tough is that a lot of these have very close pricing. For instance I found a Seagate 120GB SATA-I drive with NCQ for $89 and for $6 more ($95) I can get a Western Digital 200GB SATA-II 3.0Gb/s drive; so now I have to decide whether the NCQ is really something.

Same thing with the rest of the components: motherboard (options, overclocking features, etc.), RAM (CAS Latency, Timing, speed, DRR vs DDR2), Power supply (watage, noise level-which is important to me)… Man o man, what I am going to do 😀

Visual C# 2005 Express Edition, bad news for SharpDevelop?

Visual C# 2005 Express edition is out and developers can download it for free (at least for a little while), now I am wondering what this means for SharpDevelop which is also a free open source C#/VB.Net integrated development environment. I am not going to make any speculations because I haven’t worked with either products to really say which is better but I am pretty sure the Microsoft product is going to take at least some of SharpDevelop’s base. Maybe when I once again start concentrating on C# development in the next weeks I will write an article comparing the two products. For now, I am going to check out what the C# Express Edition is about! 🙂

Scaffold Generator in Rails 0.14.2

Today I upgraded to Ruby on Rails version 0.14.2, while working on a new website when I went to generate a scaffold I started getting the following error:

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?

After searching around for a little bit I found out that it was a problem in the latest code. Basically you have to change the line 49 in scaffold_generator.rb which gem usually installs at /usr/lib/ruby/gems/1.8/gems/rails-0.14.2/lib/rails_generator/generators/components/scaffold/ from

1
@controller_name = args.shift or (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name)

to

1
@controller_name = (ActiveRecord::Base.pluralize_table_names ? @name.pluralize : @name)

Credit for this fix goes to ‘anymouse’ who posted the fix at Stephen’s Web

HTML Application

HTML Applications are a very nice option when it comes to small, easily changeable scripts. With such applications you can use your knowledge of HTML, CSS and DHTML to give rich user experience without the overhead of large executable files. HTML applications use Internet Explorer’s already built engine. Here you can find one that I wrote, this script moves files from all the sub-directories in a given directory to the main directory. As it’s moving the files it appends the directory crumb to the name of the file. So if a file, say “MyDoc.doc”, is in a directory called "MyDir" then the file will be named "MyDir – MyDoc.doc". To use this just click here and save the target file as moveFiles.hta and double click on it.

The legal tidbits: I assume no liability or responsibility for errors or inaccuracies. Please understand that you will be using this software at your own risk.

Funny video!

You have to checkout this video, it’s freakin’ funny!

http://www.viknluda.com/foe/video/

Amazing Speed Up

I just installed the Intel Application Accelarator, did this tweak to my computer and restarted my computer. The performance enhancement is amazing! Applications seem to be starting in half the time than they normally took. I haven’t tested this with multiple memory hog applications (e.g. VS.Net, Fireworks, etc.) running at the same time but at least for the daily tasks this is a blessing! You should try these out but only at your own risk! 🙂

Filtering HTML tags in Textile

Someone in #rubyonrails today asked about filtering specific tags with the RedCloth textile library and I was surprised to find out that the library does not have anything by default. Looking for a little while I found this article that tries to solve this issue, take a look if you are interested.

VIM syntax file for Ruby

Here is a nice VIM syntax file for Ruby created by Michael Brailsford. Many thanks to Michael! 🙂

Troubles with GRUB and NTFS

So I finally ended up reinstalling Windows XP to get a new start. This meant my current bootloader, grub, would be overwritten by the Windows bootloader which is fine with me because I can easily reinstall grub with the boot CD (grub-install "(hd0,0)"; Note: DO NOT USE THIS COMMAND, ITS INCORRECT!) but this time something else happened. After reinstalling grub Windows XP wouldn’t boot. When I click on the entry it would show a line about not being able to find the partition type and then come back to the grub main menu. Linux was booting fine, so I went into Linux and tried mounting the ntfs partition, but `mount /ntfs` gave the following errors:

mount: wrong fs type, bad option, bad superblock on /dev/discs/disc0/part
1,
missing codepage or other error
In some cases useful info is found in syslog – try
dmesg | tail or so

So I ran `dmesg | tail` as suggested and got the following useful text:

NTFS-fs error (device hda1): read_ntfs_boot_sector(): Primary boot sector is invalid.
NTFS-fs error (device hda1): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.
NTFS-fs error (device hda1): ntfs_fill_super(): Not an NTFS volume.

"Primay boot sector is invalid?" Ooh, that sounds painful! So I have done some quick search on net and didn’t too anything that pointed out the cause but it did say that you can mount using the errors=recover option as pointed out in dmesg. So I went ahead and mounted it as:

mount -t ntfs -o ro,errors=recover /dev/discs/disc0/part1 /ntfs/

…and that seem to mount it correctly. Well, that is half the story. I haven’t rebooted yet to see if that might have fixed the error but I am going to take a break, bring my system up to date and then reboot and see what that might have done. Worst come to worst I can backup my Litestep configuration files that I spent so much time on.

Here is a link to an article might help:
http://forums.gentoo.org/viewtopic-t-346183-highlight-readntfsbootsector.html

2005-10-08 8:00 PM: After trying testdisk for a few times with no luck I have decided to reformat the NTFS partition and reinstall Windows XP.

2005-10-08 10:00 PM: Well, I have finally successfully reinstalled both Windows XP and GRUB! My mistake last time was that I actually told grub to install on the first partition instead of the master boot record. Basically I had to do ‘grub-install hd0’ instead of ‘grub-install "(hd0,0)"’. The four extra characters have costed me quite some time 🙁