18 April 2011

Injuries Suck



If only my footwork was as talented as some of the players in this video, I probably wouldn't write code for a living! Although I have played soccer nearly all my life, I haven't sustained injuries that stopped me from playing since I was in high school when I fully severed my right ACL.

A few years ago, my wife and I began playing in a coed indoor soccer league on Friday nights on a team of friends. Last year, she sustained a hip injury during a game that took her out of all sports for a couple months while it healed. Luckily she healed well and got back to running and soccer. Well this spring it seems is my turn with the injuries.

About five weeks ago I sustained an injury to some ribs that left them pretty badly bruised and they are still not 100% healed (I still cannot sleep on my left side!). Then about 10 days ago, a swift kick to the lower, inside of the tibia just above the ankle and just outside my shin guards caused a sizable hematoma on my leg. It's basically a pocket of blood that forms under the skin when the wall of a blood vessel is damaged and allows blood to flow into the surrounding tissue. Not only is the area of the injury very swollen and discolored, but it has caused my entire ankle and heel to swell and discolor. The photo below looks similar to my injury but mine is on the inside of the tibia.



I applied ice to the injury all week, and then began alternating heat treatments near the end of the week. After wrapping it up good, I decided to play on Friday night. What a mistake that wound up being. Near the end of the first half, I was checked into the boards causing my ankles to smack together right on the hematoma. Needless to say that took me out for the game, barely able to walk on the injured leg.

As I awoke on Saturday morning because of the pain in my leg, I had reserved myself to the thought of rest until it heals. The doctor told me that it could take up to four months for this to heal! I was stunned when he told me this. He also said if the hematoma didn't go away on it's own, it could require a surgical procedure. Geez! As much as I love playing soccer, I guess I will have to stop until this injury is healed. Well I guess I will be playing more guitar and cycling :-).

17 April 2011

Playing Guitar



Since we finished the ActiveMQ in Action book recently, I actually have some spare time now. So I've began to get back into playing guitar. I'm not especially talented, but I have always enjoyed strumming chords and playing rhythm guitar.

Every week, my girls take piano lessons from a friend whose husband taught them both kindergarten at a nearby Montessori school. The couple are both accomplished musicians and really enjoy teaching music. She plays guitar, piano and sings; he plays guitar and sings. We've seen them play together and they are very complimentary together. So recently I decided to take some guitar lessons from the husband while the wife teaches my girls piano.

It's funny to learn that collaboration means just as much in playing a musical instrument as it does in writing code. When I collaborate with others and actually write code with them, I tend to learn a lot more than when I just sit in a corner writing code. So far, the same is true for playing guitar. Sitting at home, playing by myself seems so much more limiting than playing even once a week with my friend. He has been a musician for many years, is very talented and is also a gifted teacher.

For many years now, when I'm solving problems with the work I do and I get stuck, I tend to grab my guitar to clear my mind. Playing for even just 5 or 10 minutes can help me see a problem more clearly. I know that taking a walk with my dogs would do the same thing, but I can't go out for multiple walks during the day. But I can quickly grab my guitar, play for a brief period of time and then get back to work. Oftentimes when I do this, I'm able to immediately solve a problem that I've been working on for a while.

Something I know about myself is that I enjoy constant learning. When I stop learning, I tend to lose interest in whatever I'm doing. Getting back into playing guitar and learning again is a breath of fresh air. I have known this for years, but it's nice to be reminded of it again.

Though I'm still playing on a cheap acoustic guitar I bought many years ago in college through Musician's Friend, I'm still having fun. But I'm realizing again why most people don't stick with guitar when they are first learning. Typically, cheap guitars are not easy to play. Your fingers begin to hurt and your hands can cramp rather quickly with a cheap guitar. I've simply been trying to play though this recently and it's starting to become a problem. So now I'm wondering about graduating to a nicer guitar that is easier to play. When something is easy to do, you tend to want to do it more often. Playing a nice Taylor guitar in a shop recently reminded me of this. Though I don't think I want to spend that kind of money, I do have something different in mind. More on that in a future post.

05 April 2011

ActiveMQ In Action Now Available



ActiveMQ in Action is now available in print! After the long road of writing the book, it's very nice to actually see it in print. One of the first things I noticed about the final PDF was the color in the images. Manning did a very nice job of adding color. I've already had four people mention to me that they really like the colored images.

One really nice thing about Manning print books is that they include a complimentary ebook which comes in three formats: PDF, mobi, and epub when available. So if buy the print book, you will get an electronic copy include at no additional charge. This can be very handy when you don't care to lug around a print book wherever you go, but you would still like to search it for particular items.

