Tim

Footprints in the snow of a warped mind

Monday, March 02, 2009

Where to find me

Flickr Icon  Twitter Icon  Linked In Icon  FaceBook Icon  Windows Live Alerts Butterfly  RSS 2.0 

The Site Doctor is Hiring!

Enjoy what you read here?
Think you can do better?
Join our team and get paid
up-to £35,000.
Apply now.

Tag Cloud

AJAX (4) Analysis (3) ASP (6) ASP.Net (59) Error Reporting (4) Web Service (2) WSDL (1) Atlas (2) Azure (1) Born In The Barn (1) Business (94) Business Start-up Advice (36) Client (17) Expanding Your Business (24) Recruitment (1) C# (25) Canoeing (4) Canoe Racing (5) Cheshire Ring Race (5) Racing (2) Training (4) Christmas (1) CIMA (1) Cisco (1) 7970G (1) CMS (1) Code Management (1) Cohorts (4) Commerce4Umbraco (1) Content (1) Content Management (1) Content Management System (1) CSS (4) dasBlog (5) DDD (2) DDDSW (1) Design (12) Icons (1) Development (28) Domain Names (1) eCommerce (12) Email (1) Employment (2) Festive Sparkle (1) General (39) Christmas (6) Fun and Games (11) Internet (22) Random (46) RX-8 (8) Git (2) Google (1) Google AdWords (1) Google Analytics (1) Hacking (1) Helpful Script (3) Home Cinema (2) Hosting (2) HTML (3) IIS (11) iPhone (1) JavaScript (5) jQuery (2) LINQPad (1) Marketing (6) Email (1) Multipack (1) MVC (3) Networking (3) Nintendo (1) Nuget (1) OS Commerce (1) Payment (1) Photography (1) PHP (1) Plugin (1) PowerShell (3) Presentation (1) Press Release (1) Productivity (3) Random Thought (1) Script (2) Security (2) SEO (6) Server Maintenance (7) Server Management (12) Social Media (2) Social Networking (3) Experiment (1) Software (11) Office (5) Visual Studio (14) Windows (5) Vista (1) Source Control (2) SQL (11) SQL Server (19) Starting Something New (2) Statistics (2) Stored Procedure (1) Sublime Text 2 (1) SVN (1) TeaCommerce (1) Testing (2) The Cloud (1) The Site Doctor (139) Turnover Challenge (1) Twitter (3) uCommerce (18) Umbraco (36) 2009 (1) 2011 (1) Useful Script (4) Virtual Machine (1) Web Development (72) WebDD (33) Wii (1) Windows Azure (1) XSLT (1)

Blog Archive

Search

<March 2009>
SunMonTueWedThuFriSat
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

Recent Comments

Blog Archive

Various Links

Google+

Blogs I Read

[Feed] Google Blog
Official Google Webmaster Central Blog
[Feed] Matt Cutts
Gadgets, Google, and SEO
[Feed] Ol' Deano's Blog
My mate Dean's blog on my space, equally as random as mine but not off on as much of a tangent!
[Feed] Sam's Blog
Sam is one of my younger brothers studying Product Design and Manufacture at Loughborough, this is his blog :) Enjoy!

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

newtelligence dasBlog 2.2.8279.16125

Send mail to the author(s) Email Me (Tim Gaunt)

© 2014 Tim Gaunt.

Sign In

# Monday, March 02, 2009

Visual Studio Tip of the day: Open files/folders in Windows Explorer

Monday, March 02, 2009 11:09:25 AM (GMT Standard Time, UTC+00:00)

A little irritation/time consuming process when you're working with multiple projects on multiple drives/SVN repos/directories is to open the current file's location within Windows Explorer. If you weren't already aware, you can do this from most projects/files by right clicking on the project in the solution browser:

Problem for me (and my mate Chris) is that not only is it just for the Project Item but more importantly it means using the mouse -which is something I'm trying to avoid as much as possible. Then I stumbled across a couple of posts which suggested opening Windows Explorer with Visual Studio's External Tools dialog.

