Computing: page 8
Gearman, PHP and mod_gearman_status on Ubuntu
Installing Gearman is pretty easy as there are packages for it in Ubuntu: sudo apt-get install gearman libgearman-dev The development headers (libgearman-dev) are only required if you need to compile a library for your programming language such as a PHP extension. To install the PHP module you would run: sudo pecl install channel://pecl.php.net/gearman-0.7.0 If you have trouble with the above step then it is probably because you are running an older version of Ubuntu. Read more ⇒
PHP Hangs When Fed 2.2250738585072011e-308
PHP Hangs When Fed 2.2250738585072011e-308 A pretty horrible bug when you assign the number 2.2250738585072011e-308 to a variable PHP will hang on Linux or Windows 32bit builds of PHP. This does affect $_GET and $_POST variables as well and as such could be an exploit in some PHP sites. So the following code will break your PHP for example: $var = 2.2250738585072011e-308; Or if a page is given a GET parameter like page. Read more ⇒
Logging global PHP objects and saving memory using a lazy loading proxy
Quite often when you are working with legacy code you will come across a mess of globals. Every single method will make use of the same global instance of the database class for example. So where do you begin to work with this massive impediment? Logging is a great way to see what methods and classes are being used by you application and where. To achieve this you would normally need to add a logging call to each and every method in the code base. Read more ⇒
Set up a new port forward on a Draytek Vigor over the telnet interface
I needed to add a new port forward to a router, but I did not have access to the web interface through a graphical browser. Attempts to get in using Lynx stalled as it seems the router will not serve up the frames in the interface independently of each other and it kept issuing 404 errors. Either way I had to use the telnet interface using the following command (replace 192. Read more ⇒
Firefox with Radio Inputs and it’s Annoying Autocomplete I recently had problem with Firefox’s autocomplete when using a jQuery star rating plugin. The linked article explains the problem more in depth and the code snippet below should get you going. if ($.browser.mozilla) { $("form").attr("autocomplete", "off"); } Read more ⇒
You may have noticed that the Oracle logo has begun to appear across all the Sun websites, which is a visible indication that the Oracle buy out of Sun is now complete. In the spring of last year the deal was announced and many people were very worried about Oracle’s intentions for Sun’s open source projects – most notably MySQL. Many seemed to consider MySQL a competitor for Oracle’s 11g database software and therefore Oracle would be looking to reduce development investment to stifle the perceived competition. Read more ⇒
Attaching the population filter without using form IDs (suitable where the current form is on the same page as the URL in forms action parameter) <?php // Like so $this->getContext()->getRequest()->setAttribute('populate', new AgaviParameterHolder(array( 'question[0]' => 'Can you eat cheese?', 'answer[0]' => 'No' )), 'org.agavi.filter.FormPopulationFilter'); // Or like so... $populate =& $this->getContext()->getRequest()->getAttribute('populate', 'org.agavi.filter.FormPopulationFilter'); $populate = new AgaviParameterHolder(array( 'question[0]' => 'Can you eat cheese?', 'answer[0]' => 'No' )); Use form ids to link the pre-population to a particular form Read more ⇒
To get Netbeans to listen for browser initiated debug sessions please consider the following steps: Go to Project Properties > Run Configuration > Advanced > Debug URL and choose the Do not open a web browser. Save. (you may like to setup Path Mapping, but it works for me without it) In the projects listing right click on your intended project and choose Debug, which will start Netbeans listening for connections. Read more ⇒
Bitextender backed Agavi is a very secure and helpful open source (LGPL) MVC framework with the core development being headed by David Zülke (Wombert) and Felix Gilcher (certainly in the IRC channel!). It can take some time to get the hang of the framework so I have put together all the resources I use or have used to help you get started. Documentation Resources: Official Agavi Tutorial - Incomplete at time of writing API Documentation Agavi Cookbook Official Agavi FAQ Unofficial Agavi FAQ – Very helpful Package Docs in SVN – You need to dig around these folders in the SVN source code viewer of Trac (some of it is also old) Veikko Mäkinen’s Blog: http://blog. Read more ⇒
I worked on a project while ago that required the use of iFrames to create “AJAX” file uploads. It took me a little while but I finally worked out how to get the contents of an iFrame using jQuery. To get the contents of an iFrame we need to wait until the iFramed content has finished loading as well. var iFrameBody = ""; $("#iframe").load(function () { iFrameBody = $(this).contents().find("body"); }); Read more ⇒