" /> UrlBlogGrey: September 2005 Archives

« August 2005 | Main | October 2005 »

September 24, 2005

The Beauty of "Red Stars Theory"

I recently stumbled upon an old favorite-band of mine called Red Stars Theory. I was absolutely addicted to the passionate, atmospheric, reverb-overload rock group in 2000. I had encoded their full-length self-titled album a few years ago and gradually forgot about them. It's weird how "stumbling" over digital audio files seems like a misuse of the phrase. Anyhow, they are an awesome band composed of members of Built to Spill and Modest Mouse. All of their music is incredible. Similar bands that I like are Godspeed You Black Emperor! and Bright Eyes.

September 14, 2005

Converting RealAudio content to the MP3 Format

I have a lot of RealAudio files containing recordings of my radio show while I was a DJ at KDVS in college. I've wanted to port them to a more portable format like MP3 for a long time. I came across a message board post a while back and was able to accomplish the task pretty easily. On my Mac OS X 10.3 laptop, I downloaded and built the Lame MP3 encoder, mplayer, and mencoder and was off to the races. Now I can listen to the streams in iTunes, yay!

September 11, 2005

Using Betwixt to Aid in Unit Testing

One problem I'm facing at work is the labor-intensive process of composing complex data structures for use in unit testing. Sure, I can consolidate a lot of the object contruction in the JUnit setup method; however, it still amounts to a lot of code and remains hard to visualize the overall object structure. So, I need a better way to compose my test data structures.

Enter Betwixt, a tool I'm looking to use in another problem domain for Java object (de)serialization. In this case, I can represent my test data structure content as an XML document and use Betwixt to populate the structures. Similarly, the end-result test data structures can be deserialized to XML and validated using a simple String comparison. If the structure changes or I want to alter the test data, I simply need to edit the XML document. This is easier to conceptualize and maintain. I now realize that the approach is very similar to how the dbunit tool uses XML document instances to set up databases before and after running unit tests.

September 10, 2005

Guitar-Face

Natalie enjoys pointing out the facial contortions of guitar player during live performances. She refers to it as a "guitar-face" and says that I even have a guitar-face when I'm playing at home. Hmm...

Well, I came upon a blog entry about a musician who uses facial recognition software to modify the sound of his guitar while playing. So, a guitar-face would actual be part of the performance and not just something to laugh at!

September 6, 2005

Translating Document Representations Using Betwixt & XSLT

One of my current tasks at work is to develop a mechanism for supporting our legacy transfer record (TR) formats while developing new XML-RPC web services. This is a bit of a challenge since the TR formats are composed of fixed-width strings (read: not XML). So, how can you map between non-XML and XML documents?

I stumbled upon an interesting project in the Jakarta Commons site called "Betwixt". Betwixt is designed to serialize and de-serialize JavaBean compliant objects to-and-from XML documents. This is all possible thanks to the magic that is "reflection". And because it's relying on reflection, Betwixt does not need to have any hints as to the structure of the JavaBeans.

So, I came up with the idea of using our existing TR parser/generator classes to represent the TR strings as JavaBeans, serialize their contents to XML, apply an XSLT template to transform the document structure into something compatible with the XML-RPC web service stubs, and then de-serialize the XSLT output into the stubs. The reverse applies, too. This sounds like a lot of work, but really it's not. I only need to write an XSLT to translate between the TR and XML-RPC stub structures. Betwixt handles the serialization and de-serialization operations on the JavaBeans in just a few lines of code. The alternative would be to have a Java class manually map between the two structures, which is error-prone and difficult to maintain.

I think that there is going to be a huge demand for these kinds of translation services in the future. In our case, we want to support a new XML-RPC interface while having the ability to route all legacy clients to the new interface without any TR interface changes. This is the beauty of code-by-interface programming.

September 3, 2005

Developing with the Spring Framework

I've been experimenting with the Spring Framework lately while developing a strictly-for-fun web application. I have been really frustrated with the invasiveness of the Struts Framework in past years. Fortunately, Spring has none of these flaws. It works on two core principles: Dependency Injection, and Aspect-Oriented Programming (AOP).

Dependency Injection has radically changed how I approach Object-Oriented Programming (OOP). It relies on classes defining what they want, and allowing the Spring Framework to give it to them. This is different from standard Java programming in that traditionally classes would concern themselves with both constructing and using their dependencies. With Spring, classes are concerned only with using their dependencies. Hence, their dependencies are "injected".

Spring handles Dependency Injection (DI) through XML descriptors that are loaded by the Spring Container at runtime. This provides a great way to alter the behavior of application processing classes simply by changing how their dependencies are built and assigned through the descriptor files. A key component of DI is the use of interfaces to describe the operations & data available to users of a component. If consumers of the component use DI and program to the component interface, the component implementation is open to change and substitution with little or no modification to the consumers.

I'm currently reading the "Spring in Action" book from Manning Press. It's a well-written overview of the Spring Framework, and is a great companion to the wonderful documentation included with the Spring distribution.

walls2_cover150.jpg

September 2, 2005

"The Village"

I just finished watching the movie "The Village" on DVD with Natalie. It's an amazing tale! I don't want to completely give it away, but the story-line is unbelievable. It reveals a lot about the power of human emotion, and how it's inseparable from pleasure and pain. The basis of the story is that of members of an isolated village who are afraid to venture into nearby woods because of the "evil" that lurks there and in neighboring towns. But the evil forces they seek to exclude are present in every member of their own village. Analogies can be drawn to our own nations, cultures, etc. After watching the movie, I felt stronger and less fearful of differences or adversity. I'll highly recommend the movie to anyone!

Camping in Big Sur

Last weekend, Natalie and I went camping in Big Sur with a group of her friends from back-in-the-day. It was lots of fun! Most of my camping experiences have been with my parents when I was young, or while backpacking with my Dad in the wilderness. Either way, it results in very different circumstances than if you're camping with a group of young people interested in drinking, singing, and hedonistic activities :)

We went to the Julia Pfeiffer State Park on Saturday afternoon. It was absolutely beautiful! I can't believe that we were only 45 minutes away from our residence in Monterey. It felt like we were a world away.

I've posted some of our photos on my Flickr page (see sidebar), so enjoy!

IMG_0737.JPG