19 September 2011

Installing PostgreSQL 9.0 on Mac OS X 10.6.8 via MacPorts



While installing PostgreSQL 9.0 on Mac OS X again, I had to figure out all these steps yet again. So I'm documenting this process for my own sake because I have been through this now twice on two computers recently, having to hunt down all of these commands each time. I'm hopeful that this will help others as well.

Use the MacPorts command port to install PostgreSQL 9.0, then create and own a data directory and a logs directory:

$ sudo port install postgresql90-server
$ sudo mkdir -p /opt/local/var/db/postgresql90/defaultdb
$ sudo chown -R postgres:postgres /opt/local/var/db/postgresql90
$ sudo mkdir -p /opt/local/var/log/postgresql90
$ sudo chown -R postgres:postgres /opt/local/var/log/postgresql90

Now you need to initialize the database using the data directory that was created above:

$ sudo -u postgres /opt/local/lib/postgresql90/bin/initdb -D /opt/local/var/db/postgresql90/defaultdb

I prefer to change the postgres user's shell to bash:

$ sudo dscl . -create /Users/postgres UserShell /bin/bash

View the postgres user account just to make sure it all looks OK:

$ dscl . -read /Users/postgres
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 5B38F583-CBBF-4082-A32D-C17947394A27
NFSHomeDirectory: /opt/local/var/db/postgresql90
Password: *
PrimaryGroupID: 501
RealName:
PostgreSQL-90 Server
RecordName: postgres
RecordType: dsRecTypeStandard:Users
UniqueID: 502
UserShell: /bin/bash

Also check the postgres group:

$ dscl . -read /Groups/postgres
AppleMetaNodeLocation: /Local/Default
GeneratedUID: 715FEB22-D0F1-443F-BC93-55896210DB44
Password: *
PrimaryGroupID: 501
RealName: postgres
RecordName: postgres
RecordType: dsRecTypeStandard:Groups

Now edit the /opt/local/var/db/postgresql92/defaultdb/pg_hba.conf file to add the appropriate permissions:

# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust

This should allow you to connect easily using the psql utility.

I prefer to use the pg_ctl command to start and stop PostgreSQL. This is simply because I learned PostgreSQL on Linux and that's all there was. To prevent having to retype the full command every time I want to start or stop the database, create a start script and a stop script in the postgres user's home directory named pg_start and pg_stop. Below are the contents of the pg_start file. Make sure to create these files as the postgres user in the home directory:

$ sudo su - postgres
$ vim ./pg_start
#!/bin/sh
/opt/local/lib/postgresql90/bin/pg_ctl -D /opt/local/var/db/postgresql90/defaultdb -l /opt/local/var/log/postgresql90/postgres.log start &

Below are the contents of the pg_stop file:

$ vim ./pg_stop
#!/bin/sh
/opt/local/lib/postgresql90/bin/pg_ctl -D /opt/local/var/db/postgresql90/defaultdb -l /opt/local/var/log/postgresql90/postgres.log stop

Don't forget to make them executable:

$ chmod +x ./pg_start
$ chmod +x ./pg_stop

(There is a Mac OS X way of starting PostgreSQL using launchctl but I don't tend to use that because I'm used to the standard pg_ctl command.)

Now use the pg_start script to start up PostgreSQL. Execute it as the postgres user (sudo su - postgres) I tend to cat the log file just to make sure it's running correctly:

$ ./pg_start
$ server starting

$ cat ../../log/postgresql90/postgres.log
LOG: database system is ready to accept connections
LOG: autovacuum launcher started

Looks good so we'll create my user:

$ /opt/local/lib/postgresql90/bin/createuser bsnyder
Shall the new role be a superuser? (y/n) y

Because I made my user a superuser, I can create my own db schema, so log out of the postgres user account and back to my own account first:

$ exit
$ /opt/local/lib/postgresql90/bin/createdb
CREATE DATABASE

