Choosing Names in Your Database

written by edavis on September 12th, 2005 @ 02:16 PM

At work I was working on a simple Ruby on Rails project that is basically going to use CRUD to store, edit, and view information, something simple. I kept getting really weird errors with my scaffolding. After much mangling done with my database and code I found the problem was that I named a field in a table “System”.

This field was supposed to keep track of the Computer System so System was a nice shorthand for it. Well my shorthand cost over 6 hours of headaches. Turns out by using System, rails tried to create a new instance of it to reference the table but there already was a System in the namespace… namely “System” as in Kernelspace. So when my scaffold called System.send to try to read the data from the database it was actually calling the kernel of the , not the desired result you see.

After much googling and research I came across some links for my fellow rails developers (and myself for when I forget again). These are links to rails’ reserved words, the sql reserved words, and then just some words that should not be used in tables (ActiveRecord reserved words?)

Reserved Words in Ruby on Rails on the RoR wiki

Search for reserved words in various SQL database engines.

Words to NOT use in tables

Eric

Apple's FileVault

written by edavis on September 11th, 2005 @ 10:13 AM

Recently I turned on the “FileVault” option on my Mac. For those who don’t know FileVault is a preference that lets a user encrypt their /home directory. It is encrypted and the user sets a password to access it. Then when the user logs in their /home is decrypted on the fly as it is used.

Well I was looking at something eariler and noticed that the “Get Info” screen changed. Now not only is there the “where” area but also the “Disk Image” area. Mine said “/Users/.eric/eric.sparseimage”.

For the non-UNIX junkies, the dotted directory means it is hidden. So first thing I did was fire up a terminal and check out why I had a hidden directory. Come to find out there is an encrypted spareimage in there that is over 4GB. Ever more curious I then fired off a ‘df’ to see what was going on. Turns out my /home folder was mounted off a disk I didn’t know I had, but was the same size as my hard drive. Hmm these look connected.

Well to sum up, when you turn FileVault on it actually makes a hidden home directory for you, creates an encrypted sparceimage in there for you and then tranfers all your files over there. Then to finish up it mounts that image as your /home, thus making it appear nothing has changed. Kinda good idea. So for all those who have been using custom rsync’s to backup their computers (myself), can now just sync one sparceimage and it is already encrypted and setup corrctly.

Eric

Updated Typo

written by edavis on July 24th, 2005 @ 09:34 PM

Just went through and updated typo to the latest trunk and got it all working. It might look the same but under it all it is totally amazing. The work the developers have done in the fast few days make this one of the best setup’s I have run. Only real issues I had were :

  • The migration script wouldn’t work for my sqlite3 database. I heard this is something with rails itself and is fixed in the next version. So I just had to create a new database and migrate the data by hand, not too hard.
  • I had a looping issue where whenever I went to the main blog page I got looped back into the admin section. I tried many different things but found out you have to select a theme after saving the admin options. (thanks Eridius)

Other than that it is pretty damn good, look for the next release soon, it is totally worth it.

Eric

Accounting on Rails

written by edavis on July 12th, 2005 @ 05:53 PM

For my first project on Rails I will be making a fully fledged business accounting setup. It will be fully web-based and is targeted at medium and small sized businesses. I got a little bit of it done, and will work on it as I get time. Hopefully in a month I will have a completely working copy.

Eric

New Blog Engine

written by edavis on July 12th, 2005 @ 04:33 PM

Ok, back up and running… again. I guess just randomly running a SVN update isn’t such a good idea. Typo changed the db config and the migrate didn’t want to work with my sqlite3. As you can see I got a modified CSS/theme setup now, just a bit more to refine. Eric