« July 2006 | Main | September 2006 »

August 31, 2006

Fail Fast in Eclipse?

Is there a way to make Eclipse abort the build process as soon as the first compilation bug occurs? I've been working with Flex Builder 2 for some time and one of the things that bugs me is that if a base project has an error, Eclipse still tries to compile all of the other projects which depend on it. While sometimes this helps show all of the possible errors that might appear, more often then not, I don't want to waste the time waiting for the failed build to finish. This has become especially true since adding some external Ant tasks to handle other build features that Eclipse isn't doing out of the box. I've been over the preferences but didn't see anything that made sense so if you happen to know, please pass along this nugget. Keep in mind I'm running Eclipse 3.1.2 and can't upgrade to 3.2.

Tags: eclipse programming

August 18, 2006

CSS and Runtime Modules

Another strange problem has popped up with the use of runtime modules. CSS type selectors don't work correctly. The compiler optimizes the CSS such that it only includes information for types that are actually used, based on the class dependency hierarchy. Since with a runtime module you are indirectly using classes, the dependency isn't found and the CSS information is excluded. Consider the following type selector:

SampleClass {
    backgroundColor: #FFFFFF;
    backgroundAlpha: .5;
    borderColor: #000000;
    borderThickness: 2;
    borderStyle: solid;
    paddingTop: 4;
    paddingBottom: 4;
    paddingLeft: 4;
    paddingRight: 4;
}

If you don't have a dependency on SampleClass in the main application you will end up with the following compiler warning:

"The type selector 'SampleClass' was not processed, because the type was not used in the application."

Right now I don't have a good solution for this. The simple work around is to not use a type selector but instead just make it a style selector (i.e. .sampleClass instead of SampleClass), but that requires you to set the styleName attribute on every instance you create. I'm open to other ideas.

Update
There are a couple of compiler options that help with this issue. If you are getting the warnings and don't care about them you can turn them off like this:

-show-unused-type-selector-warnings=false

This can be either a command line parameter, stuffed into a flex-config.xml file, or setup as an additional compiler argument in Flex Builder. If instead you want to include every CSS type selector, without having to do the static reference nonsense, you can do this:

-keep-all-type-selectors=true

Again that can be setup as either a command line parameter, part of a config, or enabled in Flex Builder. For additional information on the two options see LiveDocs.

Tags: css flex

August 16, 2006

Binding Warning

While working on an AS3 class today I had the following message appear in the debug console:

warning: unconverted Bindable metadata in class 'com.example::SampleData'

Everything still seemed to work correctly, but the fact that the message was getting reported concerned me. Unfortunately, this message doesn't appear in the run-time error documentation, which makes some sense since there was no error number associated with the problem and it just a warning. Doing a little more digging I found that the message is coming from the class mx.binding.BindabilityInfo.as. Thank you Adobe for including sources with the framework!

It seems that when the binding is being resolved the class metadata is bad. In this case the metadata was:

<metadata name="Bindable"/>
<metadata name="Bindable">
<arg key="event" value="propertyChange"/>
</metadata>

The message results from the fact that the first Bindable metadata entry doesn't include an event name. The more important thing was what was causing the event not to exist? Turns out it was a combination of the ordering of my get/set methods and the fact that I was casting my object as an Object instead of as SampleData. A little code will help explain what was going on. First this is the simple application that uses the SampleData instance.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:example="com.example.*">
<mx:Script>
<![CDATA[
import com.example.SampleData;
[Bindable]
private var _data:Object = new SampleData();
]]>
</mx:Script>
<mx:Label text="{_data.data}"/>
<mx:TextInput id="textInput"/>
<mx:Binding source="textInput.text" destination="_data.data"/>
</mx:Application>

The reason that _data is cast as an object is that in real code (unlike this simplified example) any one of a number of different types of objects could be fed in as the data to use. Next up is the implementation of SampleData that generates the "unconverted Bindable" error from above.

package com.example {
public class SampleData {
private var _data:Object;
[Bindable]
public function get data():Object {
return _data;
}
public function set data(data:Object):void {
_data = data;
}
}
}

This is where I get really confused about what the compiler and runtime are doing under the scenes. I've not looked at the "-keep" output to see if there is a good explanation. For the time being there are two solutions to the problem. The first one is to switch the order of the getter and setter in SampleData. The following change fixes the Bindable metadata and as such the error goes away:

package com.example {
public class SampleData {
private var _data:Object;
[Bindable]
public function set data(data:Object):void {
_data = data;
}
public function get data():Object {
return _data;
}

}
}

Subtle isn't it :) The [Bindable] documentation shows an example of the setter before the getter, it doesn't seem to emphasize that it can make a difference, which is why I suspect something else funky maybe going on. The other fix is to use more a strongly typed object reference. Using the SampleData class from above with the get before the set, this modified application will also cause the warning to disappear.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:example="com.example.*">
<mx:Script>
<![CDATA[
import com.example.SampleData;

[Bindable]
private var _data:SampleData = new SampleData();
]]>
</mx:Script>
<mx:Label text="{_data.data}"/>
<mx:TextInput id="textInput"/>
<mx:Binding source="textInput.text" destination="_data.data"/>
</mx:Application>

