« December 2005 | Main | February 2006 »

January 31, 2006

Blogging more

Some of you may have noticed I've been blogging more. That is because I finally got off bloglines + MT's built in blog publication/website. I've started using NetNewsWire and MarsEdit and it is just so much easier to track blogs and post my own entries. If you have OS X and don't use them, try it out.

IoC configuration without XML

Are there any IoC containers out there that have an easy way to configure without using XML. Specifically, a configuration mechanism that lends itself well to refactoring?

I'm a big fan of EasyMock and the way mocks are configured is by using record-and-playback approach. That is, first you create your mock and call methods on it while it is record mode. Those method calls become the expectations on the mock. Then you call mock.playback() and now the same object is ready to be used as a mock, expecting the same calls it just recorded.

So why not do this for an IoC container? Consider the following code used to configure your IoC-managed beans:

Foo foo = ContainerSetup.configure(Foo.class);
Bar bar = ContainerSetup.configure(Bar.class);
foo.setBar(bar);
ContainerSetup.done();

Now when I refactor Foo or Bar, my configuration is also refactored. I'm sure there are other ways something like this can be done. Thoughts?

I Don't Get 'I Don’t Get “I Don’t Get Spring”'

For all this talk about how Spring and whether it is good or bad or we get it or don't get it, there is one thing about this whole discussion that really irks me: javablogs.com. Based entirely on the subject, rather than the content, the "popular entries" are currently "I Don't Get Spring" and "I Don't Get 'I Don't Get Spring'". To prove my point, I titled this post something even more "headline grabbing" - and I won't be surprised that it makes it's way to the top of the popular entry list.

I propose we fix JavaBlogs. Why not start a system where blogs in a community (Java, Politics, whatever) can be rated after they have been viewed? Then those ratings can be applied in the popular topics. On top of that, it catches those who don't visit javablogs.com but instead come through RSS feeds.

Anyone else think JavaBlogs' popularity system is a bit lame?

PS: Sorry to be a tease with the subject, you'll find no flame war about Spring in this entry (though I have recent entries talking about it, so go there if you want).

PPS: I'm planning to write a blog community service exactly like this, but for Politics. Perhaps the JavaBlogs community can join me and we can produce a generic system that works for any community. Or, for those Java folks that are also political couch potatoes, let me know if you'd like to help out.

January 30, 2006

Attention: RSS URL changed

I have finally made the switch over to FeedBurner - please update your RSS readers accordingly. The new URL is: http://feeds.feedburner.com/Blogbody

Slick RSS feeds for Dojo, WebWork, Struts, Selenium, etc

Dojo. WebWork. Struts. Selenium. Selenium IDE. OpenQA. OpenSymphony. All of these communities have their mailing lists synchronized with a Jive Forums installation that I manage, and today I made RSS feeds slightly more detailed for those that wish to watch a project's activity without subscribing to a mailing list or visiting a web site every day.

Simply grab the standard RSS feed for threads (fourth icon to the right) at the OpenSymphony forums or OpenQA forums. Then just add &full=true to the end of the URL. The RSS feed you end up with is a list of the active threads, with the entire thread discussion included. It's a bit "heavy weight", but it works great with a news reader like NetNewsWire. The list of authors of each reply at the top makes it even easier to quickly check if a known expert in the community has recently replied, letting you quickly skim over the thread.

So if you are looking for an easy way to track these projects, try out these new RSS feeds. Feedback is of course welcome!

Anemic domain model solved (without source weaving)

I am perplexed by the use of source code weaving and AOP in Spring 2.0 to solve the anemic domain model problem. I propose a better solution: a community-driven effort to standardize on an ObjectFactory API.

Let me give an example: in WebWork, there is an ObjectFactory that is responsible for the creation of any object. I do mean any object: actions, interceptors, results, domain objects that need to be initialized because they were null, etc. Anything. The default implementation simply looks up classes and calls newInstance().

WebWork provides a WebWorkSpringObjectFactory that tries a few things:

  • Look up the "class name" (it might just be a bean name in reality) in Spring and use that if it is exists.
  • If the bean doesn't exist, ask Spring to create it and wire it using the automatic wiring rules you've specified in applicationContext.xml.

This means that my HTML forms can have parameters like "person.name" and my action can have an empty Person property. Since WebWork will automatically create the Person object using the registered ObjectFactory, my Person object will have a PersonService wired up to it automatically. Simple and easy.

