Names are Hard

Wednesday, May 12, 2010

Clear improperly cached compile errors in FlexBuilder

If FlexBuilder is giving you a compile error that shouldn't be happening, and nothing you do seems to make it go away, it's possible FB is failing to clear its cache. Try going to:

workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\<project>\

and deleting the .markers file. Restart FB and do a clean build.

Explanation after the break.

Thursday, March 25, 2010

Event testing helper for FlexUnit 4

I noticed a little while ago that assertions made in event handlers don’t work the way you’d expect in FlexUnit.  It looks like the event dispatcher wraps its calls to event handlers with a try/catch block and treats any errors it receives as unhandled (showing the exception dialog if you have the debug player installed, ignoring it otherwise).  This means if you have an assertion fail in an event handler it will not cause the test to fail.

Tuesday, February 16, 2010

Importing external scripts in same directory in Applescript

I started dabbling in Applescript the other day and rather quickly ran into an annoying limitation. Applescript has a mechanism for loading external scripts, but it requires absolute paths. I like keeping my code portable, and that means absolute paths aren't allowed. After some experimenting and digging around online I finally managed to find a solution.

Thursday, February 11, 2010

Asynchronous unit tests in FlexUnit 4

FlexUnit looks like a fairly decent Flex unit testing framework and we've started using it in our new Flex project. Unfortunately FlexUnit has pretty much zero documentation, so unless you can find a blog post from someone about how to do something you'll have to just figure it out from scratch.

My coworker and I end up having to dig into the FlexUnit code occasionally to figure out how things work. The latest instance of this for me was to try and figure out how to test asynchronous events. I found a couple posts showing that it was possible with basic examples, but no real explanation of the different options.

I've managed to get a few different types of async tests working, so I figured I'd give examples of the different async methods provided by the Async FlexUnit class.

Thursday, February 4, 2010

Shortcut for enabling/disabling wireless device (or any device)

Most laptops these days have a switch or button to toggle the wireless device.  Turning off wireless is a good way to save battery, and having a shortcut to turn it off is nice.  The switch on the previous laptop I had would completely turn off the device.  However, the new laptops we got at work seem to only turn off the antennae.  Power-wise this is fine, but Windows continually opens one of the bubble notifications to tell me that the wireless isn't connected.

Nothing is broken, but it started getting really annoying to have to dismiss that notification a couple times an hour.  Extra annoying is the fact that Windows provides a checkbox that looks like it should turn that behavior off, but even with that unchecked it still bugs me.

Friday, January 29, 2010

Open Cygwin/Powershell Here directory context menu entrys

For years one of the first things I installed on new windows machines was the Open Command Window Here powertoy. I'm not much of a fan of cmd and generally use cygwin for my command-line stuff, but the ability to quickly open a terminal at a particular directory was very useful.

Lately I've started to use powershell in place of cmd wherever I could. I still don't like it nearly as much as I do cygwin (probably mainly due to familiarity), but it's a lot better than cmd. I also use it in cases where cygwin doesn't play nice with windows command-line apps.

Saturday, January 23, 2010

SortedQueue in Ruby

I've started working on the solver class for my ES project. I'm essentially implementing Dijkstra's algorithm where the graph nodes are the different board states and the edges are the turns. It's a little different as I'm generating the graph while traversing it instead of starting with a known graph.

One of the data structures required for implementing Dijkstra's algo is a priority queue. A strict priority queue won't quite work for me, as that requires numeric values for the priority, which I don't have. Instead I've defined a compare function for my nodes and want the queue to simply be sorted based on that.