Archive for: November, 2006

Adapter Pattern applied

When you’re applying an Adapter Pattern, you’re generally grappling with classes and method signatures. I just had to deal with packages and package visibility in Java where I found the Adapter Pattern to be an interesting solution.

I was accessing a class A in a package com.example from the outside (an RMI call). The method I called had to return an instance of a class B in a subpackage, say com.example.sub, which in turn had to access a class C in package com.example. The trouble with class C was that it had only package-visible methods so that I could not call them from class B which was in a subpackage. Exposing C’s method to the public wasn’t desireable at all, so changing the visibility wasn’t a choice.

I wrote an adapter class in package com.example which had publicly visible methods but a package-visible constructor. Now I was able to instantiate class B in class A and provide an instance of my adapter class which in turn received a reference to class C and then delegated all calls to C. This way, I didn’t reveal C’s methods to the public, since my adapter class could only be instantiated in the package of class A, com.example.

Pathfinding I

Tim-Oliver bothered me today with a question about A* pathfinding. It has been some time since I wrote our A* implementation in DVW, so I had to dig into this topic again. I used this tutorial and wrote some code. Note that this is just a straightforward implementation of the pseudo code presented in this article. I wouldn’t write productive code that way. Anyway, this might come handy for someone, so I’ll present it here. Next time, I will replace the open list with a binary heap.

Click here to see the source:

Farewell adidts.sys BSOD

I promise, if this isn’t my very last posting on hardware and hardware driver issues (todays topic), I will add an own category. But since I finally found a solution for my last PC problem, namely BSODs caused by adidts.sys, I feel the urge to blog about that.

adidts.sys is the SoundMAX high definition audio driver for the onboard audio which came with my ASUS M2N32-SLI Deluxe motherboard. The driver version available on the ASUS homepage, where I went frequently to check for an update, is still V5.10.1.4530 dated 2006/07/10, but now I learned that there are actually two newer versions available on the ASUS FTP site. I tried 1988b_32bit_510014560.zip and it worked like a charm. I just updated the driver from the hardware control panel instead of using the setup.exe, and finally, my last woe was gone.

Update: Although this fixed my BSOD troubles, I recognized that I did not have a stereo mixer available to record the output of my sound card. I tweaked around a bit to handle this, too. Let me know if you’re interested and I’ll write another short entry on this.

Update: I am using Windows XP.

Update: I wrote a posting on enabling the StereoMix recording device. I did this with a newer driver version than the one used in this posting. You may want to look there, too.