The Value Object Pattern

I been trying to explain to a friend how to use Value Objects to describe data, after a google search returned nothing more than an ancient DevNet article by Branden Hall, I figured I’d better write a quick example.

So the first thing I do is fire up FlexBuilder and create a new project, source folder and a package called VO. In that package I create a really simple Value Object which describes a Car and 3 properties of the Car. These properties are public vars and typed to the data type that we want to handle. Quite often Value Objects contain arrays of other Value Objects.
Continue reading ‘The Value Object Pattern’

Flex 3, AIR, FlashPlayer, Safari for PC and Leapard!

Did I miss anything?

It seem like the last few days have been jam packed with tons of exciting stuff.

First from Adobe we have Flex Builder 3 hitting labs.adobe.com there are lots of cool additions to the working environment, some new components, even more integration with Flash custom components, full AIR integration, the ability to hot swap between Flex SDKs - just to name a few. It’s looking very good and from the guys at Mook that are using it the compile time has sped up as well. I’m going to be diving into it soon so I can start work on my LFPUG presentation in September.
Continue reading ‘Flex 3, AIR, FlashPlayer, Safari for PC and Leapard!’

blogging from my ultra thin Samsung X820

This is kinda cool, it’s just a shame the browser doesn’t have the Opera rendering engine because the layout is all over the place.

Publish all open documents in Flash

It's been a really long time since I used the IDE but a big project I'm working on at the moment calls for it. I wished that I could hit a button and compile all my open Fla's.

Thankfully I've been here before, with a little JSFL you can publish all the open documents:

JAVASCRIPT:
  1. var num = fl.documents.length ;
  2. for ( var k = 0 ; k <num ; k++ ) {
  3.     fl.documents [ k ].publish ( ) ;
  4. }
  5.  
  6. fl.outputPanel.clear();
  7. fl.trace( "all your documents have been published" ) ;

With a little applescript compiled down to an Application you can launch your jsfl:

JAVASCRIPT:
  1. tell application "Finder"
  2.     activate
  3.     open document file "Publish_all_open_docs.jsfl" of folder "Path to your folder" of startup disk
  4. end tell

And with a little XML in your Ant Build you can kick the whole lot off from Eclipse:

XML:
  1. <target name="Compile all open Fla's in Flash IDE" description="Compile all open Fla's in Flash IDE">
  2.         <exec executable="path/to/you/compiled/applescript/compile_all_in_flash.app" />  
  3.     </target>

Enjoy :-D

Removing svn meta data with the Terminal

So I had a framework directory that I copied from one project to another, tried to commit and it kept erroring saying it was already committed.

A coworker said there was an easy way to clean all the meta data off using Terminal.

/usr/local/bin/svn export [the name of the folder you want to clean] [the name of a new temporary folder]

Jolyon :-)

Quote of the day…

"On completion of the video (i.e. at the end) the initial default state will re-occur."

I had a 115 page document dropped on my desk, I've not read a lot of technical documents in my time, in fact this is probably my first "proper" one. From what I can tell they're a barrel of laughs for all the wrong reasons, see above.

A key quote from the article,

"A developer who said he had limited experience with Flash also sided with Silverlight. "I just think the integration with .Net is going to be big. I'm a .Net developer. It allows me to jump in [to] Silverlight a lot easier,"

But, but, but, but...

Of course he'd say that, he's a .Net developer and all the other feedback is positive, why, well lets see they're asked .Net developers at a Microsoft event, duh!

Does the fact that all the feedback I've had from Flash developers saying they don't see the point in Silverlight mean it's going to die a death? No.

Can we just face it that, Flash and Silverlight can sit side by side. The next version of Flash is not going to be the death nell for Silverlight as much as Silverlight is going to suddenly convert Flash developers to the cult of M$.

I see Flash and Silverlight sitting in very different areas, but Flex and Silverlight are probably more likely to meet in the business/intranet market. They're both built on Frameworks, they're both XML based amongst other things.