Again nice and subtle. If anyone has thoughts on why the order of the getter and setter might contribute to this warning, I'd love to hear them.

Tags: actionscript3 as3 bindable flex warning

August 15, 2006

Well Now

Atheists identified as America’s most distrusted minority, according to new U of M study. To quote:

Atheists are also the minority group most Americans are least willing to allow their children to marry.

That might help explain a few things :)

Tags: atheist links religion

August 14, 2006

Stuffed, Drunk, and Happy

Tonight I had dinner at Aura which is the restaurant in the Seaport Hotel. It was the first of what I hope to be many enjoyable Boston Restaurant Week experiences. Unlike my last attempt.

One of the best parts of tonight, which contributed highly to the drunk part was they offered a wine pairing with each course for a reasonable additional fee. Not only did I get a great appetizer, main course, and dessert, I also got to have three very nice wines. I picked my courses to have a wide variety which was great since it provided great contrast. The meal started off with bread and sauces.

The appetizer was the Nesenkeag farm greens with lemon-basil vinaigrette, julienne cucumbers, and baby tomatoes paired with a 2003 Sauvignon Blanc, Chateau Ste. Michelle, ‘Horse Heaven’, Washington. Nothing too special about this course. The wine was very good but nothing in the dish stood out in my mind to really bring out the flavors of the wine.

For the main source I had Grilled beef tenderloin and chipotle glazed short rib with a Vidalia onion and new potato hash paired with 2002 Cabernet Sauvignon, Villa Mt. Eden 'Tall Trees', Napa, California. By far the best part of the meal. The tenderloin was a perfect medium rare and brought out the woody flavor in the wine. The short rib was also good but I think I would have been happy with just more of the tenderloin.

Lastly for dessert I got the Ricotta Crème Brulee with Honey thyme marinated raspberries and pecan sable cookie paired with Muscat Canelli, Icewine, Bonny Doon, Santa Cruz, California. The wine was very sweet, but not overpowering, and reminded me of pears. I didn't eat that much of the brulee as I was mostly full at this point. The raspberries were very yummy though.

Overall a wonderful meal and excellent service. As a side note the restaurant also validates parking which was an added bonus!

Tags: food

August 13, 2006

SpamAssassin

I finally got around to upgrading the version of SpamAssassin that I use. I was previously running 3.0.2 and am now running 3.1.4 I also spent a bunch of time installing a optional Perl modules to enable additional features of SpamAssassin. Boy am I glad that I did. Prior to upgrading I'd say at least 20 spams were getting through a day. In the last 24 hours I've only see one spam that didn't get flagged and it was as close as you can get to not being considered spam.

This makes me happy. I've never been that good with email to begin with but having to spend most of my email time filtering through my inbox only made matters worse. The few times that I've checked email since upgrading I've almost not known what to do. It's sad, but spam in my email has become so common I've almost forgot what it's like. This is a good problem to have to readjust to.

I do have to say that the documentation that I've come across so far for SpamAssassin has been pretty disorganized. I find this really odd since it seems to be under the Apache Software Foundation, which having used many of their other projects, I've usually been happy with the documentation. I suspect that the SpamAssassin wiki holds the knowledge I'm seeking but damned if I can find it. In any case, less spam is good and AFAIK no false-positives.

Tags: spam

August 6, 2006

The Devil in the White City

I've recently finished devouring The Devil in the White City by Erik Larson. It has been awhile since I've found a book so riveting that I had trouble putting it down. I actually had a couple fits of insomnia this past week because of the heat and thankfully this book was there to pass the hours. Or maybe it was the other way around, I want to read so I feinted insomnia? In any case the book is mesmerizing and extremely well written. Unlike A Million Little Pieces the author's note at the beginning sets the tone "However strange or macabre some of the following incidents may seem, this is not a work of fiction" (emphasis his) [xi].

The story follows two men and is set around the 1893 World's Fair that was held in Chicago. The first man is the architect behind the World's Fair. The second is a gruesome serial killer who played upon people coming to see the World's Fair. The city of Chicago itself also takes center stage throughout the book with the author's vivid descriptions and auxiliary people that are tied into the two main men.

To read about a city trying to assert itself and America through the fair then be stricken along with the rest of the country as the economy took a downturn only makes the success that the fair achieved even more phenomenal. That success would not have been possible without the men and women behind the fair all of which are captured in the book. Likewise the cunning dastardly deeds of the killer provide a somber backdrop to the excitement of the fair. A truly remarkable, approachable, educational, and entertaining book.

Tags: books

August 1, 2006

News Diet

It has turned out for the past few months I've been on a news diet. The intensity of this diet has varied over that time but I in the past couple of weeks it has been full on. One of the primary triggers of this was switching to a new job. While in the past that has not triggered such a change, the fact that I now ride my bike to work was the primary catalyst. The reason being that I read most if not all of my news while waiting and riding on public transportation. Now that I'm no longer taking public transportation, those guaranteed chunks of time are not there.

As a result I've just not been following the news. I'm not sure why my interest in the world has waned, particularly with everything that other people tell me is going on. I think what I find most interesting is that I can't really place my finger on what has taken the place of that time I used to spend reading the news.

Tags: life news