Scott Mebberson

Icon

Web Technologist

fcsh and rlwrap

I’ve really only used mxmlc when compiling AS3 only projects, and decided to look into fcsh. While it’s great, and does make compiling incremental edits much faster, it’s a complete pain in the ass.

It doesn’t behave like a normal command line interface as you’d expect, like the interactive mysql daemon for example. However, this is a great little to rectify that issue, called rlwrap.

I installed rlwrap using Darwin Ports. Once you have it installed, you can issue ‘rlwrap ./fcsh’ to the command line. I’m not exactly how it works, but apparently it acts as a wrapper to all command line applications making them function like the normal bash command line. Arrow + UP works a treat for example, to pull up your most recent command.

Filed under: ActionScript

MATE: Using the PropertySetter tag

I’ve never understood why many MATE developers don’t use proper getter/setter properties within Managers. I’ve just assumed it is because MethodInvoker is the preferred means to communicate with Managers. Setting an individual property on a Manager hasn’t been an easy thing to do, until now, so I wonder if that will change?

Having read through similar discussions on the forums however, I’m not convinced MATE purists will like/agree with this post, but I feel most confortable with property getter/setter properties and it has always been a common method in ActionScript.

Mate 0.8.6 included a new tag called PropertySetter and my eyes lit-up as soon as I read it on the change log. The PropertySetter tag (there’s no documentation for this tag yet) allows you to communicate with Managers by directly assigning values to a property, and using getter/setter property functions to check, manipulate and fire off other events as necessary.

Before the PropertySetter tag my EventMap used to communicate with Managers like this:

<EventHandlers type="{PreferencesEvent.BREAK_LENGTH}" debug="false">
<MethodInvoker generator="{ApplicationManager}" method="setBreakLength" arguments="{event.value}" /></pre>
</EventHandlers> 

and the related methods within my Managers used to look like this:

private var _breakLength : int = 0;

[Bindable(event="breakLengthChanged")]
public function get breakLength () : int
{
	return _breakLength;
}

public function setBreakLength (value : int) : void
{
	breakLength = value;
}

notice the use of a proper property getter function, but no proper property setter function Рthat has always felt so awkward to me. With the PropertySetter tag, I can now set a property in my Manager from my EventMap like this:

<EventHandlers type="{PreferencesEvent.BREAK_LENGTH}" debug="false">
<PropertySetter generator="{ApplicationManager}" targetKey="breakLength" source="{event.value}" /></pre>
</EventHandlers> 

and use proper property getter/setter functions in my Manger like this:

private var _breakLength : int = 0;

[Bindable(event="breakLengthChanged")]
public function get breakLength () : int
{
	return _breakLength;
}

public function set breakLength (value : int) : void
{
	_breakLength = value;
	dispatchEvent(new Event('breakLengthChanged'));
}

I’m not sure what the general community at large thinks? I’ve started a thread over on the mate forums to discuss it, but it would be great to hear other peoples opinions on what should be best practice.

Filed under: ActionScript, flex, frameworks, mate

Focus Booster, minimised!

We’re tossing up between a few options on a new feature for Focus Booster and we’d like your opinion.

We’ve had a number of requests for a minimised version of Focus Booster that doesn’t take up as much screen real estate. The two options are to show the remaining time or the progress bar. So, please let us know which you’d prefer!

Filed under: Focus Booster

GTD for developers

I follow GTD (Things) to organise my working life, making sure I have a list of the things I need to do. The list is updated and re-prioritised regularly. This method relieves me of a shit load of work related stress, as I don’t have to keep everything buzzing around in my head.

I use the Pomodoro Technique (Focus Booster) during the day at work, to make sure I’m productive and efficiently working through the gazillian items in my GTD list.

One of my favourite things about GTD is the 2 minute rule; if you can do it in 2 minutes, do it straight away, but if not, jot it down quickly without prioritising and get back to what you were doing.

At work, I encourage my development team to note any bugs while developing that they may not fix on the spot, so that nothing is forgotten and we know how much work we still have, post beta.

It has just dawned on me this is GTD for developers! So, this my new GTD for developers rule: if you can fix the issue within 5 minutes (a little extra time is required when it comes to development) do so, if not, note it down so that you can come back to it later based on priorities.

Filed under: general, GTD

