Essential tools when setting up a new development environment

Sep 4, 2016. | By: Pervez Choudhury

A list of essentials tools when setting up a new machine for software development.

[Read More]

Bootstrapping Psake for your windows builds

Jun 5, 2016. | By: Pervez Choudhury

Psake is a great build system for automating your .Net builds on Windows. To save time when using it and to make it a simple command to run the build, I like to place a batch file in the root of the code repository to allow you to download and execute Psake without having to check in any binaries.

It also avoids the hassle of importing the Psake module and calling Invoke-Psake

[Read More]

Auto reconnecting Margiebot to Slack

Jun 5, 2016. | By: Pervez Choudhury

MargieBot is a simple to use .Net framework for making your own bots for Slack. To start up a bot and connect it to Slack, all it takes is:

	Bot myBot = new Bot();
	myBot.Connect("<your bot's slack API token>");

This makes the happy path work very well, but out of the box this will not handle dropped connections or attempting to reconnect to the server - so if the connection is interrupted for any reason, you bot will no longer try to connect to Slack.

[Read More]

Castle Windsor ASP.Net HTTP Handler Factory

Mar 26, 2016. | By: Pervez Choudhury

When writing a simple HTTP handler in .Net, the framework provides support for replacing the default HTTP Handler Factory with your own factory which provides support for dependency injection.

[Read More]

Removing superfluous HTTP headers in ASP.Net

May 25, 2015. | By: Pervez Choudhury

When creating a new ASP.Net MVC project, by default you will end up with a number of extra HTTP headers in your responses which can safely be removed.

These headers will advertise which version of Windows you are hosting on, and which versions of the .Net framework and ASP.Net version you are developing with. As well as being needless bloat over the wire, they also give away information to potential hackers about your software.

[Read More]

Default nuget.config file for new projects

May 24, 2015. | By: Pervez Choudhury

When starting a new .Net project, I like to place a nuget.config in the solution root folder with a number of default settings in place. This is to ensure a number of good behaviours for NuGet.

[Read More]

Easier Castle Windsor WCF Registration

May 30, 2014. | By: Pervez Choudhury

Castle Windsor has a great add on called the WCF Integration Facility which allows you to get all of the benefits of DI/IoC when working with WCF services.

The only downside of using it is the verbosity of the component registration. Thankfully we are able to use extension methods to help us here and hide away all of the verbose registration code behind a simple, chainable method call.

[Read More]

Unit testing appSettings from web.config

Dec 22, 2010. | By: Pervez Choudhury

You can call the set method of ConfigurationManager.AppSettings to set the values required for that particular unit test.

public void SetUp()
  ConfigurationManager.AppSettings.Set("SettingKey" , "SettingValue");
  // rest of unit test code follows

When the unit test runs it will then use these values to run the code.

[Read More]

NVelocity is dead

Mar 30, 2009. | By: Pervez Choudhury

The Castle Project forked the project and have been maintaining it, and most recently released version 1.1.1 on 10 December 2010. More details can be found at the Castle Projects NVelocity site. They have also made a number of improvements to it, details of which can be found on their NVelocity improvements page. The project looks like it is now dead and in MonoRail 3, it has been replaced by Castle Blade which is based off Razor.

If you are looking for an alternative, then I would suggest the Razor view engine from ASP.Net MVC3 or the Spark View Engine.

The open source project RazorEngine allows you to use the the Razor View engine outside of ASP.Net MVC or Web Pages so you can use it to generate templated emails.

[Read More]

MySql Delete From Table vs Truncate

Dec 24, 2008. | By: Pervez Choudhury

Delete from table deletes each row from the one at a time and adds a record into the transaction log so that the operation can be rolled back. The time taken to delete is also proportional to the number of indexes on the table, and if there are any foreign key constraints (for innodb).

Truncate effectively drops the table and recreates it and can not be performed within a transaction. It therefore required fewer operations and executes quickly. Truncate also does not make use of any on delete triggers.

Exact details about why this is quicker in MySql can be found in the MySql documentation

[Read More]


A .Net developer from Bushey, Hertfordshire. Also serves as a Councillor for Hertsmere Borough Council and a Governor for Bushey Heath Primary School. All views expressed are my own.

Social Links

© 2016 Pervez Choudhury; Content licensed under CC BY-SA 3.0 with attribution required.