Wednesday, 31 December 2008

Happy New Year!

(What more is there to say?!)

I wish you all all the best for 2009 and look forward to 'seeing' you next year!

Until then... enjoy :).

Tuesday, 30 December 2008

symfony - upgrade1.2 and Propel 1.3 DSN

Yup, I have been fiddling around with symfony some more!
Since I installed the latest stable build of symfony (1.2.1), I decide to upgrade my projects using:

symfony project:upgrade1.2

The command processed fine but then all hell broke loose so to speak. Basically, the whole project went kaput. So...
I then ran the magic (that is in the non-PHP sense) command:

symfony plugin:publish-assets

Which fixed all my sfGuardPlugin issues!

My next problem was related to propel. I had my databases.yml file configured like so:

all:
propel:
class: sfPropelDatabase
param:
phptype: mysql
database: anxcity
dsn: 'mysql://root@localhost/anxcity'

I kept getting an Access denied error for user 'ODBC' which was strange since my DSN contained the user: root.

So... I tried the long form of the databases.yml declaration like so:

all:
propel:
class: sfPropelDatabase
param:
phptype: mysql
hostspec: localhost
database: anxcity
username: root
port: 3306
encoding: utf8
persistent: true

Then the system complained it wasn't receving the DSN string as planned.
So... I just added it:

dsn: mysql:dbname=anxcity;user=root;host=localhost;port=3306

That seems really trivial BUT ... you do need to use the exact string syntax for it to actually work (which is very different to the DSN string in my original configuration file).
And hey presto!

Thoughts?

Edit:
Ah yes, forgot to say I had to rebuild the model too, using:

symfony propel:build-model

Sunday, 28 December 2008

symfony - Ajax is not defined

I have been working on a small Ajax project using symfony - really trying to figure out how to get the nifty ajax functionalities working (using link_to_remote for instance).

I kept getting Ajax is not defined or Draggable is not defined errors and spent a couple of hours searching for the solution. Anyway, I finally came across this command:

symfony plugin:publish-assets


This got it all working for me - it simply copied the 'assets' (js scripts) to my /web folder. Simple :).

More code soon...

Thoughts in the meantime?

Thursday, 4 December 2008

Installing symfony - setting up the virtual host 2

Just a quick clarification on my previous post about setting up virtual hosts, which seems to be a little misleading.

You do also need to define your localhost as follows:

<VirtualHost *:80>
ServerName localhost
DocumentRoot "/path/to/www"
DirectoryIndex index.php
</VirtualHost>

(localhost should already be defined in your hosts configuration file).
This way you can still access all your other applications.

Thoughts?

Tuesday, 25 November 2008

Installing symfony - setting up the virtual host

Well, here is another thing that I have learned using symfony.

The basic installation tutorial instructs you to set up a virtual host for symfony:

<VirtualHost *:80>
ServerName myapp.example.com
DocumentRoot "/home/steve/myproject/web"
DirectoryIndex index.php
Alias /sf /$sf_symfony_data_dir/web/sf
<Directory "/$sf_symfony_data_dir/web/sf">
AllowOverride All
Allow from All
</Directory>
<Directory "/home/steve/myproject/web">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>


This was all new to me, so I set up "all" the paths correctly, and found that while it did allow me to use my symfony application properly and all the data_dir links where effectively aliased as planned, it also broke my other "localhost" links (e.g. I could no longer access http://localhost/other_app). Ouch.

Now I have figured out why: I hadn't changed the ServerName. So, the issue was solved by simply creating a new ServerName like so:

ServerName symfonyappname.localhost


To get this working the operating system must also be configured accordingly. To do this, simply add an entry to your hosts file, the location of which depends on which OS you are using.

Check out this link to find out where your hosts file is located.

Once the hosts file is properly configured (remember you may need to reboot), simply type:

http://symfonyappname.localhost

and magic happens :).

Thoughts?

Monday, 24 November 2008

