critical, uh – blog…entries

Hot and fresh: Langeberg Consulting has been in business since July 2009. Come on over to http://scottlangeberg.com, and check us (well, me) out. I’ve moved all posts to the new site, and any future Flex, AIR, AS3, interactive – related posts will go into the new site. Thanks to those who’ve contributed to this site, and perhaps I’ll see you around, at the new digs.

I forget how to do this every few months, so here’s a reminder – when merging changes from /trunk to the branch you’re working in:

PS: If there’s a lot of work going on in trunk… Merge often!

In eclipse, your working copy is pointed to the branch in question.

Team > Merge

From:
URL to the trunk
Revision: This is the revision # where you last branched/merged (good reason to make notes in SVN log).

To:
Use “From:” URL
Merge to HEAD revision

Hit Merge

Now you should be able to use Eclipse to resolve conflicts at will.

This helpful tidbit shed some light for me:

First of all, “From:” and “To:” do /not/ refer to source and target of
the merge-operation. The target of the merge-operation is /always/ your
current working-copy.
“From:” and “To:” refer to the first and the last revision to be used
during the merge-operation (or: to be considered by the merge-algorithm).
Please note that the last sentence is not really precise at all, for you
should check chapter 4 of the SVN-book
(http://svnbook.red-bean.com/en/1.4/svn.branchmerge.html) for more info.

src: http://www.nabble.com/Merging-to-branch-from-old-branch-trunk–td15459849.html

Thanks to Danny, Dustin and the MN.swf group for the chance to present at today’s camp.

Here’s the files from my presentation on Flex build automation with ANT + Fluint:

mnswf-camp-09-flex-build-and-testing-automation

mnswf-automation project

Note: Running the automated fluint ant task will require installation of the fluint AIR testrunner, located in my project’s /lib directory, or from the fluint downloads:

http://fluint.googlecode.com

If you’ve ever tried compiling a Flex app of any size, using the ANT task from within Eclipse / FlexBuilder, you will eventually encounter this lovely message (Mac only?):

[mxmlc] Error: Java heap space
[mxmlc] java.lang.OutOfMemoryError: Java heap space
[mxmlc] at java.lang.AbstractStringBuilder.(AbstractStringBuilder.java:44)
[mxmlc] at java.lang.StringBuffer.(StringBuffer.java:104)
[mxmlc] at macromedia.asc.parser.InputBuffer.clearUnusedBuffers(InputBuffer.java:823)
[mxmlc] at macromedia.asc.parser.Scanner.clearUnusedBuffers(Scanner.java:10546)
[mxmlc] at macromedia.asc.parser.Parser.clearUnusedBuffers(Parser.java:7898)
[mxmlc] at macromedia.asc.parser.Parser.parseProgram(Parser.java:7871)
....

Thankfully, I stumbled on the solution today, when looking at the generic ANT task docs.:

<mxmlc file="${src}/${application}.mxml"
keep-generated-actionscript="${debug}"
incremental="true"
debug="${debug}"
compiler.optimize="true"
output="${bin}/${application}.swf"

fork="true" maxmemory="256m"
>

Of course, adjust maxmemory to fit your needs. However, 256MB was enough to get it to work, but I think it also worked at 128. I’ve got enough ram, that it’s not an issue. Also, the forked process should relinquish ram on completion. Right?

I had tried forking the process before, but must have assumed that since maxmemory is not listed as having a default value that it would grow to match needs. Sorry!

If you’re using a display with DVI and try to connect a hi-def game console you may get the dreaded floating grey window of death:

Input Not Supported

Be strong. The problem is neither your display or your game console. HDMI -> DVI works a treat. Unfortunately, your monitor is probably like mine and only supports a max resolution of 1680×1050. That’s ‘1050′, so no 1080i/p. Sucka!

I’m not sure about the PS3, but when I tried to reset my 360’s output per microsoft’s instructions, it did: Nothing. I’m guessing this only resets the analog output. However, taking heart from online chatter, I had a revelation:

- Plug the console into a device that supports 1080 resolution (my hidef bigboy).
- Enter the console’s settings and set the resolution to 720p.
- Connect to monitor.
- NO MORE FLOATING DEATH MESSAGE.
- Now play my game.

Don’t have one? Find someone who do, or a better solution!

Related monitors / comments:

Acer AL1916w
When I use the DVI port on the monitor, it displays a little box saying ‘input not supported’

Acer AL2216W
I’m about to get a xbox 360 (with the HDMI port), and am trying to find out whether it’ll be able to … What do u mean input not supported

No signal. Input not supported

I have been starting to use WOW, the AS3 3D physics engine.

Things are going fine with their v1 code, but their does not appear to be any compiled ASDocs, so I have put together my own:

Wow engine ASDocs

Using following ANT build script:

Wow engine ANT build file

Cheers!

Ted Naleid just gave me some handy info regarding command locations in *nix, which I’m sure I’ll want to reference again ;)

“whereis” is a little different than the “which” command. “whereis” looks in “standard” places for executables, places that are set up by default (i.e. not macports). “which” actually checks your currently active “PATH” for the first thing matching the string, so you know which item will actually get executed. I find “which” much more useful than “whereis”.

There’s also a “where” command that shows all locations in your path of an executable (in order of where they are in your path).

pollux% which svn
/opt/local/bin/svn

pollux% whereis svn
/usr/bin/svn

pollux% where svn
/opt/local/bin/svn
/usr/bin/svn

The following is a re-print of Alex Uhlmann’s post. I’ve only ‘reprinted’ it here, as the weblogs.macromedia.com site appears to be broken.
Original article

September 28, 2006

Using Binding Securely