They're both great ideas but you still need to use the mouse so I thought I'd take the final step and wire up some keyboard shortcuts. I'll recap the process here as I've added/grouped a few of their settings.

Creating the "External Tools"

There's a little productivity tip here for setting the folder in question the root of Windows Explorer, this encourages you to focus on just the work in question (though it can be a little irritating sometimes so I may "undo" this change later.

Custom #1: Open the current solution item in Windows Explorer

Title: Windows Explorer - Item
Command: explorer.exe
Arguments: /select,"$(ItemPath)"

Custom #2: Open the current Visual Studio project in Windows Explorer

Title: Windows Explorer - Project Directory
Command: explorer.exe
Arguments: /root,"$(ProjectDir)"

Custom #3: Open the current Visual Studio solution in Windows Explorer

We've got a number of projects that have useful files/folders stored in the same folder as the solution file so this one's useful to get quick access to them, I think I'll use this one a lot when dealing with SVN.

Title: Windows Explorer - Solution Directory
Command: explorer.exe
Arguments: /root,"$(SolutionDir)"

Custom #4: Open the current solution's binary (bin) directory in Windows Explorer

Useful when you want to get access to the dll i.e. to copy to another folder/upload just the dll to a website.

Title: Windows Explorer - Binary Directory
Command: explorer.exe
Arguments: "$(TargetDir)"

Custom #5: Open the current solution's target build directory in Windows Explorer

