Moran Prizes web kiosk app for NSW State Library

I recently just finished the ‘People’s Choice Award’ web kiosk application for the NSW State Library. The purpose of the app is to allow the public to vote on their favourite from the Moran Prizes exhibition.

The screen cast shows the general flow of the app, it was relatively siple and includes a back end admin to display user data.

Handy Hint: AMFPHP to Flash Character Encoding

If you’ve ever used AMFPHP to connect your DB into Flash, you may stumble across weird characters being output! eg: – replaces the ’. The simple explanation is that the PHP is decoding it wrong.

Forget about preg_replace(), all you need to do is update your amfphp/gateway.php file to decode, encode in UTF-8.


$gateway->setCharsetHandler("utf8_decode", "UTF-8", "UTF-8");

and walla no more annoying characters sent from AMFPHP.

Freelance @ White Agency – Flash game on Wii console

Last week I completed another little stint at the White Agency, Sydney. The brief was to create a little simple flash game that could be played through the opera browser on the Wii console. It was for a company called Sirtex Medical Ltd. and they wanted to create the game to highlight there medical technology in treating liver cancer with radiation.

Sirtex Flash Game

The aim of the game was to kill off the cancerous tumors by injecting the proprietory Sirtex radiation spheres in the quickest time possible, using the Wii remote you needed to have find the right blood vessel and inject the radiation.

Responsible for the game development and helping with design it was a rather enjoyable little project, as it was educational in the process. The game is going to be the key part of their exhibition which is expected to be displayed at a number of medical expos in the future.

PHP – having problems with getimagesize() when space in filename?

Some images containing spces in the file name led me to some errors when trying to determine their image size for manipulation using PHP.

Simply url encoding the string fixed this problem.
 

 <?php
  $imagePath = "some funky filename.jpg";
  $imagePath = str_replace(" ","%20",$imagePath);
  list($imgwidth,$imgheight) = getimagesize($imagePath);
?>

PHP Snippet – GetFileContents and save PDF

I needed to be able to access a pdf outside my document root… so I created the script below. Using just file_get_contents with an echo would just save it as the name of the script, using an $output_file variable and in the header you are able to specify what you want to save it as.


<?php
$output_file = 'outfilename.pdf';
$file = "target.pdf";
$fileDir = '../target/directory/';
$contents = file_get_contents($fileDir.$file);
header("Content-Disposition: attachment; filename=" . $output_file);
header('Content-type: application/pdf');
echo $contents;
exit();
?>

State Library of NSW 100 exhibiton Kiosk App

I’ve just finished the design and development of a flash based kiosk app for the State Library of NSW 100 Exhibiton. Originally I was contacted by Mental Media to do the job.

The app was fairly straight forward in process, providing the public the ability to vote on their favourite exhibiton item, view favourtie exhibiton item, complete a survey and enter a draw.

All data is saved into a mySQL database and the library staff can access a admin page to download the various data as CSV files. I had some fun with PHP merging all the tables to provide a simple usable table for the non-technical staff.

kiosk_onsite2

The app is running continuously for 100 days, so it was seriously important that there were no memory leaks. Flash and no memory leaks can be a time consuming effort…. At the end of the project I did encounter a memory anomaly where the memory seemed to jump 5MB every time an image was displayed on screen, although I was loading the images from memory. It turned out it was due to the fact I added a drop shadow to the image at runtime…. therefore flash somehow needed to reprocess that shadow area as a new image. This turned into a problem when I couldn’t access it, even by removing the filter, it still kept it in memory. Quick solution.. got rid of the drop shadow.

PHP Snippet – Get Yesterdays date

This is a simple function that returns yesterdays date. Simple but handy.

function yesterday()
{
 $yesterday = date("Y:m:d",mktime(0,0,0,date("m") ,date("d")-1,date("Y")));
 return $yesterday;
}

PHP Snippet – Time difference between 2 date/time stamps.

