This one made me laugh so I thought I'd share it.
Saturday, August 14, 2010
Doodling
Saturday, August 7, 2010
History of the SSD
As some of you may know I'm a big SSD fan. For those who are worried about the negative reputation that SSDs have gotten you should check out an article pointed out to me by our chief architect.
History of the SSD courtesy of AnandTech:
http://www.anandtech.com/show/2738/1
History of the SSD courtesy of AnandTech:
http://www.anandtech.com/show/2738/1
Thursday, August 5, 2010
Light Text on a Mixed Background
Let's say you wake up one morning and find you're the guy responsible for deciding what colour the subtitle text should be. After overcoming the initial shock of having slept through a major career change, you'd come realize what a difficult problem this is. If you make the text white it'll show up fine on a dark background as you would find in a horror movie or Tim Burton film. On the other hand it will leave the audience puzzled at on a white background like the snowy battle of Hoth. If you give in to the star wars fans and make the text black the Tim Burton fans will grab their pitchforks and head up to your spooky castle during a midnight thunderstorm. Things get even more embarrassing if half the screen is white and half the screen is black. The audience will be able to read half the sentence and no doubt fill in the rest with whatever their dirty minds come up with. This, of course, will lead to many viewer complaints about how smutty modern films have become. What are you to do?
I've run into this problem a couple of times during my programming career. In my case it was adding text overlays to images to show additional image meta data... while fighting the Sith with Jonny Depp! It's actually surprisingly easy to get text to show up nicely on almost any background. All you need to do is have lightly coloured text with a shadow effect.
The simplest way to do this is to simply paint a copy of the text in question one pixel down and one to the right in black. For added readability add another copy one pixel to the right.
Here's some sample code:
Nice, large, translucent drop shadows can also increase the readability of text. In my case, though, I only want the shadow effect to increase the readability of the text. The simplicity and subtlety of the shadow effect above is a feature.
I've included a real time java demo of just how amazing this effect can be.
Shadowed text demo!
(Requires java. Open the file with the "java web start" application)
Source code is here!
For those without java this is what the incredibly light pink text looks like on a pure white background:

I've run into this problem a couple of times during my programming career. In my case it was adding text overlays to images to show additional image meta data... while fighting the Sith with Jonny Depp! It's actually surprisingly easy to get text to show up nicely on almost any background. All you need to do is have lightly coloured text with a shadow effect.
The simplest way to do this is to simply paint a copy of the text in question one pixel down and one to the right in black. For added readability add another copy one pixel to the right.
Here's some sample code:
g.setColor(Color.BLACK);
g.drawString(TEXT, 10 + 1, 10 + 1); //second shadow
g.drawString(TEXT, 10 + 1, 10); //first shadow
g.setColor(Color.WHITE);
g.drawString(TEXT, 10, 10);
Nice, large, translucent drop shadows can also increase the readability of text. In my case, though, I only want the shadow effect to increase the readability of the text. The simplicity and subtlety of the shadow effect above is a feature.
I've included a real time java demo of just how amazing this effect can be.
Shadowed text demo!
(Requires java. Open the file with the "java web start" application)
Source code is here!
For those without java this is what the incredibly light pink text looks like on a pure white background:

