Simplify

Simplify: Ten Practices to Unclutter Your Soul

I grabbed this book while attending the Global Leadership Summit earlier this year and read it a couple of months ago.  Having heard Bill Hybels speak before, I know he does a good job at sharing practical advice on the podium, but he does a great job of it in the book as well.  He really challenges you to think about why you might be overworked and struggling to have true work/life balance.  This is actually a book I plan to read again, because I am sure a refresher will be necessary for me down the road.

RabbitMQ Configuration via Rake Task

I recently wrapped a Ruby on Rails project in which we were leveraging RabbitMQ as the message broker.   We wanted a quick and easy solution to manage the configuration of the exchanges and queues for deployment.  Since the developers on the team had the occasional need to leverage RabbitMQ locally it made sense to combine those solutions into a rake task.The task leverages the RabbitMQ command line interface (CLI) which gives you the ability to accomplish most anything.  The problem is that most of the team were not well versed in RabbitMQ and didn’t need to be, so to make it simple I first created a ‘rake rabbit:setup‘ task that would pull down the CLI script and place it in the proper path for execution of the remaining tasks.  This only needed to be executed once and they were good to go.
Configuration
To start, I wanted to make the configurations quite simple and familiar to the team so the rabbitmq.yml file was born.  The rabbitmq.yml file allows for configuration of exchanges, queues and bindings between them.  As you will see in the example gist below, you specify the user and password for RabbitMQ.  Exchanges can define all available types, identify an alternate exchange and whether the exchange is internal or not.  Queues allow for simple definition of just the name to including the expiration time and dead letter settings.  Bindings tell an exchange and queue about one another and their relationship.  You can also add a host configuration entry and modify the base command in the rake task if you are interested in configuring a remote RabbitMQ server.
Execution
To configure the system with the CLI is pretty straightforward, you can simply export the rabbit configuration to a JSON file using the ‘rabbitmqadmin export rabbit.config‘ command, make your changes and import the configuration file using ‘rabbitmqadmin import rabbit.config‘.  The problem is that if you change an existing exchange or queue those changes are ignored.  To work around that problem, I added that ability to delete exchanges and queues so that a fresh configuration would allow for all configurations to be the latest and greatest. You are probably thinking, what about existing messages, if you delete a queue with messages in it you are going to lose data, what kind of solution is that?  Well, relax if you call the delete queues or delete all, which deletes queues and exchanges, it will only remove those queues that are empty and warn you that some queues have messages.  So you can then act on those queues with messages and repeat the delete action to ensure all is well.  If you are not worried about existing messages and data loss you can easily delete the queues containing messages by running ‘rake rabbit:delete:queues_by_force‘.
In the long run, I am confident that the task can be improved upon, but it is a great starting point to incorporating a configuration based management of RabbitMQ.
To use this with your Rails project, you will want to download the gist  (https://gist.github.com/4233924) and place the “rabbit.rake” file in your lib/tasks directory.  The tasks expect a yml file, also part of the gist which should be placed in config/rabbitmq.yml.
Rake Tasks
A quick review of the tasks available and their usage.

rake rabbit:setup# Prepares the current system to be able to run the rabbit rake tasks.  It must be run before you can execute any of the other tasks.  

rake rabbit:configure# Configures Exchanges, Queues and Bindings based on config/rabbitmq.yml

rake rabbit:delete:all
# Deletes all Exchanges and empty Queues within RabbitMQ

rake rabbit:delete:exchanges
# Deletes all Exchanges within RabbitMQ

rake rabbit:delete:queues
# Deletes all empty Queues within RabbitMQ

rake rabbit:delete:queues_by_force
# Deletes all Queues (and messages) within RabbitMQ

Configuration
The rabbitmq.yml file allows for configuration of exchanges, queues and bindings between them.  As you will see below, you specify the user and password for RabbitMQ.  Exchanges can define all available types, identify an alternate exchange and whether the exchange is internal or not.  Queues allow for simple definition of just the name to including the expiration time and dead letter settings.  Bindings tell an exchange and queue about one another and their relationship.
The gist

Speaker Lessons

I have had the opportunity to work on both sides of the speaking realm as both a regular speaker and event organizer. Over the years, there have been a number of interesting incidents which lead me to write this post. For the most part, I believe the majority of aspiring speakers behave professionally, but there are definitely those who don’t fit the bill. I thought I would share a few stories and some takeaways. This is certainly not a full list, just something that hit me as a valuable post for those who plan to be a speaker at different events. I have excluded any names from the stories to protect the guilty and avoid making someone look bad.

Once there was a keynote speaker that provided an abstract that sounded great. The abstract talked about how things had been in the past, what we have done to make things better and the bright future ahead. All was well with the world until the speaker started talking. The keynote content was one of the most boring and disliked sessions in the history of the event. Attendees were blasting the speaker and his illustrious keynote on Twitter as the blather continued to spew. I was in the back hallway crouched down by the floor with my head in my hands wishing for time to speed up so he could be finished and get off the stage.

LESSON TO SPEAKERS:

  • Your abstract is not just a quirky little paragraph to make people think you are witty and come see your session. It is a tool for attendees to determine what content makes sense for them and if the content doesn’t match the abstract you have missed the point. Make sure your abstracts are clear in what the intent of the session is and who should be there as well.
  • Know your audience, if you are going to present content that is focused on a specific audience be sure to indicate that in your abstract. Additionally, look at the event to get a feel for whether the attendees will be interested.

I was once contacted by a speaker the week of the conference letting me know that a family health emergency had come up and they could not attend. Obviously, I was understanding and cancelled their sessions with my hopes that all would work out well. Then one of the conference staff members mentioned that the speaker just posted on a popular social networking site how great their vacation with their family was going. After a quick look, the speaker was indeed having a wonderful time with their family, which is great for them. I don’t care that the speaker was on vacation and would have understood if he had been honest. Why did the speaker feel the need to lie? Who cares, the fact is that they didn’t have the courage to be honest.

LESSON FOR SPEAKERS:

  • Don’t lie to organizers about why you can’t make it to the event. You show your character, or lack thereof, and it will be remembered. P.S. We can use Twitter and Facebook too. ;)
  • When you are accepted as a speaker, put it on your calendar and manage other activities around it. If a priority comes up, immediately notify the organizers so they can make alternate plans.
  • Do everything possible to be there if you can, don’t think that it isn’t a big deal to cancel because it can wreak havoc on organizers. I have had last minute cancellations in the past, but did everything possible to find a replacement beforehand so it wasn’t on the organizers plate.

