ADAM'S WEB PRESENCE

30 August 2006

Debian on a Gigabyte 945 series motherboard

Filed under: Nerd Notes — adam @ 12:42 pm

The world is always full of challenges. Today I need to set up a Linux server for a customer. No problem normally but this is a new motherboard I haven’t seen before. The Gigabyte GA-8i945GMH-RH with the new fancypants VIIV technology. I usually install Debian 3.1 “Sarge” on all my boxes but it would not install onto this one.

Sarge had two issues with the board, The ICH7-DH SATA controller and the Vidalia 82573L Gigabit Ethernet controller. Without a hard disk controller, it cannot install onto the hard disk. Having no network was also an issue.

To make a long story short, I installed Debian “Etch” beta 3 and lo, it worked and detected all the devices perfectly. I’m much relieved. I was dreading having to compile a custom kernel with buggy beta drivers and all that other yuckky stuff you had to go through in the olden days of Linux.

I also want to set up RAID5 with this box (it has 4 x 400GB SATA drives). The ICH7 chipset has a hardware RAID controller but after beating my head against that for an hour or so, I figured it was not going to work with Etch so I disabled the hardware RAID in the BIOS and set up software RAID which works really well in Linux.

That was this morning and so far Etch seems stable. This box is going to be a server running Apache2 and PHP. It needs to be very reliable so all fingers are crossed and I hope Etch will deliver the goods for me.


24 August 2006

Kids Electronics Lab update

Filed under: Homemade Creations — adam @ 8:45 pm

The polyswitch in actionKai has been loving the Kids Electronics Lab we made last weekend. Bea tells me he played with it all day on monday while I was at work. I’m happy that he likes it.

I have been pondering the best way to add some over-current protection to prevent damage to the batteries in the event of a short. A colleague suggested I try a Polyswitch - he even donated one for this project (thanks Ian!) thus saving me about $2.

This device is also known as a PTC fuse and is commonly used to protect loudspeakers. When a certain current is reached, it will trip and go into a high-resistance state until the current is removed. You can see a photo here of the device dropping the current to 120mA despite a dead short across the battery. The trip current is well over an amp so it does not affect normal operation of the board. Neat.


20 August 2006

Homemade Kids Electronic Lab

Filed under: Homemade Creations — adam @ 2:47 pm

Clip leadsToday with the help of my four year old son Kai, we built a little experimenter’s board because he has been wanting to “learn about ‘lectricty” for a while now.

First I found an old piece of MDF from my shed and cut off a bit about 10″ by 6″. Then I bought some screw eyes from the hardware shop. I already had this bunch of colourful clip leads.


Drilling the pilot holesTo build it, we drilled some 1mm pilot holes and then screwed in the eyelets with a small washer under each one. Kai loved having a go of a power tool even if it was only a little battery-powered Dremel. The wire from each part gets clamped under the washer as the screw eye is tightened. I used some pliers to screw the eyes in nice and hard so the wire will stay clamped.

Closeup of mounted screw eyes


Small child and power toolI have soldered a current limiting resistor in series with each part. I used 100Ω for each of the LEDs and a 15Ω ½ watt resistor for the motor. These values were arrived at by guesswork, experimentation and whatever I could find in my parts box using the time-honoured principle of “Whatever works man”. I used a little hot-glue to hold the parts in place.

I attached the battery holder to the board with some velcro so it can be easily lifted up to change the batteries.


The finished boardAnd here’s the finished product. I still do not have any kind of over-current protection for the batteries. I guess it won’t be long before the child tries to connect the battery terminals together and kills them. I’ll see what I can come up with in the future but for now we are having too much fun to bother about it.

I spent about $2 all up to buy a packet of screw eyes. Everything else came out of my junk box. That is my driving philsophy here. Just use what I’ve got, otherwise, I may as well have spent $50 on a store-bought electronics kit.


and Kai likes itThe board contains 4xAA batteries, 2 LEDs, a momentary push button and a DC motor. Kai can make up circuits by clipping the clip leads onto the eyelets. I have left some room on the board so we can add other bits on in the future. Its simple and fun enough for a four year old.


Related posts

Kid Type

UPDATE - Adding current protection


14 August 2006

Macro Photography with a Phone Camera

Filed under: General — adam @ 7:18 pm

Just your ordinary magnifying lampRecently there was an article on Make Blog about taking macro photos with a phone camera. I’ve got an alternative way to do it.

If you have one of these magnifying lamps on your desk, you now have your own macro photography studio.

creepy crawley


11 August 2006

Nuts and bolts

Filed under: Nerd Notes — adam @ 4:28 pm

Joel Spolsky wrote an article a while back on why it is important to know how computers work at the low level even when programming in a high level language. I came across an example today of how important that is. Have a look at this MFC code:

try
{
    CString query;
    query.Format(_T("SELECT blah,something FROM mytable\\n")
                 _T("WHERE itemid=%d AND NOT defleted"));

    getDatabaseConnectonPtr()->ExecuteSQL(query);
}
catch(DBException ex)
{
    MessageBox(ex.getMessage(), _T("Database error"), MB_OK);
}

OK, the first error is I mistyped the word deleted in my SQL query but instead of throwing up a message box as you’d expect, the application CRASHED with an unhandled exception error. But as you can see, I do have an exception handler so what gives ?!

Have you spotted it yet? It turned out to be the %d token in the format string. I haven’t given it a value. This caused the stack to become corrupted and when the database object threw a DBException, it did not have a valid stack frame for the exception processing. There are thousands of lines of code in my app and I’ve just wasted a whole freakin’ hour finding this bug but I probably never would have worked it out if I did not know how the exception mechanism worked and how C++ uses the stack to pass parameters.

Then again, this kind of thing would never happen if I was writing in Java.


6 August 2006

Freak Eats Cake

Filed under: General — adam @ 12:48 am

Eye-poppingly good cakeI think that Bea has captured the real inner me with this shot. No it has not been digitally manipulated and yes, I was completely sober at the time.

Click the image for a scary larger version.


Powered by WordPress