(The application isn't this blurry when you run it :-) )
Google makes use of a subtle and more fancy shadow effects if you select a background for you Google homepage. You can use any photo for the background. In this image I've selected a plain, white background:Sunday, August 1, 2010
Booting XP with the new motherboard
You may remember how I recently got a new motherboard.. and then I changed the CPU. I thought I'd get my motherboard to boot Windows XP.
When I upgraded to Windows 7 from Windows XP I installed Windows 7 on a brand-new solid state drive (remember when I got one of those?). This left me with the original installation of Windows XP on the existing hard drive. This is a sweet arrangement as it meant I could boot up with Windows XP if I discovered of applications that can't run in Windows 7. It's also useful to have your old Windows XP around if you want to look up some setting or bookmark or something that won't transfer over to Windows 7.
When I changed the motherboard I could no longer boot into Windows XP. I'm not entirely sure why that happened. My suspicion, at the time, was the drive numbers changed around. Windows XP keeps track of which drive number it's booted from in the boot.ini file. I went into the boot any file and tried changing the numbers to my best guess as to what what they should be but for some reason it wasn't working. I'm still not sure why it didn't work, actually. I think it may have had something to do with me screwing up the file format a little. I thought the '#' symbol was used to denote comments when in reality it's the ';'. Oh dear.. a little too much Linux shell scripting.
In any case, it wasn't working so I tried to use the utility EasyBCD to re-create the Windows XP boot option. This failed as well. I'm not sure why this failed either. I'm not sure what EasyBCD was trying to do but my booting arrangement is a bit unusual in that my old Windows XP drive contains the boot loader which then boots Windows 7 on my new solid-state drive. I think EasyBCD was a bit confused by this. When I would launch Easy BCD, it couldn't find the BCD file, for instance. I think it was setting everything up thinking the boot loader was being run from the solid-state drive. In any case, it I was left pretty much where I started except that now I kept getting messages about NTDETECT failing.
I noticed that EasyBCD had messed with files that Windows XP uses to boot. I tried to repair the Windows XP installation by running a few commands off the Windows XP repair CD. Many of the Windows XP commands were throwing errors and clearly had no idea what Windows 7 and easy BCD had done to the installation.
(The BIOS bone's connected to the MBR record. The MBR's connected to the PBR. The PBR points the BCD file.. but not on my system 'cause it's b0rked. yeah!)
I tried rebooting and was surprised to find I couldn't even boot Windows 7 now. After much swearing I used the Windows 7 repair CD to try and repair the installation. The Windows 7 installation CD had no idea what I'd done. I had no idea what I'd done. Things were going from bad to worse. I knew that the Windows 7 repair CD (or at very least the Windows 7 installation itself) would have the tools I needed to repair the Windows 7 installation. Theoretically, all I would need to do is generate a new BCD file that would point to the already installed Windows 7 installation. The thing was, I didn't know what the damn commands were that did that.
I tried to use EasyBCD but that didn't work as it needed the full Windows 7 to run; the repair CD didn't cut it. I couldn't even run the command line versions of EasyBCD. After a further sampling of four letter expletives, I started up the old Dell netbook and poked around the Internet looking for a solution. It turns out that, in the Windows\System32 directory, you can find two commands that will allow you to manipulate the BCD file. "bcdboot.exe" allows you to build a new BCD file and "bcdedit.exe" allows you to edit said file to add additional boot options. Sweet.
To make a long story short I used bcdboot.exe to make a new BCD file on the solid-state drive. I then switched the solid-state drive to my primary boot drive in the BIOS. With that I could boot into Window 7. yay! I then added the Windows XP installation as an option with EasyBCD. I now had a choice between the two operating systems when I booted. This all went so well that I also took a stab at repairing the BCD file on the Windows XP installation just in case my solid-state drive (containing the all important BCD file and Windows 7 installation) died. If the solid-state drive died I could boot directly to Windows XP on my other hard drive. I haven't actually tested it yet. I think it might boot Windows 7 but I don't hold out much hope that it's going to actually boot Windows XP. To do that I would need to use that BCD file to boot into Windows 7 and then used it two commands to add a second entry for Windows XP. This is precisely what I couldn't figure out how to do the first time. Oh well, maybe I'll try it again.. A bit later...
Now that Windows XP is booting all I need to do is install the drivers and get ACHI working again. Weeeeeeeeeeeeeeeeeeeeee......
When I upgraded to Windows 7 from Windows XP I installed Windows 7 on a brand-new solid state drive (remember when I got one of those?). This left me with the original installation of Windows XP on the existing hard drive. This is a sweet arrangement as it meant I could boot up with Windows XP if I discovered of applications that can't run in Windows 7. It's also useful to have your old Windows XP around if you want to look up some setting or bookmark or something that won't transfer over to Windows 7.
When I changed the motherboard I could no longer boot into Windows XP. I'm not entirely sure why that happened. My suspicion, at the time, was the drive numbers changed around. Windows XP keeps track of which drive number it's booted from in the boot.ini file. I went into the boot any file and tried changing the numbers to my best guess as to what what they should be but for some reason it wasn't working. I'm still not sure why it didn't work, actually. I think it may have had something to do with me screwing up the file format a little. I thought the '#' symbol was used to denote comments when in reality it's the ';'. Oh dear.. a little too much Linux shell scripting.
In any case, it wasn't working so I tried to use the utility EasyBCD to re-create the Windows XP boot option. This failed as well. I'm not sure why this failed either. I'm not sure what EasyBCD was trying to do but my booting arrangement is a bit unusual in that my old Windows XP drive contains the boot loader which then boots Windows 7 on my new solid-state drive. I think EasyBCD was a bit confused by this. When I would launch Easy BCD, it couldn't find the BCD file, for instance. I think it was setting everything up thinking the boot loader was being run from the solid-state drive. In any case, it I was left pretty much where I started except that now I kept getting messages about NTDETECT failing.
I noticed that EasyBCD had messed with files that Windows XP uses to boot. I tried to repair the Windows XP installation by running a few commands off the Windows XP repair CD. Many of the Windows XP commands were throwing errors and clearly had no idea what Windows 7 and easy BCD had done to the installation.
I tried rebooting and was surprised to find I couldn't even boot Windows 7 now. After much swearing I used the Windows 7 repair CD to try and repair the installation. The Windows 7 installation CD had no idea what I'd done. I had no idea what I'd done. Things were going from bad to worse. I knew that the Windows 7 repair CD (or at very least the Windows 7 installation itself) would have the tools I needed to repair the Windows 7 installation. Theoretically, all I would need to do is generate a new BCD file that would point to the already installed Windows 7 installation. The thing was, I didn't know what the damn commands were that did that.
I tried to use EasyBCD but that didn't work as it needed the full Windows 7 to run; the repair CD didn't cut it. I couldn't even run the command line versions of EasyBCD. After a further sampling of four letter expletives, I started up the old Dell netbook and poked around the Internet looking for a solution. It turns out that, in the Windows\System32 directory, you can find two commands that will allow you to manipulate the BCD file. "bcdboot.exe" allows you to build a new BCD file and "bcdedit.exe" allows you to edit said file to add additional boot options. Sweet.
To make a long story short I used bcdboot.exe to make a new BCD file on the solid-state drive. I then switched the solid-state drive to my primary boot drive in the BIOS. With that I could boot into Window 7. yay! I then added the Windows XP installation as an option with EasyBCD. I now had a choice between the two operating systems when I booted. This all went so well that I also took a stab at repairing the BCD file on the Windows XP installation just in case my solid-state drive (containing the all important BCD file and Windows 7 installation) died. If the solid-state drive died I could boot directly to Windows XP on my other hard drive. I haven't actually tested it yet. I think it might boot Windows 7 but I don't hold out much hope that it's going to actually boot Windows XP. To do that I would need to use that BCD file to boot into Windows 7 and then used it two commands to add a second entry for Windows XP. This is precisely what I couldn't figure out how to do the first time. Oh well, maybe I'll try it again.. A bit later...
Now that Windows XP is booting all I need to do is install the drivers and get ACHI working again. Weeeeeeeeeeeeeeeeeeeeee......
Saturday, July 31, 2010
CPU heat sink woes
Okay so here's the story of what happened to my CPU after I installed the new motherboard.
When you install a new motherboard you need to take the CPU off the old motherboard and put the CPU onto the new motherboard. This is a bit involved but not as difficult as dealing with the heatsink. The standard heatsink for the socket 775 series CPU is absolutely silly. Essentially, it's held on with some pushpins. It's a bit difficult to describe exactly how this works but basically you have two plastic flaps being held open with a sort of wedge. The wedge is on the head of this pin. The wedge is flattened so that as you twist the pin can wedge open the two plastic flaps or not as you wish.
I didn't know any of this when I started and the manual wasn't exactly helpful. After a while I managed to get the heatsink off but I would definitely suggest reading a handful of tutorials on the Internet on how to do it before you start. The way I did it was wrong. I actually twisted some of the pins in the wrong direction. They eventually turned but they weren't too happy about it. If you do it the right way it's much easier.
So anyway, I successfully got the heatsink off and transfered the CPU over to the new motherboard. There were no bent pins on the motherboard when I bought it. The guy at the computer shop was really eager to show me this. "You see" he said. "No bent pins". Mmm kay. I'm guessing that some motherboards have bent pins or some people bring motherboards back in with bent pins because they put too much pressure on the CPU when they installed it or something. I can definitely see how that could happen but if you're carefully following the instructions (which is actually well explained in the motherboard user manual at least in my case) you shouldn't screw anything up.
Once the CPU was on the new motherboard all that remained was to replace the heatsink. At this point I felt like a bit of a fool as I had completely forgotten about the thermal paste. You see, when you move a CPU like this you typically have to reapply the thermal paste (sometimes called thermal grease). In my case I didn't have any thermal paste. Nor did I have the isoproterenol you need in order to clean off the old thermal paste. Cunningly, I took advantage of both these situations and simply reused the existing paste. This was okay because it would still work, just not very well. Even if it didn't work Intel CPUs have little thermometers in them which stop you from damaging the CPU if they get too hot. It also stops them from bursting into flames if the heat sink falls off which is handy.

Intel CPUs (and modern AMD CPUs) do this by under clocking themselves until they cool down. So a 3Ghz chip might run at 1 Ghz or even lower if it gets too hot. The general rule is the higher the Mhz/Ghz the more heat is produced so lower Ghz means less heat. When this feature was introduced people accused Intel of crippling their CPUs because they would under clocked themselves when after you've installed them.. umm... wrongly... I still don't fully understand that attitude. I am quite thankful for this feature because I much prefer a slow CPU to a burning CPU.
When I got my system running I checked to see what the temperature on the CPU was. The temperature was about 75°C which is not that hot. Under load it went up to 80°C. These numbers didn't seem that high to me but I knew that different CPUs have different operating temperatures. Some Pentium 4 chips used to get very hot indeed. This being a Core 2 Duo (E6400) and not a Pentium 4 it might have a lower operating temperature. After some research it turned out that it was only supposed to run at 61°C maximum. Dang.
So I went down to the computer store and picked up some thermal grease and went to the drugstore and picked up some extremely pure isopropanol. I then took off my heat sink (with minimal swearing this time), used some cotton swabs and isopropanol to take off the old thermal paste and replaced it with the new thermal grease in the usual way. I then booted up my machine to check the temperature.
At idle the temperature was 65°C and under full load the temperature was 80°C. This annoyed me. I hadn't even finished overclocking the CPU. It was a 2.1 GHz CPU that I wanted to run at 3.2 GHz. I already knew that the chip could run at that speed just fine. My guess was that the thermal grease I installed was crap. The other possibility was that I had installed the heat sink slightly wrong... I made the decision that I wasn't going to reinstall the heat sink again as I was no longer on speaking terms with it. I wanted to run my system overclocked so I figured that I should get something better then the stock cooler anyway. With any luck it would be quieter and come with its own (better) thermal paste too.
I went down to the local computer shop and got an Arctic Freezer 7 ver 2. I did this because it had some good reviews on the web. It was also in stock at the local computer store. At only 35$ dollars it was a good deal too. Yeah, it included the thermal paste.
Installation was shockingly easy although I must confess that I had to read the instructions (Well, look at the instruction pictures really. There were no words.). I was also worried about over tightening the screws that held the heat sink onto the black, plastic mounting bracket. The 775 socket is made to take a lot of pressure but I didn't want to overdo it. I had visions of going back to the computer store. I'd have to get another replacement motherboard because I'd bent the pins! I couldn't even claim they were bent to begin with. :-)
In the end I installed the cooler, booted up and checked the temperature. Idle temperature was now 40°C. Temperature under full load was 60°C. Woohoo! What made it even nicer was that the fan wasn't even going at full speed like the old heat sink fan was. This meant I had some headroom to work with. It also meant I wasn't going to go deaf from the fan noise. Going deaf sucks. Especially if you don't want to.
I was very happy with all this and so tried overclocking it to the full 3.2 GHz. Idle temperature was still 40°C temperature and under full load it was still 60°C. I was very, very happy. I did notice something weird though. The the CPU seemed to be operating only at 2.4 GHz when the CPU was idle but when the CPU is under full load it was operating at 3.2 GHz. I'm guessing this has something to do with saving energy. If the CPU is not doing anything then there's no point in running it at the full 3.2 GHz. It just wastes energy. I'm still investigating exactly which feature that I inadvertently installed that is causing this to happen. When I find out I'll be sure to tell mention it.
Now all I had to do was get my second hard drive (with Windows XP) booting again.
When you install a new motherboard you need to take the CPU off the old motherboard and put the CPU onto the new motherboard. This is a bit involved but not as difficult as dealing with the heatsink. The standard heatsink for the socket 775 series CPU is absolutely silly. Essentially, it's held on with some pushpins. It's a bit difficult to describe exactly how this works but basically you have two plastic flaps being held open with a sort of wedge. The wedge is on the head of this pin. The wedge is flattened so that as you twist the pin can wedge open the two plastic flaps or not as you wish.
I didn't know any of this when I started and the manual wasn't exactly helpful. After a while I managed to get the heatsink off but I would definitely suggest reading a handful of tutorials on the Internet on how to do it before you start. The way I did it was wrong. I actually twisted some of the pins in the wrong direction. They eventually turned but they weren't too happy about it. If you do it the right way it's much easier.
So anyway, I successfully got the heatsink off and transfered the CPU over to the new motherboard. There were no bent pins on the motherboard when I bought it. The guy at the computer shop was really eager to show me this. "You see" he said. "No bent pins". Mmm kay. I'm guessing that some motherboards have bent pins or some people bring motherboards back in with bent pins because they put too much pressure on the CPU when they installed it or something. I can definitely see how that could happen but if you're carefully following the instructions (which is actually well explained in the motherboard user manual at least in my case) you shouldn't screw anything up.
Once the CPU was on the new motherboard all that remained was to replace the heatsink. At this point I felt like a bit of a fool as I had completely forgotten about the thermal paste. You see, when you move a CPU like this you typically have to reapply the thermal paste (sometimes called thermal grease). In my case I didn't have any thermal paste. Nor did I have the isoproterenol you need in order to clean off the old thermal paste. Cunningly, I took advantage of both these situations and simply reused the existing paste. This was okay because it would still work, just not very well. Even if it didn't work Intel CPUs have little thermometers in them which stop you from damaging the CPU if they get too hot. It also stops them from bursting into flames if the heat sink falls off which is handy.
Intel CPUs (and modern AMD CPUs) do this by under clocking themselves until they cool down. So a 3Ghz chip might run at 1 Ghz or even lower if it gets too hot. The general rule is the higher the Mhz/Ghz the more heat is produced so lower Ghz means less heat. When this feature was introduced people accused Intel of crippling their CPUs because they would under clocked themselves when after you've installed them.. umm... wrongly... I still don't fully understand that attitude. I am quite thankful for this feature because I much prefer a slow CPU to a burning CPU.
When I got my system running I checked to see what the temperature on the CPU was. The temperature was about 75°C which is not that hot. Under load it went up to 80°C. These numbers didn't seem that high to me but I knew that different CPUs have different operating temperatures. Some Pentium 4 chips used to get very hot indeed. This being a Core 2 Duo (E6400) and not a Pentium 4 it might have a lower operating temperature. After some research it turned out that it was only supposed to run at 61°C maximum. Dang.
So I went down to the computer store and picked up some thermal grease and went to the drugstore and picked up some extremely pure isopropanol. I then took off my heat sink (with minimal swearing this time), used some cotton swabs and isopropanol to take off the old thermal paste and replaced it with the new thermal grease in the usual way. I then booted up my machine to check the temperature.
At idle the temperature was 65°C and under full load the temperature was 80°C. This annoyed me. I hadn't even finished overclocking the CPU. It was a 2.1 GHz CPU that I wanted to run at 3.2 GHz. I already knew that the chip could run at that speed just fine. My guess was that the thermal grease I installed was crap. The other possibility was that I had installed the heat sink slightly wrong... I made the decision that I wasn't going to reinstall the heat sink again as I was no longer on speaking terms with it. I wanted to run my system overclocked so I figured that I should get something better then the stock cooler anyway. With any luck it would be quieter and come with its own (better) thermal paste too.
I went down to the local computer shop and got an Arctic Freezer 7 ver 2. I did this because it had some good reviews on the web. It was also in stock at the local computer store. At only 35$ dollars it was a good deal too. Yeah, it included the thermal paste.
Installation was shockingly easy although I must confess that I had to read the instructions (Well, look at the instruction pictures really. There were no words.). I was also worried about over tightening the screws that held the heat sink onto the black, plastic mounting bracket. The 775 socket is made to take a lot of pressure but I didn't want to overdo it. I had visions of going back to the computer store. I'd have to get another replacement motherboard because I'd bent the pins! I couldn't even claim they were bent to begin with. :-)
In the end I installed the cooler, booted up and checked the temperature. Idle temperature was now 40°C. Temperature under full load was 60°C. Woohoo! What made it even nicer was that the fan wasn't even going at full speed like the old heat sink fan was. This meant I had some headroom to work with. It also meant I wasn't going to go deaf from the fan noise. Going deaf sucks. Especially if you don't want to.
I was very happy with all this and so tried overclocking it to the full 3.2 GHz. Idle temperature was still 40°C temperature and under full load it was still 60°C. I was very, very happy. I did notice something weird though. The the CPU seemed to be operating only at 2.4 GHz when the CPU was idle but when the CPU is under full load it was operating at 3.2 GHz. I'm guessing this has something to do with saving energy. If the CPU is not doing anything then there's no point in running it at the full 3.2 GHz. It just wastes energy. I'm still investigating exactly which feature that I inadvertently installed that is causing this to happen. When I find out I'll be sure to tell mention it.
Now all I had to do was get my second hard drive (with Windows XP) booting again.
Friday, July 30, 2010
Why the U2211-H panel?
Why did I get this relatively small 21.5 inch panel (note that I paid 219$ CAD not the 319 it is normally) instead of, say this much larger, comparably priced panel.
Doesn't go into portrait mode.. Doesn't have a display port.. is too big 4 me (24 inches yipes! 3 of those won't fit on my desk) and it's a TN panel..
from
http://www.pchardwarehelp.com/guides/lcd-panel-types.php
The "ultra" panels from Dell are the latest generation of ISP panels:
Wikipedia also has a good article on the topic of panel types:
https://secure.wikimedia.org/wikipedia/en/wiki/TFT_LCD
Doesn't go into portrait mode.. Doesn't have a display port.. is too big 4 me (24 inches yipes! 3 of those won't fit on my desk) and it's a TN panel..
from
http://www.pchardwarehelp.com/guides/lcd-panel-types.php
"TN (Twisted Nematic) panels are the most widely used panel type in the manufacture of LCD monitors. TN panels are cheap and offer excellent response times, making them perfect for fast paced gaming. The response times of current TN panels range from 2ms to 5ms. However, color reproduction, viewing angles and contrast ratios of TN panels are the worst of any current LCD panel technology. Unlike most 8-bit IPS/VA based panels, TN is only 6-bit and unable to display the full 16.7 million colors available in 24-bit true color. They can mimick the 16.7 million colors of 8-bit panels using a technique called dithering, but the results are unimpressive. TN panels have become popular with the average computer user because they are very inexpensive and currently dominate the LCD display market in availability."
The "ultra" panels from Dell are the latest generation of ISP panels:
"S-IPS/H-IPS (In Plane Switching) panels are generally considered the best overall LCD technology for image quality, color accuracy and viewing angles, but this comes at a price. They are well suited for graphics design and other applications which require accurate and consistent color reproduction. S-IPS panels offer the best viewing angles of any current LCD technology, with wide viewing angles up to 178 degress. The response time of S-IPS is adequate, ranging from 6ms to 16ms with current panels. This is only slightly slower than TN panels. However, gamers should take this into consideration. Fast paced games may suffer from motion blur or ghosting with S-IPS panels that have a response time higher than 8ms."
Wikipedia also has a good article on the topic of panel types:
https://secure.wikimedia.org/wikipedia/en/wiki/TFT_LCD
Wednesday, July 28, 2010
Dell monitor for cheap U2211H - 100$ off
Well, in the end I couldn't find a good 4:3 aspect ratio monitor at a price that made sense. Instead I got 3 U2211H monitors. Dell is selling them at a 100$ CAD discount each so that's not bad. They are full 1920x1080 monitors with tilt and swivel bases so you can use them in portrait mode. I'm not sure how long the 100$ deal lasts. Check it out:
<http://accessories.dell.com/sna/products/Displays/productdetail.aspx?c=ca&l=en&cs=cadhs1&sku=320-9271>
Price with discount is $219.00 CAD
<http://accessories.dell.com/sna/products/Displays/productdetail.aspx?c=ca&l=en&cs=cadhs1&sku=320-9271>
Price with discount is $219.00 CAD
Subscribe to:
Posts (Atom)