This is useful when you have a project that builds to another directory (i.e. a common DLL directory, I'm not sure how many people do this but I've got a couple of projects that do this so I thought I'd share it).

Title: Windows Explorer - Target Directory
Command: explorer.exe
Arguments: "$(BinDir)"

In all instances you can leave the Initial Directory field empty.

Note: On a couple of the directory related commands I've set the "/root" argument, this is a useful little productivity tip I learn a while ago to stop you navigating away from your work. Irritatingly I've not found a way of using the /select and /root commands together. It would also be nice to say "Open the bin folder and set the root to the project folder" but again I've not found a way.

If you're interested in the arguments I'm using there, check out the Microsoft Support article about How To Customize the Windows Explorer Views in Windows XP (these also work in Vista). Alternatively you can read more about the Visual Studio macros for build commands here (some of which are global I believe). I'm interested to see the use of $(TargetDir) as although it'll be useful for non-web projects, however using Web Deployment Projects might make it irrelevant for you.

You should now have 5 new items in your Tools' toolbar:

Wire up the keyboard shortcuts

As mentioned earlier, I want keyboard shortcuts but if you want toolbar icons, you should checkout the end of this post.

Open up the Keyboard settings within the Visual Studio Option dialog (Tools -> Options -> Environment -> Keyboard) -you may need to select the "Show all settings" checkbox in the bottom left of the Options dialog to see the Keyboard option.

In the Show commands containing field enter "Tools.ExternalCommand" to list the set of commands, irritatingly it just labels each command as "Tools.ExternalCommand#" for each command so this bit will require a little thinking on your behalf. My commands are #2-6 (#1 is the Dotfuscator Community Edition command).

I would then wire up the following shortcuts (I've set them up Globally for convenience):

Tools.ExternalCommand2 (Current Item): Ctrl+E, I
Tools.ExternalCommand3 (Current Project): Ctrl+E, P
Tools.ExternalCommand4 (Current Solution): Ctrl+E, S
Tools.ExternalCommand5 (Bin dir): Ctrl+E, B
Tools.ExternalCommand6 (Target dir): Ctrl+E, T

To enter these shortcuts simply press the first combination (in this case Ctrl+E), then press the second key (I -item, P -project, S -solution, B -binary, T -target). I found that a couple of these were already wired up to ReSharper and Pex which is a pain but I don't tend to use those particular shortcuts so I just overrode them

Now you should be able to press Ctrl+E followed by I and get your current item in Explorer.

It'd be nice if I could get it to use a single instance of Explorer and just refocus the items (on another key combo as that's not always the desired action).

Update: After using it a little, I've noticed that in my projects, I had the Bin/TargetDir the wrong way around (now corrected).
 

Don't forget to follow me on Twitter.

# Friday, February 27, 2009

Advanced Error Reporting in Umbraco, dasBlog and other ASP.Net sites

Friday, February 27, 2009 3:51:13 PM (GMT Standard Time, UTC+00:00)

If you've been following my blog you'll know that I've been raving about error reporting within ASP.Net (you can see my ASP.Net Error Reporting category for a couple of them if you like) but until now it's been limited to those sites that you have access to the global.asax file.

One of the irritations I've found with Umbraco and dasBlog is that I don't get notified of errors as they're just logged to a text file/database somewhere. This is fine if you run 2 or 3 sites but we manage too many to check them all everyday. Instead we rely on email error notifications which until today have been a PITA to integrate into Umbraco.

Today I'd like to introduce to you Error Handling v2.0 which instead of relying on the global.asax file for the error hooks, uses a HttpModule which means you can install it into any existing/pre-built application such as Umbraco and dasBlog.

Adding it into the site is simple, you'll need to install the module into the web.config file and add the configuration section a sample (cut down) web.config is below:

<?xml version="1.0"?> 
<configuration> 
    <configSections> 
        <section name="tsdErrorsConfigSection" allowExeDefinition="MachineToApplication" restartOnExternalChanges="true" type="System.Configuration.NameValueFileSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    </configSections> 
 
    <tsdErrorsConfigSection file="ErrorHandling.config"/> 
 
    <system.net> 
        <mailSettings> 
            <smtp from="you@yourdomain.com"> 
                <network host="127.0.0.1" port="25" /> 
            </smtp> 
        </mailSettings> 
    </system.net> 
 
    <system.web> 
        <httpModules> 
            <add name="ErrorModule" type="TheSiteDoctor.ErrorHandling.ErrorModule, TheSiteDoctor.ErrorHandling" /> 
        </httpModules> 
    </system.web> 

<!--  
IIS 7 Settings 
    <system.webServer> 
        <validation validateIntegratedModeConfiguration="false" /> 
        <modules> 
            <add name="ErrorModule" type="TheSiteDoctor.ErrorHandling.ErrorModule, TheSiteDoctor.ErrorHandling" /> 
        </modules> 
    </system.webServer> 
-->
</configuration>

Then you'll need to check all the settings -I recommend storing these in another .config file for clarities sake. Make sure you've configured your SMTP settings and you should be good to go.

If you want to test your settings, I've included a test page for you that will check your settings and show you the defaults if you've not set them. I've got this running now on a couple of Umbraco and dasBlog installs without an issue.

There's also a useful logging system in it which I'll look to overview in a later post but if you want to see it, check out the included aspx file.

Download ErrorHandling_v2.0.zip (25Kb)

If you do use this code I'd be interested to hear how you get on, I think it requires a little more refinement un some areas but it's pretty robust.

Enjoy.

 

Don't forget to follow me on Twitter.

# Wednesday, February 25, 2009

No hidden charges

Wednesday, February 25, 2009 6:36:42 PM (GMT Standard Time, UTC+00:00)

I've had a couple of situations recently where clients have suggesting "tricking" the user into either remaining subscribed to a service i.e. a mailing list or rammed some sales info down their throat whereas we advise to go the oposite direction -if someone doesn't want to read your email, why pay to send it to them? Just because you send it to them, doesn't mean they're going to read it.

Then while booking some tickets this evening I came across FlyThomson's take on it. I was going to blog how I thought their prices were reasonable, or how their checkout process upsold well etc but instead I get to the very last stage and after having "Still no change, the seats are the same price"!"/"The price you see is the price you pay" throughout I noticed that when selection any form of "grown up" payment card I get charged £10!!

The only cards it turns out that don't charge you are Solo and Visa Electron. So much for the "Still no change."

Why try and bamboozle your customer? Ok I had to pay it but I wouldn't now recommend you.

 

 

Thanks. Why didn't you state that at the start?

 

Don't forget to follow me on Twitter.

No hidden charges
Useful Links:  #  digg it!  del.icio.us  Technorati  email it!  Post CommentsComments [3]  Trackback LinkTrackback
CategoriesTags: Business
# Tuesday, February 17, 2009

Recent comments macro for DasBlog

Tuesday, February 17, 2009 9:25:05 AM (GMT Standard Time, UTC+00:00)

One of the issues I had with John Forsythe's Recent Comments macro for DasBlog was that the dasBlog recent comments weren't ordered by date (descending). I found that as people commented on older posts they were getting buried which irritated me as many were very still valid comments.

The fix was actually fairly simple, it was just a matter of adding  a sort and thanks to Lamba expressions, this is something we can do fairly simply. If you want to add recent comments to your dasBlog installation, use the following macro:

Recent Comments Macro

public virtual Control RecentComments(int count, int adminComments, int trimTitle, int trimContent, int trimAuthor, bool showTitle, bool showCommentText, bool showCommentCount)
{
    int commentsToShow;
    int totalComments;

    CommentCollection allComments = this.requestPage.DataService.GetAllComments();
    totalComments = allComments.Count;

    //Sort the comments in date order (descending)
    allComments.Sort((c1, c2) => c1.CreatedUtc.CompareTo(c2.CreatedUtc));

    if (!this.requestPage.HideAdminTools && SiteSecurity.IsInRole("admin"))
        commentsToShow = totalComments - adminComments;
    else
        commentsToShow = totalComments - count;

    if (commentsToShow < 0)
        commentsToShow = 0;

    StringBuilder sb = new StringBuilder();

    sb.AppendLine("<div class=\"recentComments\">");

    if (showCommentCount)
        sb.AppendFormat("<div class=\"totalComments\">Total Comments: {0}</div>", totalComments);

    sb.AppendLine("<ul class=\"comments\">");

    #region Loop through the comments

    for (int i = totalComments - 1; i >= commentsToShow; i--)
    {
        Comment current = allComments[i];

        bool showComment;
        if (!current.IsPublic || (current.SpamState == SpamState.Spam))
        {
            if (!this.requestPage.HideAdminTools && SiteSecurity.IsInRole("admin"))
            {
                showComment = true;
            }
            else
            {
                showComment = false;
                if (commentsToShow > 0)
                    commentsToShow--;
            }
        }
        else
        {
            showComment = true;
        }

        if (showComment)
        {
            if ((current.SpamState == SpamState.Spam))
                sb.Append("<li class=\"spam\">");
            else if (!current.IsPublic)
                sb.Append("<li class=\"hidden\">");
            else
                sb.Append("<li>");

            string link = String.Format("{0}{1}{2}", SiteUtilities.GetCommentViewUrl(current.TargetEntryId), "#", current.EntryId);
            string title = current.TargetTitle;
            string desc = current.Content;
            string author = current.Author;

            if (showTitle)
            {
                sb.AppendFormat("<div class=\"recent{0}CommentsTitle\"><a href=\"{1}\">",
                    current.SpamState,
                    link
                    );

                if ((title.Length > trimTitle) && (trimTitle > 0))
                    sb.AppendFormat("RE: {0}...", title.Substring(0, trimTitle));
                else
                    sb.AppendFormat("RE: {0}", title);

                sb.Append("</a></div>");
            }

            if (showCommentText)
            {
                sb.AppendFormat("<div class=\"recentCommentsContent\"><a href=\"{0}\">",
                    link
                    );

                if ((desc.Length > trimContent) && (trimContent > 0))
                {
                    sb.Append(desc.Substring(0, trimContent));
                    sb.Append("...");
                }
                else
                {
                    sb.Append(desc);
                }

                sb.Append("</a></div>");
            }

            sb.Append("<div class=\"recentCommentsAuthor\">");

            if ((author.Length > trimAuthor) && (trimAuthor > 0))
            {
                int num3 = (trimAuthor > author.Length) ? author.Length : trimAuthor;
                sb.Append("by " + author.Substring(0, num3));
                sb.Append("...");
            }
            else
            {
                sb.Append("by " + author);
            }
            sb.Append("</div></li>");
        }
    }
    #endregion

    sb.AppendLine("</ul>");
    sb.AppendLine("</div>");

    return new LiteralControl(sb.ToString());
}

I've since been working on extending it further so you can add a "All Comments" link which I'll post up later as it needs a little more work :)

