You Can now add Quotes to my Rotator

I finally got around to allowing visitors to add their quotes to the rotator. All the same rules apply as before.

D'oh, I forgot to add Analytics to this site

I was curious about the demographics of my site, so I naturally pulled up my analytics page. I found that I had about 90% traffic from Windows machines. This didn't settle well, so I looked over at what hostnames people were accessing and found all of them pointing to yogurt (my old machine on campus, previous host to Turns out all the recorded hits were on my old site. I immediately fixed the problem by adding analytics code to my template and creating a redirect for all the pages on yogurt.

8-Core Drool Fest

Some of you know that I am planning on buying a MacPro with my developer discount once a new revision comes out or before I graduate (whichever comes first). Today, I'm drooling over rumors of the dual quad-core Xeons (Clovertown) coming to the MacPro in November. If this is true, I really hope I will be able to get my hands on one by the time LANFEST comes around December 1st or 2nd.

Relaxing Weekend and Productive Monday

I finally had a weekend that seemed relaxing. I wasn't sick (like 3 out of the 4 last weekends), and there wasn't anything that had to be done immediately. Gaila and I did laundry and cleaned the kitchen, living room, and bathroom. I can't believe how quickly the apartment falls apart when you don't feel good and don't have the time to clean.

Today, I finally got the pubcookie system working at work. I also got it doing authorization, only letting certain netIDs in and kicking out unauthorized users. So, now I guess I have experience authenticating and authorizing PHP scripts on my own custom systems, Active Directory, and now pubcookie YAY!

I applied for a bunch of jobs at Principal. Yeah, that's right, Principal. Here's to hoping that I won't get stuck with too much COBOL work if I do get a job there. Though from what I have been hearing, there are a lot of other IT jobs there that don't require much (if any) use of COBOL.

I launched the new scholarship pages on the 13th. Very few glitches and a lot smoother operation and integration with departmental applications. The only problem I had was that I didn't validate zip codes well enough. Remember, zip codes can start with a zero on the east coast!

Anyway, it's time to go home and work on some projects. Perhaps I will finally get my hair cut this afternoon too.

Using MySQL With PHP

At work the other day, I was asked to help someone learn how to connect to a MySQL database using PHP. When I saw what they had done in an attempt, it was very inelegant looking a lot like the following code snippet:

$link = mysql_connect('', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());

$dbConnection = mysql_select_db('database_name');
if (!$dbConnection) {
    die('Could not connect to database');

$result = mysql_query('SELECT * FROM table');
if (!result) {
    die('Query failed: ' . mysql_error());

$row = mysql_fetch_array($result);

echo $row['attribute'];


I about cried. I do have to say though, that for someone learning the language, it is important to learn how to do it this way in order to understand what is going on, but once you have done this for a while you will see some flaws and frustrations when working on a larger project.

The example above requires a lot of icky looking code every time you connect to and use a database. It also requires the developer to define the MySQL server, the user, the password, and the database every time you want to make a connection to a database, which can be in almost every file of a complex application. It also has no standard way to deal with errors and often times you have to guess where errors happened in your code, especially if you have multiple queries in an execution.

By using includes and a nice function supplied by ILoveJackDaniels and a few of my own conventions, making database connections will become much easier to implement and debug. In the attached example the database connection gets simplified to:



$result = do_query('SELECT * FROM table', __LINE__);

$row = mysql_fetch_array($result);

echo $row['attribute'];


Now that is much easier to read and understand, and since most of the work is done in the custom functions dbConnect() and do_query() it makes it easier to have a nice error reporting system that tells you where in your execution any error occurred down to the line number, and even display a detailed description of the error on the page and/or in an email to you. This example also places the hostname, username, password, and database information in one location, making it easier to change those values in case the application needs to be moved to a different machine or database.

Check out the attached examples and their comments to learn more.

100,000 Miles

My car has finally turned 100,000 miles after getting it back from the repair shop on Wednesday.


Sorry for the crappy cell phone image.

Car Repairs Galore!

So, I take my car in for it's 100,000 mile tune-up and find the following problems:

Stuff I Knew About
Front Breaks: $204
Belt and tensioner: $226
Coolant Flush: $155
Transmission Service: $155

Stuff I didn't know about, but explains a few things I've noticed
Broken Rear Spring: $440
Broken rear stabilizer end link: $316
Left axle seal leak: $175

Total to fix all: $1,671

I am letting them do the breaks, the belt and tensioner, coolant flush and transmission service for about $740. I may just look elsewhere for rear spring, rear stabilizer, and the left axle seal leak.

Thank God for student loans and a good student job.

Sick Again

So, I was sick last weekend. The plan was to clean the apartment. Sick again this weekend, the plan was to clean the apartment. Am I allergic to cleaning? I want my apartment to be clean. I want free-time to clean the apartment and I don't want my free-time to be taken up by being sick. The last two weekends were open, but I was too sick to do anything about it.

I guess if I'm going to be sick, being sick on the weekend is the best time so that it doesn't interfere with stuff that needs to get done during the week.

Strange Quirk

If you follow my blog closely my last post about Showtime just appeared today, but is time-stamped on the 12th. I encountered a strange problem I haven't had time to fix until today (I've been busy with career fair stuff and school work).

I came across a problem where I couldn't post new pages or entries (nodes in Drupal speak). Drupal was trying to give new nodes the same ID as posts I have imported from my old blog system. Various Google searches didn't find anything helpful. My first thought was that the auto-increment feature on the table wasn't working right, then I eventually found out that Drupal keeps track of the IDs itself in another table totally disregarding the auto-increment feature placed by the installation. Doing a search for "drupal key node nid" found the answer.

So yay! I can post.

Reference to fix

Showtime: My Reaction

So, today was Apple announcement day. All new iPods, nothing really impressive there. The real news is the iTunes Store now offers feature length movie downloads, and the Apple set-top box code-named iTV*.

iTunes 7

I have downloaded and installed iTunes 7 along with the new QuickTime. I have to say, the interface is very different. The biggest difference is the new views available for showing your music or videos. The Cover browser is a nice eye-candy way to view your files, and if you don't already have album art, iTunes 7 will now be able to download it, which is nice. The navigation on the left has been organized very well, separating Library, Store, Shared, Playlists, and Devices.

With the new iTunes comes the movie store. Right now there are only Disney owned movies (Disney, Miramax, Touchstone, Pixar) available. The quality is actually pretty good. I downloaded "Pirates of the Caribbean" so I can have something to show off at ClubFest tomorrow. I really would rather have have a cheaper rental offer than buying the content. I can get better quality, more content, and better reliability from purchasing a physical DVD. Having a movie rental operation online makes more sense to a cost vs quality vs value equation for me.

The download is actually pretty smooth. While I was downloading the movie, I was able to pause it, quit iTunes, restart the computer and resume the download as well as start watching the movie while it was still downloading. This made it almost instantaneous to start enjoying the movie after purchasing (that is an even faster purchase to consumption turnaround time than buying the DVD at Wal-Mart) .


When I learned about iTV, I was hoping that it would be the device I was looking for. However, it won't be out until sometime in the first quarter of 2007, which is still a long ways away. Also, it only does streaming of files from iTunes. As far as I know, it doesn't have its own storage system or ability to record stuff from TV. It is also over-priced for what it does. A player for $300 seem a little excessive. I hope Apple will come to its senses soon and make it more feature complete (Provide a DVR or storage capabilities) and if it doesn't make it cost less. From the way it looks, I'm still going to settle for a Mac mini for my media center device.

Syndicate content