Archive for April, 2011

Keep your laptop cool the right way

Laptops by their very nature use smaller and more compact systems than their desktop counterparts. Unfortunately, this applies to the cooling system — the heat sink and fan assemblies — as well. Anyone who has any experience with computers, or electronics in general, knows that heat is one of the biggest enemies of electronics.

With the smaller and more compact cooling systems of laptops, unfortunately they have smaller fans and less airflow space, and are more quickly and more frequently affected by dust build-up in the heat sink and fans than desktops. However, even though the air flows through a smaller space, it works very well to cool the laptop, provided that the air spaces aren’t blocked or clogged.

Note that during heavy usage, its normal (and expected) for your laptop to get a little warm on the bottom. However, if you can’t put your hand there without having to pull it away, it’s too hot.

Most laptop users who have experienced an overheating laptop turn to a readily-available but poor choice of solutions: the laptop cooling mat. These poorly-designed devices are generally flat plastic “trays” with a USB-powered fan or two in the middle. They only serve to stir the air under your laptop and actually do very little to cool its hard-working internal electronics.

Signs of an overheating laptop include slow speeds (the processor clocks down to lower it’s heat output after it reaches a certain temperature), random sudden shutdowns (the processor shuts the system down in an “emergency” when clocking down still can’t cool the system), and program freezes, crashes, and more (hot processors become unstable, and the heat can affect nearby components). It’s also not uncommon for sustained periods of high heat to permanently damage your laptop’s motherboard or other components. So, protect your investment and do the right thing: clean it.

Preventing the problem of an overheating laptop is easy to do. Simply blow the air vents out periodically with compressed air. This 2-minute job serves to quickly evacuate the dust and dirt from the heat sink and fans, and keeps the air flowing as it should.

Unfortunately, once the dust has accumulated past a certain point, it’s sure to have formed a giant dust bunny and the compressed air will do very little. It’s simply too large now to go back the way it came in, but it’s still not too late. You’ll have to disassemble your laptop far enough to get the heat sink (and possibly the fan) out and clean it by hand.

Depending on your laptop, it may be a quick operation, or it may not. Use your favorite search engine to find disassembly instructions for your specific model, and budget yourself an hour or so, depending on the length of the procedure.

It’s extremely important that you reapply a thermal compound to the processor before the heatsink is reattached. Thermal compound serves to fill in the small gaps between the processor and the heat sink for ideal heat transfer.

Have a story about an overheating laptop? Have a photo of a giant dust bunny to share? Have some other feedback? Please feel free to share it in the comments below!

Leave a comment

Block access to your website via proxies using .htaccess

If you’re a webmaster, you may want to block access to your site via proxies. While you could do this by blocking the proxy domains individually, there are thousands upon thousands of proxies and more popping up all the time. Rather than block them individually, you can easily block the HTTP headers that [properly behaving] proxies use.

Originally appearing at Perishable Press, the following code segment gets added to your .htaccess file:

RewriteEngine on
RewriteCond %{HTTP:VIA}                 !^$ [OR]
RewriteCond %{HTTP:FORWARDED}           !^$ [OR]
RewriteCond %{HTTP:USERAGENT_VIA}       !^$ [OR]
RewriteCond %{HTTP:X_FORWARDED_FOR}     !^$ [OR]
RewriteCond %{HTTP:PROXY_CONNECTION}    !^$ [OR]
RewriteCond %{HTTP:XPROXY_CONNECTION}   !^$ [OR]
RewriteCond %{HTTP:HTTP_PC_REMOTE_ADDR} !^$ [OR]
RewriteCond %{HTTP:HTTP_CLIENT_IP}      !^$
RewriteRule ^(.*)$ - [F]

This sends visitors a “403 Forbidden” message. Period.

An interesting update to this finds that most anonymous proxies aren’t sending the headers that this filtering acts upon. You can test this by visiting a site that shows browser HTTP headers, such as HTTP Header Viewer: list browser headers, using a proxy. If you don’t see any of the headers mentioned above, then this code isn’t going to filter for you. Unfortunately the proxies have realized that people aren’t going to use them if they can be easily blocked, and the proxies are getting smarter. That makes blocking them all the more difficult.

