Posts

Write More Declaritive JUnit Assertions with Hamcrest

The Hamcrest framework is a generic "matching" framework that JUnit added direct support for with version 4.4. Hamcrest allows developers to write more declarative assertions by using both built in matchers, as well as a clean way to define your own matchers. The online documentation on Hamcrest is mostly limited to some API docs, test cases, and a brief online tutorial . However the API is fairly intuitive for basic checks. One area that was intersting to me was the collection portion of the API. Hamcrest allows you to perform some assertions on collections to check for the existence of an item in the collection, but all the examples I saw were based on simple collections of items that implemented "equals" (Strings, primitives, etc). However, I wanted to find a way to validate more complex objects that may not have implemented equals. After some experimentation, I found I nice way to do what I was trying do. Basically, the collection matchers allow for embed...

Don't Package on Every Single Compile, Flex Compiler!!

One of the problems I have with Adobe's Flex technology is that Flex compile times are very slow. Yes, I know, Gumbo is going to make compiles somewhat faster. I also know about the Flex Compiler Shell, and other projects to distribute compilation. Yes, I've also tried incremental compilation. All of these things really miss the true problem with the Flex compiler. And it is really at the heart of the Flash technology itself. The problem really lies in granularity of a compilation unit that Flash and the Flex compiler produce. Basically the output of a compile is a SWC or SWF which is fully ready to be deployed. I think the scope of compilation unit that the compiler uses is way too big. The Flex compiler should be producing an intermediate level compilation unit tied to the source file level, or at least some smaller scope. I'm just a dumb Java guy, but SWCs and SWFs look a lot like JAR files to me. They include all the bytecode and embedded resources needed for ...

Pandora Desktop Hotkeys Enhanced

I noted an issue with my original Pandora Desktop Hotkey script in that the embedded Flash control in the Pandora Desktop app sometimes has a different "control" name. This change in name would _sometimes_ make the script unable to send keys to the control. Here's an updated script that tries to work around this issue by simply sending keys to either of the possible names for that embedded control. Enjoy! DetectHiddenWindows, On ; Pandora Controls ;Ctrl-Win-Alt-Right Arrow ^#!Right:: IfWinExist, ahk_class ApolloRuntimeContentWindow ControlSend, WebPluginView1, {RIGHT} ; Next ControlSend, WebPluginView2, {RIGHT} ; Next return ;Ctrl-Win-Alt-Up Arrow ^#!Up:: IfWinExist, ahk_class ApolloRuntimeContentWindow ControlSend, WebPluginView1, {UP} ; Volume Up ControlSend, WebPluginView2, {UP} ; Volume Up return ;Ctrl-Win-Alt-Shift-Up Arrow ^#!+Up:: IfWinExist, ahk_class ApolloRuntimeContentWindow ControlSend, WebPluginView1, {SHIFT}{UP} ; Volume Max ControlSend, WebPluginView2, ...

Completely Unscientific Test of Chrome 2.0 Beta with Bubblemark

So, I had to rush out and get the Google Chrome 2.0 Beta and try it out. I was already running Chrome 1.0, but the install for Chrome 2.0 installed with no hitch, asked me to restart the browser, and then I see that all my settings/bookmarks migrated forward with no problems. After playing around with some the new features I had to find out how Chrome's DHTML Rendering performance stood up to Flash/Silverlight/JavaFX. Bubblemark is a standard benchmark for comparing these different technologies. It simply tries to render a certain number of images (or vectors in some cases) and animate them. I fired it up and collected some numbers. Here are the results of my _totally_ unscientific test: Browser + Tech Bubble Count FPS Silverlight 2.0 (CLR) on Chrome 2.0 16 283 128 44 Flash (Flex) with cacheAsBitmap on Chrome 2.0 16 115 128 46 Java (Swing, optimized) on Chrome 2.0 16 200.0 128 199.7 Java (LWJGL) on Chrome 2.0 16 1435 128 658 JavaFX 1.0 (at Osvaldo Doederlein blog) on Ch...

Official Pandora Desktop and Hotkey Support?

EDIT: There is a slight problem occasionally with this script not being able to send keys to the Pandora Desktop Air app. I've got an updated version of the script that you can use instead of this one. Pandora is a different sort of online music service that uses the work of the Music Genome Project to automatically selects music similar to an artist or particular song, and then streams it over the Internet for your listening pleasure. You can't select individual songs, but you can skip ones you don't like and make as many music channels as you like to suit your particular tastes. Pandora provides a free version of the product that is supported by visual advertising, and a very inexpensive ($36 USD per year as of the creation of this entry) subscription supported version of the product that provides higher quality streams and no advertising. Traditionally, Pandora has been a Flash-based application that required you to have your bulky browser open to listen on the deskto...

Custom Foil Hats

Image
My oldest son wants to announce the launch of online sales of his newest product, Foil Hats. These hats are certified to protect your thoughts from prying government spooks, and brainwave stealing aliens. These hats are custom made to your measurements (up to US hat size 8), for just $3.99 (US). Simply comment on this blog entry, and we can coordinate payment/shipment over more secure channels.

Rollback DB Changes in Unit Tests with Spring

Observation 1: Applications are written human beings, which tend to make mistakes. It's a good idea to have some tools in place to help catch those mistakes early by validating assumptions against reality. One such tool is unit testing. Observation 2: Almost every application out there needs access to some kind of persistent data storage. In a lot of application code, that storage mechanism is some kind of relational database. It is easy to understand, based on the situations described above, that unit testing tools should take into account handling initializing persistent storage systems properly for testing. Thankfully, JUnit has some extensions to make unit testing with a particular set of data in the relational DB easier. DBUnit provides a way to represent test relational data in an XML form that is human readable, and can be loaded into most any JDBC data source. DBUnit's strategy is to reset the database to a known good base state before each unit test runs. I...