<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fresh Click Media &#187; Development</title>
	<atom:link href="http://www.freshclickmedia.com/blog/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.freshclickmedia.com</link>
	<description></description>
	<lastBuildDate>Mon, 23 Aug 2010 20:00:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Firebug 1.5 book from Packt Publishing Review</title>
		<link>http://www.freshclickmedia.com/blog/2010/07/firebug-1-5-book-from-packt-publishing-review/</link>
		<comments>http://www.freshclickmedia.com/blog/2010/07/firebug-1-5-book-from-packt-publishing-review/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 21:41:27 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=298</guid>
		<description><![CDATA[<img src="http://www.freshclickmedia.com/wp-content/uploads/2010/07/firebugbookreview.jpg" alt="Firebug Book Review" title="" width="590" height="350" />

The success of Firefox over recent years can be partly attributed to the extensions that beef up what's already a great browser into something truly amazing. Firebug's one of the most popular extensions, and for good reason. I've used it for editing CSS, viewing AJAX requests, DOM manipulation and debugging JavaScript. To say it's been helpful is a large understatement, and it's why I use Firefox as my main browser for web development. 

Packt Publishing's lengthily titled 'Firebug 1.5 : Editing, Debugging, and Monitoring Web Pages' starts the reader off gently with a 'Getting Started' chapter, discussing Firebug's history, installation and Firebug Lite, a JavaScript version for non-Firefox browsers. In cases where a particular problem occurs on Safari, for example, the lite version can be extremely useful. Chapter 2 introduces the various Firebug tabs and gives a good overview of Firebug's main capabilities. Chapters 3, 4, 5 and 6 expand on the HTML, CSS and DOM functionality, and provide a great, in-depth examination of what's possible. 

Chapter 7 - 'Performance Tuning Our Web Application' - looks at the Net panel, and once again, the discussion is thorough and well-written. Not only does it give information about Firebug, but by its very nature, delves into HTTP headers and XMLHttpRequest monitoring.

Chapter 8 - 'AJAX Development' explains the <code>console.debug</code> call that I've made on several occasions, as well the (new to me) <code>console.assert</code> for for assertions and the useful <code>console.dir(object)</code> for giving a DOM tab style object dump for the supplied <code>object</code> parameter.

Chapter 9 - 'Tips and Tricks for Firebug' also had something new for me, <code>console.group()</code> and <code>console.groupEnd()</code>, which are functions that group ouput in the output console. When there are lots of debug statements being fired out to the console window, it can be useful to group them, and I've already used this to my benefit since reading the book.

Chapter 10 - 'Necessary Firebug Extensions' takes a look at ways of making Firebug even better by using 8 extensions that empower their users to more accurately diagnose and fix performance issues, manage cookies and improve SEO.

Chapter 11 - 'Extending Firebug' builds on Chapter 10's introduced extensions by describing how to build your own. To keep things in proportion, it's a fairly small chapter, building a small 'Hello World' extension, but it does give food for thought.

The book closes with an Appendix detailing Firebug's API, and a look ahead at Firebug 1.7

Overall, this is a well-written and descriptive book, and although it is probably more suitable for a new to intermediate Firebug user, I found quite a few 'ooh - I didn't know that' moments throughout that make it worthwhile for any reader who designs and develops websites.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.freshclickmedia.com/wp-content/uploads/2010/07/firebugbookreview.jpg" alt="Firebug Book Review" title="" width="590" height="350" /></p>
<p>The success of Firefox over recent years can be partly attributed to the extensions that beef up what&#8217;s already a great browser into something truly amazing. Firebug&#8217;s one of the most popular extensions, and for good reason. I&#8217;ve used it for editing CSS, viewing AJAX requests, DOM manipulation and debugging JavaScript. To say it&#8217;s been helpful is a large understatement, and it&#8217;s why I use Firefox as my main browser for web development. </p>
<p>Packt Publishing&#8217;s lengthily titled &#8216;Firebug 1.5 : Editing, Debugging, and Monitoring Web Pages&#8217; starts the reader off gently with a &#8216;Getting Started&#8217; chapter, discussing Firebug&#8217;s history, installation and Firebug Lite, a JavaScript version for non-Firefox browsers. In cases where a particular problem occurs on Safari, for example, the lite version can be extremely useful. Chapter 2 introduces the various Firebug tabs and gives a good overview of Firebug&#8217;s main capabilities. Chapters 3, 4, 5 and 6 expand on the HTML, CSS and DOM functionality, and provide a great, in-depth examination of what&#8217;s possible. </p>
<p>Chapter 7 &#8211; &#8216;Performance Tuning Our Web Application&#8217; &#8211; looks at the Net panel, and once again, the discussion is thorough and well-written. Not only does it give information about Firebug, but by its very nature, delves into HTTP headers and XMLHttpRequest monitoring.</p>
<p>Chapter 8 &#8211; &#8216;AJAX Development&#8217; explains the <code>console.debug</code> call that I&#8217;ve made on several occasions, as well the (new to me) <code>console.assert</code> for for assertions and the useful <code>console.dir(object)</code> for giving a DOM tab style object dump for the supplied <code>object</code> parameter.</p>
<p>Chapter 9 &#8211; &#8216;Tips and Tricks for Firebug&#8217; also had something new for me, <code>console.group()</code> and <code>console.groupEnd()</code>, which are functions that group ouput in the output console. When there are lots of debug statements being fired out to the console window, it can be useful to group them, and I&#8217;ve already used this to my benefit since reading the book.</p>
<p>Chapter 10 &#8211; &#8216;Necessary Firebug Extensions&#8217; takes a look at ways of making Firebug even better by using 8 extensions that empower their users to more accurately diagnose and fix performance issues, manage cookies and improve SEO.</p>
<p>Chapter 11 &#8211; &#8216;Extending Firebug&#8217; builds on Chapter 10&#8242;s introduced extensions by describing how to build your own. To keep things in proportion, it&#8217;s a fairly small chapter, building a small &#8216;Hello World&#8217; extension, but it does give food for thought.</p>
<p>The book closes with an Appendix detailing Firebug&#8217;s API, and a look ahead at Firebug 1.7</p>
<p>Overall, this is a well-written and descriptive book, and although it is probably more suitable for a new to intermediate Firebug user, I found quite a few &#8216;ooh &#8211; I didn&#8217;t know that&#8217; moments throughout that make it worthwhile for any reader who designs and develops websites.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2010/07/firebug-1-5-book-from-packt-publishing-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with googletest &#8211; the Google C++ Testing Framework</title>
		<link>http://www.freshclickmedia.com/blog/2009/10/getting-started-with-googletest-the-google-c-testing-framework/</link>
		<comments>http://www.freshclickmedia.com/blog/2009/10/getting-started-with-googletest-the-google-c-testing-framework/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 18:54:30 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=193</guid>
		<description><![CDATA[So, I've just recorded a second screencast at <a href="http://screenr.com">screenr</a>, this time about googletest - the Google C++ Testing Framework.  I had a couple of issues getting things up and running so I thought it might be beneficial to show I got going.

I've been more used to unit testing in a C# environment, particularly NUnit and MS Unit, so googletest was a fresh look at unit testing for C++.  Note that the screenr title is incorrect, it should read 'Getting started with googletest - the Google C<strong>++</strong> Testing Framework :)

<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_0817090731.swf' ></param><param name='flashvars' value='i=21294' ></param><param name='allowFullScreen' value='true' ></param><embed src='http://screenr.com/Content/assets/screenr_0817090731.swf' flashvars='i=21294' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer' ></embed></object>]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve just recorded a second screencast at <a href="http://screenr.com">screenr</a>, this time about googletest &#8211; the Google C++ Testing Framework.  I had a couple of issues getting things up and running so I thought it might be beneficial to show I got going.</p>
<p>I&#8217;ve been more used to unit testing in a C# environment, particularly NUnit and MS Unit, so googletest was a fresh look at unit testing for C++.  Note that the screenr title is incorrect, it should read &#8216;Getting started with googletest &#8211; the Google C<strong>++</strong> Testing Framework :)</p>
<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_0817090731.swf' ></param><param name='flashvars' value='i=21294' ></param><param name='allowFullScreen' value='true' ></param><embed src='http://screenr.com/Content/assets/screenr_0817090731.swf' flashvars='i=21294' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer' ></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2009/10/getting-started-with-googletest-the-google-c-testing-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>5 things you may not know about ASP.NET</title>
		<link>http://www.freshclickmedia.com/blog/2009/03/5-things-you-may-not-know-about-aspnet/</link>
		<comments>http://www.freshclickmedia.com/blog/2009/03/5-things-you-may-not-know-about-aspnet/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 12:17:55 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=138</guid>
		<description><![CDATA[Since its release in early 2002, Microsoft's ASP.NET platform has gone from strength to strength.  Despite its strong uptake from Microsoft-centric software houses, there may be a few people who have hesitated in adopting ASP.NET for their web development platform.  Here I present some things you might not know about ASP.NET.  Perhaps it'll encourage you to take a look at it.

<h3>Cost</h3>
There once was a time when the standard IDE for developing ASP.NET apps, Visual Studio, was prohibitively expensive for the average Joe.  In late 2007, Microsoft released its first versions of 'Express' software, aimed at students and hobbyists.  Though Express incarnations have fewer features than their full version cousins, they do offer the possibility of exploring ASP.NET.  The Microsoft website offers a <a href="http://www.microsoft.com/express/vwd/">download page for Visual Web Developer 2008 Express Edition</a>. An express version of SQL Server is also available, and can be downloaded from the <a href="http://www.microsoft.com/express/sql/">SQL Server 2008 download page</a>.

<h3><abbr title="Model View Controller">MVC</abbr> Support</h3>
The MVC pattern is an established and well-recognised way of building web applications, and is familiar to <abbr title="Ruby on Rails">RoR</abbr>, Java and PHP developers.  For many years, MVC was not available as a standard approach to developing ASP.NET websites, but Microsoft has recognised the deficiency and have (at the time of writing) released version 1.0 Release Candidate of ASP.NET MVC.  The release has had a mixed response from the ASP.NET community, many of whom are used to the traditional code-behind model.  Despite the inevitable squabbles as to which way is best, many have welcomed the MVC approach for its separation of concerns and finer control over JavaScript and markup.  To find out more about the release candidate, head over to <a href="http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx">Scott Guthrie's blog post</a>.

<h3>Learning Resources</h3>  
A big advantage for anybody learning a new technology is the wealth of learning material that is available.  Although you can rely on a large number of books, the <a href="http://www.asp.net/learn">ASP.NET learn</a> website contains many videos on both traditional and MVC ASP.NET as well as data access.

<h3>Intrinsic jQuery Support</h3>
The lightweight open source JavaScript library that's taken the web by storm is now fully supported by Microsoft.  As well as <a href="http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx">full intellisense support in Visual Studio</a>, Microsoft will be using the library as-is, without forking or changing the code from the main jQuery branch.  What's more, Microsoft will be using jQuery as a basis for future ASP.NET and ASP.NET AJAX features.  I feel this counters the argument of Microsoft not supporting open-source software.

<h3>Career Prospects</h3>
Microsoft's ubiquity means that learning ASP.NET and supporting technologies will do no harm to your career prospects.  <a href="http://www.cwjobs.co.uk/Content/PermanentDeveloperDemand.html">.NET skills are ranked as some of the most in-demand in the UK</a>.  ]]></description>
			<content:encoded><![CDATA[<p>Since its release in early 2002, Microsoft&#8217;s ASP.NET platform has gone from strength to strength.  Despite its strong uptake from Microsoft-centric software houses, there may be a few people who have hesitated in adopting ASP.NET for their web development platform.  Here I present some things you might not know about ASP.NET.  Perhaps it&#8217;ll encourage you to take a look at it.</p>
<h3>Cost</h3>
<p>There once was a time when the standard IDE for developing ASP.NET apps, Visual Studio, was prohibitively expensive for the average Joe.  In late 2007, Microsoft released its first versions of &#8216;Express&#8217; software, aimed at students and hobbyists.  Though Express incarnations have fewer features than their full version cousins, they do offer the possibility of exploring ASP.NET.  The Microsoft website offers a <a href="http://www.microsoft.com/express/vwd/">download page for Visual Web Developer 2008 Express Edition</a>. An express version of SQL Server is also available, and can be downloaded from the <a href="http://www.microsoft.com/express/sql/">SQL Server 2008 download page</a>.</p>
<h3><abbr title="Model View Controller">MVC</abbr> Support</h3>
<p>The MVC pattern is an established and well-recognised way of building web applications, and is familiar to <abbr title="Ruby on Rails">RoR</abbr>, Java and PHP developers.  For many years, MVC was not available as a standard approach to developing ASP.NET websites, but Microsoft has recognised the deficiency and have (at the time of writing) released version 1.0 Release Candidate of ASP.NET MVC.  The release has had a mixed response from the ASP.NET community, many of whom are used to the traditional code-behind model.  Despite the inevitable squabbles as to which way is best, many have welcomed the MVC approach for its separation of concerns and finer control over JavaScript and markup.  To find out more about the release candidate, head over to <a href="http://weblogs.asp.net/scottgu/archive/2009/01/27/asp-net-mvc-1-0-release-candidate-now-available.aspx">Scott Guthrie&#8217;s blog post</a>.</p>
<h3>Learning Resources</h3>
<p>A big advantage for anybody learning a new technology is the wealth of learning material that is available.  Although you can rely on a large number of books, the <a href="http://www.asp.net/learn">ASP.NET learn</a> website contains many videos on both traditional and MVC ASP.NET as well as data access.</p>
<h3>Intrinsic jQuery Support</h3>
<p>The lightweight open source JavaScript library that&#8217;s taken the web by storm is now fully supported by Microsoft.  As well as <a href="http://weblogs.asp.net/scottgu/archive/2008/11/21/jquery-intellisense-in-vs-2008.aspx">full intellisense support in Visual Studio</a>, Microsoft will be using the library as-is, without forking or changing the code from the main jQuery branch.  What&#8217;s more, Microsoft will be using jQuery as a basis for future ASP.NET and ASP.NET AJAX features.  I feel this counters the argument of Microsoft not supporting open-source software.</p>
<h3>Career Prospects</h3>
<p>Microsoft&#8217;s ubiquity means that learning ASP.NET and supporting technologies will do no harm to your career prospects.  <a href="http://www.cwjobs.co.uk/Content/PermanentDeveloperDemand.html">.NET skills are ranked as some of the most in-demand in the UK</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2009/03/5-things-you-may-not-know-about-aspnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Professional CodeIgniter Book Review</title>
		<link>http://www.freshclickmedia.com/blog/2008/12/professional-codeigniter-book-review/</link>
		<comments>http://www.freshclickmedia.com/blog/2008/12/professional-codeigniter-book-review/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 18:06:10 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=119</guid>
		<description><![CDATA[<img src="http://www.freshclickmedia.com/wp-content/uploads/2008/12/codeigniterbook.jpg" alt="" title="CodeIgniter Book Review" width="590" height="100" />

With all the furore surrounding Ruby on Rails, you'd be forgiven for forgetting that any other web application framework ever existed.  The fact is, of course, that there are many to choose from, and one leading PHP-based framework is MVC-based CodeIgniter.

The <a href="http://codeigniter.com/">CodeIgniter</a> website is a great place to start for newcomers and more experienced developers alike, but I still like a good book, that I can hold in my hand and digest.  Wrox's <a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-CodeIgniter.productCd-0470282452.html">Professional CodeIgniter</a> is such a book, and presents a good overview of the framework that's getting deserved attention in the web development community.]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.freshclickmedia.com/wp-content/uploads/2008/12/codeigniterbook.jpg" alt="" title="CodeIgniter Book Review" width="590" height="100" /></p>
<p>With all the furore surrounding Ruby on Rails, you&#8217;d be forgiven for forgetting that any other web application framework ever existed.  The fact is, of course, that there are many to choose from, and one leading PHP-based framework is MVC-based CodeIgniter.</p>
<p>The <a href="http://codeigniter.com/">CodeIgniter</a> website is a great place to start for newcomers and more experienced developers alike, but I still like a good book, that I can hold in my hand and digest.  Wrox&#8217;s <a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-CodeIgniter.productCd-0470282452.html">Professional CodeIgniter</a> is such a book, and presents a good overview of the framework that&#8217;s getting deserved attention in the web development community.</p>
<p>The book weighs in at a fairly lightweight 336 pages, but covers various aspects of CodeIgniter development, together with a history of the <a href="http://en.wikipedia.org/wiki/Model_View_Controller">Model View Controller Pattern</a> and an examination of <a href="http://en.wikipedia.org/wiki/Agile_software_development">Agile Development</a> that is often employed by modern web-centric development teams.  Whilst these discussions are not completely necessary to experienced programmers looking at getting to grips with CodeIgniter, they may benefit others who are looking for a more rounded introduction to web development.  Being familiar with MVC and agile-development, I skipped these sections and headed for some CodeIgniter code.</p>
<p>Chapter 3 satisfies my code craving, where an overview of CodeIgniter is presented, covering such topics as the default installation, configuration, CodeIgniter libraries, helpers, and models, views and controllers, the foundation of any CodeIgniter site.</p>
<p>Chapters 4-8 walks through the development of an e-commerce style website with a shopping cart, categories and products, and a dashboard for managing details of the site.  Chapter 9 covers some security issues, and although the information is presented, it is not intended as an exhaustive coverage  of PHP Security.  There is never a one book fits all situation, and for PHP security, you&#8217;re likely to find <a href="http://phpsecurity.org/">Essential PHP Security</a> of great use.</p>
<p>The book concludes with an brief examination of the site launch, though this adds little of any significant importance.</p>
<p>It&#8217;s good to see a CodeIgniter book, and the quality of the writing is generally high, with easy to follow code examples.  The book is very thin on AJAX coverage, which is quite a negative.  Used in conjunction with the excellent <a href="http://codeigniter.com/forums/">CodeIgniter forums</a> and website, it&#8217;s likely to prove a great resource for learning the framework.</p>
<p>The book&#8217;s list of Chapters is as follows:</p>
<ol>
<li>Welcome to the MVC World</li>
<li>Agile Methodologies and Approaches</li>
<li>A 10,000-Foot View of CodeIgniter</li>
<li>Creating the Main Website</li>
<li>Building a Shopping Cart</li>
<li>Creating a Dashboard</li>
<li>Improving the Dashboard</li>
<li>Last-minute Upgrades</li>
<li>Security and Performance</li>
<li>Launch</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2008/12/professional-codeigniter-book-review/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Programmatic impersonation in C#</title>
		<link>http://www.freshclickmedia.com/blog/2008/11/programmatic-impersonation-in-c/</link>
		<comments>http://www.freshclickmedia.com/blog/2008/11/programmatic-impersonation-in-c/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 20:08:47 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=115</guid>
		<description><![CDATA[<img src="http://farm4.static.flickr.com/3054/3064284648_4a04bbfbed_o.jpg" alt="Impersonation" width="590" height="100" />

I recently deployed a WPF app on a server that allowed the user to stop and start some application-related services.  The purpose of the app was to allow users with administrative rights an easy way to manage the services that they needed to manage.  Granted, they could manage the services through the services MMC, but the little WPF app was a requirement, and it's our job as developers to make things easier for our clients - right?  

All went well until a change of requirements meant that a user without administrative rights needed to use the program to stop and start the required services.  When I tried to use the app, I got an exception - quite rightly, stopping and starting the services required admin rights.  We needed the restricted user to be able to log on and use the app, but still needed to restrict their permissions.

So - step in programmatic impersonation in C# - a way to give restricted users the power that that's required, all within the confines of your application.]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3054/3064284648_4a04bbfbed_o.jpg" alt="Impersonation" width="590" height="100" /></p>
<p>I recently deployed a WPF app on a server that allowed the user to stop and start some application-related services.  The purpose of the app was to allow users with administrative rights an easy way to manage the services that they needed to manage.  Granted, they could manage the services through the services MMC, but the little WPF app was a requirement, and it&#8217;s our job as developers to make things easier for our clients &#8211; right?  </p>
<p>All went well until a change of requirements meant that a user without administrative rights needed to use the program to stop and start the required services.  When I tried to use the app, I got an exception &#8211; quite rightly, stopping and starting the services required admin rights.  We needed the restricted user to be able to log on and use the app, but still needed to restrict their permissions.</p>
<p>So &#8211; step in programmatic impersonation in C# &#8211; a way to give restricted users the power that that&#8217;s required, all within the confines of your application.</p>
<p>The first thing to point out is that I got quite a bit of this code from a google search, but I had to do a bit of work to get things in a state that I found really useful.</p>
<pre class="code">using System;
using System.Collections.Generic;
using System.Configuration;
using System.Runtime.InteropServices;
using System.Linq;
using System.Security.Principal;
using System.Text;

namespace ServiceControllerApp.Security
{
    public class Impersonator : IDisposable
    {
        private WindowsImpersonationContext _impersonatedUser = null;
        private IntPtr _userHandle;

        public Impersonator()
        {
            _userHandle = new IntPtr(0);

            string user = &quot;servicecontroller&quot;;
            string userDomain = ConfigurationManager.AppSettings[&quot;MachineDomain&quot;];
            string password = &quot;yourpassword&quot;;

            bool returnValue = LogonUser(user, userDomain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, ref _userHandle);

            if (!returnValue)
                throw new ApplicationException(&quot;Could not impersonate user&quot;);

            WindowsIdentity newId = new WindowsIdentity(_userHandle);
            _impersonatedUser = newId.Impersonate();
        }

        #region IDisposable Members

        public void Dispose()
        {
            if (_impersonatedUser != null)
            {
                _impersonatedUser.Undo();
                CloseHandle(_userHandle);
            }
        }

        #endregion

        #region Interop imports/constants
        public const int LOGON32_LOGON_INTERACTIVE = 2;
        public const int LOGON32_LOGON_SERVICE = 3;
        public const int LOGON32_PROVIDER_DEFAULT = 0;

        [DllImport(&quot;advapi32.dll&quot;, CharSet = CharSet.Auto)]
        public static extern bool LogonUser(String lpszUserName, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);

        [DllImport(&quot;kernel32.dll&quot;, CharSet = CharSet.Auto)]
        public extern static bool CloseHandle(IntPtr handle);
        #endregion
    }
}
</pre>
<p>Impersonator is a simple class that uses interop to call Win32 LogonUser and CloseHandle functions.  We have to use interop because .NET doesn&#8217;t provide the equivalent methods.</p>
<p>The code shown above has a user, domain and password actually in the code &#8211; for some situations this is a security risk, so the credentials should be obtained in another manner, but for my needs, it was satisfactory, and their direct inclusion simplifies this example.  </p>
<p>The class has a WindowsImpersonationContext to manage the impersonation, and the constructor sets up the required logon rights using the LogonUser interop.</p>
<p>Crucially, the impersonation must end, with an equivalent Log Off &#8211; and the class implements IDisposable to call the required log off code.  Using the class is easy.</p>
<pre class="code">
using (Impersonator impersonator = new Impersonator())
{
    // code in here
}
</pre>
<p>The good thing is that because the class implements IDisposable, you don&#8217;t have to pepper your code with the log off code equivalent.  I hope it&#8217;s of use to somebody wishing to implement impersonation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2008/11/programmatic-impersonation-in-c/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Chrome &#8211; A First Impression, or two</title>
		<link>http://www.freshclickmedia.com/blog/2008/09/google-chrome-a-first-impression-or-two/</link>
		<comments>http://www.freshclickmedia.com/blog/2008/09/google-chrome-a-first-impression-or-two/#comments</comments>
		<pubDate>Wed, 03 Sep 2008 20:22:52 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/?p=93</guid>
		<description><![CDATA[<img src="http://farm4.static.flickr.com/3066/2826132010_5d8c2c2471_o.jpg" alt="Google Chrome resembles the Simple Simon memory game" />

I can't quite remember there ever being this much furore about the release of a web browser.  Together with a large number of blogs mentioning the release of Google's new Chrome browser, the BBC and Sky have carried large reports on their news programmes, and people at work, unconcerned with IE8 or Firefox 3 releases, have asked me about it.  Even my wife, who normally couldn't give a hoot about web browsers, has mentioned it.  So, I downloaded and installed it.  Here I present a first impression, or two.]]></description>
			<content:encoded><![CDATA[<p><img src="http://farm4.static.flickr.com/3066/2826132010_5d8c2c2471_o.jpg" alt="Google Chrome resembles the Simple Simon memory game" /></p>
<p>I can&#8217;t quite remember there ever being this much furore about the release of a web browser.  Together with a large number of blogs mentioning the release of Google&#8217;s new Chrome browser, the BBC and Sky have carried large reports on their news programmes, and people at work, unconcerned with IE8 or Firefox 3 releases, have asked me about it.  Even my wife, who normally couldn&#8217;t give a hoot about web browsers, has mentioned it.  So, I downloaded and installed it.  Here I present a first impression, or two.</p>
<p>I didn&#8217;t even know about Chrome until a day or so before its release.  Once considered the David in the classic bible story, Google now seems to be amassing quite an armoury in its assault of Goliath Microsoft.  Some people are now concerned that its very qualities as a rising star have now morphed into those of a Microsoft that they have always despised.  They want to own the Internet, and I find that neither surprising or unconventional.</p>
<p>So, beyond the discussion of monopolies and competition, honour and integrity, let&#8217;s have a look at the browser itself.</p>
<h3>Getting Started</h3>
<p>To <a href="http://www.google.com/chrome">download the install package</a> was less than 500k, but to download the main install took an age.  I wonder how big the main install package is?<br />
Currently, it&#8217;s only available for Windows machines, but a <a href="http://www.vnunet.com/vnunet/news/2225190/google-promises-chrome-mac">Mac and Linux version is on the cards</a>.</p>
<h3>Using</h3>
<p>Chrome&#8217;s tabbed browsing is nothing new, but each tab runs in its own process, so theoretically, a typical browser crash results only in a &#8216;crashed tab&#8217;, allowing you to close just the tab and carry on seamlessly.  A welcome feature.  I&#8217;ve had to end the firefox process countless times because a page on a particular tab has caused a terminal problem.<br />
Doing a Control + F (find on page) doesn&#8217;t overlap the page with a modeless dialog (like IE), but merges the dialog with menu bar at the top right of the main window.  If text is found on the page, it is highlighted, like Safari.  If the text is found, the number of occurrences is shown on the dialog.  The particular occurrence (say, 1 of 3) is highlighted in orange, and others are highlighted in yellow.  A useful feature.</p>
<p><img src="http://farm4.static.flickr.com/3091/2825293643_911fb0b6e9_o.jpg" alt="Finding text on a Chrome web browser page" /></p>
<p>Opera&#8217;s &#8216;Speed Dial&#8217; has been reproduced, but the sites shown are those that you have visited most often.  Hmm&#8230; a useful feature methinks.</p>
<p><img src="http://farm4.static.flickr.com/3149/2825293901_41c8e9cbe0_o.jpg" alt="Chrome's Speed dial feature" /></p>
<p>Ever wanted to save some of your browsing history, but not all?  Um, perhaps you have been browsing a site or two&#8230; perhaps to buy your partner a surprise gift?  Well, select &#8216;New incognito window&#8217; from the file menu and all browsing done within will be secret.  Very useful.  I buy a lot of gifts. :)</p>
<p><img src="http://farm4.static.flickr.com/3149/2826132468_f2988dc086_o.jpg" alt="Incognito mode on Chrome Browser" /></p>
<h3>What about us Geeks?</h3>
<p>One of the main reasons I love Firefox is its extensions, particularly the <a href="https://addons.mozilla.org/en-US/firefox/addon/60">web developer toolbar</a> and <a href="https://addons.mozilla.org/firefox/addon/1843">Firebug</a>.  Right-clicking on a page and selecting &#8216;Inspect Element&#8217; provides a poor-man&#8217;s Firebug.  It&#8217;s early days, but it&#8217;s there. </p>
<p><img src="http://farm4.static.flickr.com/3076/2825293823_1df97c0b46_o.gif" alt="Chrome's Poor Man's Firebug" /></p>
<p>However, this is the tip of the iceberg.  Chrome provides &#8216;<a href="http://gears.google.com/">Gears</a>&#8216;, an effort aimed at developers, and allowing for the browser to be extended.  Quite how this will pan out remains to be seen, but I&#8217;m sure well see some good things coming from the Gears initiative.</p>
<p>Chrome uses <a href="http://webkit.org/">Webkit</a> for its rendering engine, so if you&#8217;ve been using Web Standards and your sites look good on Safari, Firefox and Opera, you&#8217;ll have no issues.</p>
<p>Together with the obvious start-up speed, Chrome&#8217;s JavaScript rendering engine has been built by the ground up and promises faster execution speed.</p>
<p>The ACID2 test renders perfectly.</p>
<p><img src="http://farm4.static.flickr.com/3228/2825293721_882c651f7c_o.jpg" alt="ACID2 test in Browser" /></p>
<h3>What next?</h3>
<p>I&#8217;m not one for discussing the rights and wrongs of Google&#8217;s strategy, nor am I prepared to muse the future of the Internet.  I have read many blog comments that another standards compliant browser will be the final nail in the coffin for IE.  I disagree.  Though people have turned away from IE to some extent with the advent of Firefox, I think that it&#8217;ll be mainly those in the know that will try Google&#8217;s browser.  Though the trend appears to suggest that Internet Explorer is losing popularity, in the short term, I feel that Firefox users will try Chrome.  I started this post using Chrome, and having got to this point, like it quite bit.  For now, it&#8217;s only the lack of firebug that&#8217;s stopping me switch for good.<br />
I welcome the browser &#8211; competition is good.</p>
<h3>Asides</h3>
<p>Surely I&#8217;m not the only one to recognise the similarity between the Chrome logo and Simple Simon, the memory game that I owned in the 80s.</p>
<p><img src="http://farm4.static.flickr.com/3066/2826132010_5d8c2c2471_o.jpg" alt="Chrome Logo's startling resemblance to Simple Simon Memory Game" /></p>
<p>Do a Google search for Chrome, and the Browser is listed as result number 3, though there is a &#8216;news story&#8217; at the top of the results page.  I wonder how long it&#8217;ll be before it&#8217;ll be returned as number 1? :)</p>
<p><img src="http://farm4.static.flickr.com/3194/2826132558_11a582a3d7_o.gif" alt="Chrome search results in Google" /></p>
<p><em>I just went through the motions of uploading the images used in this post to Flickr, and I couldn&#8217;t use their photo upload page with Chrome.  Oh well, back to Firefox :)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2008/09/google-chrome-a-first-impression-or-two/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>When in Rome, code as the Romans do</title>
		<link>http://www.freshclickmedia.com/blog/2008/01/when-in-rome-code-as-the-romans-do/</link>
		<comments>http://www.freshclickmedia.com/blog/2008/01/when-in-rome-code-as-the-romans-do/#comments</comments>
		<pubDate>Fri, 25 Jan 2008 12:50:00 +0000</pubDate>
		<dc:creator>Shane</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Working Life]]></category>

		<guid isPermaLink="false">http://www.freshclickmedia.com/blog/2008/01/when-in-rome-code-as-the-romans-do/</guid>
		<description><![CDATA[No doubt most developers are in favour of coding standards, but something that has annoyed me of late is &#8216;coding baggage&#8217;. For example, former Visual Basic programmers using VB style in C#. Such style pollutes the purity of a language that has its own style for a particular reason. Many years ago, I spent 6 [...]]]></description>
			<content:encoded><![CDATA[<p>No doubt most developers are in favour of coding standards, but something that has annoyed me of late is &#8216;coding baggage&#8217;.  For example, former Visual Basic programmers using VB style in C#.  Such style pollutes the purity of a language that has its own style for a particular reason. </p>
<p><span id="more-78"></span></p>
<p>Many years ago, I spent 6 months in India.  For the first three months, I was staying at a rural polytechnic in <a href="http://en.wikipedia.org/wiki/Uttar_pradesh">Uttar Pradesh</a>, and I tried to learn some Hindi for my own interest, and because I felt it would help me settle in and go some way to befriending the mainly non English-speaking people in the area.  Some of my fellow travellers felt no need to make an effort, and insisted on saying English words more loudly and slowly.  Funnily enough, this doesn&#8217;t really work.</p>
<p>I make this comparison to people who bring coding style and standards from previous languages.  I&#8217;ve recently been working on C# code that screams of work from a former VB programmer.  There are prefixes to all the variable names to indicate their type, constants are capitalised, method parameters are prefixed with additional information as to whether they are passed by reference, and members are prefixed with &#8216;m&#8217;.</p>
<pre class="code">
public const string cstrDataGridXml = "DataGridDetails.xml";

public EditableTable(string p_strTableName,string p_strTableDesc, bool p_bExtended)
{
	mstrTableName = p_strTableName;
	mstrTableDescription = p_strTableDesc;
	mbExtended = p_bExtended;
}</pre>
<p>I find this type of thing mildly infuriating &#8211; it&#8217;s like going to India and shouting English.  To bring this old coding style to a new language blurs the distinction of coding standards between languages, the very coding standards which are established because of language features.  To mix the styles blurs this distinction, and reduces the clarity and purpose of those coding standards.</p>
<p>I come from a C++ background, and although I don&#8217;t touch the stuff these days, you can bet that if I returned, I&#8217;d be coding as I did back in the year 2000.  Now I&#8217;m doing C#, I use those the standards defined by Microsoft, who, to be fair, should know a thing or two about C#.</p>
<p>Having started Ruby and Ruby on Rails, I code Ruby like a Ruby programmer &#8211; so you won&#8217;t find any m_ prefixes for member variables or such like.  Perhaps one day, another Ruby programmer will look at my code.  If it&#8217;s styled like Ruby, their understanding and comfort in reading my code will be maximised.</p>
<p>This naming also extends to control prefixes in ASP.NET and WinForms.  Drop a TextBox onto a web form and by default, you&#8217;ll get TextBox1.  So why change the prefix to txtBox?</p>
<p>I think it&#8217;s important for developers to respect the language they&#8217;re programming in, and code accordingly &#8211; although the exact content of a coding standard for language &#8216;X&#8217; promotes contention, a mishmash surely doesn&#8217;t have any advantages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.freshclickmedia.com/blog/2008/01/when-in-rome-code-as-the-romans-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