If you want to learn about ActiveMQ and JMS, pick up your copy of ActiveMQ in Action today!

15 March 2011

Why I Love My Bike



Ever since I first learned to ride a bike, I have loved it. My mom and dad taught me to ride a little blue Schwinn bicycle when I was four or five years old. I remember learning very quickly to skid down the sidewalk across some gravel and I thought I was so cool. But just riding my bike made me happy and to this day that is still true.

As a kid, riding a bike meant freedom. I could ride just about everywhere I needed to go in the small town where I grew up in Illinois. And nearly everything we did as kids included riding our bikes. We rode to school, to the park, to soccer practice, to swim practice; I even began going out on the road to neighboring towns. Not only did I enjoy it, but it was good transportation until I was old enough to drive. But even then I kept riding my bike when I could.

During my college years, I bought my first mountain bike. Friends and I would go out riding together in the parks and wooded areas around where we lived and we loved it. Then, a couple years after graduating from college, we moved to Colorado. Then I really got a taste for true mountain biking and it has been in my blood ever since.

When we first moved from Illiniois to Colorado in 1995, one of the reasons we came was for the outdoor activities all year round. Mountain biking was number one on my list and I was out riding in the mountains practically every weekend back then. A few years later, we started our family and our lifestyle really changed (raising kids will do that to you).

When our girls were really young, they had miniature big wheels and then small bikes with training wheels. But once they each got old enough, I got to teach them to ride without the training wheels. For me, this was definitely a highlight of their younger years. Seeing how much they loved it is difficult to describe. Seeing the look on their faces as they realized that they were pedaling all on their own is such a memorable moment. Riding a bike is something I hope will stick with them for the rest of their lives. Every time I see my kids on their bikes, it makes me smile.

To this day, I still ride my bike and I still love it. Though I've moved on to more serious mountain biking and road cycling, part of what I love about it is being outside, seeing the beautiful scenery and getting away from the computer. After all, living in Colorado, I no longer need to look in books and magazines to see such amazing sights. I just go outside and ride my bike to see them.

08 March 2011

ActiveMQ In Action Going to Print!



This week we received the final cover art for ActiveMQ In Action and the book went to the printer! Yay!!! It's been a long road, but Dejan, Rob and I can finally celebrate all our hard work on this project.

You can check out the cover art here and be sure to mouse over the image and click the link to view the full size.

There are certainly many people to whom we owe a great deal of gratitude including:
  • Jeff Bleiel, our development editor - Without Jeff's input, the book would not be what it is today
  • Gary Tully For his tireless technical reviews of the entire book
  • The Manning staff - For their arduous work on the book
  • Filip Hanik - For his assistance with Tomcat
  • Jan Bartel and Greg Wilkins - For their assistance with Jetty
  • David Jencks and Kevan Miller - For their assistance with Geronimo
  • Jaikiran Pai - For his assistance with JBoss

We would also like to thank the following list of reviewers who read the manuscript at different stages during its development and provided valuable feedback:
  • Jeff Davis
  • Deepak Vohra
  • Robert Hanson
  • Davide Piazza
  • David Strong
  • Tijs Rademakers
  • Prasad A. Chodavarapu
  • John Merryman
  • Jeroen Benckhuijsen
  • Pratik Patel
  • Scott Dawson
  • Jason Kolter
  • Rod Biresch
  • Roberto Rojas

Finally, a big thanks to the readers of Manning’s Early Access Program (MEAP) releases of the book for their comments and input via the Author Online forum.

We authored the book using DocBook XML and it was processed using the Docbkx Tools Maven plug-in on Mac OS X (To those folks who keep asking about my experience with DocBook, yes, it is worth it! Shoot me an email if you have any questions). Other items that went into the book include MacBook Pros, Google Docs, GMail, Foonz (until it shut down), FreeConferenceCall.com, barking dogs during conference calls, company acquisitions, lots and lots of music, loud construction next door, sleepless nights, too much work on airplanes, and plain old exhaustion.

23 February 2011

ActiveMQ and Message Redelivery



Today I helped a customer with a problem in their use of ActiveMQ where messages were getting backed up in a particular queue. It seems that messages in the queue would back up when a downstream process was not available. But this downstream process was only unavailable for a short period of time in the middle of the night for routine maintenance. However, this seems to have caused an ongoing problem for this customer.