It used to be easy to see the difference between a .Net developer and Flash developer. But as the Flash Platform splinters and as Microsoft tries to open up and be more friendly I'm not so sure any more.

Maybe one of the distinctions that will remain is that generally speaking Flash developers are more open to other technologies, they have to be, the swf is not the end of the road. You've got the usual MySQL and PHP, then there's Flash Com/Media Server, RoR, javascript, xml if you want to be an accumplished Flash developer you'll touch some or all of these.

Microsoft's .Net framework packages everything up into an ecosystem so that once a developer has learnt .Net they never have to use anything else is that a strength or a weakness?

I think that's all for now, just some musings...

The Web Design Survey

A List Apart have launched a survey to try and find out what it is we all do, it only take 10 mins and you could win an ticket to an Event Apart or an iPod.

Go take the survey

New Host

So I signed up for hosting with Dreamhost a while ago, they came recommended from a couple of friends. They work out very cheap for what you get, one of the downsides is that it's shared hosting another is that they don't host co.uk domains.

As a freelancer if you're hosting a lot of little sites with some PHP and MySQL this is perfect. If you're doing more hardcore stuff like multiuser games or RoR then this isn't for you, although Dreamhost do dedicated hosting it's much more expensive.

All their packages come with loads of goodies, like 1 click installs, Video streaming, Jabber IM, Cron Jobs and much more. Another pretty sweet feature is one that you get with gmail, your bandwidth allowance and storage space increases every week.

I've had a couple of questions along the way and their speed of reply to support questions has been great.

All in all I'm really happy with them, if you're looking for hosting, check them out

PS. That's also why some of the image links are broken, will go through and fix them.

Apollo makes the tintrnet possible

When I first saw the demos of Apollo and the HTML element with it's ability to be manipulated as if it's a MovieClip an idea popped into my mind.

It's taken a while for me to get the time and inclination to play with Apollo, Mike Downey's talk at LFPUG on Tuesday was enough of a reminder that I really should have a go.

So, my first Apollo app is tintrnet, it's a very poor visual pun on the colloquialism t'internet, literally tinting the internet, I dropped the "e" just to make it a little bit more Web 2.0 ;-)

The bulk of the code is pilfered from flashgen.com, obviously the addition of the colour picker is where the bulk of the work was, that and getting the colour transform to behave.

XML:
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="820" height="640" applicationComplete="loadURL('http://www.google.com')">
  3.     <mx:Script>
  4.         <![CDATA[
  5.             private function loadURL(uri:String) :void {
  6.                 browser.location = uri;
  7.             }
  8.             private function setURL(uri:String) :void {
  9.                 url_txt.text = uri;
  10.             }
  11.             private function setTint ( ) : void {
  12.                 var hex : Number = picker.selectedColor ;
  13.                 var red : Number = hex>>16;
  14.                 var grnBlu : Number = hex-(red<<16);
  15.                 var grn : Number = grnBlu>>8;
  16.                 var blu : Number = grnBlu-(grn<<8);
  17.                 browser.transform.colorTransform = new ColorTransform(1, 1, 1, 1, red , grn , blu , 0);
  18.             }
  19.         ]]>
  20.     </mx:Script>
  21.     <mx:Panel id="holder_panel" layout="absolute" width="100%" height="100%" x="0" y="0">
  22.         <mx:Label x="7" y="7" text="tintrnet (beta)"/>
  23.         <mx:TextInput id="url_txt" x="105" y="5" width="581" editable="true" enabled="true" />
  24.         <mx:Button id="go_btn" x="703" y="5" label="GO" click="loadURL(url_txt.text)"/>
  25.         <mx:ColorPicker id="picker" x="760" y="5" change="setTint()" />
  26.         <mx:HTML id="browser" width="100%" height="100%" y="30" locationChange="setURL(browser.location)" />
  27.     </mx:Panel>
  28. </mx:ApolloApplication>

This was just a bit of fun and a nice little taster of Apollo.

I forgot to add the air file for download: tintrnet.air

And here's a link to the runtime if you haven't already got it: Apollo Runtime