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:
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
Then build the Cruisecontrol code using the BAT file build.bat in {INSTALL_DIR}/main/
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.
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.
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.
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:
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 .
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.
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!
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.
So, I've finally snagged some time to whip out a post about dealing with different file types with the File API in Apollo AIR.
The contents of a file can be read into a ByteArray and manipulated there. For example if we had a simple text file we could read in its contents to a ByteArray with the following code:
This would jsut output the first 9 items int he ByteArray. So, you'd see something like the following:
I asked myself, well what good is that? We'll lets say the file you were reading was a PNG. You could figure out how to write that file data out to the PNG file format, or you could check out the AS3 libraries that has a PNG and JPEG encoder already.With that said you now have control...hold that, TOTAL control of the file as you read/write the bytes to/from a file.
In my previous posts (Reading a File & Reading a file Asynchronously), the file contents were read into a String variable. This was accomplished with the FileStream readMultiByte() method.
The readMultiByte(length:uint, charSet:String) method takes two (2) parameters:
length: uint - The number of bytes to read from the stream
charSet: String - The String specifying the character set to use to interpret the bytes read from the stream. I'm looking for a nice list of supported character sets, but have yet to find them. I'll let you know when I do. For now we can use the livedoc examples of "shift-jis", "cn-gb" & "iso-8859-1".
We've checked out reading image data and text data, you could extend either of these to accommodate most situations. I'll keep playing and if I run into anything I'll be sure to add to this series.
I was very excited to receive the book Advanced ActionScript 3 with Design Patterns I had heard great things about the book and was not disappointed as I read through it.
I just happen to be stuck in jury duty for a full day and as I waited for the city and county of Denver to decide if they required my services I was able to read through most in the book in a morning. The really nice thing about this book is the lack of fluff. It is very direct, very to-the-point and very useful.
There were quite a few lessons that I learned (one would be typing a variable to an Interface...tre useful!) through out the book. Not to mention to the descriptions of many of the more popular design patterns around. I'd say Joey Lott and Danny Patterson have done a fine job presenting ActionScript 3 as applied to development with a focus on design patterns.
The only complaint that I have heard, is that that it can become a little repetitive. If you are very familiar with ActionScript syntax, you may want to skim many of the chapters for items that catch your eye and look to be good tips or new to you.
Looks like Eric Feminella has released an updated version of Cairngen. Since I posted about the 1.0 release I figured that I'd let you know about the udpate as well.
New features in Cairngen 1.2:
Complete support for Cairngorm 2.0
Complete support for Cairngorm 2.1
Complete support for Cairngorm 2.2
Added logging capabilities for all targets
Abstracted user / project specific properties. User properties are now located in the project.properties file.
ApolloRanch is a mini-conference similar to ApolloCamp. Thanks to Xylem CCI (Xlyem and Creation Chamber merged on April 30th) for putting together and hosting the ApolloRanch, they've done a great job so far! ApolloRanch is at the Fisk Planetarium (shoot for the starts Apollo!) on the CU campus in Bolder.
Mike Chambers gave the keynote as well as a "creating your first Apollo application" presentation.
Here is a frew of the highlights:
Apollo Beta to be released on Labs around mid June (keep an eye on Labs)
Many of the missing APIs will be in the beta; drag-and-drop, clipboard
Philo (Adobe Media Player) Preview: Very interesting media player. RSS feed based "channels" for video contnet delivery (FLV).
Some more of the release timeline:
Apollo 1.0, Moxie (Flex 3.0), Philo 1.0 - late Fall early Winter
Eric Feminella created Cairngen as a code generation tool for Adobe Cairngorm. he developed it to do away with the redundant copy/paste work needed to create Flex applicatoins with Cairngorm and is released under the MIT license.
Cairngen 1.0 is built entirely in Ant and provides a solution for one-shot code generation of Adobe Cairngorm 2.2 classes.
I haven't had a chance to play with Caringen 1.0, but can't wait (I love ANT!).
There are many common events for Flex components, such as the click or change events. These events are very usefull and great for many situations. Your application or custom component may require more from an event than is provided in these built-in events. Not a problem! You can dispatch any of the predefined events inherited by a component's superclass, as well as new, custom, events that you define within the component.
To dispatch a new event from your custom component, you must do the following:
Create a subclass from the flash.events.Event class (or another event class) to create an event class that describes the event object. This step is optional.
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.