2010
02.17

Ok so we all have programmers that can speak every language from around the world (or at least in every contry where our software is deployed). No? Oh!

This of course is a problem, and translation can become expensive if done frequently. Now I also dont speak multiple foreign languages, so I can’t vouch for how accurate this is, however I found a tool called “Resource Blender” which I’m sure will give the helping start you need to localise your app.

Check it out at http://www.resourceblender.com/

2010
02.03

If you have a query that takes a long time to execute, its possible that its lacking a good index. What I didnt realise untill recently is that where your execution plan contains nodes such as “Table Scans” SSMS will kindly offer you a suggested Index that you could create and improve the overall performance. It even tells you by how much it thinks it will improve your procedure by.

Simply bring up the context menu of the node and you should see the “Mising Index Details…” menu item.

Missing Index

You index will then be scripted to a new window. Simply remove the comments and give the index a name.

This has saved me a bit of time and I hope it can do the same for you!.

2009
10.21

Its now possible for everyone to get their hands on the latest version of Visual Studio 2010.

Download Visual Studio 2010 Beta 2

2009
10.21

Fundipedia goes live.

A very short post….Just wanted to let everyone know after a solid year of working on the project Fundipedia goes live.

2009
09.08

Formatting code – in particular SQL – has been something I’ve been campaigning a bit more about recently within the development team I work within. I strongly believe well formatted code (not the same as well written bullet proof code) saves time in debugging, refactoring and increased speed in understanding the projects at source code level.

I found a note worthy article SQL Code Formatting Standards by Robert Sheldon today – I recommend a read.

It raises some interesting things, however my main concern is that within my current development team I have members with varying levels of SQL expertise. Therefore even for the simplest of queries I strongly believe there will be a sizable benefit to all members.

I have already been able to prove that by employing code formatting styles in our C# code has been beneficial. We currently use a tool called StyleCop, its not perfect, but I can now guarantee when I open a file from another developer I now no longer have the ‘urgh’ response when trying to navigate and find the items I am after. If I can achive this with my SQL source files, then I have succeeded in rolling out our SQL code formatting enforcement.

The main problems I have had to tackle when rolling out such policies are…

  • Don’t have time to roll out such policy -> You don’t have to start enforcement on everything at once or roll out across all existing code. Pick a single active project, and enforce on new and edited files. Eventually as files are revisited you will soon have nicely formatted SQL files in your source control.
  • Someone doesn’t agree on some particular formatting rules -> It doesn’t have to be a dictatorship on this, be democratic, take a vote within the team. Most formatting tools are flexible in this manor.
  • Cost -> Always a tough one to argue, but I believe the figures in the article that as much as 8-12% of time saved can be achieved through good code formatting. Therefore if you take your average wage, factor in a single user licence (SQL Prompt at time of writing was £125) it wont take long to recoup the costs.

So I’ll try and have a follow up in a month or so on how our SQL enforcement has gone here at Atlas CS.

2009
07.15

There are many benefits to using the built-in string.Format() function over the string + operator. I found a good article on its use…here.

In addition I personally find it easier to read :-) .

2009
07.01

I have recently stated working with .NET Windows Services (again) after a year long break from them, and any developer who has worked with them before will tell you how much effort is involved in debugging a .NET windows service.

In short the basic principle is…

  • Run Service
  • Attach Visual Studio Debugger

…as simple as this seems there is an awful lot of mouse clicking involved.

Also debugging the service as it is strating up is problematic, so I place a simple wait to give me the opportunity to debug start-up code such as…

#if DEBUG
// give us a chance to attach the debugger
Thread.Sleep(10 * 1000);
#endif

… so i have a chance to get my debugger attached in time. However the number of times I’ve made mistakes like attaching to the wrong process or have run out of time is countless.

So below is a Macro I wrote to auto-magically attach to the service I wish to debug in question. This code will also stop and re-run the service in question if already running so you have a chance to grab the start-up code.

To Install:

  • Open the Visual Studio “Macros IDE” (Alt-F11).
  • Add a new code file.
  • Add a reference to System.ServiceProcess
  • Paste contents of below script.
  • Add your .NET Windows Service short name and EXE name in the constant variables.
  • Run the macro.

Option Strict Off
Option Explicit Off
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Imports System.ServiceProcess

Public Module Scheduler

Private Const ServiceName As String = ""
Private Const SeviceEXE As String = ".exe"

' Used to start the service on a seperate thread.
Delegate Sub StartServiceWorker()

'stop the service
Sub StopService()

Dim schedulerService As ServiceController
schedulerService = New ServiceController(ServiceName)

If schedulerService.Status = ServiceControllerStatus.Running Then
schedulerService.Stop()
End If

End Sub

' starts and attached to the scheduler
Sub StartAndAttachToScheduler()

StartService()

' wait 1 second so service starts.
Threading.Thread.Sleep(1000)

AttachToScheduler()

End Sub

' Starts the service on a seperate thread.
Private Sub StartService()

Dim myStartService As New StartServiceWorker(AddressOf StartServiceHelper)
myStartService.BeginInvoke(Nothing, Nothing)

End Sub

' Starts the service (will stop first if already running)
Private Sub StartServiceHelper()

Dim schedulerService As ServiceController
schedulerService = New ServiceController(ServiceName)

If schedulerService.Status = ServiceControllerStatus.Running Then
schedulerService.Stop()
End If

schedulerService.Start()

schedulerService = Nothing

End Sub

' This subroutine attaches to calc.exe if it is running.
Private Sub AttachToScheduler()

Dim attached As Boolean = False
Dim proc As EnvDTE.Process

For Each proc In DTE.Debugger.LocalProcesses
If (Right(proc.Name, SeviceEXE.Length) = SeviceEXE) Then
proc.Attach()
attached = True
Exit For
End If
Next

If attached = False Then
MsgBox(String.Format("{0} is not running", ServiceName))
End If

End Sub

End Module

Hope this now makes working with services now a little easier for all.

2009
06.25

Its been a few days since I placed my request for my personal domain www.garyhowlett.co.uk but the registrar has still to confirm and activate it. I don’t remember domains taking this long previously – how much longer will it take?

In the mean time ive added a few more links to sites i use often and now looking for a nice windows mobile app so I can word press on the move :-) , anyone know of any?

2009
06.23

Well I finally got around to making my first ever blog site! Post title seems aptly named for the career choice I have taken.

Many thanks to Steven Day for helping me get up an running!