Now I'm using iBatis (I love it, but that's for a different entry). Unfortunately, iBatis doesn't have an ObjectFactory concept. But if it did, I could plug the same implementation in and now objects created from a SELECT statement would also be wired up properly.

Ta-da! No source code weaving. No pre-compilation step. No AOP. Just simple agreement on a standard interface. Why can't we all get together and do this?

PS: In the short term, simply putting some self-wiring code in the Person constructor can get you by. It's one additional line of code per domain model, which I prefer much more over an invasive pre-compilation step.

Update: I decided to put up the simplest code possible to show you how you can have rich domain models without all crazy Spring 2.0 stuff. Just make your domain models extend Model (or place the same one-liner in each constructor):

public class Model {
    public Model() {
        SpringAutoWire.autoWire(this);
    }
}

And SpringAutoWire looks like this (it has both a static method and is a definied as a listern in web.xml):

public class SpringAutoWire implements ServletContextListener {
    private static AutowireCapableBeanFactory autoWiringBeanFactory;

    public void contextInitialized(ServletContextEvent servletContextEvent) {
        init(servletContextEvent.getServletContext());
    }

    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        // nothing needed
    }

    private static void init(ServletContext servletContext) {
        WebApplicationContext webApplicationContext
                = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        autoWiringBeanFactory = findAutoWiringBeanFactory(webApplicationContext);
    }

    public static void autoWire(Object o) {
        autoWiringBeanFactory.autowireBeanProperties(o, AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE, false);
    }

    private static AutowireCapableBeanFactory findAutoWiringBeanFactory(ApplicationContext context) {
        if (context instanceof AutowireCapableBeanFactory) {
            // Check the context
            return (AutowireCapableBeanFactory) context;
        } else if (context instanceof ConfigurableApplicationContext) {
            // Try and grab the beanFactory
            return ((ConfigurableApplicationContext) context).getBeanFactory();
        } else if (context.getParent() != null) {
            // And if all else fails, try again with the parent context
            return findAutoWiringBeanFactory(context.getParent());
        }
        return null;
    }
}

Maven 2: both great and obnoxious

Maven 2 will not gain a large user base until it can provide an easy mental migration path for Ant users. Today I saw Running Ant tasks in Maven 2:

"Running Ant tasks in Maven 2 is completely different from Maven 1. In Maven 1 you could define the Ant tasks in maven.xml and run them as easily as any other Maven task. In Maven 2 this has changed, I would say for the worse. Maven 2 no longer has a maven.xml and requires that everything is a plugin."

(Via pragmatically.net.)

