Category Archives: Tips and Hints

Specifying a different source directory in OpenWrap

Currently our source tree is very similar to the recommended OpenWrap layout other than one difference, the “src” dir is called “Source”. This only causes an issue when it comes to building the wrap itself as by default the command tries to find any projects in the src folder. It’s a simple config change to get this to work, just add the following line to your .wrapdesc file:

build: msbuild; project=[PathToTheProject]\[CsProjFile]

Thanks to SerialSeb for an awesome package manager and super-quick support via twitter! 🙂

Enabling a project to have multiple StyleCop targets.

As the RC is now out for StyleCop 4.5 I wanted to give it a go mainly to see if the ReSharper integration included works with Resharper 6 (unfortunately it doesn’t :(). Unfortunately it includes a breaking-change if you import the StyleCop.targets file (so that violations are shown as either errors or warnings when building the project) as the path has changed.

To enable me to continue to use the 4.5RC version and my workmates to carry on using 4.4 I had to make some changes to the csproj file to cater for both:

<PropertyGroup>
    <StyleCop4_4Path>$(MSBuildExtensionsPath32)\Microsoft\StyleCop\v4.4\Microsoft.StyleCop.targets</StyleCop4_4Path>
    <StyleCop4_5Path>$(MSBuildExtensionsPath32)\StyleCop\v4.5\StyleCop.targets</StyleCop4_5Path>
</PropertyGroup>
<Import Condition="!exists($(StyleCop4_5Path))" Project="$(StyleCop4_4Path)" />
<Import Condition="exists($(StyleCop4_5Path))" Project="$(StyleCop4_5Path)" />

This disables the 4.4 target if 4.5 is installed, however if neither are installed it will fail the build trying to find 4.4. If you need to disable both if they are not installed you can replace the first import with the following:

  <Import Condition="exists($(StyleCop4_4Path))" Project="$(StyleCop4_4Path)" />

Using a symlink to emulate the windows command cls in Linux

Even though the command “clear” is really obvious in Linux (you can also use CTRL+L) I always forget and try and use the windows “cls” command. All you need to do to make it work on Linux is create a symlink (same as a Junction point in windows, NOT a shortcut) pointing back to the clear command. This is actually very simple and is achieved by the following command (Tested on LinuxMint but should work on all versions of Linux):

1
sudo ln -s /usr/bin/clear /usr/bin/cls

Using the virtual memory restriction in IIS6

We’ve been having some seemingly random performance issues on some of sites and for a while I was quite stumped. Basically every so often the website would take between 16-20 seconds to load the page, although we were not able to predict when it would happen, as it occurred on different pages within the site.

My initial thought was that it was a network issue due to the fact that it was only being reported on some sites. Luckily the company subscribes to a external monitoring service so I was able to see the sites that it was happening on and how frequently. Once I had a look there I noticed that was happening on all the sites to varying degrees.

One of the servers was taken out of the DMZ to try and isolate the issue and it was only then that I noticed what was going on. With all the other sites shut down and only one or two w3wp.exe process to keep an eye on I was noticing that one of the processes was being shutdown and replaced with a new one. Now I know that this is the what happens when an app pool gets recycled but this shouldn’t have been happening as we had only 1 scenario enabled, the virtual memory limit setting:



As you can see this was set to 250Mb and process itself was never getting anywhere near that!! In fact even before I had thought it was a network problem I did actually check for this, however with so many w3wp.exe processes (~30) it was difficult to see them recycling, and because none of them were going near my limit I quick discounted this idea! So I went ahead and removed the setting and re-ran the tests. Low and behold it fixed the issue. Now the reason I had set it in the first place was due to getting System.OutOfMemory exceptions if too many bots were walking the site at one time. This happens due to the fact that we use the XsltCompiledTransform to clean up content coming from our Homebrew CMS. This generates a lot of assemblies and hence when to much content is accessed too quickly it runs out of memory. Initially I was wondering if there was a bug in IIS6 but it turns out that memory can be consumed directly from the swap disk completely bypassing the physical RAM and hence why the w3wp.exe never got anywhere near my limit.

Anyway in the end the fix was quite simple, just use the physical memory setting in IIS. 🙂

Getting Team Build to trigger a new build when you update the MSBuild file

I’ve been working on getting some more builds added to our TFS server today and actually had a moment of inspiration! It doesn’t happen all that often so better blog it while it’s still fresh! 🙂

I have set-up several custom build steps that run after the normal build process has finished. These steps simply remove any files not needed for deployment and deploy to a server so it can be tested/QA. Previously if I updated the MSBuild file that handles the build and deployment (TFSBuild.proj) I had to manually trigger a build. Today I realised that if I add the folder containing the MSBuild file, TFS would automatically detect that it has changed and trigger a build!! I know it’s only a few clicks and will not save a lot of time, but everything counts!!

How to call T-mobile UK voicemail using your Flext minutes!

UPDATE: Unfortunately T-Mobile have twigged onto this and started charging for the voicemail retrieval when calling yourself directly. Due to this fact I’ve just ordered the new HTC Desire from three.co.uk as their voicemail minutes come off your call allowance.

T-mobile are a bit sneaky and don’t include any calls you make to your standard voicemail number in your free flext minutes but instead charge you 10p/12p a minute for the pleasure.

Fortunately I have just found a hack (kind-of) the enables the voicemail to come off your flext allowance!! 🙂

I have known for a while that if you setup a PIN to allow remote access to your voicemail you can use another phone and only get charged for a normal call. Thanks to having a work BlackBerry I have been using that, and not getting charged. However it was a bit annoying having to ring, then hang-up or wait for it to go to voicemail and then type in the PIN number.

Now down to the real sweet part. If you notice when you call your voicemail normally the number is basically your mobile number but with a few extra digits. Now if you change it to your exact mobile number it still works as normal and automatically recognises you and bypasses the PIN entry. This then gets listed under your calls as a standard call and is taken out of your Flext allowance!! 😀

If you are using a windows mobile phone it seems that T-mobile block you from changing the voicemail number for obvious reasons (it is usually stored and then read from the SIM). Now with a few little registry changes you can override the one in the SIM. To do it make the following updates (add if missing):

1
2
3
[HKEY_CURRENT_USER\Software\Microsoft\Vmail]
"PhoneNumber1"= "[Your mobile number]"
"RegOverridesSIM"=dword:00000001

Anyway as always be careful editing the registry and don’t come running if you screw it up! Hopefully this will save you a bit of cash!! 🙂