28 August 2007

My Soapbox for SLF4J



There seems to be a ruckus being generated lately over SLF4J. Both Howard and Dion have posted on the topic so far and they have their reasons. But I see that some things have been left out of the discussion, so I'll get on my soapbox for a bit to offer my own opinion.

<soapbox>
IMO, the most important point about JCL is that the use of it is most oftentimes incorrect from an architecture standpoint, and this is according to the creator of JCL, Rod Waldhoff:


'...The purpose of Commons Logging is not to somehow take the logging world by storm. In fact, there are very limited circumstances in which Commons Logging is useful. If you're building a stand-alone application, don't use commons-logging. If you're building an application server, don't use commons-logging. If you're building a moderately large framework, don't use commons-logging. If however, like the Jakarta Commons project, you're building a tiny little component that you intend for other developers to embed in their applications and frameworks, and you believe that logging information might be useful to those clients, and you can't be sure what logging framework they're going to want to use, then commons-logging might be useful to you...'


Here is Rod's full blog entry.

Additionally, back in 2004 Ceki posted an extremely good writeup about the shortcomings of JCL that addresses the classloader issues with JCL. Anyone who has ever been bitten by these issues has my sympathy because I've been there before as well. Even the latest Spring Framework project (Spring OSGi) doesn't use JCL. Instead, Spring-OSGi switched to SLF4J. My buddy Chris has a great blog entry about JCL classloader issues as well.

And using java.util.logging (JUL) is just not a good option. Sure it's baked into the core Java libraries, but it is a pain to reconfigure because there are really only two options: a) via the logging.properties file in the JRE, or b) by supplying system properties (-D) to the JVM. Why would I want to reconfigure logging for my entire JRE and I suppose I could supply even more system properties to the JVM but what PITA. And don't get me started about the JUL feature set lagging behind Log4J so horribly in the areas of formatters and handlers. This is exactly why the x4juli project was created.

SLF4J provides what the vast majority of people really wanted (and assumed they were getting) when they adopted JCL in their projects. That is, an abstraction layer for logging that allows you to plug in your logging framework of choice at deployment time. SLF4J statically binds to a particular logging implementation so that there is no automagic discovery for configuration. This gets around the whole JCL nightmare.

SLF4J also supports the MDC/NDC (Mapped Diagnostic Context/Nested Diagnostic Context) that are supported in Log4J. The trouble with using these from Log4J with JCL is that JCL won't let them through its facade. SLF4J also offers parameterized log messages which is a really nice feature. Though the FAQ explains it, here is some more info on parameterized logging.
</soapbox>

OK, that's my soapbox for today. Maybe I'll add more to this later.

07 August 2007

Google Voice Local Search




It seems that Google is now offering a free 411 service named Google Voice Local Search. I've already tried it and it works great *and* I don't get charged! Is there anything that Google is not into yet? Just look at all the stuff being offered by Google Labs these days.

04 August 2007

Combining Multiple PDFs on MacOS X



This week I had to concatenate multiple PDFs into a single PDF. I have worked with Postscript in the past and I could hack together a script to do it, but I didn't have the time to do this so I resorted to Google. There I located Combine PDFs which worked like a charm.

The really interesting thing about working with PDFs on MacOS X is that Apple provides lots of libraries for working with PDFs in MacOS X and Combine PDFs just makes use of these libraries. Even the source code is provided on the website if you're interested to plow through to understand how this is implemented. Very nice ;-).

Now I need to click the PayPal link to give the author some cash. I have no problem doing this as the software was a very big help to me when I was in a crunch. Thanks!

03 August 2007

Keeping Your Sanity When Working at Home

A while back I promised a write-up from a red-eye flight of my experiences working out of a home office (aka working remotely). Unfortunately, the last red-eye flight I had was spent polishing chapters. So after a five hour delay in an airport this evening, I'm writing this entry from another red-eye flight.

I've worked remotely in various capacities since back in the mid- to late-1990s while working for various startups and my experiences have varied widely. What I've learned in that time has helped me to figure out how and when I work best. This will likely be a very long topic, so I'll break up over two or three entries. There are many aspects of working remotely and I could go on and on about this topic. So I've decided to whittle down my thoughts into a set of tips based on my experiences and perspectives.