I remember a time when a speaker showed up to the conference asking for a session to be delayed so they could finish up their presentation. After giving them the schedule change, they asked again saying that they were not able to get it 100%. We rescheduled again, but the speaker didn’t show up to their session and instead attended an Open Space session. When I found the speaker it was nothing but excuses. The problem here was that the speaker had no understanding of the impact their actions had on attendees. People had really wanted to learn what the speaker said they were going to present.

LESSON FOR SPEAKERS:

  • Get your content together for sessions that you have committed to deliver before the week of the conference. Tweaks and updates are fine, but it is always difficult to get a quality session together without the proper time.
  • If you won’t be ready for your session, let the organizer know immediately to give them an opportunity to make alternate plans before it is too late. It happens, but there are always options like having another speaker who knows the content help you out with one of their sessions.

During one event we had a visiting speaker from a major software company who gave a session at the conference. Unfortunately, they left their luggage in one of the rooms which we locked for security purposes while the closing keynote was going on at the end of the event. So we sent the speaker and a volunteer down to wait for security to bring the key. Security took their sweet time getting there and I arrived at the room to find the speaker and volunteer having a cordial conversation. Once I approached them the speaker said something regarding me saving him from listening to the volunteer talk anymore. While he meant it as a joke, his personality (kinda Prima Donna) came across as an insult to the volunteer.

LESSON FOR SPEAKERS:

  • Just because you are an expert in your field, doesn’t mean you are a better person than anyone else. Check your ego at the door and be watchful of how you treat others. Speakers are highly respected by most people and should act professionally in all their activities. This seems to be a major problem with some speakers who have Huge Ego Disorder (HED) also known as having a “Big HED”. That was me being witty. ;)

Another interesting time was when a speaker had two of the most popular sessions at the conference. During his first session there were over 100 people in the room, but the speaker was nowhere to be found. Finally, before his second session was set to begin the speaker leisurely arrives at the conference announcing his presence. I informed him of the issue with the earlier session and he explained that the schedule indicated it was in the afternoon. He was correct, except that was not the actual schedule, it was the tentative schedule from over a month earlier. Updates were sent to speakers about the final schedule before we printed the guides, which he obviously didn’t pay attention too.