I would have to to agree. Maven 2 has this weird ability to be extremely exciting, but also terribly annoying. It's exciting because it really does do 80% of the build management for you. Unfortunately, the other 20% that it doesn't do out of the box (and probably shouldn't, since it is usually unique to each project) is a pain to do.

When speaking with the developers, the usual response is to "write a plugin". Well, great. If I was a Maven developer I'm sure writing a plugin would be no big deal. In fact, I found that tweaking a plugin (such as the ultra cool IDEA plugin that generates your IDEA .iml, .ipr, and .iws files) is super painless. But it's quite another thing to ask someone to create a new plugin from scratch, especially considering they don't know the Maven APIs at all.

Even more, a build system is something that should be made easy. It literally can stop all development when it doesn't work. This can be enough to frustrate users in to never looking at Maven again after they hit their first 24+ hour roadblock.

For Maven to take off, the developers need to admit that "writing a plugin" isn't the answer for everything, especially for new users. Over time, new users such as myself should be weened off of Ant and create plugins instead. But for those of us just starting to use the project, why not provide an easier mental migration path in the form of something we're familiar with?

January 28, 2006

iLife 06: iWeb review

There aren't too many reviews of iWeb around, so if anyone wants to know the skinny, I have just two words for you: skip it.

iWeb has to be the worst software Apple has ever released. It looks slick at first, but then you realize right away there is a problem: the blog software doesn't have comment support. Or trackbacks, or any other interactive capability. In fact, it simply just spits out static HTML every time you update the site.

On top of that, dragging in images from iPhoto does not resize them for use on the web. Instead, iWeb just resizes the img tag width and height attributes, making the download sizes far too large.

Furthermore, the templates Apple provides are not editable. This means that each time you create a new blog entry, you have to remove or overwrite the lorem ipsum text in the template, as well as the photo included (in some of the blog templates).

In fact, the only good thing about iWeb is that the non-blog stuff is just mediocre. For those that don't know how to set up a website, their templates are so-so. But even then, they are extremely limiting. Too bad, it really looked like it had some promise.

January 24, 2006

VMware: Use .iso as virtual DVD drive

So I downloaded the evaluation version of VMware Workstation so I could create my own Linux VMs. I chose to use Fedore Core 4 as my Linux OS, so I downloaded the 2.6GB DVD ISO provided by RedHat. Much to my surprise, I didn't even need to burn the image to a real DVD. VMware has a feature where you can bind a virtual optical drive to any of your physical drives... or to an .iso file on your desktop. Installing Linux has never been easier!

January 22, 2006

VMware Player: a huge step for developers

Without much fanfare, VMware recently released a free version of their product: VMware Player. At first glance, I didn't really understand how important this was. But when more and more virtual machines were added to the Virtual Machine Center, it hit me: VMware Player is going to be a huge boon for software development, not just the typical testing/QA that VMware has typically targeted.

Think about this: how often do you find yourself installing Oracle 11i or Postgres or mySQL on your desktop when starting a new project? What about OpenLDAP? Apache web server? WebLogic? Or worse, WebSphere? Don't you just hate how they pollute your system when you only need them for one project? Or worse, when you get a new machine you have to eventually re-install all these random pieces of software.

VMware Player provides a way out for people who typically aren't given the tools that VMware provides. That is, testing professionals and QA managers usually are given budget for some nice VMware software. But rarely do software developers, let alone every single developer, get their hands on virtualization technology. Now they can, for free.

Over the weekend I installed VMware Player, downloaded the freely available VMs, and began setting up a few different VM snapshots with some of the common services I need on my development computers: OpenLDAP, mySQL, and Oracle 11i. When I am done, I will have a handful of customized VMs sitting on my external hard drive, ready to be launched on any machine I'm working on. Now when I need to write some code that works with LDAP, I don't have to hunt down an LDAP server and install it. I can just crack open my LDAP VM and get to writing code right away.

Are there any VMs you would like to see? I plan to create a collection of developer-centric VMs to share with the community. Let me know what you'd like to see and I'll try to make it happen (or at least keep an active list).

Contegix: amazing hosting, amazing company

It isn't very well known, probably because they don't like to toot their own horn, but Contegix hosts most of the popular Java open source projects out there, as well as many Java technology companies. The list is impressive: OpenSymphony, Spring, Codehaus, Appfuse, Jive Software, Atlassian, Virtuas, Sourcebeat, Cenqua (makers of FishEye and Clover), and ClientJava. And those are just the ones that the Java and JavaBlogs community would know first hand.

But it's not their client list or their open source contributions that are what I want to point out. In fact, that list is merely a symptom of their excellence. Since they took over the OpenSymphony infrastructure, I've worked closely with all the Contegix engineers. What is so special about them is their communication. They are the most proactive professionals I've ever worked with. Not just in the hosting industry, but in general. Not once have I had to reach out to them about a problem. They are always the first to know about an issue, the first to communicate, and the first to provide a fix. Recently, Matt Raible had some good things to say about them.

The unfortunate thing is that many out there, especially in the Java community, don't even know how deep their support goes. Imagine this: they proactively keep JavaBlogs (the site you probably came through to read this entry) up, as well as Spring, OpenSymphony, Codehaus, and a host of Apache projects up with almost perfect uptime, all while making sure they are running the latest versions of their hosted software, such as JIRA, Confluence, Roller, Jive Forums, FishEye, or anything else. And those sites almost never have any trouble (I can't speak for the others, but the only time OpenSymphony has troubles is when I'm screwing with the server myself!) They are not only great communicators, they are experts in the tools Java professionals use every day (in addition to standard system administration).

So this is my little thank you to Contegix. I hope that everyone out there recognizes their efforts for our open source community. And of course, if you need hosting, I can't recommend them enough. They really are an amazing team to work with.

January 11, 2006

Are there any good keyboards and mice today?

I am seriously about to go crazy. I've been trying to find a good keyboard and mouse for over a month now and nothing seems to work. At first I wanted to go with a wireless solution, foolishly beliving that wireless today has to be responsive by 2006. My other requirements/hopes were:

  • Had to work on OS X and Windows (for when I switch between my iBook and desktop). I realized this had to be a requirement after I bought the Logitech G7 Wireless Mouse and found out it doesn't work in OS X!
  • Ability to bind mouse buttons based on the app you're in (ideal for making the forward/backward buttons bind to useful alternatives in IDEA).
  • Mouse had to have forward/backward buttons (other buttons were not interesting, including side scrolling) - turns out a lot today only have one side button. Why?
  • Ideally a laser mouse.

So first I went with both Logitech and Microsoft bluetooth offerings. Bad idea. Not only are they buggy as hell, they can't work unless the drivers are first installed, making them severly crippled. To be fair, the Logitech one seemed to work without the drivers (I believe it supports native bluetooth and then does something entirely in hardware to emulate the mouse), but it cause my system to crash consistently. Plus, the mouse sucks.

So giving up on Bluetooth, I then tried both of their non-Bluetooth offerings. At first, the Microsoft set was looking good. For only $60 at CompUSA, I picked up their Laser 6000 desktop set. I was pleased to see it worked well on both platforms, the mouse didn't suck, and the wireless seemed to work. Woo hoo! But then when I got home I started noticing that the wireless signal was very unreliable! In fact, maybe 1 out of 100 keys would get missed. At first I thought I was just not familiar with the new keyboard, but eventually I started realizing it was actually not seeing my input. Returned.

Next I try Logitech's offering. The software doesn't let you bind mouse clicks on a per-program basis, but I'm starting to realize I'm going to have to compromise. So next up is the Cordless Desktop MX 3000 Laser, which is what I have at home right now. Signal worked great, but something just didn't feel right. Then I realized the problem: If I typed at a fast rate (I'm a pretty fast typer, maybe 90WPM), the input actual lags. Granted, it was better than Microsoft's stuff, but still far from ideal. Good thing I saved the receipt.

