Search This Blog

Sunday, March 25, 2012

CBR Headlights

Just finished the fun task of my first head light replacement on my Blackbird.


Something that I noticed that appears to cause some confusion online is the type of lamp it uses.


The lamp is a Phillips H7 White Halogen 12v 55w lamp, BUT, and this is the kicker, there is a converter attached to them for the prongs which is a Stanley SN911-01200 (that is the model number of the converter).


The H7 lamp is extremely common but if you made the initial mistake I did and start looking for a Stanley lamp you will quickly find out that they dont make lamps and be scratching your head :D


So In summary - the Lamp is a H7 12v 55w the converter which you just pull the lamp out of once getting it out of its housing is the Stanley SN911-01200 which really shouldnt ever need replacing unless you have serious corrosion or damage.


From my reading these lamps are used in VFR's, CBR's and Goldwings amongst others.

Wednesday, January 4, 2012

Decimal to Hex of a 64bit int on a 32bit PHP System

A small issue raised its head today and required some furious action.

Given a 32bit PHP binary not capable of running dechex() on a 64 bit decimal, how would you convert said 'string' to a hex 'string'.

Enter the cool little code snippet below.

The only requirements for this to function is core php + BCMath.

$id = '1388944919774473767';
$fred = '';
while (bcdiv($id,'16','0') != 0) {
$base = bcdiv($id,'16','0');
$re = bcmod($id,'16');
$fred .= dechex($re);
$id = $base;
}
$fred .= dechex($id);
echo strrev($fred);

This produced the required result over many many tests. The basis of this base conversion was pulled from here

Enjoy!