Saturday, 22 August 2009

Windows Live Writer working again

For the last few weeks whenever I have tried to start Windows Live Writer on my desktop it just crashes straight away. I tried repairing it, uninstalling it, re-installing it, looking at log files and so on and so on and nothing worked.

Today however I found this blog post:

http://jcheng.wordpress.com/2009/02/08/windows-live-writer-2009-wont-start/

and deleting the files in the mentioned directory worked.

That’ll save me a bit of time as I was considering writing my own blog client in Air!

Sunday, 9 August 2009

FlexBudget

I’ve spent quite a bit of time this weekend working on FlexBudget. I am pretty pleased with my progress.

I haven’t created a single view component yet b8t have just been working on the domain classes and tests.

For this sort of project TDD really comes into it’s own. As I say, I haven’t created a single view component yet but when I get to that stage I can be fairly sure that all of the domain classes will work fine – including all binding.

So far I have created the following domain Classes:

  • Account
  • AccountAdjustment
  • Transaction
  • Balance
  • Withdrawal
  • Deposit
  • Transfer

Balance, Withdrawal, Deposit and Transfer are all Transactions. Each Transaction has at least one AccountAdjustment which is associated with one account. A withdrawal has one AccountAdjustment – a withdrawal with a negative amount. A Transfer has 2 account adjustments, a withdrawal from one account and a deposit in another account.

Each account has a collection of account adjustments that are sorted by date. The balance of the account is calculated by each adjustment being passed the balance of the previous adjustment and then working out the new value.

There is quite a lot of testing to make sure that if you update the amount or date of an account adjustment the amount property on the associated transaction updates (and the binding fires) and if there are any other adjustments for that transaction that the amount updates there as well.

The next step is to create a Budget class that will hold a collection of Transactions and a Collection of Accounts. The accounts will be used to generate an array of DataGridColumns and the transactions will be used as a dataprovider.

Observe / ObserveValue

I don’t know what is happening with blogs.adobe.com but a lot of pages seem to be down or missing. I can’t find anywhere to download Paul Williams’s Observe tag and Alex Uhlmann’s blog about it seems to be down as well.

I’ve uploaded them here so if you’re wanting them grab ‘em quick.

I worked with Paul and Alex on my last project at Morgan Stanley. Both are very talented developers and good fun to work with.

Saturday, 8 August 2009

EventListener

This is a little class I wrote that make it a bit easier creating and removing event listeners.

If you have ever written code like this:

public function set model( value : myPM ) : void
{
if( _model )
{
_model.removeEventListener(
"someEventType",
myFunction );
}

_model = value;

if( _model )
{
_model.addEventListener(
"someEventType",
myFunction );
}
}

Then EventListener should make your life a bit easier. The above code in MXML would become:

[Bindable]
public var model : MyPM;

]]>

target="{ model }"
type="someEventType"
handler="{ myFunction }"
/>

And in an as file:

private var domainListener : EventListener = new EventListener(
null,
DemoDomain.SAMPLE_DOMAIN_EVENT,
domainHasDoneSomething );

public function set demoDomain( value : DemoDomain ) : void
{
domainListener.target = value;

_demoDomain = value;
}

I think it makes your code look a bit nicer – especially in mxml files where you can just declare the event listener and use bindings.

There is also a passEvent property that determines if the event is passed to the handler function.

I’ve put a demo of it in use here with view source enabled and a download of the source code. This demonstrates an event listener with a target of a domain model. You can then inject the domain model into the PM, the PM then dispatches an event when it receives an event form the domain. IF you remove the domain from the PM the event listener is the cleaned up and the PM no longer dispatches events.

Let me know if you find it useful.

Flex Formatter Eclipse Plug In

At work recently I’ve been using a Flex Formatter eclipse plug in. It’s REALLY useful and saves so much time.

Take a look here.

Saturday, 1 August 2009

Parsley 2.0

On my last 2 projects I have been using Parsley 2.0. An IOC framework for Flex.

It is an alternative to Cairngorm and does a lot more on top. I have used Cairngorm for a long time and did like it but when you get used to Parsley you really start to appreciate the benefits.

Tom Sugden who I worked with on my last project has written a good blog post about IOC in general here and has some specifics about parsley.

I’ve implemented a sample project that demonstrates dependency injection, managed events and modules. The sample is here and a zip of the project is here. This is a Flex 4 project so you’ll need to download Parsley from SVN and patch it.

The sample project has 2 views in the root with a different instance of the same PM injected into them. The PMs both have the same global domain object injected into them that has a string in. This string is displayed in the text area and you can see that any changes are reflected in both views.

You can also load Module 1 and then load Module 2 inside Module 1. Parsley creates a child context for each of these modules but messages still flow to and from the modules as does the injecting of the global domain object.

The area at the bottom of the screen is a custom log target that displays logs from parsley so we can see what’s going on.

If you want to find out more about parsley the spice factory home page is here. There is some great documentation and a really good forum with excellent support from the creator Jans Halm.

Sunday, 5 July 2009

End of an Era – leaving MS

Friday was my last day at Morgan Stanley. I had a great time working there, made some good friends and met some very talented developers.

I was there for just over a year and learnt so much in that year.

It was quite sad leaving on Friday and I nearly had a tear in my eye at one point (but don't tell anyone ;) ). I'll only be across the road at my new job with HSBC though so I'll still be able to meet up with the guys.

Here is a picture from the last pink shirt Friday. It was the first time I participated as the pink shirt was a leaving present.

A special mention to Alex, Ged, Johnny, Ben, Sam, Leon, Tom, Dianne, James, Christie, Nick and Claire. I hope we’ll stay in touch and stay friends.