Archive for the ‘Sys. Admin.’ Category
Thursday, April 1st, 2010
I am writing this up to hopefully save someone else time in the future, this particular problem took up six hours of my day yesterday causing quite a bit of frustration for me, as the developer, and the users of the application.
If you are searching for the solution scroll down to the bottom of the page where I will outline the solution I used to resolve the problem. It is also worth pointing out that this does appear to be fixed in .NET 4. Certainly I was able to consistently reproduce the problem with VS2008/.NET 3.5 on multiple different computers. However after converting the project to VS2010/.NET 5 I haven’t seen the issue.
Explanation of the problem
I wrote and maintain an application that publishes a list of courses and allows users to book onto these courses, what I have listed below is a simplified version of this application.
The administration console contains two lists:
- Published Courses – courses visible to all employees.
- Unpublished Courses - courses waiting to be published, only visible from the administration console.
Courses can be freely published (i.e. moved from Unpublished to Published) by clicking green tick. Courses that have not had any bookings made can be unpublished by clicking the red cross.
The cross and the tick are implemented as GridView ButtonFields:
<asp:ButtonField ButtonType="Image" CommandName="UnpublishCourse"
ImageUrl="~/images/unpublish.png" InsertVisible="False" Text="Unpublish" />

This application has been running for six months, the issue had not been observed up until yesterday. The user explained to me that when they were publishing courses they were always published in pairs, equally when unpublishing courses it was being done in pairs, concealingly unpublishing a course with bookings.
Investigating the problem
Initially I tried to reproduce this on my local machine, backed up and subsequently restored the database locally made sure I was running the same revision as the server and fired it up. Couldn’t reproduce the problem, no matter how fast I clicked it wouldn’t happen. Tried various permutations of code and database but could only reproduce on the server.
Refreshed the binaries on the server with the HEAD from subversion, problem was still happening most of the time. I confirmed that it wasn’t an issue with the stored procedures by running them manually through LinqPad.
I started putting debug statements at the entry points to the critical parts of the code, this yielded an interesting output on my development machine, each time the cross or the tick was clicked UnpublishedGridView_RowCommand was fired twice. This gave me something to search for, seems I am not the only one to have this problem, Microsoft tried to reproduce it in 2006 but couldn’t.
Solving the problem
As it turns out there are several ways of fixing the problem, several people have used timers to “debounce” the RowCommand event, assuming that the event is always going to be fired twice a session variable can be used to filter out the second event.
Because the event is only fired twice when ButtonType=”Image” not when ButtonType=”Link” you can set the text property to the HTML to render your image. This resulted in the code above becomming:
<asp:ButtonField ButtonType="Link" CommandName="UnpublishCourse"
InsertVisible="False" Text="<img src=images/unpublish.png />" />
This proved to be the simplest possible solution, Visual Studio 2008 throws a warning about ASP.net validation, but I can live with that as long as the application works. In addition to the simplicity of the solution it also continues to work in ASP.net 4 (which doesn’t exhibit the double event behaviour).
Posted in Programming, Sys. Admin. | No Comments »
Saturday, February 27th, 2010
Somewhere in the middle of 2007 I was encouraged to use OneNote to clear my desk and move to a “paperless” system, initially this was a little painful as it seemed a gargantuan task to scan in all of the bits of paper on and around my desk that appeared to contain useful information.
As it turned out I realised that if a bit of paper was covered by another (or in fact covered by anything) it wasn’t that important to the execution of my role and could probably be thrown in the bin.
At the time I was not using Microsoft Office at home, opting to use OpenOffice for the limited needs I had for productivity software. I did however want a better way of organising my paperwork at home, OneNote 2007 came in at about £70 which isn’t unreasonable for what you got. Then I discovered Evernote.
Seemed perfect, I don’t generate so much paperwork that I would bust the 40mb/month limit on the free account. In the end I decided to adopt Evernote at home and continue to use OneNote at work, it proved quite a handy separation of work and life.
Recently I have run into two problems that are pushing me towards using Evernote for everything, and ditching OneNote entirely:
- Evernote handles PDFs really well, you drag them in and they are displayed using the Foxit rendering engine. It just works. OneNote on the other hand plain old embeds them into the note, great now how is that different from having them in a folder in My Documents.
- Evernote 3.5 has vastly improved the synchronization mechanism meaning that I can safely put something on Evernote on my PC and it will be on my laptop shortly after it is turned on next. Microsoft has tried to get this kind of functionality into OneNote and SharePoint however it just doesn’t work that well, it is too slow and there seems to be a 10 minute refresh cycle hard coded into the product.
I am still not sure that I want to ditch OneNote entirely, the 2010 version has some nice labour saving devices built in such as quick screen clippings and image formatting with the fluid user interface. Nothing in OneNote 2010 screams “don’t leave me” though.
Posted in Diary, Misc., Programming, Sys. Admin. | 3 Comments »
Monday, January 25th, 2010
There is an excellent post on the SQL Protocols blog about diagnosing the “Login failed for user ”. The user is not associated with a trusted SQL Server connection.” message displayed by SQL Management Studio and other applications which use the same API; Notice the blank username ”.
I believe there is one possibility missing from the above post: that is the Group Policy setting “Deny access to this computer from the network”. Which can be found in both Domain Group Policy and Local Security Policy in the following path:
Computer Configuration » Windows Settings » Security Settings » Local Policies » User Rights Assignment.
I have been using this policy more and more to lockdown access to site systems in accordance with our security and access policy. It pays to be cautious when applying User Rights Assignment policies to a machine, as in Windows 2003/XP they are not very granular.
Posted in Sys. Admin., Things You Find | No Comments »
Monday, October 26th, 2009
Important Update (16/11/2009): there seems to be a problem with these drivers causing a crash. I am going to experiment further with this laptop and try and diagnose the cause of the problem and hopefully find a solution.
I am typing this on my Acer Aspire 5102WLMi which is one of the popular (if flawed) Acer Aspire 5100 series; I rescued this one from the Balconi Test by putting a bit of rubber (it was a cut down rubber foot) on top of the South Bridge chip set, that however is not the story I am telling today.
I never bothered to install the Card Reader driver on this laptop while I was running the Windows 7 Beta, mainly because I am lazy, but also I didn’t have a need for it so it never came up. With the release of Windows 7 I wanted to get the system perfect, seeing as hopefully it will last a good year in it’s present state, and I wanted to be able to re-arrange the SD card from my Acer PDA.
Windows 7 x64 was unable to identify a driver for this particular card reader, this left me with three unknown devices in Device Manager:

