Sunday, July 15, 2007

And here is another google recommendation

How to go to your floor quickly, I wish I had known this one in Shanghai.

http://view.break.com/327059 - Watch more free videos

Google aka Big Brother

Check out http://www.google.com/history/. If like myself you have Google account it could list every search you made, how many per day and even more if you enable the advanced options! Its either a useful wealth of information or a scary scary big brother system, I haven't decided yet, I sure hope Google still are committed to "do no evil".

Also amusing is the trends and things you might be interested in depending on your searched here was one of my top ten recommendations

PHP webservices

I spend the last couple of days experimenting using php as a webservice client so here are a few tips!

Installation on Debian 4.0


To get up and running you need, a webserver and working php5. It important to have php5 as the webservices pretty much don't work under 4.

apt-get update
apt-get upgrade
apt-get install php5 php-soap php5-xmlrpc apache2 libapache2-mod-php5

edit /etc/php5/apache2/php.ini uncomment

[soap]
; Enables or disables WSDL caching feature.
soap.wsdl_cache_enabled=0
; Sets the directory name where SOAP extension will put cache files.
soap.wsdl_cache_dir="/tmp"
; (time to live) Sets the number of second while cached file will be used
; instead of original one.
soap.wsdl_cache_ttl=86400

Restart apache with "apache2ctl restart" and you should no be calling up php5. You might want to create a php.info apges to test by creating a test.php with the following.

// Show all information, defaults to INFO_ALL
phpinfo();
// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>

It should show your running php version 5.something and furhter down the page you should be able to see a soap section.

Simple Webservice Test


I use the .Net environment for creating web services and this foray into php was something of a test. It took me a while to get anything done as there are several php implementations of webservices none of which are very well documented. Eventually I saw the post by OrionI and it was enough to access my service. Because of the way the ms service works you need to use the SoapVar command.

In my webservice expects two doubles ratio and tolerance so I did the following

$pRatio = $_POST['xratio'];
$pTolerance = $_POST['xtolerance'];
include("SOAP/Client.php");
$namespace = "http://mars.glenfernassociates.co.uk/enmesh";
$wsdl = "http://10.0.0.254:8080/GearService.asmx?wsdl";
$sc = new SoapClient($wsdl);
$ratio = new SoapVar($pRatio, XSD_DOUBLE, "double", $namespace);
$tolerance = new SoapVar($pTolerance, XSD_DOUBLE, "double", $namespace);
$wrapper->ratio = $ratio;
$wrapper->tolerance = $tolerance;
$params = new SoapParam($wrapper, "GetPair");
$ret = $sc->GetPair($params);
?>

Magic mystery and junction boxes

My head hurt this morning, unfortunately thanks to my routine I find it virtually impossible to sleep in these days so I was awake before 9 feeling sorry for myself.

I spent most of the morning chatting to someone online, she told me I should have proposed to Olya. I was a little horrified at such an idea but she sees the whole a lot differently than me. We always have interesting conversations for it though.

I was also trying to use PHP to access the webservice I wrote for my dad. To be honest I understand why people pay for products that just work, I am using complex types for my webservice and php just can't seem to deal with them :( Failing with that I foolishly turned my hand to some diy.

The light on our landing for well over a year so I decided it was high time it was fixed. Hours later I was covered in crap from the loft and desperately searching for fuse wire after blowing the fuses. Basically its got two switches one downstairs and one up which can turn the light on and off. Unfortunately the electrician just used chocolate boxes and the light was removed months ago so it was trial and error wiring. It was also all in the loft which has no light and it very dirty. My dad and I both get pretty stressed out, it took hours and hours but eventually I succeeded in getting it all hooked up.

This evening we went to see the new Harry Potter (Order of the Phoenix). It is the longest and in my opinion one of the best of the books, a lot darker than the preceding stories. Obviously there was far too much in the book to squeeze into the film, indeed I think this one is the biggest departure from the book. It mostly got things right balancing between being faithful to the main story whilst cutting out some of the sub-plots. Some of the editing was a little clumsy, a few words glossing over some huge part of the book but overall it was an enjoyable film well worth a watch.

This was a big film release and so we didn't have to sit with the mob (and children) we splurged out on gallery seats. The gallery seats are on a raised area above the main seating. There are large plush leather seats, there is also a separate sound sound system and the best bit is free soft drinks, sweats and popcorn. Its a bit expensive at £16 a ticket its a bit pricey but if your the sort who goes to the cinema, and buys drinks and popcorn its probably not bad value.