Monday, March 23, 2009

sunspider benchmark ie8, ff3.5, safari4, chrome

IE7
Total: 52562.6ms +/- 1.8%
IE8
Total: 8459.8ms +/- 0.3%
Safari4
Total: 1411.2ms +/- 0.6%
Chrome1
Total: 1783.6ms +/- 6.5%
Firefox
Total: 4727.8ms +/- 0.6%
FF3.0
Total: 4831.0ms +/- 3.6%
FF3.5
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 http://www.zedwood.com/unicode_table 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);
$out=bindec($bin);
}
else if (strlen($bin)<=11)
{
$bin=sprintf("%011d", $bin);
$out=bindec("110".substr($bin,0,5)."10".substr($bin,5,6));
}
else if (strlen($bin)<=16)
{
$bin=sprintf("%016d", $bin);
$out=bindec("1110".substr($bin,0,4)."10".substr($bin,4,6)."10".substr($bin,4,6));
}
else if (strlen($bin)<=21)
{
$bin=sprintf("%021d", $bin);
$out=bindec("11110".substr($bin,0,3)."10".substr($bin,3,6)."10".substr($bin,9,6)."10".substr($bin,15,6));
}

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

Thursday, February 26, 2009

please mount the unreal tournament play disc cdrom - ut2004 on ubuntu fix

I was trying to install ut2004 on ubuntu and kept getting the message:
"please mount the unreal tournament play disc cdrom"

I think because ubuntu auto-mounts volumes, it mounts them in multiple places, somehow confusing the installer. The answer is to umount it... then manually mount it below as shown.

sudo apt-get install libgtk1.2
umount /media/cdrom
sudo mount /dev/cdrom /media/cdrom
export SETUP_CDROM=/media/cdrom
/media/cdrom/linux-installer.sh
... let it install ...
umount -f /media/cdrom

Note: installing libgtk1.2 is just to have a gui installer instead of console/ascii looking installer

it worked for me.

linux bash xargs cut convert usage

Convert all PSDs to PNGs:
ls *.psd | cut -d . -f 1 | xargs -L1 -i convert {}.psd {}.png

Thursday, February 12, 2009

view rpm binary content

rpm -qpl [package.rpm]

geoip lookup

opensuse 10.3 linux rpm
http://download.opensuse.org/repositories/games:/tools/openSUSE_10.3/i586/


data available from:
http://www.maxmind.com/app/geolitecountry
http://www.maxmind.com/app/geolitecity

Wednesday, February 11, 2009

echo tabs in bash

The -e turns uses escaped characters like \t \n \r instead of treating them literally which is default.
echo -e "FIRSTNAME\tLASTNAME\tOCCUPATION"

Wednesday, January 28, 2009

how to lookup current linux version command line

uname -a
cat /etc/issue
cat /proc/version

How to add mdbg search for firefox search bar

Include the following file in your searchplugins folder
on windows: C:\Program Files\Mozilla Firefox\searchplugins

mdbg.xml
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>MDBG</ShortName>
<Description>MDBG Character Lookup</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,AAABAAIAEBAQAAAAAAAoAQAAJgAAACAgEAAAAAAA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAIAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAICAgADAwMAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////APAAAP//AA//8P//D/D/8P/w//8PD///D/D//w8P/wAP8AAADw/////w//8PD///D/D//w/w//D/8AAA//8AD//w/w/w8AAP//D/D/Dw//D/8PDw8PD//w/w8PDw8P//D/Dw8PDw//8P8A//APD//w/wD/8A8P/w//D///DwAA//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAABAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAgICAAMDAwAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8A//////////////////////8AAAAAAP////8AAAD/////AAAAAAAP//8AAAAAAP///wAP//8AAP/wAA//8AAP//8AD///8AD/8AD///8AD///AA////AA/wAP////AA///wAP//8AAP8AD//wAAAP//8AAAAAAA//AA//8AAAD///AAAAAAD//wAP/////////wAP//8AD/8AD/////////8AD///AA//AA////8AD///AA///wAP//AA///wAP///wAP//8AD//wAA//AAD///8AAAAAAA///wAAAAAP////AAAAAA//////AAAA////////////////////////////////////////////////AA//AP/wAP8AAAAAD////wAP8AAP8AD/AAAAAAD///8AD/AAD/AA/wAP//AAD///AA/wAA/wAP8AD///AA///wAP8AAP8AD/AA////AA//8ADwAAAPAA/wAP///wAP//AA8A/wDwAP8AD///8AD//wAPAP8A8AD/AA////AA//8ADwD/APAA/wAP///wAP//AAAA/wAAAP8AD///8AD//wAAD//wAAD/AA///wAP//8AAA//8AAA/wAP//AAD///AAAP//AAAP8AAAAAAP///wAAD///AAD/AAAAAA////////////////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</Image>
<Url type="text/html" method="GET" template="http://www.mdbg.net/chindict/chindict.php?page=chardict&amp;cdcanoce=0&amp;cdqchi={searchTerms}&amp;cddmtm=1&amp;cddytm=0"/>
<SearchForm>http://mdbg.com/</SearchForm>
</SearchPlugin>

Friday, January 23, 2009

Saturday, January 10, 2009

How to mount an iso in linux

How to mount an iso in linux

1. make some folder
mkdir /mnt/iso1


2. as root...mount it
mount -o loop abc.iso /mnt/iso1

Friday, January 09, 2009

A8V-VM SE sound on linux

How to configure the onaboard ALC861 sound on the A8V-VM SE motherboard in opensuse:


in opensuse 11.1 set 'model' option to 3stack in yast2

Tuesday, December 16, 2008

to extract any rpm:

to extract any rpm:

rpm2cpio some.rpm | cpio -id