LESSON TO SPEAKERS:

  • When a conference organizer sends you an e-mail, READ IT
  • Always check the schedule online the week and night before an event. This ensures you are always on time and don’t cause the organizer a problem.

Now I would like end on a positive note which is one of my favorite stories ever.

Once there was a speaker who didn’t show up to his session or even the conference. Unfortunately, I was unaware that the speaker was not present because his speaker badge had gotten misplaced. So around 30 people sat patiently in the session waiting for the speaker to arrive for around 5-10 minutes after start time. Another speaker who was in the room because he wanted to hear what the scheduled speaker’s thoughts on the topic decided to take action. He strolled to the front of the room, introduced himself and let everyone know he was willing to discuss the topic if they were interested. With no presentation and everyone’s agreement he delivered a great session. At the end of the session, I was grabbed by an attendee who raved about the opportunity to hear this speaker and other attendees shared the same thoughts later. Now that is amazing!

LESSONS FOR SPEAKERS:

  • Be on the lookout for opportunities to help out at an event. The people in that session were talking about it months later and they also learned about the topic of interest.

Hopefully you would never be a part of the negative stories I shared. There are plenty of other instances and lessons that I have learned as an organizers to battle these problems as well. In the end, a speaker must have respect for the organizers/attendees and their commitment. I hope these stories will spark some thoughts about your pursuit of being a good speaker. Obviously, there are many more stories I could share and lessons to be learned. If you have a good one, please feel free to post them. Remember I am a speaker too, so it is always good to see where I can make improvements.

Atlanta Code Camp

This morning I took a short trip down to Marietta, Georgia for the Atlanta Code Camp. I was able to attend this event a couple of years ago, but only for a short visit. It was a great event and looked to be packed. My first session was more of a soft skills talk geared toward people who are interested in being a consultant and starting their own business. There was a great crowd and some excellent insights. Most notably was regarding marketing yourself.

One of the attendees mentioned attending a baseball game with a handful of business cards, then throwing the cards in the air when a big play was made at the game. He said afterwards he got a couple of phone calls from people who found his card and a job opportunity. Amazing!
Below are the slides, which are unfortunately not as enjoyable without a group of folks sharing their experiences.

A New & FREE .NET Decompiler

Today I was pleasantly surprised to learn about a new .NET decompiler that is currently in Beta release. It is called JustDecompile and developed by Telerik as a stand alone decompiler application. The best part is that JustDecompile is offered for free which is a great opportunity for those who are not able or willing to purchase Reflector once the free version stops working after May 30, 2011.

Since this is a BETA product it might not meet everyone’s needs yet. For example, it currently decompiles to C# (nothing wrong there), so if you are VB.NET developer or like viewing another language you will have to wait. The current plan seems to be regular automatic updates throughout the BETA period and a planned 3 major releases once the product is ready for prime time.
Reflector has served me well and my hope is that a well backed competitor in this area can only make both tools better. I will definitely be giving JustDecompile a few looks and see how this tool is going to work out.

Reflector – Not free anymore?

Today it was announced that Red Gate Software would begin charging for .NET Reflector with the version 7 release. The announcement triggered a flurry of Twitter activity from several developers who have enjoyed use of Reflector for many years. Reflector was developed and maintained by Lutz Roeder until 2008 when he transferred ownership to Red Gate. From the beginning Reflector was provided as a free tool to the development community. When Red Gate assumed ownership without making any commitment (or obligation) to keeping Reflector free, they continued to do so until the proposed May 2011 release of version 7.

Why all the uproar?
In my opinion, this is a perfect example of people feeling like they deserve to have something when they have done nothing to deserve it. Lutz could have easily charged for Reflector when he was working on the tool, but decided not too. I along with many other people would have been willing to pay a small price to leverage Reflector. It was a huge help for me when I started working on WPF and there were no books on the market. It was his code and his perogative to offer Reflector for free. Now the code belongs to Red Gate and in order to really commit their developers they are going to ask for $35 for a perpetual individual license. I guess they could ask their people to work for free, but I doubt they would. Would you?

Do I like the decision? NO, but I understand that companies can’t do everything for free. Think about it like this, go to your local grocery store and most of them will have free cookies for kids at the bakery. Let’s say you take your kid to the store everyday for a free cookie for 6 or 7 years until the store discovers they need to pay the baker. So they ask you to pay $1 for a membership card for your little cookie monster to get cookies. Now ask yourself, do you have a right to the cookie? Will you go on Twitter and say the grocery store is the scourge of the earth? I certainly hope not. I have used Red Gate tools for years and have been pleased. While I am not happy about the decision, I don’t fault them and they haven’t violated any sacred trust.

Caveat
Where I would find concern is if the rumor, and I haven’t seen any documentation supporting this claim, that you would not be able to use the last free version once version 7 is released. There would be no reason for Red Gate to keep users from being able to use an unsupported and feature frozen version of the free tool that exists today.

iPad – Week One

Last Saturday, I received the new Apple iPad delivered to my door. That’s right, I didn’t sleep outside any stores like so many others. Now that I have had a few days to work with it, I felt the urge to share some thoughts.

image

First Impressions

The first thing that caught my attention was the clarity of the display. It renders beautifully and is very easy on the eyes. Whether viewing web pages or a book in the iBook application, the iPad definitely has a remarkable screen. I think the next most noticeable feature for me is the performance. The iPad is extremely responsive and the smooth transition between landscape and portrait views is the most obvious way to observe it. That being said, my iPhone demonstrated great performance when I first purchased it as well, but has become considerably more sluggish over time. I will be watching that closely.

Question: “Isn’t it just a big iPhone/iPod Touch?”

While the general look and feel is identical, but size does matter in this instance. Remember that those were devices that were all about mobility, the iPad (in my opinion) is more about entertainment with a little productivity on the side. Little screens aren’t very good when it comes to reading and watching movies. Even more important is the ability to type and as Todd Anglin so nicely put it “It’s like an iPhone that finally fits your fingers”. Thanks Todd

image

I had the chance to take this little gem with me on a flight earlier in the week. I thought a quick comparison to a laptop on a plane would be a good field test.

Laptop

iPad

Can be bulky unless it’s a netbook, but still not quite the same

Light weight and reasonably sized.

Startup time wastes time and battery life

No startup time, no problem

When the person in front of you puts down their seat you have to bend down to see the screen.

Easy to handle and hold, no worries about putting that seat back. Can easily lay it on the tray.

Battery life not so hot, probably 3 good hours unless you start turning on power saver options.

Battery life was not an issue for 6 hours of travel time. Still had plenty when I arrived at the hotel.

Watching movies, games and music. All good, but back to battery life and the pesky person in front of you who likes to recline

I have 5 movies on my iPad, several games and all my music. I watched a movie each way on my trip, listened to music and squeezed in a couple of games with no impact to battery and a great picture.

Will start to get hot after a while and planes aren’t the coolest place on earth. UGH!

No heat issues at all, even holding/resting it directly in the hand for hours.

I can code on it

I CAN’T code on it

Applications

image The iPad has tons of applications, but a couple of useful productivity applications called “Pages” and “Numbers” are the big thing for iPad. These are Apple’s versions of Microsoft Word and Excel. I liked using both of the applications on the iPad. I used Pages for taking notes which was great just hit the button and tap and I can start capturing information. Numbers was not bad, but there is nothing like Excel to work with spreadsheets. It would be good for capturing some information while out of pocket though. Need a way to pull them back over and into Excel, now that would be productive.

In Summary

So overall I think the iPad is a great device for entertainment and it can help from a productivity standpoint as well. It does not replace a laptop and I don’t think that was Apple’s intention anyway. It is a nice piece of technology and has some great uses, but a laptop has all the bells and whistles and the iPad just doesn’t yet. The size is right and the price is high, but if you already have a laptop it can be a great companion.

I see some potential as a good field platform for enterprise applications (with 3G, of course). Unfortunately it looks like Apple is going to screw that up with their recent change to the Developer Program License Agreement which potentially excludes applications built by MonoTouch, Unity3d and other non-Apple tools. Smart move Apple, hope you come to your senses.

DEVLINK 2010 – Allowing voting on sessions

