AKA Marketing.com Logo            VISIT THE BLOG            

Blogged thoughts, is our web blog. Expect views, opinion, rants and tirades about everything and anything 

« Home / Forums »        

 


Subscribe to our SEO / IT related blog by entering your email address below

Blogged thoughts

| by the www.akamarketing.com team

Archive for February, 2008


Potential Trapattoni related headlines over the next while?

Thursday, February 14th, 2008

It’s finally settled, Trapattoni is in the FAI hotseat after about 111 days of searching. Along with him comes a fresh challenge to the pun kings of Ireland, namely the tabloid sports writers. What will the headlines be like over the next two or so years? Here’s a little taster of what you may see in newspapers like TheStar, TheSun and TheMirror:

 ‘Shut your Trap’ - Guaranteed to be used, perhaps when the smack talk begins between himself and rival managers in Group 8, or perhaps in response to Stephen Ireland if he dishes out more made up stories.

 ‘Trap Rap’ - If Trapattoni gets disciplined by UEFA, Fifa etc?

 ‘Through the Trap door’ - Perhaps in reference to getting into South Africa via the playoffs?

 ‘Trap-ped in Group 8′ - Perhaps in reference to failing to qualify?

 ‘Offside Trap’ - If Ireland or our opponents score a controversial late goal?

 ‘Trapa-phoney’ - If Trapattoni turns out to be completely useless?

 ‘Crapa-ttoni’ - As above.

 ‘Snapa-ttoni - Perhaps if Trapattoni loses the head and does a Jack Charlton/John Aldridge USA 94 job?

 ‘Trapa-stoney’ - If Trapattoni ever admits to smoking pot… perhaps in a heart to heart interview with ‘Dobbo‘?

 ‘Gio-canny’ - If he makes an inspired substitution?

 ‘The Italian Job’ - Going from his name to his nationality, of course I’m sure we will see it thrown in a couple of times too. Hopefully it will be in the context of Trapattoni engineering a big result for us and not in the context of a defeat by the Italian team.

‘Godfather’ - If he becomes loved by the Irish public?

‘Don Trapattoni’ - As above.

OK well I’m kind of clutching at straws now so I’ll leave it at that but there’s a few other good ones floating about the net, send in any I’ve missed. By the way if there are any budding tabloid headline writers among us check out http://www.rhymezone.com/ to see what you can come up with yourself.


$_ENV, the Environment variable array is empty in PHP

Wednesday, February 13th, 2008

The environment variables are usually made available to your scripts via $_ENV, just like $_POST, $_GET etc. are. It seems however that the registration by PHP of these kind of variables for use in your scripts is governed by a configuration option called variables_order in the php.ini file. By default many of the latest installs (and associated php.ini’s) of PHP will have this option set to ‘GPCS’, which stands for Get, Post, Cookie and Built-in variables respectively.

Therefore if you find your php_info() function call returning a bucket load of environment related information but yet a print_r($_ENV) returns an empty array () check the aforementioned setting and be sure to add E in there somewhere so as to instruct PHP to make environment variables available to you and your scripts.

While I’m not 100% certain I believe the ordering of the letters is only important when you have the register_globals option set to on. If register_globals is set to on (off by default since 4.2 and ditched in 6.0) then PHP will make all the variable kinds (Post, Get etc.) specified in variables_order available as global variables in the order you specified in that directive. Imagine for instance that you have ‘EGP’ specified in variables_order and register_globals set to on, if you have a variable called ‘Path’ in both the $_ENV and $_POST arrays, the value from the post array will overwrite the value from the environment array and thus the global variable $Path will hold information from $_POST and not $_ENV. If register_globals was turned to off, you would simply access all array indexes by their full name such as $_ENV["Path"] and $_POST["Path"] and thus they will be considered as 100% different variables.


PHP SQL Server connection problems - mssql_connect() [function.mssql-connect]: Unable to connect to server

Tuesday, February 12th, 2008

As pear (pun intended) usual if I have what I believe is a useful solution to something I’ve spent an eternity trying to fix in my code I will try put it up on the old blog for the benefit of others. The problem I was having for a large part of yesterday and earlier on this morning (Tuesday the 12th) related to the use of a PEAR based Database Abstraction Layer (DAL) module called DB. For those that don’t know a DAL allows a developer to call generic database access code, which then in turn calls DB provider specific code. The advantage of this is that the developer can change the underlying database system by changing a single line of code in a connection string as opposed to all DB access logic in his or her code.

The Database Abstraction Layer I was using: DB is actually depreciated but I was using it for legacy purposes as most of our existing PHP apps use it. The thing to remember with DALs is that ‘under the hood’ they will eventually call DB provider specific code so problems with DB, any other PEAR DAL or indeed any DAL in general may not be caused by the DAL itself but in fact caused by the underlying DB provider specific code.

My problem in this case was that I just seemed to keep getting connection errors when I called the ‘connect’ function in DB. The code I used was similar to:

require_once(’DB.php’); //makes the DB extension available to my code

//connection string for SQL Server database
$db = DB::connect(”mssql://username:PaSsWoRd@dbhost/dbname”);

if(DB::iserror($db))
{
       die($db->getMessage());
}

and the error I got was DB Error: connect failed. As you can see my underlying database is SQL Server as indicated by ‘mssql’ in the above code.
I’m not too sure about the more recent releases of DB (I was using one from 2003) but it seemed DB was not very useful from an error debugging point of view as it didn’t ‘bubble up’ all error messages and only spit out something very generic and very useless.

The thought struck me that perhaps the underlying PHP MS SQL function library was not enabled in the PHP configuration file. This turned out to be the case. Enabling it was as simple as adding a line or two into the PHP.ini file:

[PHP_MSSQL]
extension=php_mssql.dll

If you had of called

$db = mssql_connect(”dbhost”,”username”,”PaSsWoRd”);

directly in your code, which the above PEAR DB code eventually did you would have got a much more helpful error like the following:

PHP Fatal error: Call to undefined function mssql_connect() in…

which you would (hopefully) immediately diagnose as being related to the availability of the PHP mssql library itself and not DAL related.

After enabling the extension, I was still getting the DB Error: connect failed generic error from PEAR DB so I decided to work directly with the mssql_connect function to see if again it was a SQL Server issue. When I called mssql_connect I still couldn’t get a connection and got the error below so it was obviously not PEAR DB playing up.

PHP Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: servername

It turns out that my connection string was 100% correct however the version of the ntwdblib.dll file on my PHP box was not compatibile with certain recent versions of SQL Server. According to the PHP website ntwdblib.dll is required for the PHP MSSQL extension to work:

The extension requires the MS SQL Client Tools to be installed on the system where PHP is installed. The Client Tools can be installed from the MS SQL Server CD or by copying ntwdblib.dll from \winnt\system32 on the server to \winnt\system32 on the PHP box. Copying ntwdblib.dll will only provide access through named pipes. Configuration of the client will require installation of all the tools.

It seems that for whatever reason the very latest installs of PHP include a version of ntwdblib.dll that will not work with SQL Server 2003, SQL Server 2005 and as far as I’m aware SQL Server Express. The version of ntwdblib installed is likely to be 2000.2.8.0 when what you need to have to talk to recent versions of SQL Server is 2000.80.194.0. This file can actually be present in locations other than winnt\system32 depending on your platform and installation setup so I suggest you do a search for it, check the version and if it doesn’t end it 80.194.0 download the latest version from the UserScape.com site and use it to overwrite the existing version. In my case I installed PHP as a CGI on Windows Server 2003 so the file was present directly in the PHP folder. When I updated it and tried my code again everything worked fine, including the original PHP DAL DB:connect call.

In the end it turned out my problems were nothing to do with the PEAR DB module but were related to PHPs SQL Server functions. If your still having problems connecting to SQL Server from PHP I suggest you visit the relevant PHP page located at http://ie2.php.net/function.mssql-connect which contains a lot of user contributed information about ntwdblib.dll and other issues which may be causing your problems and associated pain.


What’s up with some recruitment sites not being able to handle IT search strings?

Friday, February 8th, 2008

The IT industry like most industries has its fair share of abbreviations, jargon, keywords and general ’shop talk’. With that in mind it surprises me how many recruitment websites can’t handle searches for simple IT strings like ‘c#’, ‘c++’, ‘asp.net’, ‘.net’ etc. I think the IT industry in particular makes extensive use of the web for job searching so all recruitment sites should facilitate say a c# developer who wants to search for ‘c#’. Have a look at recruitment sites like elanIT.ie, CPL.ie, EmployIreland.com which were some of the sites I spotted which couldn’t handle most if not all of the above search strings.

HOME | ABOUT US | CONTACT US | SITEMAP | GOOGLE SITE SEARCH | TOP
12 Lorcan Crescent, Santry, Dublin 9, Ireland +353 87 9807629