Cory Foy

Sunday, June 29, 2008

Problems in Rails between Development and Test Databases

One of the things I've been getting setup this week on my new laptop is my Ruby environment. I went through the Apple Leopard Rails Tutorial and ran into one big hiccup at the end - my tests wouldn't pass. I had created an app and ran the following:

script/generate scaffold event name:string budget:decimal

However, when I ran rake test:units I would get a failure that it was expecting 30.50 but was 30. I suspected something to do with decimals or integers, but it turns out that I think there is a bug in Rails.

Basically, you know you've run into this whenever your development database has a decimal column with a 0 scale. If you are using MySQL, you *will* run into this, because the default precision and scale for a decimal is (10,0). So, what happens is that when you run generate, you get:

def self.up
create_table :events do |t|
t.string :name
t.decimal :budget, :precision => 10, :scale => 2

t.timestamps
end
end


This works for the creation of the dev database (via rake db:migrate) but when you run rake test:units it looks at the dev database and tries to copy over the schema. Seeing that the scale is 0, it makes a guess that it is really an integer, and that's what gets put into the test database.

The fix is to manually modify your migration scripts anywhere you have a decimal to look like:

def self.up
create_table :events do |t|
t.string :name
t.decimal :budget, :precision => 10, :scale => 2

t.timestamps
end
end


Right after I write this, I'm going to dive in and should be at least filing a bug on it.

Friday, June 20, 2008

Agile Tampa meeting a big hit!

On Wednesday, I had the pleasure of attending the inaugural Agile Tampa meeting at the Microsoft office in Tampa. They had the guys from a local Agile company - AgileThought there giving an introduction to Agile. While it had a lot of Scrum in it, they did a decent job of introducing the crowd - even with a couple of people in the audience who had *lots* of questions (which was a good thing!)

The meeting was packed. I was talking with Joe Healy beforehand and he said they had about 40 registrations, so I was expecting about 20 people to show up. Nope, the room was packed!






The whole thing was organized by Michael Russo, and he did a fantastic job!