If you have a method for blocking proxy access to your site, or anything else to share on this subject, please feel free to share it in the comments below!

Leave a comment

Convert VirtualBox (vdi) hard drive image to VMWare (vmdk) format

I’ve been using VirtualBox for my Windows XP VM when I’m in linux to get a handle on those Windows apps that I absolutely need, and to sometimes address a piece of hardware that otherwise won’t work. One of the biggest issues I’ve had is a distinct lack of VirtualBox to address my BlackBerry — I absolutely must use my Windows hard drive to do it.

VMWare Workstation seems to overcome whatever shortfall exists in VirtualBox to address it, and I’m happy to say, it works quite well. However, now I have this VirtualBox hard drive image with all my software already installed, and I want to boot it in VMWare. How to convert it?

Fortunately, the VBoxManage utility of VirtualBox can actually convert a VirtualBox vdi image to the vmdk format used by VMWare. It can do it rather easily, as well.

The command format is:

VBoxManage clonehd          | 
                            [--format VDI|VMDK|VHD|RAW|]
                            [--variant Standard,Fixed,Split2G,Stream,ESX]

Example (Windows):

"c:Program FilesOracleVirtualBoxVBoxManage.exe" clonehd "Win XP.vdi" xp.vmdk  --format vmdk --variant standard

Absolute path to VBoxManage is necessary unless it’s in the Windows $PATH.

Example (Linux):

VBoxManage clonehd "Win XP.vdi" xp.vmdk  --format vmdk --variant standard

Successful run gets this output:

Clone hard disk created in format 'vmdk'. UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Next, open VMWare and select Create a new virtual machine

Select “I will install the operating system later”

Make your OS selection about the OS that’s currently on the vmdk you will be using. (The guest OS, not the host OS).

Later on, you will have the option to use an existing vmdk image as your virtual hard drive. Do so.

You should now be able to finish setup and boot your converted disk image.

Note that creating a new machine and using an existing hard drive image is not a feature of VMWare Player. Workstation or another product is required. However, JoVa has shared a great workaround:

Since my tip for VMWare Player is not very clear on what to do exactly, I have the following, easy steps that you can follow, right after you started VMWare Player.
1) Select: Create new Virtual Machine
2) Select Guest Operating OS “Microsoft Windows” and select the version you have (for example “Windows XP Professional”)
3) Click “Next” and give a the virtual machine a name, for example “XP-pro”.
4) Click “Next” set the maximum disk size to the size of your actual virtual machine (important!)
5) Click “Next”and click “Finish”. The VM is created
6) Copy your VM (the .vmdk file) over the created (empty) .vmdk (e.g. xp-pro.vmdk)
7) Play the virtual machine

Questions, comments, or feedback is appreciated, as always.

, , , ,

Leave a comment

Redirect or deny site visitors based on IP using .htaccess

As a webmaster, there may be times when you want to deny one or more IP addresses or ranges from accessing your website. Be it comment spammers, page scrapers, or various other reasons. For that, you’re welcome to adopt the following code snippets. If you’ve found them helpful, or have something to share, please do so in the comments below.

Deny by IP

Start by looking for the following two lines in your .htaccess file

order allow,deny
allow from all

Add the following directives BETWEEN those lines. If you don’t have the above two lines, add them and the following lines between them.

# Throws a "403 Forbidden" for the matching IP ranges
# Matches 91.46.*.*
Deny from 91.46.
# Matches exactly
Deny from

Redirect by IP

Copy/paste the following code and add to your .htaccess file, changing the RewriteCond and RewriteRule lines to meet your needs. Read the comments.

