Tuesday, June 21, 2011

Installing PHP Development Tools (PDT) Plugin on Eclipse Indigo IDE

It’s very simple right now to get the milestone builds of the PHP Developer Tools (PDT) 3 up and running in Eclipse IDE Indigo release (and a significant improvement on the current Helios SR2 release).

Pull down a vanilla Eclipse Indigo (just released!), Classic edition or JavaScript edition from http://www.eclipse.org/downloads/index.php and install.

Once installed, launch Eclipse and navigate to Help->Install new Software.

Add the Indigo update site http://download.eclipse.org/releases/indigo . This will take sometime to add, let it go for 5 or so minutes.

Once the Indigo Update Site is added, add the PDT 3.0 Update Site: http://download.eclipse.org/tools/pdt/updates/3.0/milestones/ 

Now, to install simply select PDT Development Tools All in One SDK (leave the others unselected) and click next. The installation process shouldn’t take more than a few minutes.

(Article copied almost verbatim from Aaron Bonner)

Mozilla Firefox 5.0 Web Browser Released

Firefox5-small_001

As expected, the Mozilla Project has released version 5.0 of Firefox. The update to the open source web browser comes just three months after the project's last major version, Firefox 4.0, which suffered a number of delays – Mozilla has adopted a version model similar to that used by Google for its Chrome browser.

One of the most important additions in Firefox 5 is support for CSS animation, a feature that browsers such as Safari have offered for some time. When creating a CSS animation, a developer specifies the animation's duration and name in the CSS rules for the HTML element in question. The @keyframes selector associated with this name is followed by the rules that describe the element's beginning and end points as well as optional intermediate stages.


The Do-Not-Track header preference has been moved "to increase discoverability". On Windows, it can be found under "Tools->Options->Privacy", while on Mac OS X, it is under "Firefox->Preferences->Privacy". This preference allows users to tell web sites that they don't wish to have their browsing behaviour tracked. Whether a site respects this or not is up to its developers.

Other changes include improved canvas, JavaScript, memory, and networking performance, as well as updated standards support for HTML5, XHR, MathML, SMIL and canvas. The "desktop environment integration for Linux users" has also been improved. Introduced in previous Firefox Beta updates, the Firefox development channel switcher has been removed.

The mobile version of the web browser has also been updated: Firefox 5 for Android is now capable of sending the Do-Not-Track (DNT) header – the developers say that it is "the first mobile web browser" to offer such a feature. It adds support for IPv6, "overflow: scroll" and "overflow: auto" CSS properties, Restartless Add-ons and HTML5 online/offline events. Users can download the release from the Android Market.

More details, including a list of known issues, can be found in the release notes. Firefox 5.0 is available to download for Windows, Mac OS X and Linux from the project's web site. Alternatively, users can upgrade to the new versions, either by waiting for the automated update notification or by manually selecting "Check for updates" from the Help Menu. Mozilla encourages users to upgrade to the latest releases as soon as possible.

Firefox binaries are released under the Mozilla Firefox End-User Software License Agreement and the source code is released under disjunctive tri-licensing that includes the Mozilla Public License, GPLv2 and LGPLv2.1.

An updated web browser is just one step. Learn PHP and AJAX Web Development quickly with AJAX and PHP: Building Modern Web Applications 2nd Edition book.


Update: Firefox 5 also addresses a number of security holes in the browser, five of which are rated as "Critical" by Mozilla.

Copied almost verbatim from H Online, image from Softpedia

Tuesday, April 5, 2011

Ext Debug Console Not Disabled - Regression Bug in Ext JS 2.3.0

I just got hit by an annoying regression bug in Ext JS 2.3.0 (did not occur in Ext JS 2.2.1), that Ext Debug Console (Firebug Lite-lookalike) still pops up when we use:

Ext.log(...)
Ext.debug.log(...)
console.log(...)

These functions should have no visible effect when using ext-all.js (which should disable Ext Debug Console) as opposed to ext-all-debug.js (which contains Ext Debug Console).

However this pre-1.1-beta bug resurfaces in Ext JS 2.3.0.

Several alternative solutions:

  1. Upgrade to the latest 3.x Ext JS version
  2. Downgrade to Ext JS 2.2.1
  3. Remove manually the offending code in ext-all.js
  4. Comment all debugging/logging code in your application

Thursday, November 25, 2010

Referential Integrity - Good or Bad?

In relational database world such as MySQL, PostgreSQL, Derby / JavaDB, and HSQLDB RDBMS there is Referential Integrity.

It's very useful to avoid consistency mistakes with foreign keys during operation.

It's useful when we live in *relational* world. But during development of a modular application and agile, frequent upgrades.. Is referential integrity helping or hindering productivity?

Consider an application that has a Customer table that has a column an refers to a Country table. Each deployment would have its own Customer table data. However, Country table is pretty much "shared" globally. Country table is never meant to be modified from the admin's perspective.

When there is a new country or modification, new version of application will be released, containing an update to Country table.

In old-school style of upgrades, Country table should be replaceable similar to how we replace files during upgrade, i.e. overwriting a file called countries.xml.

However, due to referential integrity, it's not possible to simply drop the table, recreate it with the data. We have to issue proper DML SQL statements to update the data from the "current" version (yes, we must detect what is the current version) to the new version.

All in the name of not breaking foreign key checks aka referential integrity.

Isn't RDBMS making simple things complex?

Friday, November 5, 2010

Displaying PHP Errors on Ubuntu

Default configuration of PHP 5.3 / Apache 2.2 installation on Ubuntu 10.10 Maverick Meerkat does not display any syntax errors and simply throws an Internal Server Error (HTTP Error 500).

How to enable display/output of PHP 5 error messages :
  1. Edit /etc/php5/apache2/php.ini
  2. Set the following configuration values:

    display_errors = on
    display_startup_errors = on
    html_errors = on

  3. The default error_reporting threshold is :

    error_reporting = E_ALL & ~E_DEPRECATED

    which should be enough. But you can change it if you want.


Thursday, October 28, 2010

var_export bug Fatal error: Nesting level too deep - recursive dependency? [Workaround]

When doing var_export() on nested arrays/objects with recursive dependency, you'll get an error:

Fatal error: Nesting level too deep - recursive dependency? in /some/script.php on line 123

The workaround is:

ob_start();
var_dump($data);
$dataDump = ob_get_clean();

Bug report (but is incorrectly marked as Bogus): http://bugs.php.net/bug.php?id=30471

Dependency Injection in PHP vs Java

How to do Dependency Injection in PHP vs Java.

Plain PHP:

$helper_sales = new HelperSales();

Magento proprietary SPI:

// no type information!
$helper_sales = Mage::helper('sales');

Java / CDI :

@Inject
private HelperSales helperSales;

Java / get bean from Spring context :

HelperSales helperSales = appCtx.getBean(HelperSales.class);

The Java examples apply to Scala as well, of course.

Still envy PHP?