NAnt Build Prompter

This is a very basic script that a co-worker named Rabid made for me. I don’t know this syntax but he does for all the group policy stuff we have at work. Basically the way I had it setup to manually do nant builds was I had three seperate .bat files. That did the following:

  • One for copying the build to the staging server
  • One for copying the build to the deployment server
  • One for doing a complete build and then copying to the staging server

It was kind of a pain to have seperate bat files because then I had to run a specific one depending on the build/deployment I wanted. So this is the script that a co-worker came up with:

NAnt Build Prompter

The only thing you have to do is open the bat file, and change the path to nant.exe. The file is setup now with the following folder structure:
- trunk
–lib\nant\nant.exe
- branches
- tags
- clickToBuild.bat
- default.build

You only have to open the file and change the path to nant.exe. Maybe there is an easier way to do this but I haven’t tried it yet. Just thought I would share this as I have found it useful. Up to this point I just had 3 separate bat files. One for each build target. This is all running on my build server that is also running CruiseControl so when I need to update the production server, I log into the build server and kick off the deployment target.

If anyone wants to see the build file I am using let me know. It’s pretty much setup as a template now that I just copy to a new project and then change the variables. I’m sure everyone probably has something similar though.

NAnt Build Prompter

This is a very basic script that a co-worker named Rabid made for me. I don’t know this syntax but he does for all the group policy stuff we have at work. Basically the way I had it setup to manually do nant builds was I had three seperate .bat files. That did the following:

  • One for copying the build to the staging server
  • One for copying the build to the deployment server
  • One for doing a complete build and then copying to the staging server

It was kind of a pain to have seperate bat files because then I had to run a specific one depending on the build/deployment I wanted. So this is the script that a co-worker came up with:

NAnt Build Prompter

The only thing you have to do is open the bat file, and change the path to nant.exe. The file is setup now with the following folder structure:
- trunk
–lib\nant\nant.exe
- branches
- tags
- clickToBuild.bat
- default.build

You only have to open the file and change the path to nant.exe. Maybe there is an easier way to do this but I haven’t tried it yet. Just thought I would share this as I have found it useful. Up to this point I just had 3 separate bat files. One for each build target. This is all running on my build server that is also running CruiseControl so when I need to update the production server, I log into the build server and kick off the deployment target.

Microsoft’s fancy footwork

A couple of days ago Phil made this posting stating that he is going to Seattle to join Microsoft. He mentioned that one of the projects he will be working on is the new ASP.Net MVC framework. I won’t be discussing my thoughts on the MVC framework here, but rather I will be discussing how this relates to the community which I had a very interesting conversation last night with my boss and a co-worker mainly about Apple but it also relates to the development community.

Okay, first of all we can all agree that Microsoft has severely messed up on their implementation and deployment of Windows Vista. Joe Ocampo had a posting describing just this on LosTechies recently. I won’t dive down into detail stating what they messed up on, but from 6 versions of an OS to severely over estimating the market I think it’s pretty obvious that they screwed the pouch on this one.

Apple is obviously the talk of the town at the moment with their iPhone, new iTouch, new iMacs and various other innovations. All of this without yet releasing their new OS, which by the way is coming soon. They aren’t trying to massively hype everyone on Leopard which honestly they shouldn’t be. I don’t think it has that many new features to really hype up that much. Time Machine is cool, so is some new eye candy and various other application improvements but that’s about it. The point here is, with Microsoft’s recent Vista debacle, Apple obviously sees an opportunity to take some massive ground on the market and they should be taking even more advantage of soon. They may not be doing this with the iPhone but seeing how well these phones are doing it will definitely turn people’s heads and get them thinking about Apple more and in turn get people to buy more Apple products.

Linux is also doing quite well specifically with Ubuntu. They have now made it so easy to get up and running with Ubuntu that virtually anyone can do it. Along with the extremely strong community behind them, this is also going to taking some of the market. Perhaps not as much as Apple, but their fair share.

Does any of this “market share” really matter at this point? Not really, I mean Microsoft is worth something like $270 billion at the moment while Apple is at around $50 billion. Immediately, this is no big deal to Microsoft, now 5 years down the road is a different story though.