If you want this wrapped up as a DLL let me know and I'll upload it.

Update 26th Feb 2009: You can download the dll here (it's also got a few other things in there if you want to look around).

Update 27th Feb 2009: I noticed that the above code was messing up everynow and again so I've updated it to use Linq instead which seems to work well. I've updated the DLL but not the source yet.

 

Don't forget to follow me on Twitter.

Recent comments macro for DasBlog
Useful Links:  #  digg it!  del.icio.us  Technorati  email it!  Post CommentsComments [1]  Trackback LinkTrackback
CategoriesTags: C# | dasBlog | Web Development
# Monday, February 09, 2009

Can Twitter be a bad thing for your business?

Monday, February 09, 2009 10:26:45 PM (GMT Standard Time, UTC+00:00)

There's going to be a series of articles shortly that go into my attempts of using social networking to build your business but I thought I'd get this one out into the blogosphere first.

What with the recent onslaught of "celebrities" onto Twitter such as Stephen Fry (who incidentally p'd a lot of people off the other day while over-posting), Chris Moyles and David Allen to mention a few, it got me thinking whether Twitter can actually be a negative thing for you and/or your business. I'm not referring to the tremendous time you lose reading and responding to the numerous posts (Tweets) but more about the transparency issues you'll run into.

Those of you who know me in person know that I don't tend to bite my tongue (not always a good thing I can tell you!) and instead tend to speak openly and honestly regardless of the situation, so for me I don't really worry about what I Tweet, IM, e-mail or SMS as it's usually saying the same thing (unless I'm tired and losing my mind!). I have however noticed that's not true for everyone.

For me, Twitter, MSN and these other social-status update services such as Facebook bring a whole new layer of complexity to those who want to "skive" -who hasn't seen the notorious Kyle Doyle email. It's not so much full on lies like Kyle's that I'm referring to but more the little ones like saying you couldn't complete some work because of xyz and then having posted a message on Twitter along the lines of "sod this I'm off to the pub". When your employer (or even friend) see's that, if it doesn't immediately annoy them, it will certainly plant the seed of doubt in their mind.

I've been seeing this "phenomenon" for a while, it started with MSN status updates, then Facebook and now the worst of them all -Twitter. For goodness sake, just be honest, if you lie these days you're so much more likely to be caught out and that really can ruin your reputation -or at least lose you business.

 

Don't forget to follow me on Twitter.

# Tuesday, January 27, 2009

Answer machine messages

Tuesday, January 27, 2009 6:19:22 PM (GMT Standard Time, UTC+00:00)

Listening to Stacey update our answer machine messages today and Darren Ferguson posting on Twitter asking how to write project synopsis' got me thinking about KISS and that people knew what an answer machine was there for now and they didn't need a load of drivel about the fact that we're not here, leave a message, that we'll get back to them as soon as possible, they're just waiting for the beep (a lot of the time these days the provider then explains what to do to re-record your message etc -incidentally, have you ever used that? I've not) so why get in their way.

