Thursday, November 8, 2012 #

VS2012 Light or Dark Theme Programmatically



Contains a guid (in the case of dark 1ded0138-47ce-435e-84ef-9ec1f439b749

This guid maps to a list of keys under


1ded0138-47ce-435e-84ef-9ec1f439b749 = Dark

a5c004b4-2d4b-494e-bf01-45fc492522c7 = High Contrast

de3dbbcd-f642-433c-8353-8f1df4370aba = Light

Posted On Thursday, November 8, 2012 6:01 AM | Comments (0)

Friday, July 6, 2012 #

When in need of inspiration…

Posted On Friday, July 6, 2012 6:08 AM | Comments (0)

Saturday, June 9, 2012 #

Linux,Apache,NetBeans,PHP == Windows,IIS/Cassini,Visual Studio,ASP.Net

I've worked out how to get my linux based Netbeans PHP development machine to behave much like what happens when you create a new ASP.Net project in Visual Studio.

Firstly create multiple PHP project in Netbeans,say for example mysite1 and mysite2. Next edit the apache2/sites-enabled/000-default file and add two virtualhost sections as below


ServerName mysite1.localhost

DocumentRoot /var/www/mysite1/



ServerName mysite2.localhost

DocumentRoot /var/www/mysite2/


For each site you add, pick a different ip address similar to the above where I use the third octet to increment, next edit the etc/hosts file and add the following two lines mysite1.localhost mysite2.localhost

Then in Netbeans, go to File->Project Properties click on 'Run Configuration' and set 'Project Url' to http://mysite1.localhost for the first project and http://mysite2.localhost for the second project.

That will give you a PHP development box which develops multiple PHP projects similar to how a Visual Studio Windows based box handles multiple ASP.Net sites.

Hope this helps someone :)

Posted On Saturday, June 9, 2012 8:49 AM | Comments (0)

Wednesday, November 9, 2011 #

SQL Server-Determine which query is taking a long time to complete


Cool little trick to determine which sql query which is taking a long time to execute, first while offending query is running from another machine do

EXEC sp_who2

Locate the SPID responsible via Login, DBName and ProgramName columns, then do


The offending query will be in the EventInfo column.  This is a great little time saver for me, before I found out about this I used to split my concatenated query script in to multiple sql files until I located the problem query

Posted On Wednesday, November 9, 2011 4:30 PM | Comments (0)

Friday, April 29, 2011 #

Umbraco 4.0.x.x UComment 1.0

If you have a web site using Umbraco and you wish to add the ability to comment on submitted articles then UComment is a quite brilliant little package, the functionality can be added in no time at all.  My problem was that the web site in question uses Umbraco 4.0.x.x and I couldn’t upgrade to the most recent (4.7 at the time of writing) due to not being able to back up the database before I begin (shared web hosting).

This meant I was forced in to using UComment 1.0 because 1.1 is tied to Umbraco 4.5 and 1.2 is tied to Umbraco 4.7 etc.. so I downloaded the 1.0 Umbraco package and installed it.  Unfortunately there are bugs in UComment 1.0 to do with page validation and the forcing of the user to enter a web site address before they can post anything.  The comment form would not pass validation checks for, .org, and lots of other possible domains.  I have modified the UComment 1.0 c# source code to fix these issues, and compiled the UComment.dll assembly for .net 3.5, the project can be downloaded from here.

Might save someone somewhere some work Smile

Posted On Friday, April 29, 2011 11:59 AM | Comments (0)

Wednesday, March 3, 2010 #

Sql Server search stored procs for text

Search all stored procedures in a database for a string

SELECT routine_name, routine_definition 

FROM information_schema.routines

WHERE routine_definition LIKE '%textyoursearchingfor%'

AND routine_type = 'PROCEDURE'

Posted On Wednesday, March 3, 2010 4:55 PM | Comments (0)

Thursday, June 18, 2009 #

MCTS 70-536 Exam

