Home avatar

Thoughts and code

Jenkins – Getting Revision for Project with Multiple Modules

I ran into this problem just recently on a project that has more than a single repository for a project. Using Jenkins (Hudson) was awesome for the past 2+ years and I was surprised that it couldn’t handle revision environment variable assignment when more than a single module had a place in a build job. According to some threads, this is done by design. One workaround in particular that I liked was to look into the poll log file and get information out of it.

TestDriven.NET AnyCPU Tests

TestDriven.NET defaults tests for code running on AnyCPU platform to be executed under 32-bit process by default. In order to change that, it has to be configured in VS through Tools –> Options –> TestDriven.NET –> AnyCPU Tests

image
image

Developing with Elevated Privileges – Gods’ Syndrome

Are you developing on Windows 7? Do you have your UAC turned off?

These are the questions I am asking developers that suddenly run into “unexpected behavior” with the code that used to work on their machines an now it doesn’t. When running Visual Studio .NET with elevated privileges you are the god. Literally. You can do anything – create virtual directories under IIS, manipulate file system where normally you’d be restricted, access anything you want – heaven for a developer. But the reality is that applications a lot of time ending up in environments that have UAC turned on. I do not expect a client system administrator to drop UAC on his server “just because our XYZ software was written in a God’s mode”. Good luck with that.

IIS 7 - Writing Log Files

I have ran into a problem while using NLog with web application – logs not created when application is deployed to IIS. Everything would indicate that this is permissions issue, except that I couldn’t figure out what account my web application was running under. Under II6 it was simple – IUSR, but with IIS 7 things have changed a little. Then I learned about Application Pool Identities. Very interesting, especially when locating an account DefaultAppPool resolves nothing, but IIS AppPool\DefaultAppPool does find DefaultAppPool. Either way, once I set write permissions for DefaultAppPool on the web application folder controlled by IIS, my problems were solved.

WCF Dynamic Client with Dynamic Service End Point

First reaction would be why?

Allow me present the problem: Application has regular WCF service and RESTful service implemented with ASP.NET MVC controller (we could implement RESTful service with WCF, but then the challenge would not exist…).

Invocation of RESTful service done with WebClient object requires requires URI. This URI is easy to store in appSettings of the configuration file. But then on the same client, to access WCF service, address is specified within the client endpoint configuration.

Impromptu-interface

While trying to solve a problem of removing conditional execution from my code, I wanted to take advantage of .NET 4.0 and it’s dynamic capabilities. Going with DynamicObject or ExpandoObject initially didn’t get me any success since those by default support properties and indexes, but not methods. Luckily, I have a reply for my post and learned about this great OSS library called impromptu-interface. It based on DLR capabilities in .NET 4.0 and I have to admit that it made my code extremely simple – no more if :)

Reflector – The King is Dead. Long Live the King.

There was enough of responses for Red Gate announcement about free version of .NET Reflector. Neither there’s a need to explain how useful the tool is for almost any .NET developer. There were a lot of talks about the price – $35 is it something to make noise about or just accept it and move on. Honestly, I couldn’t make my mind and was sitting on a fence.

Today I learned some really exciting news – two (not one), two different initiatives to replace Reflector.

Creating collection with no code (almost)

When doing testing, I tend to create an object mother for the items generated multiple times for specifications. Quite often these objects need to be a part of a collection. A neat way to do so is to leverage .NET params mechanism: