Thursday, May 17, 2012

IntelliJ syntax highlighting tip for Javascript

IntelliJ IDEA 10's default highlighting of an unknown variable/symbol is annoyingly non intrusive. It took a while to find, but the setting to change it is "Weak Warning" under Editor: Colors & Fonts: General. I find IntelliJ's scoping/variable finding (what do you call that?) to be excellent, so why an unknown symbol is only a Weak Warning is a little confusing, but here you have it.

Thursday, January 14, 2010

Upgrading to FlexUnit 4 for larger projects using FlexUnit .9

FlexUnit 4 is a much more powerful solution to unittesting in Flex than flexunit .9 was, but the documentation is a little sparse for right now. I've found over an over again the promise that it's backwards compatible with .9, and only one place that showed an example. Unfortunately, the code in that solution doesn't really work for larger projects that have many test classes. It took me a minute to realize that FlexUnit 4 doesn't need to be told specifically how to run a given test case, it will take a look at it and try to guess whats needed. The solution, then, because quite simple. Build a Suite like so:

// Metadata tells FlexUnit4 that this is a Suite and
// specifies a runner
to use with it
[Suite]
[RunWith("org.flexunit.runners.Suite")]
public class FlexUnit4TestSuite
{
//simply make public variables inside the suite
//with the test cases or suites that you want
//run.
public var baseMediatorTest:BaseMediatorTest;
// ...
}
Then you pass this suite into the test runner like so:

public function onCreationComplete(evt:Event):void
{
core = new FlexUnitCore();
core.addListener(new UIListener(uiListener));
core.addListener(new CIListener(1028, "localhost"));
core.run( FlexUnit4TestSuite )
}

Much more maintainable.

Friday, May 29, 2009

Google finally revived collaborative note taking

Yes!! It took longer than it rightly should have, but Google has finally re-enabled the world to do collaborative note taking, my hands down favorite part of my early PyCons. See this for example. I miss SubEthaEdit all the time. I hope that the SubEthaEdit guys aren't forgotten, now that Google's picked up the collaborative editing torch.

This is a very, very powerful, useful tool. Thanks Google!

Wednesday, April 29, 2009

Soda.. or Airline?

I knew it! Pepsi changed their logo last year, and when they did it, they put up all these crazy viral ads (for lack of a better term), that just had the logo a couple times in random words. One had like two or three on one bill board. I'm a little behind the times, not having TV, nor really being a soda drinker (Coke, when I do, thankyou), and I was trying to figure out why in the world any airline would advertise like this. I spent a good week wondering which airline it was.. Northwest? A new American Air logo? Finally, I see a new Pepsi can. Oooh, it's for Pepsi. That's the worst soda logo I've ever seen in my life. Here's an excellent breakdown, and they agree with me, it looks like an airline logo. Ahh, satisfaction.

Tuesday, January 20, 2009

Obama == Hope?


Stumbled across this.. on Flickr, a related tag to "Obama" is "hope".

Tuesday, August 26, 2008

PureMVC Gotcha

Don't send notifications that you're expecting a response to in your mediator's constructor (or during construction). Instead, override the onRegister() function and call them there. Your Mediator won't receive notifications it's interested in until after the registration process is finished. Seems pretty obvious, but you can loose track real quick of what's going on in the background when you're using a system like PureMVC that just seems to work.

Thursday, August 21, 2008

Crazy Flex DateField Insanity

So, I've been busily putting together a Flex application at work, and we ran into a curious issue where Flash would infinitely loop and crash itself/the browser. (Not tested in Air) To give a little background first, we're following the convention of keeping our data in data objects (or data models), and binding both the visual component to the data model field and the data model field back to the visual component. All of our code is dynamic, so it's written in Actionscript, not MXML.
The problem occurred when we had two DateField interface components pointing to the same data model field. The two DateFields would be hooked up to a single data model field, and we saw the following behavior:
  • If we bound the DateField.selectedDate to the model.birthday (as an example), with one DateField Instance, all would work. Underneath, it set off the bindings twice when you changed the selectedDate, but that was OK. With multiple DateField Instances, it would crash as it tried to create the second DateField. (This happened when we preinitialized the DateField and without preinitializing the DateField) Underneath, it would set off the bindings between the three items infinitely.
  • If we bound the DateField.data to the model.birthday, it would never infinitely loop, but model.birthday wouldn't get updated when DateField was changed. I think that the code for DateField.data is screwy, but according to the documentation, it seems like this is the property you should bind to.
  • If I tried binding the DateField.data to the model.birthday and the model.birthday to the DateField.selectedDate, it would also loop infinitely.
Finally, I created a ChangeWatcher on the DateField for when the selectedDate changed. On change, it would call a function that checked to see if DateField.data == DateField.selectedDate, and if not, it set DateField.data = DateField.selectedDate. At first, this didn't work quite right, but I changed it to check the DateField.data.time, which is just the number of seconds since Epoch, and that magically worked.

My theory is that Date comparisons are broken or behave oddly, and if you just compare Date.time, it works as expected. I'm assuming this is why the binding went forever, but I can't be sure.

Hope this helps someone else.. some also possibly helpful links:
http://devel.teratechnologies.net/steve_examples/Flex_BindingProblem/DateTest.html
http://bugs.adobe.com/jira/browse/SDK-15618