After reading all sorts of problem descriptions and solutions on various forums, I’ve finally fixed my hand-me-down Dell Dimension 8400 desktop box.

When I first got it, I couldn’t even get it to turn on. After pressing the power button, it gave a few beeps, started an orange blinking with the power light, and refused to do anything else. Some people with the same problem had to replace the motherboard, the power supply, or the memory. Some still don’t have a working computer.

As for me, I unplugged all of the devices from the power supply, removed the memory sticks, and then put it all back together. Something along the way did the trick — I suspect it was removing and re-inserting the memory, but I’m not certain.

Now my box is up and running with Ubuntu 7.10!Leave a comment if you’ve had a similar problem with your Dell — I know there are a lot of you guys out there. Maybe you can post some other solutions and ideas here to help out…

Update: According to the Dell manual, there are 4 lights on the back of the tower labeled A, B, C, and D. If the A and B lights are orange, but the C and D lights are green, it could mean that the memory isn’t recognized and that you need to take out the memory sticks and put them back in again. This sounds like it could have been my problem.

Hashtable or HashMap?

January 17, 2008

Working on some Java code, I recently found myself in need of a hash-type data structure. The project I’m working on frequently uses a home-grown hash table implementation, but I wanted to transition to the more recently developed Java Collection classes. Since J2SE 1.5.0, the data structures in the Collections framework have been updated to use Generics, which are cleaner and provide safety against casting errors.

Without giving it much thought, I started using the java.util.Hashtable implementation. But soon I stumbled upon the java.util.HashMap class. Not knowing the differences between the two, I read through the API documentation to compare both implementations.

As it turns out, there are some important differences. First, Hashtable is synchronized, meaning that it can be used concurrently by multiple processes/threads without the need for synchronization outside of the object. HashMap, on the other hand, is not synchronized. To use a HashMap object in a concurrent programming environment, you’d need synchronization external to the object.

Secondly, Hashtable does not allow null keys or values, whereas HashMap does. This was important for my project because the existing code required the ability to use null as a value. To change that behavior would be outside the scope of my task.

Finally, HashMap allows values to be safely removed during iteration, but Hashtable does not.

After comparing the two Collections classes, I chose to use HashMap mainly due to the fact that it allows null values. Since the existing source code requires null values in some cases, this ability was a necessity. The fact that HashMap does not provide synchronization is insignificant for my project — there is no concurrent access to these data structures. Although concurrency is planned in the future, there already exists a need for synchronization at a higher level.

Regardless of the differences between Hashtable and HashMap, I feel much better about using either one than the in-house hash table implementation developed circa jdk 1.0. At least I won’t have to worry about casting.

Update: After reading a little more about the Collections framework, I’ve discovered that there is a way to get synchronized versions of the unsynchronized classes. Java provides a set of synchronization wrappers capable of producing thread-safe versions of any Collection. Pretty cool!