The Acer website was a bust, as far as Acer are concerned this laptop won’t even run Vista x64, so I had to dig deeper. From past experience of looking for drivers without using Windows Update I knew that I could probably identify the manufacturer from the Hardware and Device ID’s available through Device Manager. If you want to follow along here are the steps:
- Open up Device Manager (Right Click “Computer”, Choose “Manage”, Select “Device Manager”)
- Identify your unknown devices (They will look similar to the image above, although the text will differ)
- Right click one of them and select “Properties”
- Switch to the “Details” tab
- Change the property drop down box to read “Hardware Ids”
What that will give you is one or more strings looking something like this
PCI\VEN_1524&DEV_0530&SUBSYS_009F1025&REV_01
I have marked the two important parts in bold, the four digits after “VEN_” tell you the PCI Vendor number, the four digits after “DEV_” tells you device number these two numbers should uniquely identify the driver.
There are several sites that allow you to lookup these numbers, I tend to use the publicly available PCI Vendor and Device Lists at PCIDatabase.com. Which has always given me good results with minimum fuss and adverts.
Armed with the above I identified the manufacturer of the Card Reader was ENE Technologies, sometimes this is all you need to find the driver. You can Google/Bing the name and click the download or support links and get the latest drivers. This isn’t always the way, as some OEMs don’t offer drivers leaving that down to the system integrator to offer that service.
So some time with Bing, I found some drivers for various ENE Devices, however the drivers available from VersionTracker seemed promising. After downloading and unzipping the contents of the file to a folder on my Desktop, I was able to point Device Manager at these files for each of the unknown devices I was left with three working devices and a fully operational Card Reader.

