Finding a Loop in a Singly Linked List

Motivation

A singly linked list is a common data structure familiar to all computer scientists. A singly linked list is made of nodes where each node has a pointer to the next node (or null to end the list). A singly linked list is often used as a stack (or last in first out queue (LIFO)) because adding a new first element, removing the existing first element, and examining the first element are very fast O(1) operations.

When working with singly linked list, you are typically given a link to the first node. Common operations on a singly linked list are iterating through all the nodes, adding to the list, or deleting from the list. Algorithms for these operations generally require a well formed linked list. That is a linked list without loops or cycles in it.

Continue reading

Bugzilla – Setting ‘Target Milestone’ During Bug Creation

I'm a fan of the Bugzilla bug tracking system that came out of the Mozilla web browser project. It is a web based system that makes it pretty easy to track issues with pretty much any piece of software. Furthermore, it isn't that hard to set up, so I have used it in more than one employment setting.

At work, we have a private Bugzilla installation that is only visible to employees. Given that everybody that can enter bugs should know how to fill in even the more complex fields, the enter bug form seemed a little inadequate. Our QA department really wanted to be able to specify the target milestone for a new bug to be for the next release when they entered a bug for a regression during the full quality assurance check a few days before a release.

Continue reading

Convert a Java OutputStream to an InputStream

If you have ever programmed using Java IO, you will quickly run into a situation in which a class creates data on an OutputStream and you need to send it to another class that expects to read the data from an input stream. You'll soon be asking the question, "How do I convert an OutputStream to an InputStream?"

Nowhere in Java will you find a OutpStreamToInputStreamConverter class. Luckily, there are several ways to go about this.

Continue reading

Convert a Java Writer to a Reader

If you have ever programmed using Java IO, you will quickly run into a situation in which a class creates data on a Writer and you need to send it to another class that expects to read the data from a Reader. You'll soon be asking the question, "How do I convert a Writer to a Reader?"

Nowhere in Java will you find a WriterToReaderConverter class. Luckily, there are several ways to go about this.

Continue reading

Turning off the Maintenance Required Indicator on the Honda Insight

I recently got routine maintence done on my 2000 Honda Insight, but the mechanic neglected to turn off the "maintenance required" indicator on the dashboard that comes on every 6000 miles or so. Not a big deal, the owner's manual has instructions for doing so. You would need to be able to if you did maintence yourself. Except the instructions they have don't work. The manual states:

To reset the maintenance required indicator, turn the ignition switch to the LOCK position, then press and hold the trip meter reset button until the indicator resets.

First, the LOCK position isn't labeled as such (further in the manual they explain that it is position 0). Second, they forgot a step. Better directions would be the following:

Continue reading

The FJM

I bought a hybrid electric Honda Insight when they first came out in 2000. In addition to the amazing dual gas/electric technology, the car has a sleek aerodynamic design, wheel covers over the rear tires, flashy silver paint, and an antennae centered on the roof that give it a futuristic look. I call my car "The FJM". Here is the story of how it was named.

Continue reading

Tic-Tac-Toe Strategy

Zero Sum Game

If you know what you are doing, you can't lose at Tic-Tac-Toe. If your opponent knows what they are doing, you can't win at Tic-Tac-Toe. The game is a zero sum game. If both players are playing with an optimal strategy, every game will end in a tie.

Surpisingly few people know optimal Tic-Tac-Toe stategy. Yes there are some people (and computers) that you will never beat, but they are relatively rare. Knowing this, you can become a Tic-Tac-Toe master.

Continue reading