sábado, octubre 25, 2008

Reflector Add-In's Save the Day

Recently my brother had a problem with an old winforms application we developed to help him upload images and product information. The issue was really simple, once I had a chance to run and debug the application the issue was evident. The app was using FTP to upload pictures to the website and the credentials were invalid.

image

Easy I thought, go to the config file and change it, it'll probably be encrypted and might give me a hard time to hack. I opened it and didn't find anything. Let's open reflector and see what's happening I have a Stack Trace to start with, but that wasn't the best place. I remembered the name of the user, so the Reflector Add-in Code Search quickly pointed me to the right place:

image

From there a double click sent me to the method

image

Great. Someone thought it was safer to hard code it instead of using the web.config.

Then the question remains, how can we change it? The proper solution would be to open Visual Studio, connect to TFS, get the sources, edit recompile and sent back the new version. However I don't think the latest version is stable, so I would need to search for a label to get the latest deployed version. I'm running on a really slow connection now and that would probably take a while, beside it's sunday and I'm ready to go surfing (or at least try to).

Option 2. In that same screen just open Reflexil (another Reflector-Addin) locate the IL line that sets the password (this is not as hard as it sounds) and edit the string.

image

Then we simply save the assembly. This was probably the hardest part, this was the first time I used Reflexil and I was expecting the Save As option to be right next to the place where I do the edit, in the Tools menu or a toolbar, I finally found the option when clicking file in Reflector.

image

After that, just save the file e-mail it and ready to go, but then I had the brilliant idea of write this post and it took me more time than the fix.

You can find this an other reflector add-ins in http://www.codeplex.com/reflectoraddins

lunes, octubre 06, 2008

Learning with Tests (MessageBroker in NInject)

A great way to learn a few coding practices is to get an open source project (one good, don't get the first thing you see en codeplex) and trying to understand the code, how they apply patterns, use certain classes or reuse code through the project. The best way to start (with most of the good projects) is with the tests.

I have been playing lately with Ninject, a Dependency Injection Framework,  it's well designed, auto-documented and documented (probably too much documentation at the code level), the downside is that the wiki, the blog posts and tutorials barely cover the basics. However, the tests do a good job to describe the project at a higher level. As an example an example we can see one of the tests for the MessageBrokerModule.

        [Test]
public void OnePublisherOneSubscriber()
{
using (var kernel = new StandardKernel(new MessageBrokerModule()))
{
PublisherMock pub = kernel.Get<PublisherMock>();
Assert.That(pub, Is.Not.Null);

SubscriberMock sub = kernel.Get<SubscriberMock>();
Assert.That(sub, Is.Not.Null);

Assert.That(pub.HasListeners);
Assert.That(sub.LastMessage, Is.Null);

pub.SendMessage("Hello, world!");

Assert.That(sub.LastMessage, Is.EqualTo("Hello, world!"));
}
}


The code is really easy to follow, first he asserts that the kernel can create instances of the publisher and subscriber, then the publisher should have a listener, the subscriber doesn't have any message and finally he sends a message than the subscriber should receive. The other tests like OnePublisherTwoSubscribers and ManyPubsManySubscribiers are similar.

sábado, octubre 04, 2008

Task Board for Scrum for Team System

 

I have been using Scrum for Team System since beta 1 and I quickly fell in love with that template. It reflects the way we were working, however, there was a big gap in the process, specially when planning for a sprint, we usually did all the prioritizations, sizing, assigning and breakdown of Product Backlog Items using other tools like Mindmanager, Excel or sticky notes.

Recently the guys from Conchango, creators of the template, released a beta of a tool that will help use fill that gap. It's a cool WPF tool that will interact with TFS and allow us to create and edit sprint backlog items.

I don't think the tool will replace Mindmanager and the whiteboard still will be an indispensable resource, but I don't think I would like to go back to Excel to edit my items (well lets see how it goes after a couple of sprints of working with it).

When I was looking at the tool I was thinking, mmm yes, you can move a task from In Progress to Done, that's cool, but excel can do much more specially with pivot tables and reports, but then I saw the rest of the features, like changing to Planning Mode to start adding Product Backlog Items, automatically doing the binding between product backlogs and sprint backlog items, searching, filtering and reporting and I have to say, this tool is something worth to try. So in two weeks I'll let you know more about this.

I'm still not sure about the pricing scheme and I'm a bit concern. At the moment is beta, and you can simply request a license, but it doesn't seem something that will remain free. I will need to consider if this is a tool that every developer on the team will be able to use.

Crispin Parker from Conchango published some useful webcasts and a post with more info on the product.

By the way, it would be great to get a surface to use this tool.