We looked at the JVM memory, the broker memory and the queue memory configs each of which was kinda low so I recommended that it be increased (though this was not the problem). I also recommended setting org.apache.activemq.UseDedicatedTaskRunner=false to reduce the number of dispatcher threads being used internally by the broker and to consider the use of the NIO transport instead of the TCP transport to reduce the number of threads used for connections coming into the broker.

As we dug deeper, I looked at the number of consumers on the queue and found that there were 256 Apache Camel consumers in total, none of which was marked as being slow. The consumers were using the ActiveMQ PooledConnectionFactory with the default settings (1 connection and 500 sessions). The consumer prefetch limit was already set to 1 so I knew that this was not a problem. However, while looking at the settings for the connection, I noticed that there was a Camel RedeliveryPolicy set as well. Setting a redelivery policy is not a problem, but the values in it can be a problem if they are not verified.

The settings being used for the Camel RedeliveryPolicy included the following:
  • maximumRedeliveries=-1: This means that redelivery attempts will continue forever (i.e., infinite)
  • useExponentialBackOff=true: This means that the upon each successive delivery attempt, the amount of delay used will double (because the backoffMultiplier property is set to 2 by default)
  • maximumRedeliveryDelay=36000000: This means that the maximum amount of delay that can occur for a given message is 36000000 milliseconds -- yikes that's high! It wasn't until I actually did the math that I saw that 36000000 milliseconds = 10 hours!!!
When you stop and think about the combination of these settings, the problem becomes apparent. Once the exponential backoff causes the maximum redelivery delay for a given message to be reached, that message will be delayed for 10 hours. And if that message experiences another redelivery it will endure the maximum amount of redelivery time again, 10 hours. Geez! (I hazard a guess that the value for the maximumRedeliveryDelay was a simple typo of adding an extra zero. Without the extra zero, it would have been only one hour, not 10 hours.)

I then offered the following advice on dealing with the problem.
  1. Using JMX, move the messages from the current queue to a different queue temporarily (let's refer to this different queue as the sandbox1 queue). Make sure that there are no consumers on the sandbox1 queue so you can work on them without a worry that they will be consumed right out from under you.
  2. Using Camel, consume the message
  3. Using Camel, copy the body and any headers to a new message, but skip the JMSRedelivered header. You may also need to avoid the JMSmessageID header as well since I think it is used to track a message for redelivery. By not copying the JMSRedelivered header on each message it will be stripped.
  4. Using Camel, put the message into sandbox2 queue.
  5. Manually check each one to make sure that the JMSRedelivered header is actually empty/false.
  6. Using JMX, move the messages back to the original queue for the correct consumption and processing.
This is the only way that I can think to escape the 10 hour delay imposed on each message.

15 February 2011

How to Access the DocBook DTDs When oasis-open.org Blocks You



Have you ever used the DocBook DTDs (or XSDs) and been blocked by the oasis-open.org website after a handful of accesses to them? If so, here's how to work around this problem. Granted, the solution I offer is specifically for Mac OS X, as long as you can run a webserver on your operating system, the same solution will still work (after all, Mac OS X is really just BSD Unix).

While working on the ActiveMQ In Action book, we were originally using the DocBook 4.5 DTD directly from the oasis-open.org website. Every time I built the book to transform the DocBook XML into PDFs, the Maven build would access the DTDs directly. Pretty standard stuff when the DTDs are not already packaged in a JAR so that they can be accessed locally. I wasn't happy with build ing needing to grab these DTDs for every iteration, but since I have a fast connection it wasn't a big deal for me. However, after a very short period of time, the oasis-open.org website blocked me from accessing the DTDs. This was a pain because it caused the build to fail. To work around this problem, here's what I did.

I simply downloaded the DTDs and related files that I needed, put the DTD and friends in /Library/WebServer/Documents/docbook/xml/4.5/ directory on my local hard drive and added the following entry to the /etc/hosts file so that any requests to oasis-open.org to point to my local machine:


127.0.0.1 www.oasis-open.org


Then I just started up web sharing on the MacBook Pro I used to work on the book and voila! I no longer had to access the DTDs online anymore and the fact that oasis-open.org blocked my IP address didn't matter anymore.

This really wasn't a big deal for me, but I question the motive for making the DTDs publicly available and HTTP accessible if there are rules for accessing them. Why not post work arounds such as this to the oasis-open.org site? Why not just simply post a page of rules for accessing them? Of course, these items may be posted somewhere and I just wasn't able to find them. If so, that's a problem as well. Hint! Hint!