The createdb command automatically uses my username as the schema name.

The only thing left to do before starting up the database is edit your ~/.profile or ~/.bash_profile to put the path to the PosgreSQL bin directory into the PATH:

export PATH=/opt/local/lib/postgresql90/bin:$PATH

Now just log into the PostgreSQL server using psql to make sure we're ready to roll:

bsnyder@skunk [~] $ . ~/.bash_profile
bsnyder@skunk [~] $ /opt/local/lib/postgresql90/bin/psql
psql (9.0.4)
Type "help" for help.

bsnyder=# select version();
version
------------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.4 on x86_64-apple-darwin10.8.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664), 64-bit
(1 row)

bsnyder=#

And we're good to go!

UPDATE: For those who want a nice seamless experience stopping/starting Postgres via a Mac OS X preference pane, check out Preference Pane for administering PostgreSQL on Mac OS X . It is configurable so there is no restriction on where PosgreSQL is installed.

03 August 2011

Courage Classic Charity Ride 2011, Even Better Than 2007



Every year I ride in a three-day cycling event in the Colorado Rocky Mountains named the Courage Classic. I participate in this ride every summer because it benefits the Children's Hospital Foundation, a wonderful cause that directly benefits many kids with life-saving care. To find out more, check out the website.

In 2007, I wrote about riding the Courage Classic with my oldest daughter. That was a wonderfully proud moment for me as a parent. But this year was even better.

For months now, my youngest daughter has been talking about riding the Courage Classic family day this year. We were never sure if she would actually do it or not, but we worked up to it by practicing and kept encouraging her. Not only did she ride the same little single-geared bike that her older sister rode over the 33 mile course from Copper Mountain to Breckenridge and back, she did it a year earlier -- and she's only eight years old!!! What really drove her, I found, is that she is one year younger than her older sister when she rode it for the first time. Ah, sibling rivalry has its positive moments. All along the entire course, people cheered her on and she got the biggest thrill from it.

Not only did my eight-year-old ride for the first time, so did my wife and she did great. She's typically a runner and only likes casual bike riding, so I wasn't sure how it would go. A few days beforehand, I took her around Turquoise Lake near Leadville, CO (which is about 10,000 feet of elevation) as a training ride. She was not too excited by this choice as the last training ride for her, but she did admit that it helped her prepare and she really surprised me.

So I got to ride with both my daughters and my wife on the second day of the ride this year. A memorable day indeed!

02 August 2011

The iPhone is Not a Submarine But Apple Made My Day



This morning I got up at 5am to ride up Flagstaff Mountain with a friend. Soon after I got up I dropped my iPhone in water, totally submerging it. Great. What a wonderful start to my day. Obviously this rendered the phone completely dead. Excellent. So I rode this morning with my old iPod Shuffle, so that wasn't a big deal. But I didn't have a clock so I took my wristwatch and put it in my jersey pocket.

In my second hour of riding I pulled the watch out of my jersey pocket (pockets are on the back of a bike jersey) and I dropped it on the rode. When I circled back and picked it up, I realized that one of the pins had bent and needed to be replaced. Not a big deal really as I've had this happen many times over the years. And there's a jewelry place right near the Apple Store I typically use. Still, that's strike number two for the day. I rode the third hour just waiting for the third bad thing to happen, but it never did.

I just returned from the Apple Store and I'm glad to say that I was quite happily surprised. This phone was covered under AppleCare but it doesn't cover dropping your phone in water. Matteo at the Flatirons Crossing Apple Store informed me that Apple has a policy of leniency when it comes to your first major accident with your iPhone so he was able to basically give me a get out of jail free card and save me $200 (the cost of replacing an iPhone 3GS). What a surprise!!! I was prepared to pay the cost of replacement and be on my way. So I was very pleasantly surprised.