This brings me to my main point…

The hiring of Open Source gurus and Alpha Geeks by Microsoft lately is quite interesting. What is happening now is that it seems like Microsoft has realized that they have screwed up with Vista and couple that with the fact that all the experienced developers are moving away from ASP.Net tools and going to open source ones like NHibernate, Castle, Spring etc.. they have realized that they have to do something quickly to save their eroding developer market. This is where the recent hires come into play like Scott Hanselman, Phil Haack and Rob Conery among many others.

Now, I don’t want to make it seem like I am downplaying the reasons these developers got hired for a hidden agenda at Microsoft because I am not. The reason that Microsoft hired them is because they are the best of the best AND because they have a very loyal following in the open source arena. Microsoft knows that the open source community will listen to all of these individuals and came to the conclusion of why bother trying to battle open source? Let’s hire the best open source .Net developers and then this will bring the open source developers/alpha geeks back to Microsoft.

In my honest opinion, this was an extremely smart move on Microsoft’s part. After hearing about this I was excited to see this MVC framework from Microsoft. This coming from a person who refuses to even touch the painful ASP.Net Page Lifecycle among other gripes.

Microsoft has definitely played this one very well, at least compared to how Vista turned out. That’s why they are the most powerful software company in the world. They have realized that this was the best thing they can do at this time in the developer market. Invite the best of the open source community inside with open arms and try to understand how the rest of the community would like their software and frameworks to be built.

Now, the final and biggest question… Will Microsoft now try to get these developers to do programming their way, or will these developers induce a very good, and needed change in how Microsoft develops their tools.

I want to congratulate all of these individuals that Microsoft has brought on board. I am very jealous and hope to learn as much as I can from you so that I can hope to be as good of a developer as you gentlemen are!

Cheers!

Ubuntu, Flash Drives and Goofing off

Well, the last couple of days I have been messing around with ubuntu. I already have some virtual machines that are running ubuntu at work and home, but what made it different this time is that I recently obtained an 8GB flash drive from newegg.com

So I set out to install Ubuntu to my new flash drive. So I found some instructions here. All this is doing is installing the LiveCD of Ubuntu to one partition on the flash drive, and then creating a seperate partition to install the filesystem. This is all fine and dandy and actually works quite well. The only problem is that the LiveCD is actually Gzipped libraries and UnGzipped when requested which makes for a very slow experience. Not horribly slow, I mean we’re running off a little pen drive here, but slow enough. Originally people only had access to 1GB flash drives and were trying to squeeze as much space out of the drive as possible. This is no longer the case with flash drive prices dropping quickly. I mean the 16gb flash drives are now below $200. Give it another year and they will be at $100.

So now I am attempting to do a full install to my flash drive after wiping it and we’ll see how that works out. I found these instructions here and here (the latter is actually how to do it to a usb external hdd, but same idea). It seems straight forward with installing Grub or Lilo and doing the install as normal.

Now, this is great and really cool to freak out your friends when you load up your own operating system on their computer, the only problem with the entire scenario is the write threshold on flash drives. That’s right, there is a point when your flash drive will commit suicide and then you are up the creek. There is a posting on this page by flimbo about installing each mount point to a different flash drive which could mitigate some of this disaster. IIRC, the “theoretical” write threshold is anywhere from 10,000 to 100,000 times. I found this information on Ask-Leo. Writing is much more expensive than reading, but there is a high number of read/writes when running an entire operating system from a flash drive. More reads than writes however.

All that being said it is a pretty cool techie item to have up your sleeve. If you are fixing a friend/relative’s computer its pretty handy to pop in a thumb drive and run some disk diagnosis tools, but at that point you could just use the LiveCd to do that. All in all, just eyecandy for the brain. Cool stuff!!

Keeping Configurations Happy

I just spent about 20 minutes trying to figure out a very dumb problem with my configuration files.

 The way I have my configuration setup for my projects is becoming a little cumbersome. I would interested in any other ways people have of accomplishing this because I am ripe for change.