A visual aid for RAID

Just a quick recap of how the most common RAID can be used for recovery (or not...).



Thoughts?

Thursday, 13 November 2008

Netbeans support for Symfony

Now here's a nice and chewy piece of news posted by ppisl from netbeans.org:


The news is that the Symfony support will be part of NetBeans 7.0. We are going to start work on it very soon. I hope that it will be a part of continual build this year and community can comment the support and work with us to finish it in the best possible quality and usability.


This is straight from the Netbeans "issues" site: Issue 145913. You can vote to advocate Netbeans support for symfony from that same page. 468 votes so far...

According to the roadmap Netbeans 7.0 will probably be released around April 2009. It will be exciting to see how this pans out with the release of symfony 1.2 due in December of this year.

Anyone else looking forward to this?

Saturday, 1 November 2008

CSS - Choosing colors

A colleague pointed me to this article recently (no offense taken :D). In my view, there are quite a few interesting things there, but still I think using HTML tables for layout is conceptually bad, even wrong, especially today.

Among the good stuff, this interesting link to do with colors and how to choose colors that actually work well together.

They have developed a useful ColorTool applet which you can access via:
PC version
Mac version

You can choose the background color, then select various text colors to go with it (by clicking first on the line of text you would like to change).

Rather clever.

Thoughts?

Saturday, 25 October 2008

Plugin installation failed: No valid packages found

Well, I am still exploring symfony and its many interesting options. One of the features that really appeals to me is the ability to secure certain actions (e.g. "create", "save") for a given module (e.g. "user" module, "group" module) using user credentials (e.g. "admin", "guest"). The only catch is that this inbuilt mechanism doesn't provide login per se which means you can set credentials, but have to create the login process yourself. The most obvious way to avoid this is simply to install the sfGuardPlugin plugin for symfony.

I typed the installation command but came across the following:


cmd>> symfony plugin:install sfGuardPlugin

>> plugin installing plugin "sfGuardPlugin"
>> sfPearFrontendPlugin downloading sfGuardPlugin-3.0.0.tgz ...
>> sfPearFrontendPlugin Starting to download sfGuardPlugin-3.0.0.tgz (18,752 bytes)
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin .
>> sfPearFrontendPlugin ...done: 18,752 bytes
>> sfPearFrontendPlugin symfony-plugins/sfGuardPlugin requires package
>> sfPearFrontendPlugin "symfony/symfony" (version >= 1.2.0, version <= 1.3.0,
>> sfPearFrontendPlugin excluded versions: 1.3.0), installed version is 1.1.4

Plugin "sfGuardPlugin" installation failed: No valid packages found


The problem here was simply that the latest version of the package was being used. That particular version (3.0.0) is meant for symfony 1.2 which is still being developed. Since I am using the latest stable release of symfony (1.1.4), the trick is simply to specify which release to install. To work this out, simply check out the sfGuardPlugin changelog page to find the correct release version number (2.2.0).


cmd>> symfony plugin:install sfGuardPlugin --release=2.2.0


And hey presto, it worked! Excellent. More on symfony soon...

Thoughts in the meantime?

Saturday, 18 October 2008

Adobe Flash 10 released

It looks like it's "sniffer-update" time again... quite a few sites seem to have 'broken' with this new release, at least in Internet Explorer.

Here's a quick way of detecting the Flash version using ActiveXObject:


function testFlashIE() {
var flashMajor=0;
var flashInstalled=false;
try {
flAXO = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
flVersion = flAXO.GetVariable("$version");
flMajor = flVersion.substring(
flVersion.indexOf(" ")+1,
flVersion.indexOf(","));
flashInstalled=true;
flashMajor=flMajor;
}
catch (e) {} // ignore

if (!flashMajor) {
// here comes the usual flash detection loop
// for older versions
// ...
}

return flashInstalled?flashMajor:null;
}


Thoughts?

Tuesday, 14 October 2008

PHP Development Frameworks