Multiple screens in AIR

A user of Focus Booster sent through an interesting request, which is to make Focus Booster restore the window position upon subsequent loads. I can’t believe I hadn’t thought of that, and have now added it to my list of required standard functionality for AIR applications.

So, I set out to implement this feature and got to thinking about multi-screen support. Everything screen related takes place in the flash.display.Screen class. I thought there might be a simple method or property to return the current screen index a particular nativeWindow is on; but there isn’t really anything quite that useful there.

The closest thing you can get is Screen.screens which is an array containing individual Screen objects, one for each screen plugged into the viewing computer. From there, you have to implement your own routines to determine which screen a nativeWindow is on.

I wrote up a quick example that demonstrates how to determine which screen the window is on, and also how to store the window position and restore it next time the application is loaded. It’s called TwoScreens, and you can right-click to view the source (once you’ve unzipped the AIR file and installed it).

There may be a better way to do this, so post a comment if you know better ways to achieve this.

Filed under: ActionScript, air, flex

MATE: Responding to events

Recently, I embarked on a personal project to learn about the Mate Framework, which I’ve started hearing more and more about. We’ve successfully used Cairngorm in dozens of Flex/AIR projects at Enpresiv and I thought it was time to try out Mate (apparently pronounced mah-teh).

I’m glad I did, because it is an awesome framework with much flexibility making it suitable for many different types of projects. One of my favourite things about the framework is how quick and easy it is to integrate. It doesn’t force you to use all Mate concepts either, providing endless options for partial integration into existing projects that might just need a little structure.

One of the issues with Cairngorm that a lot of people have trouble with is easily responding to events/commands within a view (albeit the event that dispatched the event or not). I was happily surprised when I found out this is one of the easiest things to do within Mate, and there are two ways to do it!

Mate advocates the Dependency Injection pattern over the Model Locator pattern which Cairngorm advocates. Dependency Injection is a fantastic concept and truly promotes reusable views as the view needs no knowledge of the framework. Your view doesn’t really need to respond to an event directly, it just receives only the required or updated data it needs.

The second means for views to directly respond to events is using the Listener tag, which simply could not be any easier to work with.

I’ve worked up a basic yet focussed example on two options for repsonding to Mate events within views.

I plan on discussing other Mate features in future posts, but thought this was a great starting point as it’s the source of pain for many Cairngorm developers. Although, Universal Mind have released some extensions which make responding to events/commands within views much easier.

Filed under: cairngorm, flash platform, flex, frameworks, mate

the Pomodoro Technique

I’m always looking for ways to improve my productivity; the more I get done at work, the less work I have to wrestle with to stop from creeping into my family life.

I’ve been using the Pomodoro Technique for a few weeks now, and I’m pretty happy with the results. the Pomodoro Technique promotes working to a specific unit of time (25 minutes) with a 5 minute break in between sessions. During a session you’re supposed to avoid all interruptions to try and achieve a list of tasks (one task per session).

Two important things I learnt almost immediately are:

  1. make sure you break down your tasks into steps that are achievable within 30 – 40 minutes; you’ll be surprised how much extra work you can complete with 25 minute bursts of pure focus
  2. take the scheduled breaks (and when you do, get away from the computer and walk around, refresh your body, eyes and your mind), if you don’t you’ll be super tired at the end of the day

A positive side affect I’ve noticed is that your team can usually resolve any issues they have during the 25 minutes without your intervention (but that’s a blog post for another day).

I’ve started a side project with Gavin Keech, our creative director at Enpresiv to create a pomodoro timer, helping to implement the Pomodoro Technique called Focus Booster. We’ve had almost 1000 downloads since its launch (a couple of weeks ago) and we’ve had two official releases.

We built it using Flex 3, Air 1.5, the Mate FrameworkM, Degrafa, AS3CoreLib and BendPixels (for integration Pixel Bender filters) libraries. I’m going to write a series of blog posts on some of my learning’s along the way.

Filed under: general

Dispatching events in Adobe AIR using MATE

I’ve been intrigued about the Flex framework called MATE ever since I stumbled across it, some months ago. The guys at asfusion.com have always been expert Flex / ActionScript developers and the MATE framework they’ve developed is no exception.

