Thursday, March 26, 2009

C/C++ win32 programming tutorials and open source projects

Monday, March 23, 2009

sunspider benchmark ie8, ff3.5, safari4, chrome

Total: 52562.6ms +/- 1.8%
Total: 8459.8ms +/- 0.3%
Total: 1411.2ms +/- 0.6%
Total: 1783.6ms +/- 6.5%
Total: 4727.8ms +/- 0.6%
Total: 4831.0ms +/- 3.6%
Total: 2551.4ms +/- 11.5%

Sunday, March 22, 2009

utf8 in mysql

select CONCAT('V',x'c3a1','zquez'), _utf8'Vázquez';

Same result

php - decutf8 decimal to utf8 entity

go to you will see a unicode table listed by htmlentity number.

echo decutf8(632);//prints ɸ which has htmlentity ɸ

function decutf8($str)
$bin = decbin($str);
$out = 127;
if (strlen($bin)<=7)
$bin=sprintf("%08d", $bin);
else if (strlen($bin)<=11)
$bin=sprintf("%011d", $bin);
else if (strlen($bin)<=16)
$bin=sprintf("%016d", $bin);
else if (strlen($bin)<=21)
$bin=sprintf("%021d", $bin);

if ($out <=255)
return chr($out);
else if ($out <=(255 * 256) )
return chr($out/256).chr($out%256);
else if ($out <=(255 * 256 * 256) )
return chr($out/256).chr($out/256).chr($out%256);
else if ($out <=(255 * 256 * 256 * 256) )
return chr($out/256).chr($out/256).chr($out/256).chr($out%256);

Wednesday, March 11, 2009

javascript debugging in ie

Firebug rocks, and though there is a version for IE, it isn't the same. So in developing javascript heavy websites, it is always useful to have an IE brower around and debugging tools so you can figure out why your code is breaking in IE and not Firefox.

There are 3 ways to debug javascript in ie:
1. microsoft script debugger
2. visual studio .net
3. microsoft script editor (comes with office xp/2003)

Seeing as [2] and [3] both involve handing money over to micro$oft. We are left with [1]. The microsoft script debugger is no way related to the Internet Explorer Developer Toolbar

The Script Debugger is pretty sad but at least you can visually see what line of code your IE breaks on. It can still leave you scratching your head as to 'why' though. To enable it go to your "internet options" menu and hit uncheck the "Disable Script Debugging (Internet Explorer)" option.

Note to self: This breaks in IE7
var a = { width: 100, height :200 , };
While invalid syntax, IE7 should not be so delicate it gets tripped up by this. Allowing an extra comma in an array or dynamic object allows for cleaner code when generating javascript from another language.

debug ie6