text wrapping in the html pre tag

If you ever have a tag in a div or table, and you are providing say text from your database to the pre element, be very careful that the default style of the pre tag will let the text keep running until hitting the newline character. This is probably not desirable because these long text lines will push their container thus expanding the container unexpectedly. It’s ugly to say the least. ...

January 20, 2012 · 1 min · birdchan

PHP encode JS decode

Very often I need to encode some string in PHP, then pass that to javascript. For example, say I am using PHP to generate some javascript functions. See below: $s = "some text from somewhere"; $js_code = " function do_something(some_text){ alert(some_text); } do_something('$s'); "; The above javascript code would work fine until one day you have some symbols in $s, for example the single quote. (There may be more troublemakers, but at least this is a common one). ...

January 19, 2012 · 1 min · birdchan

bin hex dec calculator

Here are some handy bin,hex,dec convertors. Binary => Dec or Hex http://www.easycalculation.com/binary-converter.php Dec => Bin or Hex http://www.easycalculation.com/decimal-converter.php Hex => Dec or Bin http://www.easycalculation.com/hex-converter.php

January 19, 2012 · 1 min · birdchan

小學畢業

假如有位婆婆跟你說她小學畢業,請不要少看她! 請先看看當年(1953)小學會考 「 常識科 」 題目,睇睇自己懂多少題,才好笑人「小學畢業」。

January 19, 2012 · 1 min · birdchan

Carrot Crazy

[vimeo 27588379 w=601 h=338] Carrot Crazy from littleGIANT on Vimeo. Very nice 3D graphics!

January 13, 2012 · 1 min · birdchan

osx hardware status bar

I really believe this little tool is essential for all you guys out there who care about what’s going on with your hardware at any given moment. It’s called MenuMeters from Raging Menace. Basically, you can see status of your cpu, memory, hard disk, and network traffic in real time on the menu bar. Slowness of any kind can now be troubleshooted with better supporting evidence. Try it out, it’s FREE. ...

January 12, 2012 · 1 min · birdchan

Trello

If you have a small organization and you need to share ideas and manage various tasks in the team, it would be quite a headache. Coz you are dealing with a mini growing social network, hopefully with something better than emails and phone calls. This is when you need trello ( https://trello.com/). Take a look at their video and see if you can benefit from it. You could even use that to organize a small get-away to deal with the shopping list and packing items. Best of all, it’s FREE. ;) ...

January 11, 2012 · 1 min · birdchan

jquery datepicker date format

If you are using the jquery datepicker and have been displaying the date in the usual mysql date format, you probably will find it annoying that the date picker gives you the slash date format back. Here is how to keep the mysql date dash format all throughout. var queryDate = '2012-01-10', dateParts = queryDate.match(/(d+)/g) realDate = new Date(dateParts[0], dateParts[1] - 1, dateParts[2]); // months are 0-based! $('#datePicker').datepicker({ dateFormat: 'yy-mm-dd' }); // format to show $('#datePicker').datepicker('setDate', realDate); The code above will translate the mysql date to do the initial setup, then use the dash format for the text field. ...

January 11, 2012 · 1 min · birdchan

National Budget Explained

December 22, 2011 · 0 min · birdchan

Biggest Risk for the U.S. Economy in 2012

[youtube &w=640&h=360] The Street.com piece on “Biggest Risk for the U.S. Economy in 2012”

December 18, 2011 · 1 min · birdchan