Monthly Archives: December 2007

Mysqli small fix for allowing socket in Zend Framework

As this site is running on ICDSoft hosting, they allow to use MySQL 5 or MySQL 4, but they provide different sockets for each version.

In MySQLi extension, the following host string doesn’t works: localhost:/tmp/mysql5.sock (or localhost:/tmp/mysql.sock), this because they separate the socket from the server host string.

In Zend Framework in the MySQLi Adapter, they don’t use the socket optional parameter, so I made a small fix to allow this [Zend/Db/Adapter/Mysqli.php]:

if (isset($this->_config['port'])) {$port = (integer) $this->_config['port'];

} else {

$port = null;

}/* new block */

if (isset($this->_config['socket'])) {

$socket = $this->_config['socket'];

} else {

$socket = null;


/* end of new block */

// Suppress connection warnings here.

// Throw an exception instead.

@$this->_connection = new mysqli(






$socket //new


This allow you to use the socket name, this was for enabling my new showcase example: Google Maps and GeoIP Location, you can see the full code here:


Security Policies in Flash Player 9

I recently had a problem with Security Policies with flash player; I suggest you to read the official documentation specially if you want to know what to do in several versions of Flash Player.

WhatI learn is too simple about loading a crossdomain.xml from a server:

  1. If you load the crossdomain.xml from an http request. Example: Security.loadPolicyFile(''). The flash player sandbox will only allow to you swf to connect to ports over 1024
  2. If you want to load ports below this, you need to read the crossdomain from a port below 1024, for example: Security.loadPolicyFile('xmlsocket://')

Of course the most important about the last is that you can load from any port below 1024 and you’re granted to access any port on that server; you can use classes like Socket or XMLSocket for connecting to other ports; so you can have a server listening to information from Flash, but in another to serve the policies. You can do for example a small server in PHP5 for example: which shows you to use this great feature in PHP5.

Hope this help you.



New Showcase – Javascript and Flex

Showcase by Danguer, Javascript and Flex IntegrationI’ve uploaded a new example in my showcase, this works using Flex technologies that makes the interface more easy to use but only with javascript are impossible to do.

I’ve used a download example, with normal javascript you cannot check the progress of a downloading into your computer. Of course, as this example could be not seen as of great use (but of course can simplify a lot the usability when your download links are not very clear, or in case of video, etc), this can be extended easily to upload and this is a feature very need on several sites.

Flickr for example uses a Flash uploader tool (along other sites) on a similar way, so you can upload a bunch of images/files and see the progress, making this using pure javascript only can be achieved patching the PHP sources with File Upload monitors, which is not easy and also not allowed on shared hosting, this example it can be used without problems with any normal PHP Server.

Go to example: Javascript and Flex Integration


Web Dragons: Inside the Myths of Search Engine Technology

This book is an excellent introduction not only about Search Engines and how works, but all which is around it, mainly internet from the view point of find information.

The book also handle information about copyright, future and past of internet development.

Even the authors recommend to start reading on the half, surely you should start from begining ;) , since all the information is clearly explained and easy to read.

If you want to read this book searching for SEO techniques (like I though when I read the title) you won’t find anything here, well it talks about what is considered SPAM and several SEO ‘companies’ still doing like cloaking or hidden text. But the book handles very well every concept, even the Information Retrieval which sometimes can look obscure and only for rocket scientists, here this topic is clearly explained (of course the concepts) to learn how the Search Engines works.

Web Dragons: Inside the Myths of Search Engine Technology (The Morgan Kaufmann Series in Multimedia Information and Systems)


Professional Javascript for Web Developers

This book is a great introduction for Javascript and also for those who know basics of javascript. The book is clearly explained and feature a lot of examples, but unfortunately after the DOM chapter it doesn’t show the output of scripts, but as those are specific on browser and is easy to figure the output.

The books is separated in two parts, one which talks about ECMASCRIPT and features are available on majority of browsers (and their differences).

The second part features advanced features of browsers like drag & drop, XML, Web Services and so on. Unfortunately on this parts are very specific on browser, but the book also works through it to make common objects in javascript.

The main lack is of course AJAX (even it’s discussed not as AJAX briefly in chapter 17), but is comprehensible since the book is from 2005 and the term AJAX was coined on 2005. He propose a method to achieve a bit similar of ajax with hidden frames; by the way this kind of method should be avoided in programming, I said this because I’ve found recently written articles which propose the same; this technique was fine when there was no AJAX developing but now only look as a rusty method to simulate AJAX (and is harder to control).

The author now have written recently a book of AJAX (Professional Ajax, 2nd Edition (Programmer to Programmer)), which surely is worth of read.

In conclusion, this book is excellent to learn and deploy your Javascript skills, but I think the book should be readed deeply until the DOM chapters, later chapters should only take as basic information, since are parts have changed a lot since AJAX.

Professional JavaScript for Web Developers (Wrox Professional Guides)