Although it's not something we've done yet, I'm thinking of changing the company message to something like "You've got through to The Site Doctor, we're not in, leave us a message or email" and that's it. Short, sweet and simple. I'm tempted to go as far as "The Site Doctor is closed, here's the beep" but that might be too blunt.

Why should they differ? People know what they're there for, get them straight to the point and don't fluff around it. BTW if you're interested to know what I think makes a good portfolio write up, again KISS and say as much as possible while writing as little as possible -the client doesn't generally care what technology you're using (9/10 they'll say they want PHP when they meant ASP.Net FWIW) as that's generally gobeldygook to them anyway.

It's also important to keep it as short as possible (unless you're not aiming at them reading it i.e. SEO). The readers not interested in how much trouble you went to, just make sure the following is mentioned (if it's true)!

  • How they found you, this can be subtly  e.g. "Acme Corp contacted The Site Doctor to." or "Acme Corp was referred to The Site Doctor" -says all it needs no?
  • Overview what the general spec was e.g. "We were commissioned to do ABC"
  • Overview any successes that you had e.g. "We achieved everything Acme Corp asked of us within the timescales and budgets outlined"
  • Without getting too techy, overview how it works and what they can do with it
  • Use your company name once or twice but not every time, it's not necessary

As I said, our portfolio doesn't always follow this at the moment but we're working on it. A better example is our paper brochure where we only had 50-100 words per project.

 

Don't forget to follow me on Twitter.

Answer machine messages
Useful Links:  #  digg it!  del.icio.us  Technorati  email it!  Post CommentsComments [0]  Trackback LinkTrackback
CategoriesTags: Business | The Site Doctor
# Sunday, January 25, 2009

New Years Resolutions and Getting rid of deadwood

Sunday, January 25, 2009 1:37:01 PM (GMT Standard Time, UTC+00:00)

Log in the sandHave you made any New Year's resolutions this year? -That's a question I'm sure you've been asked a dozen times already this year. New Year's resolutions have always amused me, the thought that people wait around for months to make (often) big changes in their life has baffled me.

If you run a business you'll know that it's important to review, assess and action a huge number of factors pretty much on a daily basis, if you don't, your business is likely to be slow to react to changes within your market place and so struggle.

I think its human nature to have a point to focus on whether it's the beginning of a new year, a holiday, even the recession but why wait until the end of the week? Or even better when you identify a problem? Surely that would be better?

That said the New Year and the recession are giving companies (including The Site Doctor) the perfect opportunity to clean out the deadwood within their businesses and reassess everyone's roles.

What do you do? Do you review weekly, monthly or annually? At The Site Doctor we have weekly meetings to review the previous week's successes, failures, evaluate next week's goals and more importantly to identify areas that require attention. This doesn't need to take long but it allows you to react quickly to emerging issues and limit the impact it could have.

If you're being hit by the recession (my sympathies go out to you if they are affecting your business) then you should be asking yourself "If I had reviewed our current position sooner, would I have been able to spot any warning signs?". I rather suspect if you are on top of your business you would have been able to.

If I were you, I'd look to make my New Year's resolution this year to not need one next year because you action the issues as soon as they arise.

 

Don't forget to follow me on Twitter.

# Wednesday, January 21, 2009

Umbraco tip of the day –sort your document types

Wednesday, January 21, 2009 7:59:39 PM (GMT Standard Time, UTC+00:00)

I thought I'd share this as it's something I've been thinking about trying for a while. Umbraco is great but sometimes you want the default document selected when creating a page to be one that isn't the alphabetically first one.

To work around this I tend to prefix the important Umbraco document types with a symbol (or you could use 1. etc I guess) but if instead you use a space (" ") before the name of your document type, Umbraco will place it at the top of the list for you.

The nice thing to note here is that they obviously trim the name first so it just appears as "Text Page" rather than " Text Page".

I found this out on our latest site which is just about to go live: www.nhshistopathology.net -check it out and let me know what you think.

Enjoy!

 

Don't forget to follow me on Twitter.