In my last post about the Cairngorm Dashboard example I’ve added a little functionality that allowed a view to react to a state change in the model in order to do something view related like invoking a popup or an effect.

I’ve been using the binding approach and that made it very easy and flexible to do. But as I said in my last post, this can have one slight drawback you have to consider. In this post I’ll showcase the drawback and provide a solution to it via an extended version of Paul’s Observe tag. Furthermore, this extended version of Observe makes it even easier to perform this kind of listening to the model.

Behind the scenes, binding uses flash.events.EventDispatcher. But binding gives you much more than just that. You can bind to properties even when their objects aren’t initialized yet. You can also bind to XML data using E4X to specifically listen to certain areas of the XML. For more information on the features of binding make sure you read the Chapter 37 in Part 5 of the Flex 2 Developer’s Guide.

There are multiple ways to use binding. All of them require a source that defines what property you want to listen to and a destination that defines what shall be triggered once your source changes.
You can either use the MXML curly braces syntax, function binding, the mx:Binding tag or define bindings in ActionScript.

Either way, you have to be careful in triggering application code in a destination of a binding, which we’ve done in previous examples of my Dashboard sample using either function binding to trigger a formatter or mx:Binding to invoke a view related method.
Since the Binding feature hides us from many exceptions that would have been thrown using EventDispatcher, it cannot differentiate in certain situations when certain; to us important, exceptions are thrown in our application code that is triggered in the destination. Let’s showcase this and throw one of these “certain” exceptions on purpose in our latest Cairngorm Dashboard sample. Let’s throw one that I’m sure you’ve have seen before: The one and famous:

ErrorID 1009: “Cannot access a property or method of a null object reference.”

Change the createChargedMessage setter to:

private function set createChargedMessage( value : Boolean ) : void
{
        var o1 : Object = {};
	o1.o2 = {};
	trace( "show o2 " + o1.o2 );
	o1.o2 = null;
	o1.o2.foo = "bar"; //oops, o2 doesn't exist, an exception should be thrown.
	trace( "show foo " + o1.o2.foo );
	if( value ) Alert.show( "Thanks! Your bank account has been charged" );
}

Since this code is triggered as a destination of the mx:Binding tag, the runtime exception that should appear on

o1.o2 = null;
o1.o2.foo = "bar";

is swallowed by the binding code in the Flex framework. You will not see the usually expected runtime exception displayed via the Flash Debug Player. Instead, the following code like the trace( "show foo " + o1.o2.foo ); will just not execute.

Note, that this will only happen with certain exceptions. It will only happen on the following exceptions:

  • Error #1006: Call attempted on an object that is not a function.
  • Error #1009: null has no properties.
  • Error #1010: undefined has no properties.
  • Error #1055: – has no properties.
  • Error #1069: Property – not found on – and there is no default value

For more information on these errors take a look at Run-Time Errors of Adobe Livedocs.

Note also, that this will only happen when your application code in the destination executes in the same ActionScript block. This means if your exception throwing code executes in a different frame (as would usually be the case on a custom effect) you will see a runtime exception as expected.

However, if your application code does throw one of the swallowed exceptions in the same ActionScript block, there are ways so you can see this immediately.

You could use a special debug class in the Flex framework to help you see the error message. Use
mx.binding.BindingManager.debugBinding( <your destination as a String&gt );

But in a production environment I’d recommend you use another more bullet-prove way of solving this problem. You can use the extended version of Paul’s Observe tag.

<ac:Observe
	source="{ stockTransaction.stockPurchase.isComplete }"
	handler="{ createChargedMessage }"/&gt

Using Observe you can invoke a method instead of the setter.

private function createChargedMessage( value : Boolean ) : void
{
	if( value ) Alert.show( "Thanks! Your bank account has been charged" );
}

Try putting the code from above that will throw a runtime exception into the createChargedMessage method. Observe will make sure that a runtime exception is being thrown as expected.
Internally, Observe wraps another global Error handler around your destination, saves the exception thrown and throws it in the next frame.

Furthermore this approach offers an additional feature for your convenience. If you want to listen to only a specific value of the source, you can use ObserveValue for this. In our use case of the iteration 6 Cairngorm Dashboard we just want to know when the isComplete property of our StockPurchase object is true.

<ac:ObserveValue
	id="observe"
	source="{ stockTransaction.stockPurchase.isComplete }"
	handler="{ createChargedMessage }"
	value="{ true }"/&gt
private function createChargedMessage() : void
{
	Alert.show( "Thanks! Your bank account has been charged" );
}

I’ve mentioned above that this also applies to function bindings. In StockMarketPod.mxml of the iteration 6 Cairngorm Dashboard sample application, I’ve used the provided Observe.execute method in order to ensure a secure use of our function binding, which tirggers a custom formatter.

<mx:Label text="{ observe.execute( statusFormatter.format, stockTransaction.status ) }"/>

You can download the Observe and ObserveValue utility classes from here.

Hope this helps!

Posted by auhlmann at September 28, 2006 11:58 AM

The old Macromedia weblogs (at least Alex Uhlman’s blog) seem to be down for the count. However, you can still access the Observe, Observer, ObserveValue tags.

You can download the Observe and ObserveValue utility classes from here.

src: http://weblogs.macromedia.com/auhlmann/archives/2006/09/using_binding_s.cfm#more

If you don’t know what they are, but are looking at using data binding to any measure, with MXML, they’re well worth your time to check out. ;)

Original author’s post is still up

NOTE:
I have posted Alex’s original article, myself – as i believe he has too much useful information here, for it to languish in the brokenNet:
Using Binding Securely

Here’s the files from my presentation on FB3, today.

Sorry that i wasn’t able to present all of my very well-researched quiz questions (thx Danny). ;)

using-fb3_mnswf-camp.zip