Archive for February, 2010

UTC Date (time is relative)

Friday, February 26th, 2010

Anyone interested in Dates and passing them between different languages, I had an issue with selecting dates in a Flash UI which uploads them to a data base via a webservice and pulls them back again. Some were coming back a day earlier and some not. After some (hours) investigation I tracked down the offending  date to 29 March… Ah, British Summer Time +1 hour. Flash sends the date out as UTC (universal time) so the date is being read on the server as the day minus one hour to compensate if in BST. The default setting for hours is zero so if not set this equals the day before.

The solution to read the date on the server as Locale time, though depending on the circumstance this may only be wise if you can be sure both server and client are in the same time zone. Or in AS to set the hour of the date to anything greater than zero, or substract the timezoneOffset from the minutes.

Though useful if dealing with time zones it can be a little confusing if you just want a date of a particular day. UTC is the not only the date but a point in time as well. The date of that time could be yesterday if your east of Greenwich or tomorrow if west.

var a:Date = new Date(2010,2,29);
trace(“UTC Date: “+a.toUTCString()); //UTC Date: Sun Mar 28 23:00:00 2010 UTC
trace(“Locale Date: “+a.toLocaleDateString()); //Locale Date: Mon Mar 29 2010
trace(“——————–”);
var b:Date = new Date(2010,2,29);
b.minutes -= b.timezoneOffset;
trace(“UTC Date: “+b.toUTCString()); //UTC Date: Mon Mar 29 00:00:00 2010 UTC
trace(“Locale Date: “+b.toLocaleDateString()); //Locale Date: Mon Mar 29 2010
trace(“——————–”);
var c:Date = new Date(2010,2,29,12);
trace(“UTC Date: “+c.toUTCString()); //UTC Date: Mon Mar 29 11:00:00 2010 UTC
trace(“Locale Date: “+c.toLocaleDateString()); //Locale Date: Mon Mar 29 2010

Tues 9th Mar: State Machine 101

Thursday, February 25th, 2010

Neil Smith awoke to find himself in a plain room, strapped to a chair, facing Seb O’Brien. The room filled with a harsh brightness, and O’Brien waited whilst Smith took it in. Smith had once believed that O’Brien was a comrade, but he could see that O’Brien was part of the state machinery all along.

‘You asked me once,’ said O’Brien, ‘what was in Room 101. You knew the answer already. Room 101 contains the worst thing in the world. That differs from person to person. It may be burial alive, rat attacks, or even something quite trivial.’

A man entered carrying a laptop and placed it opposite Smith. Tapping a few keys, O’Brien opened some files in a text editor. Smith recognised them immediately; they were from apps he had built without a State Machine. He broke out in a cold sweat.

In your case Smith, the worst thing in the world is an app without a State Machine. Tell me about this code.

Smith tried to swallow his panic and speak slowly. ‘Frameworks make software development simpler, but the possibilities they create increases demand for complexity. State Machines simplify apps by reducing them to discreet states, thus improving development, stability and scaleability. Applications without State Machines are a nightmare.

OK Smith, I will spare your pain and not run this app,’ said O’Brien, closing the laptop ‘but there is a condition. You must come to The Werks on Tuesday 9th March at 7pm and share everything you know about State Machines. And in a general way that all software developers can relate to, not ActionScript specific. OK?’

‘Yes’ agreed Smith, and breathed again. O’Brien turned, walked out, and quietly ordered a guard outside to free Smith.

Tues 2nd Mar: Introduction to Blender

Tuesday, February 23rd, 2010

Tim Vaughan and Alison G. Ballard stood on the motorway bridge and watched the traffic below. The view mentally took them to a crash site. The image of their car, sliced into shards, tearing through the soft upholstery of Elizabeth Taylor’s limosine, as it struck the limo’s nearside front wheel arch and shattered the windscreen, was familiar to them now. Their Shepperton design studio was plastered with projections they had calculated with a piece of 3D software called Blender.

Blender was the first open source 3D suite available for all operating systems. Obsessed with the fetish of technological union with the film star, they had spent so long planning the accident they had become Blender experts.

Tim had worked out the program’s interface, workspace & workflow. He knew how to set cameras & lights, to rig an armature, and how to animate. Alison had studied modelling techniques, UV mapping, particle systems, dupliverts. Their combined knowledge was such that they could render 3D simulations of almost anything, such as a limo cruising down the M25.

They stepped into their car and drove off. They had decided to demonstrate their expertise with Blender at The Werks on Tuesday 2nd of March at 7pm and needed time to prepare. Looking into the mirror in silence, Vaughan pulled out and was lost amongst the rush hour traffic.

Robotlegs and Signals Talk

Saturday, February 20th, 2010

‘Lo everyone,

Here are the slides from my talk on Tuesday. All the links to the github repos are in the pdf, but I put them below as well for posterity. Enjoy.

http://www.robotlegs.org/

http://github.com/tschneidereit/SwiftSuspenders

http://github.com/robertpenner/as3-signals

http://github.com/richtextformat/RichTextFormat-Classes/tree/master/uk/co/richtextformat/signals/

Owen

RL&Signals <–PDF!

(Also I should mention that the images in the pdf are not neccessarily CC; I didn’t have a huge amount of time to prepare. If I’ve inadvertently used an image of yours, I’ll happily remove/give you a credit.)

Tues 23rd Feb: Live Video Link with FITC Amsterdam

Thursday, February 18th, 2010

WE NOW TAKE YOU TO KERMIT THE FLASHGEEK WITH ANOTHER FAST BREAKING NEWS STORY!