Three months of hard work paid off today and I scored 982 out of 1000, would love to know on which question I lost those 18 points…

Posted On Thursday, June 18, 2009 7:14 AM | Comments (3)

Saturday, March 7, 2009 #

Regular VS IDE Colour Scheme Changes Improve Productivity..

.. maybe / maybe not.  I've collected / created lots of colour scheme .vssettings xml files over the years, here are some of my favourites... enjoy!

All files are guaranteed to only contain settings for the All Settings->Options->Environment->Fonts and Colours so the rest of your visual studio settings remain untouched.  All files are in VS2008 format though they can be edited to work with VS2005 by editing the line :-

<ApplicationIdentity version="9.0" />

to read

<ApplicationIdentity version="8.0" />

Posted On Saturday, March 7, 2009 1:47 AM | Comments (1)

Friday, November 14, 2008 #

Agent Ransack

Just discovered this great piece of free software from mythicsoft, it is a cut down version of a product called File Locator Pro. It is clearly aimed at software developers and is great for finding files which contain certain strings / lines of code.  Prior to finding this program I had been using source code modified from to suit my needs, the results are good but not as good as agent ransack, give it a try :-

Great new look to the site btw

Posted On Friday, November 14, 2008 4:01 AM | Comments (0)

Thursday, July 10, 2008 #

Directory.GetFiles() in Modified Date/Time Order Pt2

Following on from this.  I've noticed that it only gives you to the second accuracy.  If your software is capable of making more than one file per second, the sort order will be date/time to the second then alphanumerically on the filename.  Not ideal if your filenames are guids, the following class gives date/time sort accuracy of 100 nanosecond intervals then alphanumerically on filename :-

   1:  Imports System.IO
   2:  Imports System.Runtime.InteropServices
   3:  Imports System.Runtime.InteropServices.ComTypes
   4:  Imports Microsoft.Win32.SafeHandles
   5:  Imports Microsoft.Win32
   6:  Public Class clsCompareFileInfo
   7:      Implements IComparer
   9:      Private Const GENERIC_READ = &H80000000
  10:      Private Const OPEN_EXISTING = 3
  11:      Private Const FILE_SHARE_READ = &H1
  12:      Private Const FILE_SHARE_WRITE = &H2
  13:      Private Const FILE_ATTRIBUTE_NORMAL = &H80
  14:      Private Const FILE_FLAG_NO_BUFFERING = &H20000000
  16:      Public Structure FILETIME
  17:          Public dwLowDateTime As Long
  18:          Public dwHighDateTime As Long
  19:      End Structure
  21:      Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Integer, ByRef lpCreationTime As ComTypes.FILETIME, ByRef lpLastAccessTime As ComTypes.FILETIME, ByRef lpLastWriteTime As ComTypes.FILETIME) As Integer
  23:      Private Declare Auto Function CreateFile Lib "kernel32.dll" (ByVal lpFileName As String, _
  24:  ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, _
  25:  ByVal lpSecurityAttributes As IntPtr, ByVal dwCreationDisposition As Integer, _
  26:  ByVal dwFlagsAndAttributes As Integer, ByVal hTemplateFile As IntPtr) As IntPtr
  28:      Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
  29:      <DllImport( _
  30:                  "kernel32.dll", _
  31:                  CharSet:=CharSet.Auto, _
  32:                  SetLastError:=True)> _
  33:              Friend Shared Function CompareFileTime( _
  34:              ByRef lpFileTime1 As ComTypes.FILETIME, _
  35:              ByRef lpFileTime2 As ComTypes.FILETIME) _
  36:              As Integer
  37:      End Function
  39:      Public Function Compare(ByVal x As Object, ByVal y As Object) As Integer Implements System.Collections.IComparer.Compare
  40:          Dim File1 As FileInfo
  41:          Dim File2 As FileInfo
  43:          File1 = DirectCast(x, FileInfo)
  44:          File2 = DirectCast(y, FileInfo)
  46:          Dim x_Created As ComTypes.FILETIME
  47:          Dim x_Modified As ComTypes.FILETIME
  48:          Dim x_Accessed As ComTypes.FILETIME
  49:          Dim y_Created As ComTypes.FILETIME
  50:          Dim y_Modified As ComTypes.FILETIME
  51:          Dim y_Accessed As ComTypes.FILETIME
  53:          Dim fhandle As IntPtr = CreateFile(File1.FullName, GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero)
  54:          GetFileTime(fhandle, x_Created, x_Accessed, x_Modified)
  56:          Dim fhandle2 As IntPtr = CreateFile(File2.FullName, GENERIC_READ, FILE_SHARE_READ Or FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero)
  57:          GetFileTime(fhandle2, y_Created, y_Accessed, y_Modified)
  59:          CloseHandle(fhandle)
  60:          CloseHandle(fhandle2)
  62:          Compare = CompareFileTime(x_Modified, y_Modified)
  63:      End Function
  64:  End Class