In a recent project I needed to capture how long the user spent on the application, it was not expected they would spend days on it so it return hours minutes seconds which can be saved to a database.
So basically here is a function to do that…

//
echo getTimeDifference("2010-02-26 18:35:36");

function getTimeDifference($start_time){

 //convert $start_time into a usable string
 $tempStart = preg_replace('/(\d{2})-(\d{2})-(\d{2})(.*)/', '$1:$2:$3:$4',$start_time);
 $tempStart=explode(":",$tempStart);

 $year = $tempStart[0];
 $month= $tempStart[1];
 $day = $tempStart[2];
 $hour = $tempStart[3];
 $minute = $tempStart[4];
 $second = $tempStart[5];

 //set the end time as current time
 $timesEnd = date("Y:m:d:H:i:s");
 $tempEnd=explode(":",$timesEnd);

 $year1 = $tempEnd[0];
 $month1= $tempEnd[1];
 $day1 = $tempEnd[2];
 $hour1 = $tempEnd[3];
 $minute1 = $tempEnd[4];
 $second1 = $tempEnd[5];

 $countdown_date = mktime($hour, $minute, $second, $month, $day, $year);
 $countdown_date1 = mktime($hour1, $minute1, $second1, $month1, $day1, $year1);

 $diff = $countdown_date1 -$countdown_date ;
 if ($diff < 0)
 $diff = 0;
 $dl = floor($diff/60/60/24);
 $hl = floor(($diff - $dl*60*60*24)/60/60);
 $ml = floor(($diff - $dl*60*60*24 - $hl*60*60)/60);
 $sl = floor(($diff - $dl*60*60*24 - $hl*60*60 - $ml*60)
 );

 $timeDifference = "$hl:$ml:$sl";

 return $timeDifference;
 }

SSA Multimedia DVD

I’ve just finished off a little project for CBDigital a small video production company. The project was a multi-media DVD containing over 40 presentations and discussions on spinal research and development for the SSA (Spine Society of Australia) an abnormal sort of client, but seemlingly familiar in the way that I have spent a lot of time with orthapedic specialists and had numerous x-rays over the past 15 months.

The project intself has taken roughly 50hrs flash development time, also included a day of layout and design. Built with AS3 it was the first time I have incorporated FLV’s in a project since using AS2. To be honest it was a breeze working with the flv using net connection and net stream… just loved it, listening for cue points worked seamlessly and I have fallen in love with Custom Events…. shit I sound boring! HA.

Well the other good thing about this job was it was running locally so no bother really with pre-loading, although there is still a time delay on loading images so loading still needed to be taken into consideration. The project as always had the additional functionality added towards the end and the job is done and dusted all alterations can now be made in the xml, something the client is more than happy to do…. unless more functionality is needed. NO WORRIES.

Anyway good fun job as it went smoothly and the client as always was happy!

L.

Freelance at BMF sydney

I have just finished an intense flash workout at BMF in Sydney, I was hired as a freelance flash developer to develop an interactive colouring in competition for CBA Dollarmites Club. Created in AS3 this was my first agency project in AS3 working in collaboration with design, animators and other developers it was definately an intense coding moment. From my point of view I was bought in mid way into the project, with the designs, animations and a couple of class files already developed. I was given the task of pulling it all together and making it work.

On the first day arriving I was flooded with work, and told there was a strict deadline ect. The usual really, however, generally coming midway into a flash project you need a day or two to get your head around whats going on, especially now with AS3 and its strict datatyping adding timeline animations into code was a new experience… The problem with these ‘rush’ jobs, is it seems structure and planning are usually developed with the project.

After my usual, ‘work when I want’, to doing an initial 75hr first week, it was a brutal, yet invigorating jolt to the system. Magic Map Competition is now live (click on competition link here) and after finshing another flash landing page for AUS Star my work had dried up at BMF. Overall I enjoyed working there, it’s a good agency with really cool people, and hopefully they’ll want me back.

picture-151