I decided to use MATE rather than Cairngorm in a personal project I’m working on, to check it out in a real world environment (there’s nothing like going beyond examples and prototypes to determine if a framework actually works beyond design¬†patterns and theory).

So far, I’m very impressed.

It’s light weight, easy to integrate, and has a tag to suit almost any situation and many common design patterns. Within half an hour, I had MATE integrated into my project, dispatching events and updating the model.

I did however come across an interesting problem which had me stumped for a while. I’m working on an AIR application in which I have a preferences window (via a NativeWindow popup) which creates, stores and modifies preferences for the application (yes, I’m using as3preferenceslib).

The basic idea behind MATE is to dispatch events and respond to those with changes to the Model using dependency injection to keep your views notified of the changes. All of this happens via a tag called EventMap (MATE is a tag-based framework) which is used to respond to events, change the model and inject changes to data into views. Basically, you whack the EventMap tag into your Application.mxml, use the standard dispatchEvent and magically, everything works.

Unless you’re view is used in a popup window and you want to use MATE events and the model.

The reason being popup windows within AIR have an entirely different displayList to the Application displayList and your EventMap won’t be able to intercept events dispatched using the standard disptachEvent.

After some poking around in the MATE documentation (which is very good by the way) I found a Dispatch tag, which can also be instantiated via ActionScript. So, I simply made an instance of Dispatch and used the dispatchEvent method and once again, magically, everything worked.

var countdownEvent : CountdownEvent = new CountdownEvent(CountdownEvent.SET);
countdownEvent.countdown = event.newValue;

var d : Dispatcher = new Dispatcher();
d.dispatchEvent(countdownEvent);

Filed under: air, flash platform, flex, frameworks, , ,

ColdFusion AJAX (cfgrid)

ColdFusion has always been the language that makes the hard things easy. When you’re new to ColdFusion and you’re browsing the available tags, most people are confused to see cfform, cfinput, cfsubmit which are tags that wrap the standard HTML tags. Using these however, ColdFusion makes it easy to perform both client-side and server-side validation with the same code (producing the necessary client-side code for you).

The same goes with the new ColdFusion AJAX tags, such as cfgrid. All of the functionality can be achieved hand-coding it yourself using CFCs and the Ext JS library. But why would you?

Sure, when you look at the source, its not exactly the same as one might hand-code themselves; but if you can look past that, there is some powerful functionality that is really easy to tap into.

If you simply need a paging datagrid, for speed and ROI, it’s hard to look past the built-in capabilities of cfgrid. It’s value for your money as far as your clients are concerned, and profit for your own business. Little advertised by Adobe, but you can extend the functionality of tags like cfgrid via the well documented Ext JS API.

I’ve decided to throw together a few examples, and further explore the possibilities of using cfgrid and other ColdFusion AJAX tags rather than rolling our own all of the time using jQuery.

Filed under: ajax, coldfusion, examples

I love motionbox

I really do love motionbox.com. A little while ago I bought an AVCHD camcorder (a Canon HF10 to be precise). While I’ve been very happy with the camera itself, I unknowingly stepped into brave new world of dealing with AVCHD (mts) files; a world that is definitely in its infancy, to say the least.

I’m a big fan of archiving original video content (and photos, using Flickr) despite what you might edit the video into. You never know when you’re going to want that original source file. However, dealing with the huge mts files, having enough room to store them and back them up, well it’s nothing short of a pain in the arse.

I also need to share them, with limited fuss (if possible), via the web. I have family interstate and like to keep them in the loop.

After much searching (thanks for all your help Gav) and trials of a few different video sharing sites, I’ve finally settled on motionbox.com. I even paid premium memberships with another well-known video sharing site, only to be disappointed (primarily with the video quality).

Motionbox can natively handle AVCHD (mts) files. No transcoding and exporting prior to uploading, just upload your mts files and motionbox takes care of the rest. Perfect for archiving your original camcorder files.

Its easy to manage permissions, share videos and importantly, the quality of the final video that appears on motionbox is awesome. Apparently they use higher bit rates to encode your videos (in H264) than other sites, and I really did notice a massive difference in quality. And their price is unbeatable at $US30 per year for unlimited hosting.

Despite their under-whelming features page, you should really chec out motionbox if you’re looking for a fantastic online video, sharing site.

Filed under: general

Follow

Get every new post delivered to your Inbox.