Archive for March, 2008

Tired of my laptop dying every now and then, I have taken drastic action.

The Acer Travelmate 2420 is very badly designed where it comes to heat management. Air is sucked in from under the laptop (where your leg or the table would block the airflow) and blown out the side of the machine. A smarter arrangement might be to suck in air from above the keyboard and blow it out the side, but hell - what do I know about laptop design…

Anyway - the problem is that the bottom hole is too easily blocked, and besides, the fan is crap - doesn’t pull in enough air.

The solution is to give the fan a helpful boost. So, what I did was to build a small platform from cardboard, and stick three Thermaltake fans in it, each of which was more powerful than the laptop fan. This causes a large airflow through the laptop, keeping the usually-roasting right side of the machine actually colder than the rest of the machine!

pic1pic2pic3pic4

1. front view - laptop is at perfect angle for working at. 2. back view - shows the three fans. 3. left view - my hacked power-supply (normal four-wire power cable with two of the wires hooked to a 12v PSU). 4. top view - shows the air hole which sits directly under the laptop fan, and a cardboard block at the bottom middle which helps keep the laptop in place (along with the two grooves on either side).

Write a Sudoku solver in JavaScript in under 5k by 9am tomorrow morning. The prize? Two beers. Who can resist?

My colleague Bartosz for some reason thinks I’m not able to do this. I have no idea why…

By 9am tomorrow morning I’ll have the code up with a working demo.

…and No, I will not be looking at other people’s solutions. That would be cheating, and would also spoil the fun.

Feel free to submit your own solutions.

edit: 8:04am the next day here it is. Will solve most puzzles I think, but not very hard ones. I think I’ll need to try it against the Irish Times puzzles to win the bet.

edit: 9:26 yesterday’s Irish Times puzzles <– I am 2 beers richer.

ejabberd is a distributed scalable instant messenger server using the XMPP (Jabber) protocol.

I’m using it in a project upgrade at the moment which has a large established set of users. As such, when the upgrade goes live, I don’t want the users to have to recreate their user accounts. So, when the users load up their shiny new clients some time soon and see they have a new instant messenger to use, they should be able to use it flawlessly with their already-authenticated sessions, and not have to log in again.

So, I went looking for already-built code for this. The ejabberd site has a list of contributed scripts for authenticating against various scenarios. The scripts are usually in PHP or Perl.

The closest to what I wanted was the Joomla authentication one. The script needs to connect to a db and then validate the user against a table contained in that DB.

So I took the script I needed and I adapted it:

download (rename to .php when using)

I made some changes to the script. The original was strictly for the mysqli driver. I’ve changed the DB usage to use the Pear MDB2 library, so you can use whatever database you have a library for - in my case, I needed to use MSSQL. Also, the authentication SQL has been made configurable, so it should be easier to configure the script to your own usage.

The only fiddly thing is that in my database, passwords are encoded in a particular way, so you may need to change the following line to something that fits your own DB:

$convertedpass=$this->oDB->quote(base64_encode(sha1($aCommand[3],true)));