As Matteo was filling out the necessary forms for the replacement, we chatted a bit. He asked me if I upgraded to Mac OS X Lion yet. I explained that I had not because I was speaking a conference in Portland last week and I didn't want to chance any issues with my laptop until that was done. This led him to asking me more about speaking at conferences and what I do for a living. After explaining that I'm a software engineer at VMware, his response was, 'We all love VMware Fusion!" I agreed and explained that I use it often for testing and running other operating systems on Mac OS X. He said that folks inside Apple really prefer VMware because it's so reliable, which was nice to hear.

Before leaving, I asked Matteo to help me find the AC adapter that plugs into the end of a USB cable. I left one in my hotel room in Portland last week so I needed to replace it. Unfortunately you cannot buy just the AC adapter, you must buy a new USB cable as well. But Matteo said, 'Hold on a minute, I'll be right back.' A minute later he returned with the very AC adapter I needed and said, 'Here you go, free of charge. Because you work for a cool company that we love. And I can see that you need a change of luck today." Wow! Yet another pleasant surprise!!! I think this might be a good day after all. Thanks, Matteo!

12 July 2011

Triple Bypass 2011



On Saturday I rode the legendary Triple Bypass. Although this is the 23rd year of the event, this was my first year to participate and I completed it in 8h 10m riding time and I actually felt pretty good afterwards.

The weather forecast called for thunderstorms throughout the day along the entire route. But I had a good run of luck and it didn't rain for nearly the entire day save for some sprinkles here and there. This was my biggest worry because once you are soaked your core gets cold, it's very difficult to warm it up again (I've experienced this before and the only thing that can warm me back up again is a big, hot cup of tea in my water bottle).

The Triple Bypass begins in Evergreen, CO (elevation: 7,220ft) and goes over three mountain passes:
  1. Juniper Pass, elevation: 11,130ft
  2. Loveland Pass, elevation: 11,990 ft
  3. Vail Pass, elevation: 10,617 ft
These make for over 10,000 feet of elevation gain through the day. Although I had a riding jacket with me, on both Juniper and Loveland passes, I could see my breath and I was shivering, so I stayed only long enough for a bio break, bananas and water, then I took off again (except for Loveland Pass where there was no aid station). The ride ends in Avon, CO making the total mileage 120 miles (check out the route map).

By the time I made it to Copper Mountain and started the ascent up Vail Pass, I realized that my time was cutting short -- I had paid for a shuttle ride back to my car in Evergreen and it was scheduled to depart Avon at 5pm. So I didn't take it easy going up Vail Pass and I made it to the top at 3:55pm still with about 32 miles to go. After waiting in line for a bio break, and refueling as quickly as I could, I left the top of Vail Pass at 4:09pm. I pushed it all the way down the west side of Vail Pass and continued all the way through Vail, CO. I was lucky enough to hook up with another dude and we wound up taking turns drafting for one another, hammering the entire way. Just beyond Vail but before Beaver Creek, CO, my legs began to give out a bit, so I had to ease up some. At that point I tucked in with a group of four other riders and drafted again. But to keep up with them I had to muster the last ounces of power I had left in my legs to raise my cadence a bit to keep up. As we sailed through Beaver Creek, I was counting down the miles, just hoping that I was going to make it (I hadn't checked the time since I departed Vail Pass). We pounded on to Avon, around the corner to the finish and I stood up to drive it home.

I immediately saw the transportation tent and headed there. Upon checking in, to my surprise, I found that I had actually made it - the bus had not yet departed back to Evergreen! As I checked in I looked at the time and it was 5:11pm. I had covered just over 30 miles in 1 hour! Although it was mostly downhill, it was still a tremendous amount of work after a long day, but I made it! I only had time to grab my bag from the luggage truck, no time for a bio break or even to grab water or food and the bus was off, headed back to Evergreen.

