Archive for the ‘General’ Category

Nasty cold

January 26th, 2008

So I’ve managed to get a nasty cold. Headache, fever, all body aching. How did I do it? It wasn’t difficult. Think someone coming from a warm-to-hot weather in Brazil to a 40 degree Fahrenheit Dallas, TX weather :-) – yes, I brought my coat, gloves, and everything, but it wasn’t enough, I guess.. In fact I think the problem was in the airplane. It was warm for a while, when I decided to sleep. When I wake up I was freezing.

Being sick is when I miss home the most. I love being spoiled by the girlfriend. The extra attention. The high tolerance about my bad mood.

I’m also witnessing the jira tickets pilling up. But really, I wont be of any use for a couple of days.

Tomorrow I’ll try to get some medication. Any suggestion?

Categories: General | Top Of Page | 7 Comments » |

Off to Texas

January 22nd, 2008

I’m traveling to Texas tomorrow, precisely to Dallas, to kick off a project with these guys. Really excited about it!

If you live nearby and want to catch up, drop me a line. We can talk about donjon, .Net, Castle and whatnot.

Categories: General | Top Of Page | No Comments » |

donjon – a teaser

January 20th, 2008

A picture still worth a thousand words.


Getting started with IIS is trick

January 16th, 2008

Moving my web apps to a new dedicated server with Windows Server 2008 (b6001) has not been a pleasant experience so far. After reading and digesting the differences between Class and Integrated mode, I’ve obviously gone for the integrated path. After setting up the app I got a NullReferenceException. Nope, not on MonoRail, not on my code whatsoever. On System.Web code. .Net 2. Something related to GetEventCount. Now, even if I fire up Reflector and digged, would I be able to fix it or work around it? I don’t think so.

So falling back to Classic. This one works fine except for one thing. In my web site I have used MR old fashion Routing based on IIS wildcard mappings. Works like this:

You request /home/index

IIS dispatches this to your configured wildcard handler (which happens to be the ASP.Net Isapi extension). This gets dispatches to a module, that matches or not the url and rewrites it. Cool. Works fine on IIS 5 and 6.

Now, on IIS 7 there has been some changes. Cool changes, but that breaks my legs nevertheless – am I the only one?. Here’s the deal:

They now have a handler for static files, which happens to be a wildcard mapping (*).
The old fashion rewriting routing works with a wildcard mapping (*).

What you have? A conflict.

  Step 1: Disabling one and enabling other to make sure both works

Yep, the routing works fine. The static works fine. Fantastic

  Step 2: Disambiguating them

So my idea was: if I can rely on their restrictions, I can get one running and then the other. For instance, the static handler will (or should) only run for a file that is physically present on the file system. IIS 6 had something like “Check that the file exists”. On IIS 7 there’s something that I think is similar, might not be: Invoke handler only if request is mapped to: File | Folder | File or Folder.

So the disambiguation is simple: the routing runs for things that does not exists physically. The static handler runs for existing one.

Configured both and got:

/content/css/mycss.css -> Failed to Execute URL

Ok, so something still wrong.

  Step 3: Ordering them

So if I get the static handler running (or being considered as an optimal handler) before the routing one, things shall work.

Click on “View Ordered List”. Move up, move down.

Time to test!

/content/css/mycss.css -> Failed to Execute URL

Ok, so looks like ordering doesn’t matter or the restrictions aren’t exactly what I think.

  Step 4: Crying for help

I’m sure someone will comment with “just click this and that and you’re done” making me look stupid and totally inexperienced. I give you that, I’m stupid and inexperienced, so now it’s your turn: show me the light ;-)

Categories: General | Top Of Page | 5 Comments » |

So long, XBOX 360

December 15th, 2007

No, I didn’t have the three red lights problem, just sold it as I wasn’t using it often enough. Didn’t find the time to re-try Oblivion, didn’t find the time to continue playing Splinter Cell DA – I think the last mission completed was the 8th.

Hope I can buy a new one once things settle down for me.

Categories: General, Xbox | Top Of Page | 1 Comment » |

MVC Experiments

December 11th, 2007

As I promised here, you can download the samples I created on my visit to MS. What’s in there?

MvcExtensions: a class library project with all extensions developed including parameter binder support, Windsor integration and a NVelocity View Engine. I remember complaining about relying exclusively on inheritance to change behavior/add specializations. Looks like I’m not alone on this… To some things, a vertical approach is good enough, but not usually to frameworks. The inheritance scheme eventually will turn into hell in a complex project. I know as I been there.

RestSupport: Uri formats and a nice Respond To syntax inspired on the work from Chris Ortman/MonoRail.RestSupport.

UsingAR: self explanatory

UsingNVelocity: ditto.

Looks like they still need to make some things virtual and some things public. If you read my code you’ll eventually bump into interesting comments :-)

Categories: General | Top Of Page | 16 Comments » |


November 28th, 2007

It’s funny, and somewhat sad at the same time.

Categories: Apple, General | Top Of Page | 2 Comments » |

My VS.Net fonts and colors settings

November 27th, 2007

Hey, first of all: use at your own risk (ie. backup yours before trying these). Also, make sure you install the consolas font pack.

For VS 2005 and VS 2008.

Categories: General | Top Of Page | 10 Comments » |

Circumventing statics and singletons

November 20th, 2007

One thing that I find spoils a design is the use (or overuse) of statics and singletons. Right now I’m writing a ViewComponent to render site maps. I’m leveraging the site map providers that ASP.Net supports. At some point my ViewComponent needs to use the default provider or fetch a named one. Here’s the code:

public class SiteMapViewComponent : ViewComponent

    public override void Initialize()
        targetProvider = SiteMap.Provider;



While that works, it demonstrates how your code might get coupled with the default ASP.Net implementation, not to mention that it would be tricky to implement an unit test for the view component without messing the appdomain configuration and the providers API.

My usual solution to these cases is to create accessors that can be replaced. So my view component will have, by default, an ASP.Net provider accessor instance. My test case can replace the default accessor by a mocked one.

public class SiteMapViewComponent : ViewComponent
    private SiteMapProvider targetProvider;

    private string providerName;
    private string customView;
    private IProviderAccessor providerAccessor = new AspNetProviderAccessor();

    // Public Property so tests and others can customize the accessor 
    public IProviderAccessor ProviderAccessor
        get { return providerAccessor; }
        set { providerAccessor = value; }


    public override void Initialize()
        targetProvider = providerAccessor.DefaultProvider;



public interface IProviderAccessor
    SiteMapProvider DefaultProvider { get; }

    SiteMapProvider this[string providerName] { get; }

public class AspNetProviderAccessor : IProviderAccessor
	public SiteMapProvider DefaultProvider
		get { return SiteMap.Provider; }

	public SiteMapProvider this[string providerName]
		get { return SiteMap.Providers[providerName]; }

Much more elegant!

Wikipedia is clearly made by humans

October 30th, 2007

The new DI article (yuck!) uses python to exemplify the concept. Nothing against Python, in fact it always struck me as a more serious platform than Ruby, albeit Ruby is sweeter as a language. But to decently exemplify the concept they should use language with types — ie statically typed.

Oh well, go figure..

Categories: General | Top Of Page | 3 Comments » |