Is that video for real?

November 21, 2008

Extreme makeover: computer science edition

Stanford artificial intelligence researchers have developed software that makes it easy to reach inside an existing video and place a photo on the wall so realistically that it looks like it was there from the beginning. The photo is not pasted on top of the existing video, but embedded in it It works for videos as well – you can play a video on a wall inside your video. The technology can cheaply do some of the tricks normally performed by expensive commercial editing systems.

Advertisements

A nuSOAP star

November 20, 2008

It’s not often I’m impressed with a new soap star – other than Hollyoaks and there’s only one reason to watch that. However, I recently had to integrate a web service client in the web site that displays a list of all the senior level consultants in the company. The website in question is written using php so a php SOAP consumer would be needed. And, as usual, I needed to get it done quickly.

There were a few options:

After some investigation and for various reasons I chose nuSOAP which is staggeringly easy to use. Here’s the code I needed to make it work – and there’s not much of it.

<?php
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );
require_once('soap\nusoap.php');
$proxyhost = isset($_POST['proxyhost']) ? $_POST['proxyhost'] : '';
$proxyport = isset($_POST['proxyport']) ? $_POST['proxyport'] : '';
$proxyusername = isset($_POST['proxyusername']) ? $_POST['proxyusername'] : '';
$proxypassword = isset($_POST['proxypassword']) ? $_POST['proxypassword'] : '';
$useCURL = isset($_POST['usecurl']) ? $_POST['usecurl'] : '0';
$client = new soapclient('http://somewebsite.com/Consultants.asmx?WSDL', true, $proxyhost, $proxyport, $proxyusername, $proxypassword);
$client->setUseCurl($useCURL);
$result = $client->call('GetConsultants', array(), '', '', false, true);
if ($client->fault)
{
   echo '<h2>Fault</h2><pre>';
   print_r($result);
   echo '</pre>';
}
else
{
   $err = $client->getError();
   if ($err)
   {
      echo '<h2>Error</h2><pre>' . $err . '</pre>';
   }
   else
   {
      print('<table class="contentpaneopen">');
      for ($i=0; $i<sizeof($result["GetConsultantsResult"]["ConsultantDetail"]); $i++)
      {
         print('<tr><td>');
         print('<h4>'.$result["GetConsultantsResult"]["ConsultantDetail"][$i]
                    ["Firstname"].'&nbsp;'.$result["GetConsultantsResult"]
                    ["ConsultantDetail"][$i]["Lastname"].'</h4>');
         print('</td></tr>');
         print('<tr><td>');
         print($result["GetConsultantsResult"]["ConsultantDetail"][$i]
                      ["Description"]);
         print('</td></tr>');
      }
      print('</table>');
   }
}
?>

nuSOAP is particularly easy to debug and display the SOAP request and responses. Incidently, this needed to be incorporated into a Joomla based site which normally means having to write a module or plugin. Yet again I was saved by the Jumi plugin which meant I could just put the php directly into an Article. Couldn’t be simpler. You can see it working here http://www.candelamedia.co.uk/index.php/candela-consulting/our-consultants