As we crested Vail Pass, all of us on the bus were noting the number of riders that were still coming down the west side of Vail Pass and still climbing up the east side. Just then, the clouds suddenly opened up and it was an utter downpour. One bus companion said, 'Better them than me, dude!' My comment was, 'Oh that sucks bad, I've been there before!' because I have been caught in the same spot in another event twice during a downpour, so I know from experience that that meant downright misery.

After dozing on the bus ride back, I picked up my car, stopped to gobble down a burrito and headed home. My wife was sorry that she and my girls could not be along the route at various locations throughout the day for mental support as they usually are, but I understood and knew ahead of time that they couldn't be there. She asked me if I'd do it again and my response: 'Yes, definitely!' What a ride in the beautiful Colorado Rocky Mountains!

BTW, there were many riders I spoke to during the day who were doing the inaugural Double Triple Bypass. That is, on Saturday you ride 120miles from Evergreen to Avon and then on Sunday you turn around and go back. Maybe I will consider doing that next year, we'll see.

08 July 2011

Commercial Vendor Spreads FUD About ActiveMQ



It has come to my attention that a particular commercial integration and messaging vendor is actively spreading FUD about ActiveMQ.

In an official letter that was sent out yesterday, this vendor called out numerous aspects of ActiveMQ, claiming that each is a problem with ActiveMQ and their product 'resolves all of these issues'. Only one of the items mentioned in the list holds any merit. So let's first take a look at the letter and then I will address each item in turn:

Here is the official letter that was sent by the company's media relations:

============================================================
<quote>
From: Fiorano Software
Date: Thu, Jul 7, 2011 at 6:22 PM
Subject: Graduating from ActiveMQ for Enterprise Class Messaging

Dear Joe ,

If you are an ActiveMQ user, you may very likely be experiencing some or all of the following issues:

1. Poor Performance or limitation on speed - particularly for persistent queues and topics.

2. Stability issues or loss of messages, specially with clustering enabled.

2. Poor Documentation - difficult to quickly find what you're looking for or even with paid support you are unable to troubleshoot the problem.

3. Poor Reliability - when a broker goes down, do clients auto-reconnect when the broker comes up again?

4. Inadequate Technical Support - No clear directions/answers from Technical Support - for instance, if you wish to perform memory tuning, do you get clear instructions promptly?

5. Inability to handle "peak loads" - when there's a peak-load condition, does the broker tend to fail?

6. Scaling only with new hardware?

FioranoMQ resolves all of the above issues. With Fiorano, you have the best performance in the industry (for both queues and topics, persistent and non-persistent), responsive and accurate technical support, proven reliability, solid documentation and enterprise-class scalability — all of which adds up to dramatically reduced development and deployment times, with a maintenance cost lower than that of ActiveMQ and other open-source offerings.

To get started, download FioranoMQ now, at http://www.fiorano.com/downloads/login.php?prod=fmq
or contact us via email or phone to get more information.

Regards,
The Fiorano Team
info@fiorano.com
+1-408-354-3210

</quote>
============================================================

Just so you are clear, I did not write this letter. It is an official message sent out by the commercial integration and messaging vendor. Not only has this vendor posted the message on their website:

http://www.fiorano.com/newsletters/ActiveMQ_Issues_July_2011.html

They even tweeted about it:

http://twitter.com/#!/FioranoGlobal/status/89193558032134144

(Yes, I know those are not live URLs. I refuse to provide a live links to be picked up by the Google spider.)

So now let's walk through each point in this message, providing some discussion as we go.

Claim #1: Poor Performance or limitation on speed - This is rather broad statement and I'm sure that's on purpose. The idea when spreading FUD is to be as broad as possible. This way your statements can act as a catch-all for any problems that a user might be experiencing and loop them in based more on emotion rather than fact.