Hope this helps some other people with similar laptops or Card Readers, post in the comments with your experiences, please include the manufacturer and model of the laptop/netbook you have succeeded with and hopefully you will help someone else with the same devices.
Posted in Sys. Admin. | 30 Comments »
Friday, October 23rd, 2009
This information is available in many many other places, however I am putting it on here because I know it will be here for me to refer to. Also it is handy, as I know I can access my web-site even if the MTU is misconfigured.
For some reason that has escaped me Path MTU Discovery in Windows just doesn’t seem to figure out the MTU for a given path (something to do with routers being poorly configured to not respond to ICMP requests). So Windows uses the default. For the most part this doesn’t affect anyone, however if it dos affect you, it really annoys you. Failure of PMTUD will result in some websites not loading correctly, having trouble connecting to normally reliable online services and general Internet weirdness.
The resolution is to set your default MTU to one lower than the Ethernet default of 1500. Here is how:
Step 1: Find your MTU
From an elevated CMD Shell enter the following command:
netsh interface ipv4 show subinterfaces
You should get something like this
MTU MediaSenseState Bytes In Bytes Out Interface
---------- --------------- --------- --------- -------------
4294967295 1 0 13487914 Loopback Pseudo-Interface 1
1500 1 3734493902 282497358 Local Area Connection
If you are using Ethernet cable you will be looking for “Local Area Connection” or “Local Area Connection 2″ (if you happened to plug into the second network port). If you are using Wireless you will be looking for “Wireless Network Connection”. The MTU is in the first column.
Step 2: Find out what it should be
In the CMD shell type:
ping www.cantreachthissite.com -f -l 1472
The host name should be a site you can not reach, -f marks the packet as one that should not be fragmented the -l 1472 sets the size of the packet (1472 = Ethernet Default MTU – Packet Header, where the Ethernet Default MTU is 1500 and the Packet Header is 28 bytes)
If the packet can’t be sent because it would need to be fragmented you will get something similar to this:
Packet needs to be fragmented but DF set.
Keep trying lower packet sizes by 10 (i.e. -l 1460, 1450, 1440, etc.) until you get a successful ping request. Raise your packet sizes by one until you get a “Packet needs to be fragmented but DF set.”. The last successful value plus 28 will be your MTU value.
In my case a packet size of 1430 succeeds but 1431 fails, so 1430 + 28 = 1458.
Step 3: Set your MTU
Now you have identified the interface you need to change and the ideal MTU for you, now it is time to make the change. Again from an elevated CMD Shell type the following replacing my MTU of 1458 with your own value:
netsh interface ipv4 set subinterface "Local Area Connection" mtu=1458 store=persistent
Or if you are using a Wireless connection:
netsh interface ipv4 set subinterface "Wireless Network Connection" mtu=1458 store=persistent
If all has gone well you should have a perfectly working internet connection.
Posted in Sys. Admin. | 14 Comments »
Thursday, October 22nd, 2009
Windows 7 turned up in the post today. The red box is Visual Studio 2008 which is there to show that the boxes have a similar profile to the old style hard cases.
I have been running the Beta since it was first available to the general public, and I have had Windows 7 Business at work for a couple of weeks now. Bought Windows 7 Home Premium for about £45 from Tesco. One copy for the main PC which I will probably re-build at Christmas and one copy for the laptop which is re-built now. Scott Hanselman described Vista as an operating system that stabs you in the eye a thousand different ways, I would have to agree with that. Windows 7 is different, things work how you think they should and don’t seem to randomly break when you least expect it.
As for the title of this blog post, I have mostly been installing Windows 7 to Vampire Weekend which Kev introduced me to. The track M79 seems to have taken some inspiration from the Sailor’s Hornpipe better known as the Blue Peter theme tune, seems to cut off just at the moment I am expecting it to carry on into the main part of the music. Maybe there is a Mike Oldfield link in addition to the lyrical Peter Gabriel link.
If I am moved to over the course of the next couple of week I shall try and point out some of the new features available in Windows 7 that are cool. For the time being try the following hold down Alt, while still holding down Alt press “Alt Gr” (The other side of the space bar) then press Tab. For some reason you get the old XP style Alt-Tab window. Utterly pointless?
Posted in Diary, Sys. Admin. | 1 Comment »
Thursday, February 5th, 2009
Having done a little experimenting with Visual Studio Extensions for WSS (VSeWSS), I wanted to start actually developing features for our intranet site. I try and add everything that is even slightly important into source control (Subversion). VSeWSS creates normal looking solutions, however when you deploy your project to a SharePoint site it created an additional directory alongside “bin” and “obj” called “pkg”.
This “pkg” folder contains the manifest.xml, soloution.xml and feature.xml files that are used to create the feature to be deployed into SharePoint. Initially I was including this folder in my commits however, I noticed that any tweaks made to feature.xml were overwritten when you deployed the package again. After some searching around I came across an article that suggests deleting the “pkg” folder under certain circumstances. From this I assume that the contents of the “pkg” folder is generated each and every time you package and deploy your solution (or indeed project), thus it does not need to be added to source control.
While writing this post I did come across another blog that suggests adding the “pkg” folder to source control. There does appear to be little advice out there regarding VSeWSS and Source Control. I would be interested to hear others experiences on the subject.
Posted in Programming, Sys. Admin. | 2 Comments »
Tuesday, November 25th, 2008
Typemock are offering their new product for unit testing SharePoint called Isolator For SharePoint, for a special introduction price. it is the only tool that allows you to unit test SharePoint without a SharePoint server. To learn more click here.
The first 50 bloggers who blog this text in their blog and tell us about it, will get a Full Isolator license, Free. for rules and info click here.
Posted in Sys. Admin. | 1 Comment »
Monday, September 8th, 2008
For my regular day job I am a Systems Administrator, my team and I manage a network with 7 servers and approximately 600 workstations, 200 laptops and 2500 users. All clients are Windows XP SP2 or SP3 and all servers are Windows 2003 SP2 or Windows 2003 R2 SP2.
I am sure I am not alone in knowing least 5 commands that I use day in and day out to manage workstations or servers on the network. I thought I would take the time to share some of these with you now.
Posted in Misc., Sys. Admin. | No Comments »
Tuesday, July 22nd, 2008
The SMART .notebook format is simply a zipped set of XML and SVG files, This may be common knowledge but it is certainly the first time I have come across it.
To test it you can create a file in SMART Notebook rename the extension from .notebook to .zip, double click to open, you will be presented with several files named pagen.svg where n is a number, as well as a series of other files and folders including settings.xml, preview.png and metadata.xml.
The XML and SVG files can be edited in notepad, or perhaps more useful for the SVG files in a program such as Inkscape.
Posted in Sys. Admin., Things You Find | No Comments »