Categories
Computers Linux

Acerfand crashes Acer Aspire One 110

I have an Acer Aspire One 110 Ab that I have upgraded with 1 GB RAM (for a total of 1.5 GB) as well as upgrading the BIOS to version 3309.

Before upgrading the BIOS, which was done in an attempt to improve the stability of 802.11 networking, the acerfand program worked wonders to keep the fan running as little as possible.

Once I upgraded the BIOS to 3309 the acerfand program no longer worked. Instead of turning the fan off the fan was running at full speed for a second every other second.

On March 14th, version 0.07 of acerfand was released and I tried it out in the hope that it would fix the fan issue for by BIOS version. While it did turn off the fan, it caused the computer to reboot after a few minutes. Clearly, this was even worse than the alternative.

I did some trial and error and changed the value 0x20 to 0x21 (two places) for the 3309 specific values. In other words, roughly half-way down in the file, my acerfand file now looks like this:

"${BIOS_VERSION_3309}")
	#change: handle 3309 seperate 0xAF -> 0x20
	R_FAN=55
	R_TEMP=58
	FAN_CMD_OFF=21
	FAN_CMD_AUTO=00
	RAW_FAN_STATE_OFF="0x21"
	;;

This has completely solved the issue. The fan now stays off as long as the temperature is below 70 degrees Celsius. The rest of the time (which is virtually always) it is dead silent. Case closed. For now.

Categories
Computers Mac

OS X panics when inserting USB memory

Suddenly my Macbook started crashing whenever I inserted a USB memory stick. Not just crashed – it completely froze.

iousbfamily-crash

The problem report report listed a module called IOUSBFamily and I had a vague idea that I had changed that some time back for something that had to do with my iPhone.

iousbfamily-report

It turns out the solution to the problem was rather simple. Just log onto Apple Developer Connection and search for IOUSBFamily and whatever version of OS X you are running. In my case I searched for “IOUSBFamily 10.5.6”.

Download the Mac OS X USB Debug Kit file for your version of OS X. The .dmg file will include the kernel extension with logging enabled as well as the standard one. Install the one without “log” in the file name. Then restart your computer. The problem should now be solved.

Categories
Computers

Count number of bits in a Ruby integer

How would one count the number of set bits in an integer? If it was a C/C++ application I guess I would do a for-loop and shift out the bits and keep a running sum. I would be hard pressed to do it in less than three lines of code and would probably do it in five to include the curly braces.

Given the same problem and having to find a solution in Ruby I came up with this:

v.to_s(2).split(//).inject(0) { |s,i| s + i.to_i }

In other words; first convert the integer to a binary string and split the string into an array. Then use the inject method to start with zero (remember even numbers are objects in Ruby) and iterate over the array with a code block, adding each digit in the binary string to get the total sum.

Categories
Computers Linux

Target fix for Statpress Reloaded

Statpress Reloaded by Manuel Grabowski is a nice and simple plugin that helps to keep track of the hit rate to WordPress blogs and is something I personally use it for this site.

statpress

Apart from the fact that the plugin is a bit slow it miscalculates the monthly target hit rates. This has been mentioned to the plugin maintainer but until that fix gets added, here is a short description and fix.

The following sections in statpress.php are repeated in four places and is used to normalise the number of hits so far this month over the entire month.

/ date("d", current_time('timestamp')) * date('d', mktime(0, 0, 0, date('m', current_time('timestamp'))+1, 0, date('Y', current_time('timestamp'))))

However, this uses entire days which leads to incorrect results. The error is more predominant early in the month and early in the days.

I have replaced the above segment (four instances) with this:

/ (time() - mktime(0,0,0,date('m'),date('1'),date('Y'))) * 86400 * date('t')

This uses seconds since the beginning of month as the basis for normalisation which is more precise. It is not perfect – among other things it will fail exactly on midnight on the first of each month due to a divide by zero.

Categories
Computers Mac

Messenger for Mac signing out each night

Every night at precisely 01.00 CET (00.00 GMT) Messenger for Mac signs me out. When this happens a manual intervention is required in order to sign back in. I just can’t figure out why this is happening. The error message is “The system is unavailable now so you have been signed out of Microsoft Messenger”. I am running Microsoft Messenger for Mac version 7.0.1.
messenger-signout
messenger-version

Categories
Computers Linux

Increase upload size to Drupal site

If you run a Drupal site and want to upload big files you may have run into the default file size limit of 1 MB. While this is probably fine for most blogs it is way too small for most intranet deployments.

The limit for PHP is by default set to 2 MB for file uploads.

To increase this to 10 MB, add the following to the .htaccess file in your Drupal directory or to the Apache site definition:

php_value upload_max_filesize 10M
php_value post_max_size 20M

More information can be found here.

css.php