ActiveMQ can certainly provide poor performance if it is not configured correctly. You can do the same with any software that is not configured correctly. From time to time, I have dealt with performance related issues with ActiveMQ on consulting engagements. As I comb through configurations and code to take a look at a situation, many times I find that either the broker or the client are not configured correctly or there's something about the user's code or application design that plays into this scenario. Occasionally a user has asked about providing a better configuration out of the box for ActiveMQ to address a given problem. The answer is that we already do -- ActiveMQ distributions provide a configuration out of the box that should support middle of the road use cases. Problems arise with specific use cases or in a specific environment, etc. There are far, far too many use cases to provide a single configuration that will work with anything anyone might ever dream up.

Claim #2: Stability issues or loss of messages, specially with clustering enabled. - Loss of messages? Really?! Do you think if ActiveMQ actually lost messages that it would be as popular as it is? But blaming the clustering is ingenious for one single reason -- most users don't know enough about the ActiveMQ clustering that they are apt to believe that this claim is true. The only scenario where a user might perceive that messages have gone missing is one where messages get stuck on a particular broker in the cluster. Again, configuration plays a big role in getting clustering set up correctly as does proper application design.

Claim #3: Poor Documentation - This is the only claim that holds any truth, but it's only really half true. The ActiveMQ documentation is certainly lacking. However, the ActiveMQ website does hold a wealth of information. The real problem with it is finding what you need. Although some vendors who provide support for ActiveMQ have attempted to provide improved docs (e.g., notably the documentation for the Fuse Message Broker). This is exactly why Rob, Dejan and I wrote a book about ActiveMQ titled ActiveMQ in Action. We're quite proud of the book because it does provide markedly better documentation for ActiveMQ. If you need better info on ActiveMQ, pick up a copy.

Claim #4: Poor Reliability - when a broker goes down, do clients auto-reconnect when the broker comes up again? - This particular claim makes it clear that this vendor has little to no knowledge of ActiveMQ. This is exactly why the ActiveMQ failover transport was created. In short, the failover transport provides a JMS client automatic reconnection in the event that an ActiveMQ broker goes down or just becomes unreachable. The failover transport is extremely configurable in order to deal with many different scenarios including the ability to delay the initial reconnection, to set a max number of reconnect attempts, to exponentially increase the wait period between attempts and much more. In the ActiveMQ 5.4 release, the failover transport introduced a new feature to provide automatic cluster updates and broker rebalancing to JMS clients. The failover transport is highly powerful and strongly recommended, so I'm surprised that this was overlooked.

Claim #5: Inadequate Technical Support - Based on the vendors listed on the ActiveMQ support page, there are now at least five companies providing support for ActiveMQ. And I even know of a company that provides support which is not listed there, Savoir Technologies. If you are paying for ActiveMQ support and you are not happy, I encourage you to either speak to your vendor about it or find one that works better for you.

Claim #6: Inability to handle "peak loads" - This is a claim against ActiveMQ that I have never once heard from a user. They are essentially asking you if at the time where your business experiences a spike in the amount of messages it is handling, does ActiveMQ fail on you. Yet again, if you are truly experiencing this, then you need to take a serious look at your system design. I have helped many customers successfully address issues of scale through a number of means including some intelligent sharding of JMS client connections across a cluster of ActiveMQ brokers, use of a virtual IP address and even use of a load balancer. If ActiveMQ had a habit of failing for users during peak loads, I would have heard about it at least once.

Claim #7: Scaling only with new hardware? - This claim is similar to claim number 4 and really makes it clear to me that whoever compiled this list is not familiar with ActiveMQ. Did they bother to search the ActiveMQ site? Here is just one page on the site from the FAQ titled How do I configure 10s of 1000s of Queues in a single broker ?. Furthermore, Rob, Dejan and I clearly explain how to scale ActiveMQ both vertically and horizontally in our book. Again, this really depends on the situation and the environment, there is no single silver bullet solution.

Addressing each of these claims was actually quite easy for me to do. And I hope that each of the vendors providing professional consulting services and technical support for ActiveMQ are aware of the tactics being used by this commercial integration and messaging vendor. It sounds to me like ActiveMQ has become a real threat to this vendor's business.

