A Hack a Day keeps the Sickness Away - Hacking Journal [2006/02/14]

written by edavis on February 14th, 2006 @ 02:30 PM

Had a good chunk of time today to hack some more on the Rails website at work. It was planned to go into a semi-public Beta state tomorrow, where we would allow a limited amount of users to start using it. But it looks like the graphics person will take awhile and then we have not had as big a push on the content side as we wanted, but the programing is stable enough to support some users.

Anyways, I implemented my first semi-recursive method today with amazing success. Using Ruby it only took me about an hour and half to implement it, test it, and take it live. It basically loops through an acts_as_tree model and will display the relationship between the nodes. This is then used for out categories so you can then see a simple GUI of the category tree for where you want to place content. Example:

main
--News
----Site News
----Web News
--Help
----Ruby
----Rails

I am also starting to read Martin Fowler’s book Refactoring: Improving the Design of Existing Code and have just started into the refactoring catalog. It is an amazing book; in the short time I took today to cleanup my code, I found tons of places I could do the simple refactoring and make my code more understandable. Luckily for me I found it on [Safari][] but I will defiantly be buying this as a reference later on (I think it is worth at least $100 and I have only read half of it).

Eric Davis

[Safari] :http://safari.oreilly.com

Watch your Automated Backups

written by edavis on February 14th, 2006 @ 01:57 PM

If you do automated backups (and you should if you do not…) it is a good idea to check on them every now and then. After living with my DSL running at about 1200/120 for the entire night I noticed my backup from last night was still running.

I looked into it and found I was backing up the Knoppix DVD that I downloaded earlier. Needless to say, my 600 upload speed was pretty much maxed out all day trying to send it up.

Morale: Check you backups and make sure you are not backing up more than what you need. And if you Internet is slow, and your modem has been hard rebooted, and still nothing….. check netstat on all your systems

PS. Sorry about the site being slow today, stupid backup script.

Eric Davis

Getting back up to speed - Hacking Journal [2006/02/12]

written by edavis on February 12th, 2006 @ 03:19 PM

Being sick really hampers the ability to hack anything bigger than a shell script. I am almost fully recovered but still having a hard time holding a lot in my head. I was able to put some code into my web/blog engine, I ended up using a plugin to setup the authentication schema. Once I figured out how it worked, it is pretty nice.

I am also not to sure about Darcsquite yet. I like it’s simplicity, the ability to record only a few changes at a time (aka hunks), and how it only has one directory to store it’s data. I am still not up to full speed on it so it’s taking me some time to get the commands down.

Another sidenote, this Apple keyboard sucks. I used my cheapy ergonomic Microsoft keyboard but it had issues with my new keyboard tray so I had to switch. But now the aching wrists are back and hurting more than ever. Oh well, I like the feel of the Apple but I cannot work like this.

Eric Davis

Refactoring the Mess - Hacking Journal [2006/02/08]

written by edavis on February 8th, 2006 @ 02:27 PM

Testing is good. Testing is good. Testing is good.

After reviewing the progress I made on the Rails website at work, boss decided to cut a lot of features I had added. Normally this would have been a huge problem as a lot of the code is coupled but with my huge test suite it turned out easy. I planned on spending at least 6 hours to do the changes he wanted but actually it took a little over three.

The reason was I was able to drop the tables, remove the files for that model, and then slowly change the remaining files so they would call the correct methods. Using my tests I was able to do one change at a time, see the effect and then move on. So in under three hours I have the system running leaner and meaner than before. I even had enough time left over to go through and do some minor touchups to the site.

So once again, tests saved my ass. Also now that the “users” are going to use the system I can shorten the feedback cycle so I will not have to make such sweeping changes to the codebase. Keep it simple.

Eric Davis

The Effect of Flow

written by edavis on February 8th, 2006 @ 09:51 AM

I just found a great page on the C2 wiki called Mental State Called Flow. It has some good discussions about getting into a state of mind where you can get stuff done. I have found that when I work from 7am-4pm I can get at least four hours of hacking done before 9am. This is because for the first hour it is only me and a few other people spaced out in the office and then from 8-9 everyone is waking up, getting coffee, and checking email so interruptions are close to nil.

Eric Davis