Pages

Tuesday 29 November 2011

Mozilla Adds Flash to Firefox Android

Over at the Firefox Nightly builds site, Mozilla have released Firefox for Android with 'experimental support' for Flash.  After Adobe publicly killed off mobile Flash earlier this month, this turned up as quite a surprise.  I've installed it on my Android phone and I must say, it's actually quite good.  It's not quick, and it sometimes judders a little as Flash on a mobile always has been, but that's a given really.  I suspect that my phone was partly to blame here as well.

Even though this isn't sold as a stable release, I didn't experience any problems with Flash or the browser itself.  I would even say that in a way, I preferred it to the standard Chrome install on my phone.

Could it be that mobile Flash will eventually be spun off into an open source project for the wider Internet community to take hold of?  Only time will tell, but don't expect to see the final version until early next year.

PHP 5.4 On The Way

Earlier this month PHP 5.4 RC1 was released to the general public.  No big deal you might be thinking, but actually I noticed a small change in the latest release that could potentially be of massive help.
The note specifies 'Added class member access on instantiation (e.g. (new Foo)->bar())' which could be very handy if you only need quick access to a function from within a class.  OK, not massive I agree but sometimes for some of the smaller classes that I have this would be great.
Other improvements include the usual round of bug fixes and improvements in both the core and extensions.
Anybody considering PHP 5.3 who is on a version of 5.2 or less should hang on for a week or two until the final release.

Wednesday 16 November 2011

Mobile Flash is Officially Dead

Now that Adobe has publicly killed off Flash for mobile devices, what are the wider implications for the rest of the development community?  Well, hopefully it will be a brighter future thanks to the emphasis on HTML5 that the company seems to be placing all of its eggs.

It's certainly been a long time coming, and to be perfectly honest I'm not surprised at all.  There are many reasons, just take your pick as to which is your favourite.  The big two are cost and the lack of cross-platform access which Apple unfortunately has had its way with.  There are very few companies now that develop sites in Flash as it is far more costly, harder to work with and lacks many of the standard accessibility features that most browsers apply to standard HTML websites.  The cross-platform thing has certainly hasn't done Adobe any favours, but to be fair I don't think Adobe have done themselves any favours either.

I forever hate updating my machine whenever a minor point release of Flash is released, which at the moment seems to be every week as soon as Windows starts.  Really, is that absolutely necessary?  I'm sure it isn't.  Then one point that I do agree with Apple on, is that it is a battery killer because it is very CPU intensive.  Even though on the PC Adobe have now shifted some of this load to the GPU, it wasn't enough.  It also took them forever to release a 64 bit version of Flash, which is something that I've never understood.  For a company as big as Adobe, it's a huge let down.  Is the desktop going to be the next one to fall?  Apple no longer include Flash as part of their standard OS installs (again, no surprise there), so it's a sincere possibility.

The good news is that is seems to be a victory for web standards and compliancy and it's something that I almost always do my best to conform to.  While mobile Flash won't be going anywhere soon, it certainly is an admission of defeat for Adobe.  Even Microsoft haven't included Flash in its latest mobile operating system so it was probably best that Adobe gave up sooner rather than later.

Personally I've never really liked Flash.  It has always been difficult to develop and so I always skated around the subject when it came up, but now, it's a sign of relief that I know to put my eggs in the HTML 5 basket.

Installing PEAR Packages on Windows

Ok, so now that you've read my previous post about setting PEAR up on Windows, it's time to start installing some packages that will help you on your way.

An absolute must for any sort of database connection is the DB package.  You could argue that the built in database connectivity from the PHP modules is good enough, and you would be right.  There is a certain degree of flexibility in using these packages though, as they are continuously updated throughout the year by a large community (as is PHP), but in some cases it's all about how you interact with your database connectivity as you will see, it's certainly more class driven in how it's all written.  For example, there is support for scalar parameters as shown below (taken from the PEAR documentation):

<?php 
// Create a valid DB object named $db at the beginning of your program...
require_once 'DB.php';
$db =& DB::connect('mysql://usr:pw@localhost/dbnam');
if (
PEAR::isError($db)) {
    die(
$db->getMessage());
}

// Once you have a valid DB object named $db... 
$sql  'select * from clients where clientid = ?'; 
$data 53; 
$res =& $db->query($sql$data);

// Always check that result is not an error

if (PEAR::isError($res)) {
    die(
$res->getMessage());
}
 

?>
This has certain other benefits including the potential for easy cross-platform availability (bar the changes to the SQL syntax that change between SQL servers).  One thing that PHP 5.x users will need to do is replace the '=&'s that tend to crop up as they are now depreciated because of PHP 5.x; these can just be replaced by a simple '='.  If you have errors switched on (which I would at this point during installation and testing), you will most definitely see these being pointed out as errors.
The full list of functions is available under the documentation for each of the specific packages, and so the many other functions for the DB package are listed here.
So now that you know how to use it, it's time to install it.  Launch a Command Prompt, and browse to your PHP folder.  Once there, type 'pear install DB' and press return.  Congratulations.  You've now installed the DB package, it really is that simple.  To use it, you will need to have either an include or a require (as shown in the example above) to reference the DB package (DB.php).

Other packages within PEAR tend to reference this class in some way so it's always a useful one to install.  At the time of writing, DB has been superseded by MDB2 and so that is something that is also worth a view.

Installing PEAR on Windows

This really is just a short quick guide on how to install PEAR manually on a Windows box.  There are currently multiple ways of setting PEAR up, and I'm going to show you my preferred way, only because it's easy to fault find in case anything goes wrong.

For those who don't know what PEAR is, PEAR is essentially a customisable framework of many components that you can choose to have on your system.  It really takes aim at giving access to functionality that doesn't exist with the standard PHP functions.

First thing first, you will need to have a working copy of PHP installed and working on your system (preferably the latest version), and that is really about it.  You should notice that you already have a PEAR folder in the root of your PHP folder anyway, and so this ready and waiting for you to activate the features.

To do so, open a Command Prompt (go to Start > Run > type 'cmd' and press enter) and navigate to your PHP folder.  Once you've made it there, the command prompt on the left should be showing that you are in the root of your PHP folder.  If not, you are in the wrong place.  It should look something like it does here on the left.

Next, type 'go-pear' and hit return.  You will be asked if you would like to install a system or a local copy, so you will need to type 'system' here.  Once you have done this, you will be presented with 11 options that specify locations of your files and folders.  Normally this is correct straight out of the box, but if you like many people move your PHP folders then you will need to update these locations.  When you are ready, hit enter again, and off it goes.

The next screen will show PEAR installing and when it's ready there will be a small paragraph at the bottom asking you to execute a reg file that has been placed in the root of your PHP folder called 'PEAR_ENV.reg'.  Don't worry, this is completely harmless as this just lets Windows know that PEAR is up and running on your system.

And, well, that's it really.  You've set PEAR up on your system and are nearly ready to go!  All you need now are some packages that are freely available from the PEAR website.