# Permanently redirect based on IP rage
<IfModule mod_rewrite.c>
RewriteEngine On
# Try uncommenting this line if it doesn't take
# Options +FollowSymlinks
# The following line describe the IP-pattern to match
# If 1 octet is given, it will match the entire Class-A address
# If 2 octets are given, it will match the Class-B address
# if 3 octets are given, will match the Class-C address
# If 4 octets are given, will match the full address
# The NC directive means Not-Case-Sensitive. It's probably not required.
# Matches exactly
RewriteCond %{REMOTE_HOST} [NC,OR]
# Matches 10.2.*.*
# The trailing period is needed to prevent partial-octet matching
# (i.e. matching 10.200. or 10.20. instead of just 10.2.
RewriteCond %{REMOTE_HOST} 10.2. [NC,OR]
# OR statement must be on all but the last IP to match
# It means, literally, "match this rule, or..."
# Matches 10.5.6.*
RewriteCond %{REMOTE_HOST} 10.5.6. [NC]
# Next line format: RewriteRule <regex to match> <destination> <Flags>
# by default, the next line matches all URLs
# and permanently (301) redirects to the destination.
# Use R=302 instead for a temporary redirect.
# L means this is the last rule to process when this condition is met (recommended)
RewriteRule .* [R=301,L]

Thomas indicates that there should be a trailing backslash-period at the end of the 4th octet, if the octet is less than 3 digits. In testing, I haven’t found it necessary (and it behaves as expected), but readers are encouraged to try it both ways. If you find that one way works over another, feel free to share in the comments.

Here’s a simpler, albeit somewhat less flexible method. This doesn’t use the Apache rewrite module, nor pattern matching, and may or may not fit your needs.

# 301 (permanently) redirect requests for /bar to
301 redirect /bar
# Also redirect the web root
301 redirect /

Questions, comments, and feedback regarding these methods are welcome and apreciated. Have something to contribute, or have feedback about the above code? Please feel free to share in the comments below!

, ,

Leave a comment

Speed up Windows by disabling the “last access” time stamp

By default, Windows keeps track of the last time a file was accessed through the “last access” time stamp. If you use this time stamp for backup purposes or you make frequent use of the Windows search function base on time stamp, then you may actually have a use for it.

In other cases you can disable the update and it will speed up Windows by avoiding having to update (write) that time stamp every time a file is read.

There are a few different methods for disabling that time stamp:

Via the command line

Open an administrator-level command prompt and enter this command:

fsutil behavior set disablelastaccess 1

Replace the 1 with a 0 (zero) to turn the “last access” time stamp updating back on.

Via regedit

Navigate to the following registry location:


Right-click the right-side panel and select New > DWORD Value. Call it NtfsDisableLastAccessUpdate and give it a value of 1.

To reenable, change the value to 0 (zero) or just delete it.

A reboot is required when the value is changed.

Via a registry file

Take the code from one of the following settings and create a new file ending in a .reg extension. Double-click to make the change, and reboot to make it take effect.


Windows Registry Editor Version 5.00



Windows Registry Editor Version 5.00


Questions, comments, and feedback is appreciated, as always.


Leave a comment

Correctly Recognize Alps Touchpad on Dell E6510 in Linux

Laptops which use newer Alps touchpad hardware may experience some lack of functionality as a result of a regression in the kernel psmouse driver — the touchpad is detected and works as a pointing device, but only functions with basic features. Scrolling, disabling tap-to-click, off when typing, and multi-touch (on supported devices) are some of the missing functionality. This appears to be the case with E5510, E6410, M6400, and other Dell (potentially all E2) and some non-Dell models.

From Simon Dierl:

Apparently, newer ALPS touchpads use a new, undocumented and unsupported protocol. The touchpad falls back to a legacy emulation mode, resulting in faulty detections. The bug lists some efforts to reverse-engineer the protocol and has some patches based on DELL contributions that enable ImPS/2 emulation (scrolling works). This, however, still does not allow for synaptics support (turn off when typing, horizontal scroll, etc.). Additionally, some people report problems on suspend/resume. [sic]

The best way to notice if you have a machine which is affected by this bug, is to go to System > Preferences > Mouse and look for a Touchpad tab. If it’s absent, you are probably affected by this bug.

Another way to see if you are affected by this bug is to run lsinput and look for something like the following:

bustype : BUS_I8042
vendor  : 0x2
product : 0x1
version : 0
name    : "PS/2 Generic Mouse"
phys    : "isa0060/serio1/input0"
bits ev : EV_SYN EV_KEY EV_REL

The above output shows the touchpad being identified and driven by the PS/2 driver.

This bug has been entered into Launchpad as bug #606238 and has its roots in Kernel bug #14660. Since it’s a mainline kernel bug, it’s likely to affect every Linux distribution. So far, it’s still a work-in-progress and there’s not been an accepted patch submitted to the Linux kernel team. There’s a discussion on that this is a regression, and this was working in older kernel versions.

The below is based on a patch from cmg238 which, at the very least, causes the kernel to correctly recognize the device as a touchpad and enable some missing functionality. I have made adjustments to the instructions for clarity and explanation.

Download kernel source (to /usr/src):

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
apt-get source linux-image-$(uname -r)

(Note: in Ubuntu Precise 12.04, do the following instead, based on this LaunchPad comment)

sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
sudo git clone git://
cd linux
sudo git checkout origin/alps
sudo cp /boot/config-$(uname -r) .config

Also note that on Ubuntu Precise 12.04, you will be asked a bunch of additional questions at make-time. Accept the defaults, unless you have a reason to do otherwise.

Read about how to “undo” an apt-get build-dep and uninstall previously installed packages here.

Patch drivers/input/mouse/alps.c by locating alps_model_info and adding the additional line below, as follows:

static const struct alps_model_info alps_model_data[] = {
	{ { 0x73, 0x02, 0x64 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Dell Latitude E6510 */

Compile psmouse.ko module

cd src/drivers/input/mouse
make -C /lib/modules/`uname -r`/build M=`pwd` psmouse.ko

(On Ubuntu Precise 12.04, use the following instead:)

cd /usr/src/linux/drivers/input/mouse
make -C /lib/modules/`uname -r`/build M=`pwd` psmouse.ko

The following steps will cause you to lose mouse functionality until the modprobe psmouse statement. Be prepared. Also, You may want to backup your existing /lib/modules/(kernel version)/kernel/drivers/input/mouse/psmouse.ko before doing this!

rmmod psmouse
cp psmouse.ko /lib/modules/`uname -r`/kernel/drivers/input/mouse/
modprobe psmouse

The last thing to mention is if you update your kernel you will receive the distributed psmouse.ko module. If the kernel does not include a fix for this bug you will need to follow the directions in this post again to recompile the above patch back into the kernel.

Since this is a mainline kernel issue, I would ask that any reader who is able to, please visit the links within this post and contribute where ever you can to help in getting this resolved. You are welcome and encouraged to share your thoughts and feedback in the comments below as well.

, , , , , , , , ,

Leave a comment

Ubuntu OpenOffice Quickstarter prevents Gnome shutdown

I ran into an issue where, after clicking “Shut Down” in Gnome, the dialog box would simply close and shutdown would never happen. To get my system to shut down, I would have to open a terminal and shutdown using the command shutdown -h now.

As it turns out, if you have the quickstarter open and open an office document, it will somehow block shutdown. This is a known issue OpenOffice 3.2, and has been reported in Lanchpad as bug #542002 and bug #562027.

To reproduce:

Enable the quickstarter in Tools > Options > > Memory > Enable Systray Quickstarter

Now open an office document.

Try to shut down using the Gnome power button.

The dialog box closes and nothing happens.

In order to fix this, simply disable the systray quickstarter:

Right-click on the Quickstarter icon and choose “Disable Systray Quickstarter”

The quickstarter loads portions of OpenOffice into memory, which seems to save 2-3 seconds of load time. In my opinion the 2-3 seconds gained loading OpenOffice is not worth the hassle of having to shut down using a terminal command. I’ve since disabled the quickstarter and have left it that way.

Questions, comments, and feedback on this are welcome, as always.



Leave a comment

Undo apt-get build-dep

When you want to compile something from source in Ubuntu/Debian, the easiest way to install the dependencies required to compile it is to run apt-get build-dep PACKAGE. Unfortunately, there is no built-in command to remove these dependencies. Thankfully, a discussion on Launchpad gives a good solution to this problem. Using this, you can “undo” an apt-get build-dep by running a single command. Note that this requires aptitude, so if you’re running Ubuntu 10.10, or you’ve removed aptitude, you’ll first need to install it using the following:

sudo apt-get install aptitude

Now, undo the apt-get build-dep:

sudo aptitude markauto $(apt-cache showsrc PACKAGE | grep Build-Depends | perl -p -e 's/(?:[[(].+?[])]|Build-Depends:|,||)//g')

Replace PACKAGE with the name of the package you’ve previously ran apt-get build-dep for, such as kernel or python2.5

After a few moments, the packages will be marked as automatically installed and you will either be prompted to remove them immediately, or you can remove them with the following command, which uninstalls all packages automatically installed but no longer needed:

sudo apt-get autoremove

Questions, comments, and feedback are welcome and appreciated.

, ,

Leave a comment

Windows, Linux dual-boot system time issues

Multiple Boot Systems Time Conflicts

From The Ubuntu Community:

Operating systems store and retrieve the time in the hardware clock located on your motherboard so that it can keep track of the time even when the system does not have power. Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as UTC by default, though some systems (notably Microsoft Windows) store the time on the hardware clock as the ‘local’ time. This causes problems in a dual boot system if both systems view the hardware clock differently.

The advantage of having the hardware clock as UTC is that you don’t need to change the hardware clock when moving between timezones or when Daylight Savings Time (DST) begins or ends as UTC does not have DST or timezone offsets.

Changing Linux to use local time is easier and more reliable than changing Windows to use UTC, so dual-boot Linux/Windows systems tend to use local time.

Since Ubuntu Intrepid (8.10), the hardware clock is set to UTC by default.

Make Windows use UTC

Note: This method was not initially supported on Windows Vista and Server 2008, but came back with Vista SP2, Windows 7 and Server 2008 R2.

To make MS Windows calculate the time from the hardware clock as UTC.

Via regedit:

Run regedit and navigate to


Right-click in the right-side panel and select New > DWORD Value. Create the key named RealTimeIsUniversal and give it a value of 1.

Using a registry file

Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:

Windows Registry Editor Version 5.00


Make Linux use ‘Local’ time

To tell your Ubuntu system that the hardware clock is set to ‘local’ time:

1. edit /etc/default/rcS

2. Set UTC=yes if your hardware clock is set to UTC (GMT), or UTC=no to have the hardware clock set to local time.

It’s come to my attention that this issue also affects Macs which dual boot via bootcamp or other methods. 

Questions, comments, and feedback is welcome and appreciated.

, , , , , , ,

Leave a comment

Bad Behavior on Drupal 7

Bad Behavior is a set of PHP scripts that is designed to keep your blog or forum clean from spam by taking a much different approach than typical solutions. While I could go into a big explanation, you can read all about it here

That said, Drupal 7 is available for download, but the Drupal 6 Bad Behavior module has not yet been ported to Drupal 7. These instructions will help you get a very crude installation of Bad Behavior protecting your Drupal 7 site, albeit in the “no logging” mode, which is not the preferred method. If you’re familiar with Drupal 7 enough to attempt a port, I would ask that you please visit the Drupal 6 module and contact the developer. The Drupal community would greatly appreciate it.

These instructions are based on the Bad Behavior Porting Guide.

First, download Bad Behavior from

When you unzip it, you should have a folder called bad-bahavior.

Upload that folder somewhere to your web root, so that bad-behavior-generic.php is accessible as (These are sample instructions only, advanced users are encouraged to place the scripts wherever they like.)

edit bad-behavior-generic.php

Locate the following line:

'httpbl_key' => '',

Input your http:BL API key from Project Honey Pot. If your API key is ‘exampleAPIkey’, you’ll have this:

'httpbl_key' => 'exampleAPIkey',

edit drupal index.php

Right below the opening <?php tag, insert the following line, making sure it has the correct relative location of bad-behavior-generic.php:


That’s it!

Questions, comments, and feedback are always welcome and appreciated.



Leave a comment