Adhere to a Schedule

This is a no-brainer for most folks, but I still mention it all the time. Try to stick to a schedule, not only so that others know when you're available, but also for your family and yourself. A workday that is broken up and inconsistent can really wreak havoc on yourself and others. I'm not saying you need to be dogmatic about it because everyone has things come up. But try to keep the same general work hours. It will help you keep your sanity.

Focus on Work Tasks

A movie from years ago named Disclosure portrayed a vicious battle for corporate position filled with scandal inside a tech startup where Michael Douglas' character was accused of sexual harassment. As the scandal was consuming his life, he was reminded over and over by a colleague to fix the problem but he didn't take heed. It wasn't until the night before his big presentation where the biggest scandal yet was about to take place that he discovered the accusation was meant to be a big distraction while the real trap was being laid. His colleague had kept telling him to fix the problem yet he had neglected to see what was right in frton of him - his job.

Don't forget that your focus is still on the work you are paid to do. I routinely run into articles, blog entries, house chores, errands, etc. while I'm working that I'd rather be doing to need to be done instead of doing my work. So I try to remain focused by bookmarking stuff and filing it in a folder I named toRead and using a GTD tool (more on this in a bit). Then I read this stuff in my copious amounts of free time ;-).

Take Breaks!!!

I can't tell you how much better I think about problems and perform my work by simply taking breaks. As the Audioslave song says, 'I like hammering nails and speaking in tougues, because it doesn't remind me of anything,' - do something completely different from what you're doing for a bit. It's surprising how taking your mind completely off of a problem or task and coming back to it with a fresh perspective can really, really help.

Organize Your Tasks

The book Getting Things Done is a great resource for keeping yourself organized. It's got a lot of very basic tips that are really good. There's also some great software out there for helping with this including kGTD (which is in the process of becoming OmniGroup OmniFocus) and iGTD just to name a couple of MacOS X apps (sorry to the Linux and Windows folks - I'm sure there's stuff out there).

Vary Your Work Location

This one works for me but may not for others. I have discovered that I tend to focus better when pink noise is present. Pink noise kinda sounds like static and acts to mask background noise to help me concentrate better. I even use a pink noise generator named Noise. I have also found that I can sit in a bustling coffee shop and focus much better than sitting in a quiet room - as long as there is nobody who's talking loudly on a cell phone or just particularly loud. Most of my work revolves around problem solving in one way or another (e.g., writing code, digging through code, working on architecture, etc.) and focus is important. If I'm trying to read this doesn't always work. Sometimes music is enough, but sometimes that makes me pick up my guitar and I get distracted for a bit ;-).

Don't Get Too Distracted By Email
I receive a *lot* of email. This is mainly due to my being subscribed to some 30+ mailing lists for various open source projects. As much as I watch what is happening, the majority of the time I am skimming subjects to see if the discussion thread is interesting to me. There are lists for which I do read every message but I certainly don't read every single message that enters my inbox. At any rate, the point of this tip is to let you know that we all experience information overload and email is a big contributor to this dilemma.

My advice is not to let it suck you in. You can blow more valuable work time in your email client that you realize. My strategy is to keep my work email separate from my personal email (I use separate addresses) and to make full use of a good email client to filter email into various categories. I tend to pay special attention to messages that are sent directly to me as opposed to those sent to a list to which I'm subscribed. Even the most seemingly innocuous things in this world can be addicting and email is one of them. Don't let your email control you.

Review, Review, Review

Just like any Agile Methodology in the software development world, reviewing where you are at in your workload should be a constant. GTD teaches you this because remaining organized doesn't mean simply keeping little Post-It Notes for your TODOs all over the place. Situations can change on a moment's notice and it's important to take stock in where you've been, where you are currently and where you're going.

There will be many more tips to come and not all of them will be general advice. I have discovered many tips and productivity tools by simply sitting next to friends while we work on our own things. It's amazing what you can pick up from others in this manner. Unfortunately, I don't have the chance to work with friends too often these days as travel to be with clients seems to dominate my workload lately. If you have tips, tricks, ideas, tools, etc. to share, please let me know.