So now I've finally decided to give up on wireless. I tried out the Microsoft Laser 6000 Mouse recently, and that also sucked (the forward/backward buttons are in lame positions to try to make the mouse acceptable for lefies). Logitech mice just totally scare me now, since half don't work with OS X and the other half have far too many buttons. Microsoft's IntelliMouse Explorer was great, but they don't offer anything like it using Laser technology.

So it looks like what I may finally be doing is:

  • Give up on wireless - it's a lost cause.
  • Give up on laser for now.
  • Get per-program mouse button bindings with a Microsoft mouse.
  • Get a keyboard and mouse that I know work with OS X:
  • Purchase the Logitech G15 Keyboard... when it is finally in stock. Bonus: it's backlite, has programmable macros (I'm sure I can find use for that in IDEA), and it is one of the last keyboards that hasn't moved the #$@&* insert key!
  • Purchase a basic Microsoft IntelliMouse. It isn't perfect (the middle button is hard to click and feels delayed), but whatever at this point.

Anyone know of anything better?

January 09, 2006

XWork 1.1 released; WebWork 2.2 soon

We're really close now to the WebWork 2.2 release. XWork 1.1 is already released and we're in code freeze. Just another day of looking over the docs and then we'll finally be releasing WebWork Wednesday morning. Woo hoo!

January 04, 2006

Retrievr

Found via Auren a neat little sketch recognition program called Retriever. Try it!

January 03, 2006

Mark Cuban's investment advice

A great little blurb (although written in Cuban's horrible writing style/bad grammar) on investment advice. Basically Cuban repeats the message of The Only Investment Guide You'll Ever Need

  • Spend less
  • Invest in mutual funds
  • Don't buy a boat

If you haven't read it, I highly recommend the book for anyone who feels overwhelmed by the stock market and investment strategies.

OS X: Selecting lists

In OS X, one of the more annoying keyboard shortcuts that is different from Windows comes up whenever I find myself selecting lists of items (emails in Mail, for example).

Basically, in Windows if I hold down shift and move the arrow key down twice and then up once, I end up with on line selected. If I move it up three times and then down once, I have two lines selected. This makes sense to me.

But in OS X, I end up with three and four lines, respectively. That is because moving the arrow, while selecting lists of items, such as in a table, doesn't negate the opposite arrow action, but instead shifts the boundaries of the selection in the direction selected.

I find this terribly un-intuitive. Anyone know of ways around this?