I will leave you with a quote:

"First they ignore you, then they ridicule you, then they fight you, and then you win."
— Mahatma Gandhi

05 July 2011

Favorite Rides Around Boulder, Colorado


A couple of the my favorite training rides here in the Boulder valley area include the climb up Flagstaff Mountain and the climb to Ward, CO. Neither of these rides are anything that you can just walk out your front door with zero preparation and expect to enjoy. But with the proper training, I really love being out riding these routes and being outdoors. On Saturday I did Flagstaff Mountain twice and on Sunday I rode to Ward in an effort to train for more difficult upcoming rides in the Rocky Mountains.

I always start at my home in Louisville, CO, so that always adds a sort of warm up of about 10 miles to get to the base of Flagstaff Mountain, so round trip that's 20 miles. Then the climb up Flagstaff which is always great. As you can see in the linked info, there are two parts to the climb. The first half of climb goes to the amphitheater park where there is an amazing lookout over the Boulder valley and that is considered a Category 2 climb. The second half goes up to the top of the mountain and is considered a Category 1 climb. Here is some more information on the Flagstaff climb from the 303cycling.com website (run by my friend Kris Thompson). As Kris has termed it, the climb up Flagstaff is definitely a Boulder classic! I tend to climb to the amphitheater park more often than I go to the top and I always do this climb two or three times when I ride it (climb to the amphiteater, go back down, climb to the amphitheater again, etc.). The second half of the Flagstaff climb is definitely not for the faint at heart, it's a killer. Average grade is a whopping 11% -- 2142ft. of climbing in a little over 5 miles! If you need water on this climb, you need to make sure to stop at Chatauqua Park at the base either on the way up or the way down, because there's nothing up on top but homes.

On a sidenote, there is another ride I do on my mountain bike that is called Super Walker. This ride includes riding to Flagstaff, climbing all the way to the top of Flagstaff, going down the back side to the Walker Ranch trailhead and around the trail, then back up to the top of Flagstaff and all the way down to Chataqua park and back to Louisville, CO. The ride itself takes around four hours if I recall correctly. I did it three times in the Spring right after I got a new mountain bike. But then I experienced a couple of soccer injuries that set back my training and I haven't ridden it since then. I have kinda been waiting to get past the Triple Bypass ride next weekend before I do this one again. The ride to get to Walker Ranch is about 20 miles, so round trip that's 40 miles and the Walker Ranch trail itself is 7 miles. Add in the climbing and elevation gains and you've got one hell of a mountain bike ride. (A neighbor asked me last week if this climb is more difficult on a mountain bike or a road bike. Because of difference in gearing between a road bike and a mountain bike, the Super Walker ride is definitely much more difficult on a mountain bike.)

Another favorite climb is up Lefthand Canyon to Ward, CO, about 20 miles west of Boulder. Ward is a former mining settlement near the Peak-to-Peak Highway (SH 72) with a population of under 200 and a little general store where all the cyclists stop. The general store carries snacks, ice, water and has a port-o-let toilet that is paid for by donations, so drop a couple bucks in the kitty on top of the water cooler when you're there. Just to get to the start of Lefthand Canyon road is about 20 miles, so that's 40 miles round trip. Then up the canyon to Ward is about another 16 miles -- all of which is climbing and that last mile is atrocious! So the distance is not too bad and the grade of the climb is not too bad, but the climb is constant. So the mileage plus the 16 miles of climbing makes for one tough a workout!

I know that many other folks in the area do these rides as well, because I see many people when I'm out. But I tend to do them alone just because it's difficult to work out schedules with others. I like to ride in the morning before the heat kicks in because, once it does in the afternoon, my fluid and food intake really increases. I have also done other rides throughout the area, but these tend to be a couple of my favorites, mainly because they're practically in my back yard.

01 July 2011

New Cobb Cycling Saddle



After dealing with numbness that began last season during long rides on my road bike, this week I'm in the process of testing out a new saddle.

