DevOps Monkey Goodness

Monthly archives for June, 2009

Use DateTime.TryParseExact to Easily ...

Use DateTime.TryParseExact to Easily Parse Formatted String Dates

I needed to parse a known string format (DDMMYYYY) into a DateTime object and as I started to write the code I thought it looked a bit nasty and there must be a better way: 1: private DateTime ParseDate(string date) 2: { 3: DBC.CheckPre("Date can’t be null", !string.IsNullOrEmpty(date)); 4: DBC.CheckPre("Date length should be 8 for […]

Null Args in Spring.Net Container Con...

Null Args in Spring.Net Container Configuration

I came across a situation where by I needed to set a constructor argument to null in the Spring.Net container configuration file.  Took me a little digging around in the docs but found it eventually: 1: <object id="AmlHandler" type="Project.AmlHandler, Project.Lib" autowire="constructor" lazy-init="true"> 2: <constructor-arg name="nextHandler"> 3: <null/> 4: </constructor-arg> 5: <constructor-arg name="checkProvider" ref="ACheckProviderSomeWhere" /> 6: […]

Upgrade Your Google Analytics Urchin ...

Upgrade Your Google Analytics Urchin Tracker Code

I noticed recently that Google has updated it’s client side JavaScript tracking code.  I decided to migrate one of my domains today. If you use Google Analytics extensively then you’ll definitely want to read the migration guide. What are the benefits of migrating: Faster, smaller source file Automatic detection of HTTPS Increased namespace safety More […]

Experts Exchange Answers Are Free!!

Experts Exchange Answers Are Free!!

I’m not sure if anyone else has spotted this but if you’ve found something useful and want to check the answer on Experts Exchange then you’ll find the answers at the bottom of the page!  Just scroll past the bit about "subscribe to see this answer", keep scrolling past all the all the links and […]

ASP.NET MVC Refactoring JavaScript In...

ASP.NET MVC Refactoring JavaScript Includes With Helper Methods

One of the conventions within the ASP.NET MVC framework is store JavaScript files in the Scripts directory, nothing wrong with this and when you reference your scripts you probably do something like: <script type="text/javascript" src="/scripts/FormHelpers.js"></script> If you’re not using MVC Contrib in your applications then download it now! Once you reference the MVC Contrib […]

Visual Studio Comment/Uncomment Keybo...

Visual Studio Comment/Uncomment Keyboard Shortcut

Here’s a quick timesaving keyboard shortcut that works in all Visual Studio versions to quickly comment and uncomment a line or selection of code.  Quick Comment Press Ctrl + K C.  You don’t need to select the whole line and VS will detect the type of code and use the correct type of comment.  Quick […]

C# Convert String To GUID

C# Convert String To GUID

I always forget how to do this: Guid guid = new Guid("2b1ee12d-8056-4f44-bf5a-412d3cb8f948");

Latest Book I’m Reading

Latest Book I’m Reading

Professional ASP.NET MVC 1.0 (Wrox Programmer to Programmer) ISBN: 0470384611ISBN-13: 9780470384619 The reason I decided to buy this MVC book rather than any others is because 1) I have been following the authors blogs and since the preview I’ve found their contributions very helpful.  There are other Asp.Net MVC books around but I’ve not heard […]

Cruise Control Auto Rebuild with CCNe...

Cruise Control Auto Rebuild with CCNet.config in Source control

By default Cruise Control stores the all important ccnet.config file in %ProgramFiles%\CruiseControl.NET\Server,  if you didn’t know CC.Net also monitors this file and will rebuild itself if it detects a change.  Now the main problem with the default location for ccnet.config is that this is not under source control, so if your build server happens to […]

Changing The IIS Application Pool Ide...

Changing The IIS Application Pool Identity For Impersonation

Microsoft provides a tool that comes with the .Net framework that allows you to easily change the identity of a user that runs an IIS application pool.  With this method you can execute an Asp.Net web application with an integrated security SQL connection string such as: Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI; Providing the application pool user […]