Kermit. ‘…well I don’t know why they don’t call the “distanceTo” function. I mean its parent class is… Oh hello everyone, this is Kermit the FlashGeek for FlashBrighton News, receiving reports of an incident from the city of Amsterdam, where the FITC conference is taking place. I’m standing here with some world famous geeks; Mike Chambers, John Grden, Jerry Chabolla, Stacey Mulcahy, Jared Tarbell, Chris Allen & Hoss Gifford. Pardon me Mike… Mike? Could tell us why you’re here today?’

Mike Chambers. ‘We’re here to speak at FITC, and have fun in Amsterdam. Yep, that’s it, fun. We sure are looking forward to our live video link with FlashBrighton.’

Kermit. ‘Wow, you hear that folks? These guys are gonna talk directly to FlashBrighton. Well that’s just great Mike! Say Jared, do you have a second? Jared? Kermit the FlashGeek, FlashBrighton news. What are you going to talk about?’

Jared Tarbell. ‘Hi Kermit. We got me, Hoss, Jerry, John; all these great guys. Ask us anything, just fire away!

Kermit. ‘I’m sure our viewers will be pleased to hear that. Chris, can I just speak to your for a moment? How’s the link up going to work?’

Chris Allen. ‘We gotta lotta hungry geeks here, sure need to get their dinner, so we gotta talk early. We’re starting 5pm UK time. FlashBrighton are also changing venue, from The Werks to The Skiff, cos it’s much more central.’

Kermit. ‘So that’s 5pm at The Skiff, instead of 7pm at The Werks folks. So John, what if people can’t come that early, or at all?’

John Grden. ‘If you can’t make it, post questions on the FlashBrighton mailing list and someone will read them out for you.

Kermit. ‘Our members sure will like this. Say Stacey, are you looking forward to it?’

Miss Stacey. ‘Oh Kermy-Wermy! If you’re there, I’m there! HI-YA!’

Kermit. ‘OUCH! Well that’s all for now, see you at The Skiff everyone!’

Miss Stacey. ‘Come here my Kermy…’

MANAMANA DO DOO DO DO DO, MANAMANA DO DO DO DO

Tues 16th Feb: RobotLegs & Signals

Thursday, February 11th, 2010

The blackened dome of the Flex Castle rose like a cathedral of misery over Owen Steamboy‘s head. No sunlight penetrated the gloom. The ceaseless din of steam-driven pistons echoed around the chamber like marbles in a tin box. Men in  boilersuits scurried across high scaffolds, turning wheels and pulling levers. Pipes & valves covered every surface, belching smoke & steam like vents of pure Hell.

It was a prison of his own devising. He had built the Castle with Flex & PureMVC, AS3 frameworks that connected the Castle internally. They were once in the vanguard, but things had changed, and they had become unmanageable; bloated, and overtly complex. Everywhere he looked pipes leaked, parts were inconsistent, and patches were commonplace.

Walking thoughtfully out of the hall, he entered the relative tranquility of his research lab, where – modelled in gleaming brass – the prototype for a new Castle stood on the table before him. It still needed Flex, but had replaced PureMVC with RobotLegs and Signals. RobotLegs was a lighter AS3 framework, and Signals – invented by that pioneer of steam power Robert Penner-Stephenson – was a much simpler way to communicate than Events.

The telltale hiss of steam and clamour of workmen echoed through the workshop, heralding another burst pipe in a distant part of the Castle. The sooner he ripped out the old plumbing the better. He bellowed into a metal trumpet that broadcast his words throughout the building.

‘No more sooty halls and leaky pipes, it is time I showed you the future of the castle. Come to my lab next Tuesday at 7pm and I will show you how RobotLegs and Signals work together to improve our lives!’

As he stood back he was brushed by the wings of something dark. Swatting it away, he gazed back at the polished prototype, as the trace of a smile played about his lips.

Tues 9th Feb: Projects Night X

Tuesday, February 2nd, 2010

Lord Sebastian of Groan gazed out blankly through a daedal liana of ivy carpeting the high walls of FlashBrighton Castle, towards the sun setting behind the cold spike of Gormenghast Mountain. Behind him, the laberinthine stone corridors of his ancestral home stretched out as though through time itself; an iron chain of ritual that bound him hand & foot to its unvarying rhythms. Not even the Earl himself was greater than FlashBrighton; history sat as heavily on him as it did the castle.

FlashBrighton’s most enduring tradition was ‘Projects Night’, upon which ordinary members of FlashBrighton – the Bright Carvers – were permitted to enter the castle to work collaboratively on Flash projects for one night every month. FlashBrighton’s lice-ridden Master of Ritual, Barquenrich, had that morning instructed Sebastian on his duty to host a Projects Night the following week. Sebastian shuddered at the memory of the peg-legged Barquenrich, swiveling on his filthy crutch, lank hair plastered to his face, as he barked commands from a mouldering tome.

The lore of FlashBrighton demands that you open the castle gates to the Bright Carvers for one night only. They shall be permitted to create, collaborate on, and showcase their own Flash projects. They shall be granted the freedom to work both with and without the assistance of the Earl himself. When their labours are over, they shall be granted the right to adjourn to the nearest hostelry to imbibe and carouse with the Earl, and other members of the house of Groan. If the Bright Carvers are denied this right they may take revenge by stealing the lead off the roof.’

Sebastian recalled with horror the cloud of dust that blew up as Barquenrich slammed the ancient volume shut. But, as much a prisoner to the patterns of FlashBrighton as any of the Bright Carvers under his patronage, in the dwindling light he reached for a piece of flint and scratched himself a reminder into the stone wall:

TUESDAY 9TH FEBRUARY 2010 7PM. ALLOW FLASHBRIGHTON MEMBERS INTO THE WERKS TO COLLABORATE – PROJECTS NIGHT X

Marking the X with a vengeful vehemence, Sebastian tossed the flint into the darkening penumbra, and skulked out of the room.