Modular Java with OSGi and Spring

I was lucky enough to be asked to preform a technical review of “Modular Java: Creating Flexible Applications with OSGi and Spring“.  It’s Craig Walls‘ next book and it’s being published by the Pragmatic Programmers.

Craig does a great job of making the case for modular Java development with OSGi.  He covers why we need to start thinking about more than just how we design our methods / classes and focus more on how we design reusable Java modules.

First, Craig makes the case for modular design.  Then he talks about how OSGi enables us to write modular Java applications.  He covers both the Apache Felix and Eclipse Equinox OSGi containers.  Next you are writing and deploying a HelloWorld OSGi service.  And that’s all done in the first two chapters!

Craig spends the rest of the book covering modular Java and OSGi concepts through the development of an example project, Dude Where’s my JAR.  You also throughly learn an invaluable tool for OSGi development, Pax Construct. You learn about and writing and deploying OSGi bundles, then writing, deploying and consuming OSGi services.

Once you think you know everything about OSGi, and might be thinking that it’s a bit complicated, Craig brings in the Spring Framework.  He covers Spring Dynamic Modules for OSGi (Spring-DM) which is used to eliminate all of the OSGi-specific code in the example application.  You refactor the app away from depending on the OSGi API.  You change the services to POJOs and OSGi services then inject them into other beans.

My favorite thing about this book was that I didn’t have to read 1000 pages to understand the concepts and get up and running.  Like all the Pragmatic Programmer books, you are educated, and up and running in a few 100 pages.  Read this book if you want to quickly get up-to-speed on OSGi and Spring Dynamic Modules.

Optimize the iPhone 3G Battery Life…

I’m excited to say I’m heading to Las Vegas this weekend for time with friends, gambling, and lots of free drinks.  My problem is I have an iPhone 3G so it’s battery will be dead within 6 hours of landing and I won’t be communicate with my friends.  The point of this post is me looking for some tips on improving battery life.

With the goal of maximum battery life and no need for anything but phone/text support here is my plan.

  1. Disable 3G support
  2. Disable bluetooth
  3. Disable wifi
  4. Turn the screen brightness to it’s lowest setting.

Am I missing anything?  Should I just turn the phone off, completely, and only power on when I want to make a call or check for messages?

Please provide tips/tricks that you have found to improve battery life.  Thanks…

Do You Understand How Taxes Work?

This was sent to me from my one of my old college roommates and I thought it was worthy of rebroadcasting here on my blog.  In these times of “cry baby” economics, where people are complaining about who gets the biggest tax break and who should be getting the biggest tax break I thought everybody could use a dose of how things really work.



Suppose that every day, ten men go out for beer and the bill for all ten comes to $100. If they paid their bill the way we pay our taxes, it would go something like this:

The first four men (the poorest) would pay nothing. The fifth would pay $1. The sixth would pay $3. The seventh would pay $7. The eighth would pay $12. The ninth would pay $18. The tenth man (the richest) would pay $59.

So, that’s what they decided to do. The ten men drank in the bar every day and seemed quite happy with the arrangement, until one day, the owner threw them a curve. ‘Since you are all such good customers, he said, ‘I’m going to reduce the cost of your daily beer by $20. Drinks for the ten now cost just $80.

The group still wanted to pay their bill the way we pay our taxes so the first four men were unaffected. They would still drink for free. What happens to the other six men – the paying customers? How could they divide the $20 windfall so that everyone would get his ‘fair share?’ They realized that $20 divided by six is $3.33. But if they subtracted that from everybody’s share, then the fifth man and the sixth man would each end up being paid to drink his beer. So, the bar owner suggested that it would be fair to reduce each man’s bill by roughly the same amount, and he proceeded to work out the amounts each should pay.

And so:

The fifth man, like the first four, now paid nothing (100% savings). The sixth now paid $2 instead of $3 (33% savings). The seventh now pay $5 instead of $7 (28% savings). The eighth now paid $9 instead of $12 (25% savings). The ninth now paid $14 instead of $18 (22% savings). The tenth now paid $49 instead of $59 (16% savings).

Each of the six was better off than before. And the first four continued to drink for free. But once outside the restaurant, the men began to compare their savings.

‘I only got a dollar out of the $20,’ declared the sixth man. He pointed to the tenth man, ‘But he got $10!’

‘Yeah, that’s right,’ exclaimed the fifth man. ‘I only saved a dollar, too. It’s unfair that he got ten times more than I!’

