# Friday, July 25, 2008

Exactly a year ago today I posted a little application that output the sites in IIS to a text file and as a few days ago Lars asked for the source, I thought it would be a nice thing to release it exactly a year later.

I didn't plan it that way, it just happened! Cool :)

Identify IIS Sites and Log File locations for WWW and FTP source

using System;
using System.DirectoryServices;
using System.IO;
using System.Collections;

namespace IISSites
    class Program
        static string fileToWrite = String.Empty;

        static void Main(string[] args)
            fileToWrite = String.Format("IISExport{0:dd-MM-yyyy}.txt", DateTime.Today);
            if (args != null && args.Length > 0)
                fileToWrite = args[0];

            SortedList www = new SortedList();
            SortedList ftp = new SortedList();
                const string FtpServerSchema = "IIsFtpServer"; // Case Sensitive
                const string WebServerSchema = "IIsWebServer"; // Case Sensitive
                string ServerName = "LocalHost";
                DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName + "/w3svc", "Domain/UserCode", "Password");

                foreach (DirectoryEntry Site in W3SVC.Children)
                    if (Site.SchemaClassName == WebServerSchema)
                        string LogFilePath = System.IO.Path.Combine(
                            "W3SVC" + Site.Name);
                        www.Add(Site.Properties["ServerComment"].Value.ToString(), LogFilePath);

                DirectoryEntry MSFTPSVC = new DirectoryEntry("IIS://" + ServerName + "/msftpsvc");
                foreach (DirectoryEntry Site in MSFTPSVC.Children)
                    if (Site.SchemaClassName == FtpServerSchema)
                        string LogFilePath = System.IO.Path.Combine(
                            "MSFTPSVC" + Site.Name);
                        ftp.Add(Site.Properties["ServerComment"].Value.ToString(), LogFilePath);
                int MaxWidth = 0;
                foreach (string Site in www.Keys)
                    if (Site.Length > MaxWidth)
                        MaxWidth = Site.Length;
                foreach (string Site in ftp.Keys)
                    if (Site.Length > MaxWidth)
                        MaxWidth = Site.Length;
                OutputIt("Site Description".PadRight(MaxWidth) + "  Log File Directory");
                OutputIt("".PadRight(79, '='));
                OutputIt("WWW Sites");
                foreach (string Site in www.Keys)
                    string output = Site.PadRight(MaxWidth) + "  " + www[Site];
                if (ftp.Keys.Count > 0)
                    OutputIt("FTP Sites");
                    foreach (string Site in ftp.Keys)
                        string output = Site.PadRight(MaxWidth) + "  " + ftp[Site];
            // Catch any errors
            catch (Exception e)
                Console.WriteLine("Error: " + e.ToString());
                Console.WriteLine("Press enter to close/exit...");

        static void OutputIt(string lineToAdd)

            if (!String.IsNullOrEmpty(fileToWrite))
                StreamWriter SW;
                SW = File.AppendText(fileToWrite);
                Console.WriteLine("locationToOutput is Null or String.Empty please supply a value and try again.");
Friday, July 25, 2008 3:52:37 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Tuesday, July 15, 2008

As it's my Birthday today I thought I'd post a silly ditty. I'm currently altering Protx's old ASP.Net library to accommodate their changes in regards 3D Secure and while reflecting some of the code came across an enum with their number representations as Hexadecimal strings. I needed to convert these to decimals so thought I'd share a quick and easy way to do it.

Open up Window's Calculator (Windows Key + R then type in calc) under the View menu select "Scientific". Press the F5 key to switch over to Hex entry. Type in the value after the 0x and hit F6

Simple, easy and will help you convert all those Hexadecimal strings (ones that look like this: 0x01 or 0x1a).

Right, time for a coffee :)

Tuesday, July 15, 2008 10:25:56 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Thursday, July 10, 2008

We've been setting up the page's title using ASP.Net for quite some time now, we tend to word it: Product Name | Category | Site Name as this IMO is the most comprehensive naming convention (though the pipe (|) gets converted to a space for the bookmarks).

When editing one of our sites today though I noticed that the title was resorting to Avant Garde hair salons -which was setup as the brand's name. Looking into it I found that if you set the <title> tag within the page or master page, ASP.Net doesn't override it from the codebehind so watch out!

For those of you who don't know how to set the title of your page from codebehind it's simple:

this.Page.Title = "Put your title here";
ASP.Net | C#
Thursday, July 10, 2008 11:57:57 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Wednesday, July 09, 2008

This is one of the most bizarre stories I've heard in a while, you really can't make it up. http://news.bbc.co.uk/1/hi/england/norfolk/7496923.stm

Wednesday, July 09, 2008 12:51:02 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, July 05, 2008