In my folder structure I have it setup like so:

Now, above this folder I have the branches and tags folders, as well as a docs folder that holds any documents, psd files etc so I don’t have to branch/tag any large original files all over the place and increase the size of the svn repository.

As you can see the “lib” folder is any dependencies I have on my projects. Castle, SqlCe and log4net/nhibernate is in the root. In addition I have a app_offline.htm under app_offline that gets copied to the deployment root before the deployment happens, and then deleted after it is finished. Everyone should be doing this!!

Under the “configuration” folder are the following files:

  • site.deployment.config
  • site.desktop.config
  • site.staging.config

Herein lies the problem…All that is in these files is AppSettings that change depending on where the project is at, for filepaths, specific files etc… If I also develop from a laptop there would be a site.laptop.config that would contain appropriate paths to save files to etc… The appropriate .config file is copied to whereever the app.config is and renamed to site.config, then I tell TortoiseSVN to ignore site.config so that it doesn’t get placed into the project root. With NAnt, I have a task that copies that config file into the right place and renames it to site.config. I know what your’re thinking here, “Well you could use XmlPoke”, which I do for certain things but I can’t always use xmlpoke when I am running on my machine etc..

This is all grand and peachy for myself being the only developer, but then what happens as I bring on more developers? Then I need site.username.desktop.config, for each and every developer. This becomes a real PITA.

I know there has to be a better way to accomplish this other than the way I am doing it now. It has worked so far but it’s becoming a pain to change a setting and then copy the site.whatever.config to the right place and rename it to site.config. I guess I could use pre/post build events but again this seems like to much of a pain.

Does anyone have a better way of doing this? I can’t stand this method anymore. I need something more effecient

Windsor Container Factory Facility

This is a real cool facility that I just used in my Hybrid CMS. There is a full in depth walkthrough on BitterCoder’s Blog here but I will describe how I used it in this blog post.

I needed to be able to have the kernel instantiate a specific implementation of IAuthService. This Interface has a couple of method definitions, but most important it had the Authenticate() method. The idea behind this is that I can swap out IAuthService and change the way a user is authenticated. At the moment Active Directory and Database is supported.

So in the whole architecture I have the following classes/interfaces

  • IAuthService
  • DbAuthService : IAuthService (component id: db.authService)
  • AdAuthService : IAuthService (component id: ad.authService)

In the Castle config section for Windsor, they have the following component Id’s listed above. Both of these component declarations have factory=authServiceFactory which activation of the components are deferred to at runtime.

In the AppSettings section I have an Application Setting called authStore=db.authService, which just has whichever component will be used for authentication.

Here is the code for AuthServiceFactory to give you an idea how the AuthService’s are returned from the kernel:

 
 

public class AuthServiceFactory : IAuthServiceFactory 

{</pre> 

private IKernel _kernel;public AuthServiceFactory(IKernel kernel) { 

_kernel = kernel; 

} 

protected string AuthStoreType 

{ get { return ConfigurationManager.AppSettings["authStoreType"]; } 

} 

public IAuthService Create() 

{ 

return (IAuthService)_kernel.Resolve(AuthStoreType, typeof(IAuthService)); 

} 

}

Pretty cool huh? Now if I want to introduce a new method of Authentication I only need to add the component to the config file, make an implementation and select it in the AppSetting. Very flexible! =)

Good example of Domain Services

Here is a good example that Chris Richardson posted in response to one of my questions of the DDD Yahoo! Group. If you haven’t done so already you should take a look at his presentation at SpringOne in June. It goes over all the major DDD topics and gives a really good description of DDD in general.

This is the same manner that I try to use Domain/Application Services although I have found that it’s easy to go overboard with a Service layer and IMO should only be implemented when necessary. There is really no reason to have a Service class that just wraps a Repository. It’s just extra code that needs to be maintained. In Chris’s exmaple though, he illustrates how a Service would retrieve data from one or more Repositories, performs some small amount of work and thats it.

I will be posting more on this later. Just wanted to share the example that I saw. Cheers!

Follow

Get every new post delivered to your Inbox.