(That's him giving away some games that were donated)

All in all, I'm looking forward to the next meeting. If you are interested in Agile in the Tampa area, please pop over to the Agile Tampa site and let Michael know what topics you are interested in.

And, of course, thanks to Joe and Microsoft for providing a meeting space:



and the guys at AgileThought for putting on a good presentation:



See you soon!

Thursday, June 19, 2008

One possible fix for slow wireless on OSX?

On Thursday I picked up a shiny new MacBook Pro. Having been a Windows/Linux guy for, well, ever (not counting all that DOS stuff), it's been an interesting experience.

One negative that I ran into was very slow wireless connectivity. Being that we have two other computers, an iPod Touch and my XV6700 all connecting over the wireless at fast speeds, I suspected something with OSX.

The first solution I came across said to disable IPV6 connectivity. System Preferences -> Network -> Airport -> Advanced -> TCP/IP and set the Configure IPV6 to Off. This worked well at first.

Then I noticed things being slow, almost like it couldn't connect. Clicking on the wireless icon in my status bar I saw that it was constantly going from Aiport: On to Aiport: Scanning. I tried changing the DNS servers to OpenDNS, which also helped a little, but still nothing.

I was just about to switch to a USB Wireless dongle I have when I happened to click on the Location dropdown in System Preferences -> Network. I added a new location (called Home), bumped up Airport to be the top-ordered connection (by using the Set Service Order option - even though Airport showed at the top of the list, I made it the top in service order) and applied the changes. This reverted the above changes, meaning I didn't change the IPV6 or the DNS Servers, but so far even though the status keeps switching to Scanning, my internet experience has been nearly flawless.

Hope that helps someone else!

Thursday, June 12, 2008

Tampa Scrum Mailing list started

This evening at the Tampa Scrum get-together, we discovered there are a *lot* of people in the Tampa Bay area who are learning and interested in Scrum. While next week is the first Agile Tampa meeting, I wanted to gauge interest in a Tampa Bay Scrum Group. So I've created a mailing list over on Yahoo! Groups that I'd ask anyone who is interested to register for. If we gain enough interest, I'll put together a site and see if regular meetings would be interesting.

Debugging a .NET Windows Service that is crashing on Startup

This afternoon I was working on some code that I don't have the developer around for. Part of the app is a windows service which fires up a server to listen for incoming connections. I could see from the log file that we were getting an AddressNotAvailable exception, but I didn't understand why. I had a feeling it was a misset configuration parameter, but I needed more information.

To debug this, we have two challenges. First is that debugging startup code in .NET is just a tidbit tricky since you won't get to a stopping point to load sos before the exception happens. The second is that Windows Services are a little difficult to debug as well, and require some more in-depth mojo.

There was a third issue at play as well. This code was reporting the exception - and then swallowing it. This means that we'd only ever get a first chance exception, so we have to be able to break on those.

So how do we debug it? First, we have to setup the service so that when it starts, it also starts WinDBG. We can't just point to the service executable. KB 824344 is your friend here. Basically you set a registry key which fires up the debugger when that executable starts. You'll also want to follow step 3 in that article to increase the time Windows waits for the service to start up - I used 100000 milliseconds.

Now, when you click Start, WinDBG will pop-up. When it does, it will immediately breakpoint into the application. You would think at this point you could do a ".loadby sos mscorwks" but you can't - none of the .NET libraries have been loaded yet. Basically we have broken in at the start of the PE. So we need to tell WinDBG to break as soon as the .NET libraries have loaded, but before our app gets going. Tess (as usual) comes to the rescue with this article which explains how to do it. Basically, you just run an "sxe ld:mscorlib" which says to break whenever a library called mscorlib is loaded. When it does, you can then do a ".loadby sos mscorwks" to get sos loaded.

Remember that I said there was a third issue, and that was that we only got first chance exceptions. To break on First-Chance exceptions, go to Debug->Event Filters while WinDBG is broken in. Then click on the "CLR exception" event, and choose enabled. There's a command line way too - "sxe clr". Note that you'll need to make sure you do this before you let the application continue after the .NET library load.

And viola, now WinDBG will break in at each exception. Since you have sos loaded, you can do a !printexception to see what the exception is. For me, once I found the exception, I did a !dso to see the stack objects, and investigated the IPEndPoint objects on the stack until I found the one that had a funky IP. Armed with that, I was able to find the setting in the config file and change it to the local IP, and my server was happy again.

Happy debugging!

Tuesday, June 10, 2008

Scrum Happy Hour in Tampa on June 12th

Mike Vizdos from Implementing Scrum is going to be in Tampa teaching a ScrumMaster training course this week. The course is full, but the group is planning a Happy Hour for Thursday evening at Bar Louie at International Plaza starting at 6pm. Nothing formal, just networking with local Scrum people over drinks.

For more information, you can give me a shout (foyc at cornetdesign dot com) and I'll pass you along to Maureen Loach who is coordinating the event.

See you there!

Friday, June 06, 2008

Two Great Articles not to Miss

This week I've come across two great articles you don't want to miss. The first is from the great Mitch Lacey on why your stand-ups should ask 4 questions instead of 3. It's a very insightful article into what happens when communication breaks down.

Speaking of break downs, I found an older article discussing highly flexible systems On Simple-Talk.com. If you've ever been faced with requirements for systems that needed to do everything in the book, it is a vital read to gather ammunition to defend against it. (Worse, I'm actually trying to defend against one of those right now.)

Happy Friday!

Thursday, June 05, 2008

My kind of Job!

I recently saw an add for a "Universe Developer" on Craigslist. Some choice snippets (with my comments in italics):


  • "Direct Hire position- NO Contractors" Only people in for the long haul need apply

  • "Design and develop new universes and make modifications to existing universes." This one sure could use some help, but new universes?!

  • "Recommend best practices for universe and report development." That's what we need, a GoF book for universe development

  • "Provide performance tuning for reports and universes" What kinds of reports are needed for universes? Something I'd love to get my hands on

  • "Must be able to work with limited supervision." It's lonely work creating universes

  • "Experience with Visual Source Safe is a plus" Ahhh!!! Run!!!

Monday, June 02, 2008

R.I.P. Bo Diddley

Several years ago my wife and I got the chance to see Bo Diddley in concert here in Tampa. It was a great - if interesting - show. Being a musician and getting to hear greats like Bo, Eric Clapton, Tom Petty, and B.B. King that have influenced not just you, but also the others who influence you, is just amazing.

Word came out today that Bo Diddley passed away last night. Another blues and rock influencer gone.

Here's a picture I managed to snap at the concert. We'll miss ya Bo!

Bo Diddley playing in Tampa, FL