My previous saddle (a Selle Italio San Marcos) was causing severe numbness after long rides which obviously is not good. Evidently it wore out to the point that it was a hazard, though it never did fit me that well. After looking around at online many different saddle recommendations in forums, blogs, etc., I couldn't find any consistency anywhere. I saw so many recommendations for so many saddles I didn't know where to start. So I decided to head over to Colorado Multisport to see what they might recommend. I have trusted their recommendations in the past and they have served me well.

After trying a few saddles that didn't thrill me at all, Geoff pulled out a brand that was new to me -- Cobb Cycling. I tried a few models and found that I really liked the Cobb Cycling SHC. Of course it's difficult to determine in a 10 minute period while spinning on a trainer if a saddle is right for you, so I checked out the saddle for the week and I've been riding it ever since. Let me say that after dealing with the previous ill-fitted saddle for so long, it has been a pleasure to ride this saddle.

I learned a few years ago to never, ever go out riding without at least one extra tube (if not two) and air cartridges. Presumably you may need a tube if you experience a flat (patching a road tube is near impossible because they're so thin), the second tube I refer to as a karma tube because I have given away a few to other folks who I come across who are stranded with a flat and no supplies. I prefer to carry air cartridges because they are smaller and so much more reliable than a pump. I never had a good experience with a travel pump, so I tried cartridges and never looked back. So the only question I had left about this new saddle was about a bag to carry the all important tubes and air.

CMS had no recommendations and searching online rendered no recommendations. So I decided to call Cobb Cycling to see what they might recommend, especially since the Cervelo seat post is a tear-drop shape instead of a round shape. I figured I'd speak to a sales rep or a mechanic type who might be able to offer me something. About 30 minutes after leaving a message, surprisingly, John Cobb himself called me back. Although he didn't have a solid recommendation for a specific bag, he offered me a couple tips from his experience in fitting Cobb saddles on Cervelos.

Thanks for taking the time to speak with customers, John!

28 June 2011

Boulder Sunrise Century



A couple weeks ago I rode the Boulder Sunrise Century. This was the second year I rode it and this year was a bit different than last year.

Last year I chose to ride the 100 mile option. This added an extra 25 miles between Ward, CO and Nederland, CO. It's a long downhill which means that the climb back up from Ned to Ward was quite difficult -- I'll be honest, it was GRUELING!. Unfortunately this year my training schedule leading up to this event was not optimal. I was not training consistently because life got in the way. Because of this, I chose to do the 75 mile option instead of the 100 mile option. This was a good choice but even that was not enough latitude because I battled leg cramps for about an hour in the middle of the ride to Ward. Once I hit the aid station in Ward, I downed three bananas, tons of liquid and kept going. From there it's 20 miles of downhill so I had some time to tuck in behind a couple of very strong riders and fly for the entire 20 miles. After downing some food and hitting such a long downhill portion, I felt much better and was able to finish in much better shape. Let's just say the results of this event motivated me ;-).

Since that event, I have gotten into a consistent summer training regimen. Being that my next ride is the famed Triple Bypass, I knew I needed to get my butt in gear. 120 miles over three mountain passes in one day requires it! More on that ride in another post.

08 June 2011

Ben Harper Live in Denver, CO



Last night Matt Good, Matt Raible, Trish and I went to see Ben Harper with Relentless7 in Denver and it was an incredible show!

I haven't seen Ben Harper in a few years and the last time I did his original band, The Innocent Criminals, was playing with him. They were an amazingly talented set of musicians that I had already enjoyed for many years on their records. So I was pleasantly surprised at the caliber of musicians who is Relentless7. This show was so good, and Ben Harper was so outstanding, it was like a religious experience! The crowd and the band enjoyed the show so much that they came out for three or four encoures which is fairly unheard of in the live music scene.

Now I'm looking forward to our next show at Red Rocks in July, Soundgarden.

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!