‘That’s true!!’ shouted the seventh man. ‘Why should he get $10 back when I got only two? The wealthy get all the breaks!’

‘Wait a minute,’ yelled the first four men in unison. ‘We didn’t get anything at all. The system exploits the poor!’

The nine men surrounded the tenth and beat him up.

The next night the tenth man didn’t show up for drinks, so the nine sat down and had beers without him. But when it came time to pay the bill, they discovered something important.

They didn’t have enough money between all of them for even half of the bill!

And that, boys and girls, journalists and college professors, is how our tax system works. The people who pay the highest taxes get the most benefit from a tax reduction. Tax them too much, attack them for being wealthy, and they just may not show up anymore. In fact, they might start drinking overseas where the atmosphere is somewhat friendlier.

My Top 10 Songs… I’ve got 20.

I accepted the challenge thrown down by Shawn and Travis and spent way too long coming up with my Top 10 Songs list.  The list started just shy of 50.  I whittled it down to 20, and then struggled to get it to the required 10.  I’ll give the Top 10, and the Top 20, which better covers my musical tastes over the years.

Erik’s Top 10 Songs: angles of the silences – counting crows blow you away – robert earl keen cherub rock – smashing pumpkins drown – son volt misunderstood – wilco moonshiner – uncle tupelo new slang – the shins release – pearl jam soup – blind melon wish you were here – pink floyd

Erik’s Top 20 Songs: * angles of the silences – counting crows * blow you away – robert earl keen the boxer – simon and garfunkel * cherub rock – smashing pumpkins clocks – coldplay come as you are – nirvana come together – the beatles * drown – son volt elvis presley and america – u2 hurt – nine inch nails i am trying to break your heart – wilco jane says – jane’s addiction * misunderstood – wilco * moonshiner – uncle tupelo * new slang – the shins * release – pearl jam * soup – blind melon welcome home (sanitarium) – metallica * wish you were here – pink floyd yellow ledbetter – pearl jam

Dusting Off the Blog…

Yeah, I have totally blown-off this blog.  I apologize, but I’m hooked on twitter.  For those that are asking, “What is twitter?”  Please view this link for an explanation on twitter.  Honestly, I’ve been fulfilling my blogging needs over on twitter, but that ends now as I plan on getting back to blogging.  My first blog post is to point you to my twitter account.  Just kidding.  🙂

Topics that I warrant blog posts:

  • Our new Presidnet
  • Katie and I expecting our 3 kiddo!  (sorry I didn’t announce that here and dropped it on the twitter feed)  She is like 16 weeks.  We’ll find out what #3 is 1/6/09
  • The disgrace that was Coach Sherman Year 1
  • The comedy that is tu not playing in the BCS title game while OU, a team they beat, is.

Barack Obama is Bad for America…

Barack Obama is bad for America…

Barack is pushing a disgusting socialist platform.  You think America is getting run-down with lazy, unmotivated people now?  Wait until Barack starts his socialist handouts, it will be horrible.  His distribution of wealth will kill the American spirit and drive.

Barack is anti-Christian.  Pushing his pro-abortion, killing babies, platform.  God created the children Barack wants to allow people to abort.  Killing is killing and Barack is for it.

Barack backs, even campaigns for,  evil, oppressive foreign governments.  You just don’t hear about it because of the miserable state of the American media.

The good thing is that if Barack wins tomorrow he will so quickly tarnish his political image that he will be out in four years and the Republican movement will take over and rule America.

Top 10 US Cities with the Highest Poverty Rates

What do the top ten cities with the highest poverty rate all have in common?

  • Detroit, MI (1st on the poverty rate list) hasn’t elected a Republican mayor since 1961
  • Buffalo , NY (2nd) hasn’t elected a Republican mayor since 1954
  • Cincinnati, OH (3rd)…hasn’t elected a Republican mayor since 1984
  • Cleveland, OH (4th)…hasn’t elected a Republican mayor since 1989
  • Miami, FL (5th) has never had a Republican mayor
  • St. Louis, MO (6th)….hasn’t elected a Republican mayor since 1949
  • El Paso, TX (7th) has never had a Republican mayor
  • Milwaukee, WI (8th)…hasn’t elected a Republican mayor since 1908
  • Philadelphia, PA (9th)…hasn’t elected a Republican mayor since 1952
  • Newark, NJ(10th)…hasn’t elected a Republican mayor since 1907
Einstein once said, ‘The definition of insanity is doing the same thing over and over again and expecting different results.’
It is the disadvantaged who habitually elect Democrats — yet are still disadvantaged.