I am amazed that it is already March and the amount of time for getting DEVLINK 2010 is shrinking quickly. This year I thought it might be nice to open things up a little bit and let the community help drive what sessions make the conference. To be completely honest, it gets tough reviewing so many sessions and trying to find the best fit and balance, so why not share the workload. Of course, voting is only one component of how sessions get selected, in the end it will fall on us to make the deciding factor of what sessions can make the schedule. I really like the StackOverflow model of voting up or down which is why we went that route. If you are planning to attend the conference, please take a moment to check out the sessions and cast your vote on what you would like to see.

Community Events of Note

With 2010 already well underway, a new list of community events is building up.  Of course, devLink will be happening August 5 – 7 in Nashville, but I am going to be at a couple of others and wanted to bring them some attention. 

January 20th, Nashville, TN – A lap around PDC featuring Steve Ballmer
Microsoft is putting on a one day event in Nashville with Steve Ballmer, CEO of Microsoft doing the keynote.  This is a summary of some of the content that came out at PDC in 2009, so it should be very informative for those using Microsoft development platforms and tools.

January 21, Murray, KY – Western Kentucky .NET User Group
I have been given the honor of being the inaugural speaker at the Western Kentucky .NET User Group in Murray, KY.  I will be presenting on Effective Interface Design.  If you are in the area please come by for the kickoff meeting of this new group.

January 23, Mobile, AL -  Alabama Code Camp
This is my first time going to the Alabama Code Camp, but the lineup looks excellent.  I will be presenting three sessions and really looking forward to getting down there.  If you are in or around the area, you might want to consider going to this free event. 

January 29, Louisville, KY – Louisville .NET Meetup Group
My last community event of the month will be a presentation at the Louisville .NET Meetup Group.  I will be presenting Tools, Tips and Tricks for the .NET Developer which should be a great time.  If you are in Louisville then check it out.

Searching a table with SQL LIKE statement and multiple paramters

Recently I was faced with the need to search across a table for several search terms and return the results. The search terms were to be built dynamically, so there was no way to know how many would be provided. Due to some client policies, I had to do the work through a stored procedure. I did not want to perform multiple calls to the procedure for each term identified, but you cannot pass multiple parameters to the LIKE statement in SQL, or can you? I immediately thought of passing in all my search terms via XML, but couldn’t remember the syntax to pull the data out. Thankfully a friend of mine was kind enough hear my dilema and not laugh (too hard) when he pointed out that it was called ‘OPENXML’. Yes, extremely obvious, but it had been a long day. Ok, so back on track.

If you haven’t used OPENXML before it is available in SQL Server 2005/2008 and is really quite useful. In the past, I have used this mostly for passing in multiple objects to perform a mass INSERT and/or UPDATE. This was my first time using it with a LIKE statement, but it works perfectly. I didn’t want to lose this code, since I am likely to use it again in the future so I figured I would do a quick blog post. So here is how to pass multiple parameters into a LIKE statement in SQL Server.

Below the schema for a table that I will use in my example.

Here is a little sample data for as well


So I need to be able to search the “Bio” field in my table to see if it contains the words ‘PhD’, ‘scientist’ or ‘CEO’.

First, I need to build my search terms in XML form. This is a simple string which can be built in your application code and passed as a parameter into SQL Server. My example below show how you can do it in SQL Server so you can tweak it.

--String parameter with the search terms in XML format

DECLARE @xmlTerms VARCHAR(8000) -- Size it according to your expectations



--Here I am building the XML string with all the necessary terms.

SET @xmlTerms =

'<SearchTerms>

<SearchTerm>%PhD%</SearchTerm>

<SearchTerm>%scientist%</SearchTerm>

<SearchTerm>%CEO%</SearchTerm>

<SearchTerms>'



--A handle to the XML so we can reference it in the OPENXML call

DECLARE @xmlHandle INT



--This parses the XML and returns us a handle to the data

EXEC sp_xml_preparedocument @xmlHandle out, @xmlTerms



--Now we can perform our query

SELECT id, searchTerm FROM exampleTable A

INNER JOIN (SELECT searchTerm

FROM OPENXML(@xmlHandle,'/SearchTerms/SearchTerm',1) --Make note that the XML nodes are case sensitive

WITH (searchTerm VARCHAR(50) 'text()')) T ON A.Bio LIKE searchTerm

ORDER BY id

One key thing to note is that this must be done via a JOIN, otherwise it will not work. The JOIN is what allows the LIKE comparison over multiple criteria dynamically.