Category: Uncategorized

  • ImageCreateFromGIF & true color

    If you use a GIF background and try to draw a text, even with GD2 and Freetype fonts, the text will has jigsaw and not antialiased. To correct, change the background image to a true color PNG.

  • Google Search API with PHP5 or NuSOAP

    If you want to search Google through their API. This class detects if you have the PHP5 SOAP lib to use or it should use the NuSOAP lib. With the search results in a PHP object, you should be able to manipulated the information easily.

  • Convert Vietnamese from UTF8 to ASCII

    If you need to convert from UTF8/Unicode Vietnamese with intonation/ascent signs like acute, grave, circumflex, tilde, dot below, hook above, and more to just plain old ASCII without any extras, or to VIRQ format. Here is a PHP class that performs the conversion. Some examples: an toàn => an toan áo giáp => ao giap…

  • MySQL: ALTER IGNORE

    To remove duplicated rows in a table, use ALTER IGNORE. IGNORE is a MySQL extension to standard SQL. It controls how ALTER TABLE works if there are duplicates on unique keys in the new table or if warnings occur when strict mode is enabled. If IGNORE is not specified, the copy is aborted and rolled…

  • Business Joke

    Father : I want you to marry a girl of my choice Son : “I will choose my own bride!” Father: “But the girl is Bill Gates’s daughter.” Son : “Well, in that case…ok” Next Father approaches Bill Gates. Father: “I have a husband for your daughter.” Bill Gates: “But my daughter is too young…

  • International Entrepreneurship

    Benefits Staying closer to the customers is important to the success of any business. If the product is not designed or targeted to the local market, the company needs to look for other countries or locations that have demand for that product. Additionally, any local market has a certain limit in size and going global…

  • The power of file_get_contents

    With recent PHP versions, using file_get_contents() is a very efficient method to get and parse stuff from the web $vHeaders = “User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5\r\n”; $vHeaders .= “Accept-language: en\r\n”; $vHeaders .= “Cookie: PHPSESSID=”.$vSomeID.”\r\n”; $vOpts = array(‘http’=> array(‘method’=>”GET”,’header’=>$vHeaders) ); $vContext = stream_context_create($opts); $vURL = ‘https://private.example.com’; $vPage = file_get_contents($vURL,FALSE,$vContext); You…

  • failed to open stream: HTTP request failed!

    [17-Feb-2006 13:05:28] PHP Warning: readfile(http://xxxxxxx): failed to open stream: HTTP request failed! À in Command line code on line 1 => a weird error code return

  • Problem w/ .htaccess and mod_rewrite

    Purpose: maintain the same .htaccess file between localhost and production servers. Making changes to one file is better than editing two or more. Problem: directory for the project at local & production server are different. Therefore, RewriteBase of mod_rewrite needs to be set differently. Eg: Local: http://localhost/working/abc.html Production: http://example.com/abc.html Solution/Hack: have this in httpd.conf for…

  • Problem of CSS float & IE

    IE seems to really have a problem with breaking CSS. First is the 3-pixel bug for 2-column layout float. Solution: instead of just having the left panel float, have both panels (left & main) float left & right. Then there is an issue with italic and float. If the text in the left panel is…