REDBug, Wordpress and Firing up the Grill (Link share)

Friday, April 25th, 2008

It has been a little slower at Realeyes latley so I’ve had time to play a bit. While playing I’ve run into some pretty interesting things over the past week, so I thought I’d share a few of the links I liked.

Development:
RealEyes Media . RED|bug
Release an updated version recently. Nifty debugging/logger AIR app that we’ve built.

Contacts Data API - Google Code
API from google so you can “own” your contact data…pretty nifty implications.

Selenium
A test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac. We have plans to target Safari on the iPhone in some months.

101 Adobe AIR Resources to Add to Your Toolbelt of Awesomeness

CSS Templates ( Page 1 of 12 ) - Free CSS Templates

Concepts:
DataPortability.org - Share and remix data using open standards
DataPortability: The option to share or move your personal data between trusted applications and vendors

GTD:
mGTD: GTD for Moleskine v1.0 | Anabubula.com *
Another (pretty cool) moleskin hack.

Wordpress:
WordPress › AIR Badge « WordPress Plugins
Allows you to easily create an install badge for your AIR applications using the [airbadge] tag in your posts.Created by Peter Elst

WordPress › Downloads Manager « WordPress Plugins
Adds a simple downloads manager to your blog.

Random Resources:
Digsby = IM + Email + Social Networks
Instant messaging, email notifications and social networking all in one client (Twitter, Facebook and MySpace)

Firing Up Your Weber Bullet - The Virtual Weber Bullet
It is spring time after all

Free eBooks - All Our Classic Books and Novels
Free literature for you to download - I like reading (ahem…listening) in the car!

Mark Shuttleworth » Blog Archive » Playing nicely with Windows
Windows-native installer for Ubuntu

Flex and Using Meta Data

Saturday, January 5th, 2008

“Metadata is data about data” in the case of Flex it is going to describe our components, classes and their interactions/uses. For example the most familiar metadata tag in Flex and AS3 code is [Bindable] this describes a property that can be bound to (obviously). But metadata is not limited to properties in Flex, you can describe all sorts of things with metadata to make your application code much easier to decipher, easier to user as well and add functionality that might otherwise be missed. I’ll try to describe a few of these so you can be on your way to using Flex metadata to improve how you write and use Flex code.

When creating metadata keep in mind that the metadata is bound to the next line in code. So if you are creating metadata for a class property or method, it should immediately precede the property declaration or method definition.

The [Bindable] metadata tag is great for class properties created in declarations but what about Getters and Setters - This is probably the next most used metadata tag that in my code and is an addition of the [Bindable] tag. In order to bind to a property that has a getter/setter you need to declare the event type that is dispatched when the property changes. We add the event="changePropertyName" to the [Bindable] tag:
[Bindable(event="changePropertyName")]

changePropertyName can be any string, but by convention “change” and then the name of the property (in hungarian notation).

Speaking of events, when a class broadcasts and event. You can add metadata for code hinting. To specify the event and its type for a class you can add the [Event] metadata tag. You’ll need to specify a name and a type for this tag so FlexBuilder knows what event and type it will present in the code hinting. So the [Event] metadata tag will look like:
[Event(name='changePropertyName' type='flash.events.Event')]

One note about the name value - you’ll need to use hungarian notation again so the code hinting displays correctly. So the event above changePropertyName may have a static const on the class CHANGE_PROPERTY_NAME if you follow the changePropertyName (lowercase for the first character and then uppercase for additional words) the code hinting in FlexBuilder will wake up just fine.

For Example - the following event metadata [Event(name="CHANGPROPERTYNAME", type="flash.events.Event")] results in the following code hinting:

Not very code-hinting’ish :)

Where as this [Event(name="changePropertyName", type="flash.events.Event")] results in:

Much better!