As mentioned in a couple of previous posts (here and here), I have been looking into symfony as a PHP Framework solution and it's certainly one of the most comprehensive on the market. The following article at PHPit compares ten well-known PHP development frameworks including Zend, cakePHP and symfony.

Although the article is most probably outdated where facts are concerned (with comments dating back to 2006), most of the criteria on which the comparison is built are still very much up-to-date. They cover inbuilt support for: PHP5, Model-View-Controller (MVC), Object Relational Mapping (ORM), Caching, Validation and filtering, Ajax, Authentication, and more.

Still, I feel a development framework shouldn't simply boil down to supporting X or having inbuilt Y, and should in a sense embrace a wider philosophy as a whole.

Thoughts?

Wednesday, 24 September 2008

Aptivate Web Design Guidelines for Low Bandwidth

The NGO Aptivate, Cambridge, UK, brought together some useful information about simple bandwidth optimisation techniques/issues.

You can access their Web Design Guidelines for Low Bandwidth at:
http://www.aptivate.org/webguidelines/Home.html


Don't worry about bandwidth!
Soon we will all have infinite bandwidth for no cost.


Heard that before?

In fact it is not true for the majority of the world's population. Many people in remote locations and the developing world do not have fast Internet connections and won't be getting them any time soon.

This is why Aptivate has written a set of Web Design Guidelines for Low Bandwidth, at a time when web site optimisation seems to be going out of fashion.


Very interesting to see the world statistics for bandwidth and Internet access costs. Just goes to show how lucky we are in Western Europe / North America!

Also, here are a couple of the "tips" which particularly caught my attention:

  • drop using HTML tables for layout, switch to CSS: this has been discussed over and over and over, again and again and again, and yet... well, you get my drift =);

  • make your site cacheable: basically, avoid getting too wild with dynamic content;

  • externalise your CSS stylesheets and JS scripts: load it (them) only once for the whole site or sets of pages and let the browser subsequently use the cached version;

  • minimize the use of HTTP requests: there are lots of ways to do this like client-side form validation using Javascript, making sure dynamic pages don't require looping back to the server for pulling in extra files (CSS, images, etc.), and so on and so forth.

  • file and image optimisation: shrink PDF and optimise images for use on the web;

  • provide some sort of support for 'old' browser versions which may have limited support for CSS, Javascript, etc.

  • ...



There is a lot more interesting information on the site covering a variety of topics: high-level design, CSS, caching, compression, multimedia, browser compatibility, search, PDF optimisation, and much more. Well worth the read!

Thoughts?

Wednesday, 17 September 2008

PHP 5.2.0 - installing PEAR

I tried to install PEAR a few days ago using my PHP 5.2.0 install by double-clicking the go-pear.bat file in the php5 folder.

It didn't quite go as planned however:

Initialized registry...
PHP Warning: Cannot use a scalar value as an array in phar://go-pear.phar/PEAR/Command.php on line 268
.
.
.
install failed


It seems there is a small bug in the .phar file (in the PEAR folder) which can be fixed by replacing it with the following file:
http://pear.php.net/go-pear.phar

And you can find more information about this issue here:
http://bugs.php.net/bug.php?id=39733

Thoughts?

Monday, 15 September 2008

Finding the value in LinkedIn

I have been quite surprised by the number of people who complain about LinkedIn being a) a complete waste of time and/or b) just a plain 'job search' application. Obviously you could make it just that but also alot more, it really depends on how much time and effort you are prepared to invest.

To make an analogy, you wouldn't create a mailbox and then instantly expect to receive 300 interesting emails overnight. In fact, if you get any interesting mail at all it's because you have taken the time to advertise your email address in one form or another.

So why do we expect socializing online to be any different from socializing offline? If you walk into a room full of people, grab a drink and then go and stand alone in a corner, what are your chances of engaging with people? Pretty meak; at least certainly much slimmer than for those who decide to actively engage in conversation.

