John's Wishlist

Last Updated: 02-12-15

This list is subject to change. Here is the wish-list for those who want to buy me something (some may appear on Gaila's List:

  • xkcd swag. particularly interested in the signed prints, posters, and buttons
  • Blue-Ray Movies (if you know what movies I like)
  • Interesting desk ornaments (good place to look for these is Think Geek)
  • Snuggly sweaters
  • Wine (if you know my tastes, dry whites), nice beer
  • Gift Certificates to iTunes, Lowe's, Wal-Mart, Target,, Outback Steakhouse, Fighting Burrito

Purchase gifts from Amazon via links in the list or from the search box on the left to send me some commission. If you are buying Amazon gift cards use this link. It doesn't affect your price.

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

Syndicate content