When building compoenents in AS3 you’ll want to expose information about your component, default values, property names etc. In comes the [Inspectable] metadata tag. This tag is not required and there are a few rules that apply with how Flex Builder displays the information. You can check out the details in the live docs. There are many definitions that you can add to the [Inspectable] tag, but some of the more used declaration in my code are:

  • defaultValue - The initial value that is determined by the property declaration.
  • enumeration - A comma-delimited list of values that are accepted for that property’s value.
  • type - Specifies the type of the value. Useful if you need a specific type instead of a generic type
  • variable - Specifies the variable to which the parameter is bound

These are just a few of the metadata tags. There is quite a lot you can do with metadata and it has solved some problems for me. If you’d like to learn more check out the live docs!

E4X XML Namespaces

Tuesday, November 6th, 2007

For XML that looks like the following response from Yahoo's weather service:

XML:
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*
  3. http://weather.yahoo.com/forecast/94089_f.html         Yahoo! Weather for Sunnyvale, CA
  4. en-us
  5. Tue, 06 Nov 2007 6:56 pm PST
  6. 60
  7.  
  8.  
  9.  
  10.  
  11.  
  12. <img alt="" />
  13.  
  14. 142
  15. 18
  16.  
  17. http://weather.yahoo.com/             http://l.yimg.com/us.yimg.com/i/us/nws/th/main_142b.gif
  18. 37.39
  19. -122.03
  20.  
  21. http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/*http://weather.yahoo.com/forecast/94089_f.html Tue, 06 Nov 2007 6:56 pm PST
  22.  
  23. &lt;![CDATA[
  24. <img src="http://l.yimg.com/us.yimg.com/i/us/we/52/33.gif" alt="" />
  25. <strong>Current Conditions:</strong>
  26. Fair, 55 F
  27.  
  28. <strong>Forecast:</strong>
  29. Tue - Mostly Clear. High: 67 Low: 49
  30. Wed - Partly Cloudy. High: 71 Low: 49
  31.  
  32. <a href="http://us.rd.yahoo.com/dailynews/rss/weather/Sunnyvale__CA/* http://weather.yahoo.com/forecast/94089_f.html">Full Forecast at Yahoo! Weather</a>
  33. (provided by The Weather Channel)
  34. ]]&gt;
  35.  
  36.  
  37.  
  38. 94089_2007_11_06_18_56_PST

When you need to access the nodes with complex node names such as yweather:location think XML namespaces.
In the above example, look for the xmlns declaration in the rss node
- xmlns:yweather='http://xml.weather.yahoo.com/ns/rss/1.0'.
Creating a Namespace object using the declaration will allow us to access the nodes with complex names.
Creating a Namespace object is a pretty simple process:

Actionscript:
  1. var yweatherNS:Namespace = new Namespace( http://xml.weather.yahoo.com/ns/rss/1.0 );

Now we can access the node with the following code:

Actionscript:
  1. yahooWeaterXML.channel.yweatherNS::location
  2.  
  3. trace( yahooWeaterXML.channel.yweatherNS::location.@city ); // outputs 'Sunnyvale'
  4. trace( yahooWeaterXML.channel.yweatherNS::location.@region); // outputs 'CA'
  5. trace( yahooWeaterXML.channel.yweatherNS::location.@country ); // outputs 'US'

With the preceding example we need to know the namespace url ahead of time. E4X gives us the namespaceDeclarations() method that will return an array that contains the namespace declarations associated with the XML document

Using the namespaceDeclarations() method from the XML object:

Actionscript:
  1. var namespaces:Array = myXML.namespaceDeclarations();

Now we have an array of namespace declarations that we can use to dynamically declare Namespace objects and access our complex node names:

Actionscript:
  1. var yweatherNS:Namespace
  2. var geoNS:Namespace
  3. var nsLen:uint = nameSpaces.length;
  4. for(var i:uint = 0; i &lt;nsLen; i++)
  5. {
  6. var newNamespace:Namespace = new Namespace( nameSpaces[i] );
  7. if( String( nameSpaces[i].prefix ).toLowerCase() == "yweather" )
  8. {
  9. yweatherNS = newNamespace;
  10. }
  11. else
  12. {
  13. geoNS = newNamespace;
  14. }
  15. }

So we can access the geo and yweather nodes without any problems now.

Setting up Cruisecontrol - Continuous Integration System

Saturday, September 29th, 2007

Setting up Cruisecontrol is a pretty simple process. Make sure you check out the Cruisecontrol site for info on getting started and installation. The basic steps are:

  1. Download the Cruisecontrol ZIP file (cruisecontrol-src-x.x.x.zip) and unzip the files to a directory on your computer. I've un-ziped the files to C:/cruisecontrol271
  2. Then build the Cruisecontrol code using the BAT file build.bat in {INSTALL_DIR}/main/
  3. Verify the install by running the following command in the command prompt:java -jar {INSTALL_DIR}/cruisecontrol-launcher.jarYou should get a error about a missing config file. If there are any other errors, you'll need to figure out what's missing (I've seen the missing tools.jar). Usually pretty easy things to fix though.
  4. Cruise control is set up and ready to run.

*There is also a windows installer but I like the command line install, it gives the feeling of more control.

Now you've got Cruisecontrol installed. In my next post, I'll show you how we set up an ActionScript 2.0 project and build loop in Cruisecontrol.

Continuous Integration - The pieces and parts!

Friday, September 28th, 2007
I finally have some time to post about our Continuous Integration (CI) set up for ActionScript 2.0 and Flex/ ActionScript 3.0 projects. To continue on from the first post, I'll explain all of the pieces & parts that are needed to get a similar CI system rolling.

First, the parts that you'll need for any project:

  • The project files - I've created a very simple same project that you can download for testing.
  • SVN REPO for your project
  • Cruisecontrol to manage the CI
  • ANT so we can build the projects - This is included in the Cruisecontrol download.
  • Java

Next if you are going to build ActionScript 2.0 projects you'll need:

  • Flash IDE for ActionScript 2.0 projects - Yeah a little bit of a bummer. You'll need to install the IDE on the CI server so the projects can be built. I'm sure you could set it up with MTASC, but we needed to compile in the IDE.
  • FlashCommand to build ActionScript 2.0 projects using the IDE (Mac Version) - Mike Chambers built this nifty tool and I've been using it for a while since I work in Eclipse with my ActionScript 2.0 projects.
  • ASUnit for unit testing your ActionScript 2.0 projects
  • The stand-alone flash player

Finally if you are going to build Flex Projects you'll want the following:

Yeah, that seems like a lot, but once everything is set up it is easy to maintain...almost set and forget. As a note, this is all going to be set up on a PC, I'm not a Mac guys, so sorry there, but I would hope the set up would translate nicely from PC to Mac. We now have the basic moving parts of the system. In my next few posts, I'll explain setting up the system:

  1. Setting up Cruisecontrol
  2. Setting up an ActionScript 2.0 Cruisecontrol project
  3. Setting up an Flex Cruisecontrol project
  4. Integrating ActionScript 2.0 project unit test results
  5. Integrating Flex project unit test results

I'll also provide sample files and packages as we go so you have something to start from.

David is on Adobe - H.264 Article

Monday, September 17th, 2007

Check out the Article that David Wrote for Adobe just launched on devnet:

Adobe - Developer Center : Exploring Flash Player support for high-definition H.264 video and AAC audio

Pretty nifty I say! (Nice pic too...hehehe)

public var ding:Boolean;

public function jsutatest():void
{
return "It worked.";
}

More Flexible Code - Programming to an Interface

Wednesday, August 22nd, 2007

Keep your code flexible - program to interfaces. What does this mean? Well there are a few things that we need to discuss before we can really answer that question. For this discussion you'll need a decent understanding of Object Oriented programming…but, hey if you don't have that it still may make some sense anyhow and you might even get something that you don't understand explained for you as we go along.

First things first, Polymorphism - The ability for one class to stand in for another, kind of. By "kind of" I mean that by programming to an interface, a variable or property's value can be assigned to an object that conforms to a "formal interface", more on that in a second. This means that if you crate a property or variable that is typed to an interface - myPet:IAnimal; - (where IAnimal is the interface) that item can be any number of classes that follow the "interface" defined by IAnimal .

Example:

Actionscript:
  1. public var myPet:IAnimal = new Dog();
  2. public var yourPet:IAnimal = new Fish();
  3. public var hirPet:IAnimal = new Camel();
  4. public var herPet:IAnimal = new Giraffe ();

Each of the classes, Dog, Fish, Camel, Giraffe must "implement" the IAnimal interface.

Okay, so what is a formal interface you say?
First off, a formal interface is a definition, some might say a contract, but I think that is confusing, of what a class's publically accessible methods should be and what they should look like. ActionScript 3 provides a construct to create these interfaces that is very similar to classes. Basically you create the public methods, their parameters and their return types, but nothing that has to do with what happens inside the method.

Example:

Actionscript:
  1. package
  2. {
  3. public interface IAnimal
  4. {
  5. function create(p_name:String):void
  6. function feed(p_food:Object):void
  7. function sleep():void
  8. }
  9. }

Notice that there is nothing that tells you what you need to do in the methods, or anything about properties or private methods. That is determined by the needs of the class that implements the interface. This is a good point to take hold of and knock into your head:

A class has an implementation (what the class does ) and an interface (how the outside world interacts with it).

This is what allows your code to be flexible. If you program to interfaces, you can crate objects that are much more flexible and powerful by have the ability to "stand in" for any property or variable.

You can also create an "interface" through inheritance by using something called an "abstract" class. An abstract class isn't intended for instantiation, so it is up to you to manage that. But abstract classes do allow for a default implementation (what the class does) as well as allowing for the type of interface implementation mentioned above because sub-classes inherit the interface of their parent classes.

So, keep your code flexible, program to interfaces!

Continious Integration for Flash and Flex

Wednesday, June 27th, 2007

Lately I've been working with CruiseControl, a continuous integration tool, and unit testing (ASUnit and FlexUnit) for our ActionScript 2, ActionScript 3/Flex projects. With the help of a couple of some great posts from eyefodder and Peter Martin, I've finally come up with a nice little system that isn't too much of a headache to set up and is very easy to maintain once it is set up.

When I get some real time, I'll be sure to blog about the set up and give some walk-throughs on how to get everything up and running.

The basic 'gist' of continuous integration is:

To build your code as soon as it changes. This helps to identify problems with the source code as quickly as possible after the problem is introduced. By introducting unit tests into the build process, you add more integrity to the build as well as your code.

So, like I said as soon as I get some real time, I'll be sure to put together some set up information.

AIR JavaScript Pocket Guide Now Available for Download!

Wednesday, June 27th, 2007

Adobe Integrated Runtime for JavaScript Developers Pocket Guide has been released and is available for download at Ajaxian.

Thanks Adobe and Ajaxian!

Adobe Releases AIR and Flex 3

Sunday, June 10th, 2007

Adobe has released some AIR. No not that kinda air, The Adobe Integrated Runtime, this is an update and the new name of Apollo.

Also, released was Flex 3 .
Of course these are both on Labs, so they are both pre-releases.

Now that Ted got everyone so excited, it is time to play...wish I wasn't so sleepy.

Find entries :

Want to subscribe?

  Subscribe in a reader or,
Subscribe via email:

About me

I'm a senior developer at RealEyes Media, Adobe Certified Instructor and Adobe Certified Professional. Here you'll get my ideas and experience Flex, Flash, ColdFusion and related technologies as well as some generally off the wall stuff.