Nicknames and Unicode

September 20th, 2007, 9:31 am by lig

A good friend of mine on the IRC channels recently gave me a special nickname - U+0E5B. What the heck is that you say? well it is the unicode character for "THAI CHARACTER KHOMUT"... I can still feel your puzzlement. Here is what it looks like:
TML's nickname for me (image taken from here)

Rather beautiful isn't it. :)

Anyway when I was given this name as a nickname I was curious what it looked like (this was before I got to see the image provided above) but I hadn't a clue how to convert the unicode codepoint to a character I could see on a page (yes i am unicode ignorant in oh so many ways).

Do some investigating and learn to change the "U+" to "&#" add a "x" to mark it as a hex and add a semicolan at the end and walla... the HTML entity. Does this work for every unicode codepoint - no clue - but it did for the ones I played with.

My page to see what it looked like (with an extra unicode character for fun):

PHP:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. </meta></head>
  6. <body>
  7.     <h1>
  8.         &#x0E5B; &#x2620;
  9.     </h1>
  10. </body>
  11. </html>

del.icio.us:Nicknames and Unicode  digg:Nicknames and Unicode  furl:Nicknames and Unicode  reddit:Nicknames and Unicode

streams gem

September 17th, 2007, 4:58 pm by lig

Was reminded today of a gem from the streams extension - sending a POST message and getting its results. We could do it using cURL or sockets - but why work that hard. Being lazy does have its advantages after all.

Now I could make up an example for this - but why when the manual has such a nice one (though it is a bit buried in the manual on the HTTP/HTTPS wrapper page):

PHP:
  1. <?php
  2.  
  3. $postdata = http_build_query(
  4.     array(
  5.         'var1' => 'some content',
  6.         'var2' => 'doh'
  7.     )
  8. );
  9.  
  10. $opts = array('http' =>
  11.     array(
  12.         'method'  => 'POST',
  13.         'header'  => 'Content-type: application/x-www-form-urlencoded',
  14.         'content' => $postdata
  15.     )
  16. );
  17.  
  18. $context  = stream_context_create($opts);
  19.  
  20. $result = file_get_contents('http://example.com/submit.php', false, $context);
  21.  
  22. ?>

del.icio.us:streams gem  digg:streams gem  furl:streams gem  reddit:streams gem

IT Crowd - season 2

September 8th, 2007, 12:22 pm by lig

Woot - found the some episodes of new season for IT crowd on youtube! Funny as hell. Anyway if you want to see the first episode - check it out here

Second episode is here

del.icio.us:IT Crowd - season 2   digg:IT Crowd - season 2   furl:IT Crowd - season 2   reddit:IT Crowd - season 2

Late static binding article

September 7th, 2007, 9:20 am by lig

While cruising around looking at various PHP blogs I noticed on a friend's blog (Etienne Kneuss) a nice easy explanation about late static binding ( a feature coming in PHP6). You should check it out fi you are unsure what it is and how it works.

(Sorry colder for taking so long to notice it - it has been a while since I just blog surfed)

del.icio.us:Late static binding article  digg:Late static binding article  furl:Late static binding article  reddit:Late static binding article

Just gotta Woot!

September 2nd, 2007, 3:07 am by lig

Look my name is listed for the book over at sitepoint. Woot!

(Sorry I get excited about the weirdest things)

del.icio.us:Just gotta Woot!  digg:Just gotta Woot!  furl:Just gotta Woot!  reddit:Just gotta Woot!