Posted On Thursday, July 10, 2008 9:19 PM | Comments (1)

Thursday, April 17, 2008 #

SBS2003, ISA Server & 550 FTP errors

Given the time (nearly 2 days!) it's taken me to get to the bottom of this I thought it worthy of a blog post hopefully saving someone the hours of frustration i've just been through.  I know my FTP code works very well, around 50 different customer sites with very few support calls confirm this, on this one installation however my xml documents would not arrive at the web server.  My logging code confirmed that we were connecting to the server ok, successfully managing to cwd to the appropriate directory yet sending the file would fail with a 550 error code, same results from the server and any machine on the domain. 

My customers hardware supplier assured me they'd adjusted the firewall to allow ftp and it must be my codes fault, not so, after dialling in to the server and looking at the firewall rules within isa management console, you can right click the firewall rules, choose configure and a dialog will appear with a solitary check box "Read only" which defaults to ticked when adding ftp rules, un-tick that, restart and it all worked.

Their hardware company had convinced me it must be my code, I ended up installing visual studio on one of their machines to step through my code convinced it must be a bug.  Not happy when I found out my code was fine and i'd been pulling my hair out because of their incompetence, anyway, I hope this helps someone out...

Posted On Thursday, April 17, 2008 6:49 AM | Comments (2)

Thursday, March 13, 2008 #


A pet hate of mine (one of many :-j) is bloated software, especially device drivers you know the sort of thing installing a printer requiring hundreds of mb disk space and adding system tray applets (HP?), I collectively refer to this stuff as shiteware something needs to be done, it's getting worse.


This ( sort of thing was inevitable, of course it's easy to sort out but it's just becoming such a pain time wise.  Laws need to be put in place and people need to be made accountable (strung up and tortured). </rant>

Posted On Thursday, March 13, 2008 9:57 PM | Comments (0)

Tuesday, February 26, 2008 #

Happy birthday...

Today marks the second birthday of my xbox 360 and it's still going strong.  Since day one it's stood vertically and hasn't been moved an inch.  In these days of rrod ridden horror stories I thought i'd share...

Posted On Tuesday, February 26, 2008 1:36 PM | Comments (0)

Sunday, January 13, 2008 #



Posted On Sunday, January 13, 2008 2:42 PM | Comments (1)

Friday, January 4, 2008 #

UserControl actually has OnTextChanged event

 Wow, didn't know that adding

[Browsable(true), EditorBrowsable(EditorBrowsableState.Always)]
new public event EventHandler TextChanged
add {base.TextChanged += value;}
remove {base.TextChanged -= value;}


private void txtbox1_TextChanged(object sender, EventArgs e)

Actually gives a textbox based usercontrol a TextChanged event at design time, much nicer than other methods i've used previously.

Posted On Friday, January 4, 2008 4:19 PM | Comments (3)

Copyright © Neil Smith

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski