Thursday, August 5, 2010

Using Google Chrome as an external browser in Eclipse on Mac

I like Google Chrome a lot, so I'd like to use it as my default browser in Eclipse. So I do what I'm supposed to do:

  1. Eclipse->Preferences->General->Web Browser

  2. Select "Use external Web browser"

  3. Select "New..."

  4. Name = "Chrome"

  5. Location = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome

  6. Parameters = "%URL%"

But that doesn't work for some reason - not really sure why. To get it to work I had to use a shell script:

open -a '/Applications/Google Chrome.app' $1 &

and use that as my executable.

Wednesday, April 21, 2010

Flex Lesson Learned #1: Preventing mouseOver flash

Say you've got this situation:
  • A complex Flex component you want to act as a button
  • Too complex to implement as a button with skins
  • MouseOver/Out behavior involves redrawing/resizing parts of the component
I was working on something like this, and couldn't get rid of multiple rapid mouseOver and mouseOut events when mousing over the component. Eventually I found what looks like a pretty good solution.

Make the top-level subcomponent (in z-order) of the component a button component with alpha of 0. Make it cover the precise bounding box you want to be sensitive to mouse events. (It may be possible to mask the button to achieve non-rectangular mouse regions, but I haven't tried this.) Put the mouse event listeners on the button only, not the whole component. Then making the component mouseEnabled="true", mouseChildren="true", and making other subcomponents mouseEnabled="false" will cause the button subcomponent to catch all the mouseEvents, without the underlying redraws affecting it.

Wednesday, March 10, 2010

Code Aesthetics

Good code is pretty code. Ugly code is broken, and should be fixed.

Monday, February 1, 2010

Unit Testing Quiz Part I

Here's a question anyone should be able to answer if they're to be considered proficient at unit testing:

Your client asks you to unit test the serialization/deserialization code for a data model class written by their in-house developers. Since the implementation of the class is sensitive information, you are expected to work without either source code or a description of the serialized form of the model. All you know is the public API of the model: properties and methods, contracts and invariants. The client assures you that the serialized models will only be used by the given code, and do not need to be readable by any other application or implementation. If the class has the methods serialize() and deserialize(), for serializing and deserializing the model respectively, describe how you would write unit tests to test these two functions despite the given constraints.


If I remember I'll post the answer later.

Tuesday, January 12, 2010

Singletonitis

Proposition A: proper OO design exploits polymorphism.

Proposition B: singletons inhibit polymorphism.

A & B imply Proposition C: proper OO design excludes singletons (in most cases).

Friday, December 18, 2009

Tree Etiquette

Dear Developers (I'm looking at you, Eclipse!),

When you have an expandable tree UI, always remember to include a "collapse all" button. Thanks!

Love and Kisses,
Phil

Tuesday, November 10, 2009

D'oh!

Always remember - if you update your path in Windows, you have to restart Eclipse before Eclipse Ant will see the change. ARGH! This cost me 2 hours!