I've been re-working our new SVN structures recently as I'm now starting to understand how it works but one of the issues I had was trying to move the files/folders from a previous SVN directory.

PowerShell is great if you understand it (which I'm also learning) so I thought I would share this little script with you. It just loops through the files/folders and removes all those named _svn. I found this script from Wyatt Lyon Preul and he complained about the length of the script, but from what I can tell you can condense that down to:

gci $folder -fil '_svn' -r -fo | ? {$_.psIsContainer} | ri -fo -r

I'm not that great with PowerShell yet but I hope that helps someone :)

WARNING: As ever, incase I'm wrong (it happens!) test that on a folder first that you don't worry about losing!
Saturday, July 05, 2008 4:25:32 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Thursday, July 03, 2008

This started out as a response to a comment and then I thought it might be better as a post in it's own right.

In his comment David Conlisk said:

First off Tim very well done on providing some excellent information on the site. I've just spent my first afternoon as my own boss reading your business start-up advice and it's been excellent (it's called research, not slacking off!)

One question I would ask you about this post is what about market rates? I am going from being a contractor on an hourly rate to being a limited company. I never considered working out a base rate like you've done, instead I spoke to as many people as possible in the marketplace to gauge what the rates are and I price accordingly. Of course this works fine for more corporate clients, but I doubt I could charge smaller companies similar rates. Let's hope I can make a good enough impression on my corporate clients to keep that kind of work coming in!

Keep up the good work,


Hi David,

Thanks for your kind words, I'm glad to hear you found it of use.

In regards market rates, it's one of the oldest debates in the book AFAIK and has a rather unhelpful answer of "You should charge what you feel comfortable charging". I'll try to improve on that a little as it's always hard but in essence it's true. Basically from experience I would keep it as simple as possible, have as few rates as possible for all clients, just make sure you feel you're worth the rate in your own mind.

Although you need to keep an eye on the "market rates", you'll find your rate will determine the type of client you work with. Being the cheapest on the market is not necessarily a good thing. One advantage of offering a freelance service to other development companies is that we get to see what happens when your prices are rock bottom -take it from me, more often than not, it's more hassle than it's worth. When you have someone going el-cheapo all the way you often find they're overly picky about every aspect and require a lot more management time (that's not to say those paying higher rates aren't, I guess you just notice it more).

As long as you're reasonable with your rates, clients who are willing to pay your rates, will use you (they may complain a little but it's unlikely) but at the end you'll both be happy with the work produced. As long as you believe in yourself -and your rates, this will be conveyed to your clients so if you know you're value for money you will be able to justify it to any client (corporate or otherwise). It's up to the client to decide whether you're value for money.

Believe it or not the service industry is not the only industry to set it's fees and then get them negotiated on -Stacey used to work in Debenhams a few years ago, for those of you who don't know what Debenhams is, it's a large department store in the UK, they sell items for a set fee, everyone knows this but regardless of this she still had people trying to negotiate on the fee. Be open to negotiation but don't be silly about it otherwise the client may always expect a discount of that level (so stick to no more than a 10% variation).

Don't worry about having clients not use you because of your rate, as long as you're around the market rate there will be a client for you. At the end of the day, you can't realistically expect to service every prospect that comes through your doors -sometimes you just have to say "sorry that's the price".

I'm not saying charge £1,000ph when the market rate is £10ph as that's just silly but I would say your base rate shouldn't be cheaper than the market rate or more than 3 times the market rate (unless your service really is that good and you're bogged down with work [I did have a link for here about an ?SEO company charging $1,000ph and still being too busy but I can't find it atm], in which case go for it!).

Tip: How do you find out market rates? That's simple, find a couple of companies who offer similar services, to a similar client base who are a similar size to you, call them up and just ask them what their daily rates are. Call 10 or so companies and you should have a few prices to compare :)

Another tip: Always ask for an rough idea of their budget -even if it's just a range, this will give you a good idea of they're realistic or not.

And one more: Don't forget your rates don't need to be fixed. If you find you're too busy, increase your rates a little, if you're too quiet (whereas everyone else is really busy) then you may need to look into how you market your business, your presentation skills and finally possibly reducing your rates.

A word of warning: I would avoid dropping your rate "for the nice client" as the majority of times you'll end up regretting it, either because it gets out of control and you get frustrated because "you're doing them a favour" whereas they feel they just negotiated your service rates down (and so should be getting the same level of service. Remember, it's business, you don't need to do anyone a favour, charge what you feel is fair for your time and you'll always enjoy your work :)

On the flip side of this, if you're lucky enough to get a large corporate, make sure your rate is their market rate as we've lost work for being too cheap (and in my eyes we were already overcharging for the workload).

It's easy to be busy and cheap, but being a busy fool is no way to live!



Thursday, July 03, 2008 8:36:01 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [1]  | 
# Tuesday, July 01, 2008

It's gift time again (for me that is!) -yey! But when I was checking out on Amazon.co.uk earlier today I was a little puzzled by this...

On the product details page it said £4.45 shipping (correct me if I'm wrong)

But then when you check out it's suddenly £7.36. I was checked in by this stage so did Amazon think I was prepared to pay for Express Shipping? I tried to change it to default shipping (as they often upsell) but I couldn't.

.most odd.

Tuesday, July 01, 2008 10:32:54 PM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Friday, June 27, 2008

If you've had the chance to catch any of the UK news recently (or even glanced at a paper) you'll no-doubt have heard about the fantastic new art gallery that was due to open in West Bromwich last year this weekend -The Public.

Unlike all the other articles about The Public (I ran out of words so here are a few more), I'm not interested in flaming the fact that they've placed a £32 million £52million (they went over budget) art gallery in one of the Midland's most deprived areas, or the fact that they're looking to charge around £7 for entry but instead the fact that they can't even get the simplest of things right -despite an astronomical budget.

Despite having gone over budget, and delivering late, they couldn't even manage to get their website online. In this day and age with such fantastic and resilient hosting providers such as Rackspace, there really is no excuse for having your website offline.

Fair enough, an "Under Construction" message could have been an amusing pun while The Public was being constructed but it has been constantly offline for the week before it's launched is simply unforgivable. Regardless of who developed it, I hope there were serious ramifications.

Despite this massive cock-up, I'm looking forward to avoiding the £7 entrance fee and checking out the futuristic art gallery this weekend (free entry). I'll upload my photos to Flickr if I'm allowed to photograph in there, if not the guardian has a nice collection of images. At least I know there the female toilets are complete.

Now I just need to find out when it opens.

.shame the website is still offline ;)

Friday, June 27, 2008 10:47:35 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [2]  | 
# Wednesday, June 25, 2008

As requested on the forum, we've got a map to try and work out where it should be placed, if you want to come along get yourself added: http://tinyurl.com/3oaf8x

Instructions from Google:

Adding and Editing Placemarks

To add a placemark to your map:

  1. Create or open a map.
  2. Click Placemark button. Your cursor changes into a placemark icon with an "X" crosshairs. The crosshairs indicate where the placemark will fall.
    Placemark icon
  3. Move the cursor to the appropriate location. If you want to dismiss this placemark, press the Escape key.
  4. Click your mouse button to place your placemark. It should bounce into place.
  5. Add a title and description.
  6. You can also change the icon for your placemark by clicking the icon in the top right corner of the info window. You can also add your own icon.
  7. Click OK to save your placemark.
To move or edit a placemark:
  1. Click Edit in the left panel.
  2. Drag and drop the appropriate placemark to the new location. Note that you can only edit or move placemarks on your maps, not others.
  3. To edit a placemark's title or description, click on it to open the info window. Edit the title and description and click OK.
  4. Click Done in the left panel when you are finished.
Wednesday, June 25, 2008 10:25:00 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [0]  | 
# Saturday, June 21, 2008

In a previous post about CodeGarden 08, I asked people to get in touch if they'd be interested in a UK Umbraco meet up. I've had a fair few people get in touch so I think it's something worthwhile pursuing further. The nest stage from my POV is working out the location and potential content of the meet so I thought I'd open it up to the floor.

With the forthcoming DDD7, I thought it might be a ready-built platform that we could use but I agree with Phil that DDD7 may not be a suitable platform for a multitude of reasons.

As I've had people from the South West and Scotland voice an interest, I don't think it'll suit the majority of people to have it based in London so suggest it is based in the Midlands -probably Birmingham as it's easy to get to (M6 from the North, M4 from London, M5 from the South -or train!) and there are plenty of places to have the meet.

In regards the format/content of the meet, does anyone have any suggestions? We could follow Niels' and Per's open format or we can have a more structured theme? I've not had too much of a think as to subject matter but some I have come up with so far:

  • An introduction to Umbraco and what it is (many of the people I've spoken to have only just started using Umbraco)
  • Examples of Umbraco how Umbraco can be used
  • More advanced Umbraco functionality (membership etc)
  • Getting to grips with XSLT
  • How to sell Umbraco to your clients

So that's where I've got to so far, does anyone have anything to add?

BTW the logo is just a working logo atm, need to have Niels approve it ;)

Update: I have posted a post on the Umbraco forums about a UK Umbraco meet here

Saturday, June 21, 2008 12:17:58 AM (GMT Daylight Time, UTC+01:00)  #    Disclaimer  |  Comments [4]  |