That's why we 'use' (sorry, bad bad word) our network of friends and relations to get introduced to other people. The same goes for LinkedIn. You need to mimick your real social network, get introduced to others by people you know and trust and move on from there.

The greatest value of the network to me is being given the ability to contact hundreds of experts, people who would previously have remained unreachable, in mere seconds.

A few weeks ago, I was trying to find a comprehensive, cost-effective CRM 'solution'. Now, there are lots of applications out there: sugarCRM, XRMS, Microsoft Dynamics CRM, Zoho and many more.

One way to figure out which is the 'best' solution is to test each application and then try to weigh the pros and cons, and drop cost into the balance somewhere. Now, that can be pretty time-consuming and without being an expert yourself, you can't really guarantee end-result.

Another way to work out the 'ideal' course of action is simply to ask the question on LinkedIn using their Q&A feature. The beauty in this is you reach out to hundreds of experts who might spend let's say 1 to 10 minutes answering your question. Within 24-hours you are actually conversing with more people than you would have been able to get hold of by phone in a day.

And, there is no question that the 10-minutes they spent answering, were much more valuable than my searching for information that isn't in my field of expertise. And, to top it all off, it was great fun corresponding with all the people who replied. Much like in 'offline life' we can engage in a valuable exchange of ideas and knowledge.

So, IMHO, there really is much more to social (or business, as some would have it) networking than at first meets the eye.

What is your take?

Sunday, 14 September 2008

symfony sandbox project, tutorial updated

In a previous post, I discussed a couple of issues relating to the symfony project sandbox tutorial.

It looks like the tutorial has since been updated however and I haven't really had the chance to check out the latest version but the parts that were highlighted in my post have definitely disappeared! Good news... :-)

To tell you the truth, I would like to move on to creating a web application from scratch (i.e. without the sandbox) so I will be starting at square one: The Definitive Guide to symfony and hope to be sharing some of this with you in coming weeks.

Thoughts in the meantime?

Wednesday, 10 September 2008

Google Chrome EULA update

In an earlier post about the Google Chrome EULA I mentioned how the French version had yet to be amended.

Well, I checked yesterday and all's well that ends well :-).

In French...

11.1 Vous conservez les droits d'auteur et tous les autres droits en votre possession vis-à-vis du Contenu que vous fournissez, publiez ou affichez sur les Services ou par le biais de ces derniers.

... and Dutch

11.1 U behoudt de auteursrechten en enige andere rechten die u al bezit over de inhoud die u op of via de Services inzendt, plaatst of weergeeft.


Thoughts?

Saturday, 6 September 2008

PHP Fatal error: func_get_args(): Can't be used as a function parameter

Well, I was a little surprised about this message but then reading the documentation it all made sense.

The only way around this is to place the result of func_get_args() in a variable and then pass that variable to the function you were calling in the first place instead of func_get_args().

WON'T WORK:

my_func(func_get_args());


WILL WORK:

$func_args=func_get_args();
my_func($func_args);


This is because the func_get_args() function must get called in the right context to return the right values as explained in the PHP documentation (PHP.net func_get_args):

Note: Because this function depends on the current scope to determine parameter details, it cannot be used as a function parameter. If this value must be passed, the results should be assigned to a variable, and that variable should be passed.


Interesting.

Thoughts?

Friday, 5 September 2008

Google Chrome - user-agent (UA)

For anyone interested in browser detection, here is Google Chrome's "useragent" string:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13

You can get it by simply typing "about:" in the omnibox ("address" bar)
or alternatively by adding the following to your <head> section.


<script language="javascript">
function showUA()
{
userAgent = navigator.userAgent;
alert("UserAgent: " + userAgent);
}

window.onload=showUA;
</script>



So something similar to the following could be used to detect which browser you are using:


<html>
<head>
<script language="javascript">
function setBrowser()
{
var browser="unknown";
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf("opera") > -1)
browser="Opera";
else if (userAgent.indexOf("konqueror") > -1)
browser="Konqueror";
else if (userAgent.indexOf("firefox") > -1)
browser="Firefox";
else if (userAgent.indexOf("netscape") > -1)
browser="Netscape";
else if (userAgent.indexOf("msie") > -1)
browser="Internet Explorer";
else if (userAgent.indexOf("chrome") > -1)
browser="Chrome";
else if (userAgent.indexOf("safari") > -1)
browser="Safari";

var brDiv=document.getElementById("browser");
brDiv.innerHTML="<b>" + browser + "</b>";
}

window.onload=setBrowser;
</script>
</head>
<body>
You are using:
<div id="browser"></div>
</body>
</html>


If you are using one of those popular browsers its name should show up in the empty "browser" div in the body section. Note that the order of the tests is critical. For instance, both Opera and Netscape useragent strings contain "msie" so it is necessary to test for those browsers before testing for Internet Explorer.

Of course the above script is certainly very basic and we could take things a step further and not only retrieve browser name but also browser version for instance, or test for other things like whether the browser is Java-enabled, which Javascript version is available, which Flash Player version is installed or which operating system is being used.

Let me just share a couple of links which cover this more comprehensive approach to Javascript browser sniffing:
Browser sniffing: takes an in-depth look at how to sniff all major and lots of minor browsers.
JavaScript Browser Sniffer: the "ultimate" mainstream browser detection script.

Have fun!

Thursday, 4 September 2008

Google Chrome EULA

As you have probably already heard, there has been huge concern that the Google Chrome EULA was too invasive with regard to intellectual property rights. Google has since changed the English version at: http://www.google.com/chrome/eula.html?hl=en

Google apparently blamed a hasty copy/paste for the mistake but it is a little worrying to think this may have been intentional, and how many people have actually already agreed to the EULA in question.

[EDIT: I take it the change will have retro-active effect.]

Here is the Ars Technica article describing the whole chain of events:
http://arstechnica.com/news.ars/post/20080903-google-on-chrome-eula-controversy-our-bad-well-change-it.html,
and how Google has promised to change its terms and conditions for the new browser.

The French version (http://www.google.com/chrome/eula.html?hl=fr) doesn't seem to have been amended at the time of writing:

En fournissant, publiant ou affichant le contenu, vous accordez à Google une licence permanente, irrévocable, mondiale, gratuite et non exclusive permettant de reproduire, adapter, modifier, traduire, publier, présenter en public et distribuer tout Contenu que vous avez fourni, publié ou affiché sur les Services ou par le biais de ces derniers.


Something to keep an eye on...

Thoughts?

[Update: Check out the follow-up post regarding the Google Chrome EULA]

Wednesday, 3 September 2008

Experimenting with Google Chrome

(Thank God for work and the XP box there!)

I have downloaded, installed and survived the Google Chrome experience.

As far as I can tell it really lives up to expectations: on first impression its user interface is very nice and crisp, the browser is fast and renders nicely.

It's definitely usable "as-is" and despite being beta could probably replace any browser for day-to-day browsing except perhaps in some rather specific cases which some have been reporting.

Feature-wise, you can seamlessly extract a tab to a new window or reassemble tabs located in separate windows into a single window.

The developer tools are another cool feature. It would be really nice if you could snap them into your current tab though (or have the "snap-in" appear in every tab once you open it). For the moment, the tools open in an new window which stays on top of everything you are doing in the browser and I found it was a major distraction (compared to using Firebug in Firefox for instance).

Last but not least, the "omnibox" in every tab is a really nice feature which I shall probably learn to miss in other browsers.

Well, that's it for now. As you can tell I didn't really have the chance to take it for an in-depth test run and look at security features for instance.

It will be interesting to see whether Google's new approach actually causes any disruption on the browser market.

What do you think?
Online Marketing
Add blog to our blog directory blog search directory Blog Directory Blogarama - The Blog Directory