Ramblings

April 11, 2008

TODO/FIXME extension for Flex Builder 2/3

Filed under: cool, flex, tip, tool — michaelangela @ 10:56 pm

Gotta keep a note for this one. I was wondering why my tasks weren’t showing up in my new install of Flex!

richinternet.blog

I finally found some time to finish work on an extension plugin for Flex Builder 2 which adds TODO/FIXME Task support similar to Eclipse’s Java Development Tool JDT. This is the nice thing about Flex Builder 2: it’s based on Eclipse so you’re able to contribute to the product by adding your own extensions.

Cairngorm factories for xml in and VO out

Filed under: as3, dev, education, flex, tip — michaelangela @ 5:56 pm

I’ve linked to this article before but I wanted to bring up another point now. I have a good xml data set that is becoming the local store for a chunk of a UI. But because it is xml, it doesn’t update the way it should. I need to try to implement this xml > VO approach, which could yield objects that properly emit data change events. Then the UI can bind more directly which would be very nice.

Flex and Flash Developer – Jesse Warden dot Kizz-ohm » Blog Archive » Cairngorm vs. Joe Berkovitz’s MVCS

It also implies, too, that Factories won’t go away. Neither Cairngorm, nor JB’s MVCS technically have the Factory pattern, but I use it in every single project I do now. Typically this is “throw some XML in, get a ValueObject out”, or JSON, and vice-versa. These are used in Cairngorm’s Delegates, or JB’s MVCS Services. Having a Factory create a nice client side version of our VO’s is very useful, encapsulated, and you end up with easier to read Delegate / Service classes.

To do this though would require something like a hash map. Actionscript 3 doesn’t have it. But some developers have made different versions. I am leaning towards this MultiMap Class though:

H1DD3N.R350URC3 » ActionScript 3 MultiMap Class

Recently I needed a HashMap for a project to map key/value pairs but in
that particular case the Map required to map not just one but several
values to a key. I could have used an array or object to store the
values in and map that one but in practice it turned out that accessing
the map looked rather messy. It would be much more elegant to have a
map to that multiple values can be mapped directly. After some
investigation (strangely even Java seems not to have a MultiMap
included) I came up with writing my own MultiMap class, so here it is!

The MultiMap is heavily based on Michael Baczynski’s HashTable class but I modified it to my requirements and added a couple of additional methods for luxury.

But the updated HashMap is apparently bindable which is what I want. I don’t think the MultiMap is bindable

Eric Feminella: Solutions Architect, Rich Internet Applications » Blog Archive » AS3 HashMap for Flex 2

Additional explanation: The code above is basically the same HashMap, but it is bindable. You will need it i.e. if you want bind GUI components to the HashMap.

Ah yes I see it now. The HashMap implements an IMap which returns an IList when you call getEntries. And that IList has a collectionChange event “Dispatched when the List has been updated in some way”. Flex collections tend to do that which is good for binding.

Actionscript sprintf

Filed under: cool, dev, education, tip, tool — michaelangela @ 5:39 pm

I like python and the ability to do variable substitutions. In AS3 you have to do… well see the example below. Alas, this is for AS2, not AS3.

sprintf : Downloads : Nate Cook

Formatted strings are a real convenience—one that is sorely missing
from the Flash Actionscript library. This adds in the sprintf
functionality, which lets you reduce something like this:

var m,d;var myDate = new Date();

m = myDate.getMonth() + 1;if (m < 10)    m = '0' + m;

d = myDate.getDate();if (d < 10)    d = '0' + d;

trace(m + '-' + d + '-' + myDate.getFullYear());// traces out: 02-14-2004

into basically a single line of code:

var myDate = new Date();
Sprintf.trace('%02d-%02d-%4d',myDate.getMonth() + 1, myDate.getDate(),myDate.getFullYear()));// traces out: 02-14-2004

Ah! But! Someone did kindly make an AS3 version.

Sprintf for AS3?

AS2 and AS3 are similar, but incompatible. You’d have to spend some time tweaking the AS2 version you have to get it to compile in AS3, so just try Manish’s AS3 version instead: http://tasmania.globat.com/~mannu.info/flex/sprintf.as

But… the link is dead… there is mention of an ASToolBox on the web but I don’t know which version that works with. Ah… hmm… just a sec… nope… dead links… how about this? Bingo. OK so there it is.

But another one also turned up in the search for “actionscript 3 printf”. This could be very useful!

printf-as3 – Google Code

Inspired by python’s print and strtime.

This is really a simple project. Inside the rep, souce, docs and examples.

Some basic usage:

import br.com.stimuli.string.printf;// objects are substitued in the other they appear

printf("This is an %s lybrary for creating %s", "Actioscript 3.0", "strings");// outputs: "This is an Actioscript 3.0 lybrary for creating strings";// you can also format numbers:

printf("You can also display numbers like PI: %f, and format them to a fixed precision, such as PI with 3 decimal places %.3f", Math.PI, Math.PI);// outputs: " You can also display numbers like PI: 3.141592653589793, and format them to a fixed precision, such as PI with 3 decimal places 3.142"// Instead of positional (the order of arguments to print f, you can also use propertie of an object):var userInfo : Object = {"name": "Arthur Debert","email": "arthur@stimuli.com.br","website":"http://www.stimuli.com.br/","ocupation": "developer"}

printf("My name is %(name)s and I am a %(ocupation)s. You can read more on my personal %(website)s, or reach me through my %(email)s", userInfo);// outputs: "My name is Arthur Debert and I am a developer. You can read more on my personal http://www.stimuli.com.br/, or reach me through my arthur@stimuli.com.br"// you can also use date parts:var date : Date = new Date();printf("Today is %d/%m/%Y", date, date, date)

For a full list of available formaters see : http://stimuli.com.br:8080/media/projects/printf-as3/docs/printf/as/package-detail.html

Bracketeer and working with images with bright brights and dark darks

Filed under: cool, photography, tip, tool — michaelangela @ 4:46 pm

Just a note. Helps when working with images that have really bright and dark areas. Check out some examples.

Bracketeer: Exposure Processing Software

Bracketeer is a front-end GUI for Enfuse.
Enfuse is a command-line freeware utility which uses multiple exposures
of a scene (bracketed exposures) and merges them together to form a
uniformly lit scene. It is similar to tonemapping with an HDR image
except that no HDR image is ever created, and there is no ghosting. It
works with any kind of bracketed image set, not just panoramic
equirectangular images. Bracketeer can even auto-align hand-held shots!
The results are almost always much better than anything that can be
achieved with Photoshop’s HDR Tone Mapping.

Universal Mind Cairngorm Extensions

Filed under: cairngorm, cool, dev, education, flex, mvc — michaelangela @ 4:18 pm

There are several issues I have had when developing with Cairngorm. It gets better with time as you work around the issues, but you have to “work around them”, as opposed to working within the system constraints. The constraints are good. They give form and function. But there are some headaches… certainly no offense to the Cairngorm developers as it is a phenomenal piece when you think about what went into it.

Well, others agree that there is room for improvement. And this bit from Universal Mind may help with a lot of those things. Good stuff coming.

flexcairngorm – Google Code

Universal Mind has extended the
“classic” Adobe 2.2.x Cairngorm version to provide many productivity
and maintenance enhancements. Those extensions have now been
open-sourced – with BSD licensing – to the Flex and Flash developer
community.

The Cairngorm Extensions are summarized below. Each link will provide details and examples of the specific extension:

  1. Events
    • Built-in support to transport responders for direct view or business logic callbacks.
    • Implementation of AnnounceFaultEvent to allow business logic to centralize error reporting and logging.
    • Implementation of EventGenerator to allow developers to automate dispatching of sequences of events.
    • Events now should self-dispatch… for direct deliver to the business/controller layer.

2) View Notification

  • Built-in framework support to allow views to request direct notifications when buisness events respond.

3) FrontControllers

  • SubControllers are available so modules implemented with
    sub-MVC and dynamically aggregated and used within a global MVC
    framework.
  • Improved error checking
  • Ability to easily register a Function callback for any business event

4) Command Implementation

  • Base class implementation
  • Enhancements to support aggregation of event-business logic within a single Command class.
  • Support for the optional view notifications
  • Best practice to deprecate Command sequencing

5) Delegate Implementation

  • Base class implementation
  • Support for easy queue of delegate calls
  • Improved support for WebService use and WSDL errors
  • Best practice to allow easy data transformations
  • Best practice to hide multiple server calls

6) ServiceLocator

  • Configure services (RDS) at runtime
  • Configure timeouts of HTTPService and WebService

Theme: Silver is the New Black. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 28 other followers