<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4226855027264744802</id><updated>2012-02-17T02:00:04.067Z</updated><title type='text'>Kristan's Mental Output Dump : ASP.NET, LINQ to SQL, Community Server, Software.</title><subtitle type='html'>This is where I dump my mental output on a regular/adhoc basis generally regarding .NET software development. 
Enjoy.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default?start-index=26&amp;max-results=25'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>65</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-2136291007890497493</id><published>2011-11-10T12:02:00.001Z</published><updated>2011-11-10T12:02:41.661Z</updated><title type='text'>Parallel.ForEach operations and the CancellationToken</title><content type='html'>If you use the CancellationToken to enable cancellation during the parallel iteration of an enumerable, then you should note that each operation is given a chance to finish.&amp;nbsp; The OperationCanceledException is only thrown after all the threads have completed their unit of work.&lt;br /&gt;&lt;br /&gt;You could monitor the cancellation token inside the units of work as well if you liked.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-2136291007890497493?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/2136291007890497493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=2136291007890497493&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/2136291007890497493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/2136291007890497493'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2011/11/parallelforeach-operations-and.html' title='Parallel.ForEach operations and the CancellationToken'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-8649489627517918895</id><published>2011-11-10T09:41:00.001Z</published><updated>2011-11-10T09:41:54.768Z</updated><title type='text'>Windows Azure DevFabric forcing port 80 rather port 81, 82 etc</title><content type='html'>Hi there, it's useful to run a Windows Azure app in the dev fabric on port 80 sometimes.&amp;nbsp; However, you need to be absolutely sure that port 80 is not in use beforehand.&lt;br /&gt;Use TCPView from sysinternals and if you find that an item appears under "local port" called "http", then the port is in use.&amp;nbsp; You cannot easily find out what process that is as it's a service, however in my case, once I'd shut down "Web Deployment Agent Service" by doing Run -&amp;gt; CMD -&amp;gt; net stop MsDepSvc&amp;nbsp;&amp;nbsp; this solved the issue and Azure was able to run the web role under port 80.&lt;br /&gt;&lt;br /&gt;Also, ensure that Skype doesn't occupy port 80 too.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-8649489627517918895?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/8649489627517918895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=8649489627517918895&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8649489627517918895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8649489627517918895'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2011/11/windows-azure-devfabric-forcing-port-80.html' title='Windows Azure DevFabric forcing port 80 rather port 81, 82 etc'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-694073291853181639</id><published>2011-01-25T15:22:00.001Z</published><updated>2011-01-25T15:22:43.519Z</updated><title type='text'>Distributed Lock</title><content type='html'>&lt;p&gt;I’m working on a distributed system on Azure which has a Web and Worker Roles. Plus, there’s the possibility of N number of instances per role. The Worker role is a batch processor which consists of Jobs and the Job Scheduler.&amp;#160; My requirement is that we should only have one instance of the Job Scheduler throughout the whole system.&lt;/p&gt;  &lt;p&gt;If this was a simple multi-threaded application with one app domain, this would be relatively simple using a mutex and the lock statement, however, given that the application could be spread across multiple virtual machines within the Azure Fabric I had to come up with another way.&lt;/p&gt;  &lt;p&gt;I solved this problem by using a SQL Azure table, serializable transactions and a Distributed Lock Service in C#.&lt;/p&gt;  &lt;p&gt;First create the table&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: teal"&gt;/****** Object:  Table [dbo].[Lock]    Script Date: 01/25/2011 14:18:13 ******/&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_NULLS &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;QUOTED_IDENTIFIER &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;CREATE TABLE &lt;/span&gt;&lt;span style="color: red"&gt;[dbo]&lt;/span&gt;&lt;span style="color: black"&gt;.&lt;/span&gt;&lt;span style="color: red"&gt;[Lock]&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;[id] [int] &lt;/span&gt;&lt;span style="color: magenta"&gt;IDENTITY&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: maroon"&gt;1&lt;/span&gt;&lt;span style="color: black"&gt;,&lt;/span&gt;&lt;span style="color: maroon"&gt;1&lt;/span&gt;&lt;span style="color: black"&gt;) &lt;/span&gt;&lt;span style="color: gray"&gt;NOT &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;/span&gt;&lt;span style="color: black"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;[LockName] [nvarchar]&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: maroon"&gt;4000&lt;/span&gt;&lt;span style="color: black"&gt;) &lt;/span&gt;&lt;span style="color: gray"&gt;NOT &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;/span&gt;&lt;span style="color: black"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;[AcquirerGuid] [uniqueidentifier] &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;/span&gt;&lt;span style="color: black"&gt;,&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;[AcquiredDate] [datetime] &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;/span&gt;&lt;span style="color: black"&gt;,&lt;br /&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;CONSTRAINT &lt;/span&gt;&lt;span style="color: red"&gt;[PK_Lock] &lt;/span&gt;&lt;span style="color: blue"&gt;PRIMARY KEY CLUSTERED &lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: red"&gt;[id] &lt;/span&gt;&lt;span style="color: blue"&gt;ASC&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;)&lt;/span&gt;&lt;span style="color: blue"&gt;WITH &lt;/span&gt;&lt;span style="color: black"&gt;(STATISTICS_NORECOMPUTE  &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: blue"&gt;OFF&lt;/span&gt;&lt;span style="color: black"&gt;, IGNORE_DUP_KEY &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: blue"&gt;OFF&lt;/span&gt;&lt;span style="color: black"&gt;)&lt;br /&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then create the Stored Procedures, “Lock_Acquire” and “Lock_Release”&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;IF  &lt;/span&gt;&lt;span style="color: gray"&gt;EXISTS &lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.objects &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: magenta"&gt;object_id &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: black"&gt;(N&lt;/span&gt;&lt;span style="color: red"&gt;'[dbo].[Lock_Acquire]'&lt;/span&gt;&lt;span style="color: black"&gt;) &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;type &lt;/span&gt;&lt;span style="color: gray"&gt;in &lt;/span&gt;&lt;span style="color: black"&gt;(N&lt;/span&gt;&lt;span style="color: red"&gt;'P'&lt;/span&gt;&lt;span style="color: black"&gt;, N&lt;/span&gt;&lt;span style="color: red"&gt;'PC'&lt;/span&gt;&lt;span style="color: black"&gt;))&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;DROP PROCEDURE &lt;/span&gt;&lt;span style="color: red"&gt;[dbo]&lt;/span&gt;&lt;span style="color: black"&gt;.&lt;/span&gt;&lt;span style="color: red"&gt;[Lock_Acquire]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO&lt;br /&gt;&lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_NULLS &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;QUOTED_IDENTIFIER &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE &lt;/span&gt;&lt;span style="color: red"&gt;[dbo]&lt;/span&gt;&lt;span style="color: black"&gt;.&lt;/span&gt;&lt;span style="color: red"&gt;[Lock_Acquire]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: green"&gt;@Name &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: maroon"&gt;4000&lt;/span&gt;&lt;span style="color: black"&gt;),&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid &lt;/span&gt;&lt;span style="color: blue"&gt;UNIQUEIDENTIFIER&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE&lt;br /&gt;    &lt;br /&gt;    BEGIN TRANSACTION&lt;br /&gt;&lt;br /&gt;        IF&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: gray"&gt;NOT EXISTS&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: maroon"&gt;1 &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;Lock &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;LockName &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: green"&gt;@Name&lt;/span&gt;&lt;span style="color: black"&gt;))&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;BEGIN    &lt;br /&gt;            INSERT INTO &lt;/span&gt;&lt;span style="color: red"&gt;[Lock] &lt;/span&gt;&lt;span style="color: black"&gt;(LockName, AcquiredDate, AcquirerGuid)&lt;br /&gt;            &lt;/span&gt;&lt;span style="color: blue"&gt;VALUES &lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: green"&gt;@Name&lt;/span&gt;&lt;span style="color: black"&gt;, GETUTCDATE(), &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid&lt;/span&gt;&lt;span style="color: black"&gt;)&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;br /&gt;        ELSE&lt;br /&gt;        BEGIN&lt;br /&gt;            &lt;br /&gt;            UPDATE &lt;/span&gt;&lt;span style="color: black"&gt;L&lt;br /&gt;               &lt;/span&gt;&lt;span style="color: blue"&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;L.AcquiredDate &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: black"&gt;GETUTCDATE(),&lt;br /&gt;                   L.AcquirerGuid &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid&lt;br /&gt;              &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;Lock L&lt;br /&gt;             &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: black"&gt;L.LockName &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: green"&gt;@Name &lt;br /&gt;               &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;(L.AcquirerGuid &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid &lt;/span&gt;&lt;span style="color: teal"&gt;-- owned by the current requestor&lt;br /&gt;                        &lt;/span&gt;&lt;span style="color: gray"&gt;OR &lt;/span&gt;&lt;span style="color: magenta"&gt;DATEDIFF&lt;/span&gt;&lt;span style="color: black"&gt;(SS, L.AcquiredDate, GETUTCDATE()) &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;gt; &lt;/span&gt;&lt;span style="color: maroon"&gt;30&lt;/span&gt;&lt;span style="color: black"&gt;) &lt;/span&gt;&lt;span style="color: teal"&gt;-- or expired so re-assign to new requestor&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;br /&gt;        &lt;br /&gt;        SELECT &lt;/span&gt;&lt;span style="color: green"&gt;@@ROWCOUNT&lt;/span&gt;&lt;span style="color: black"&gt;; &lt;br /&gt;         &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;COMMIT TRANSACTION&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;IF  &lt;/span&gt;&lt;span style="color: gray"&gt;EXISTS &lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: gray"&gt;* &lt;/span&gt;&lt;span style="color: blue"&gt;FROM &lt;/span&gt;&lt;span style="color: black"&gt;sys.objects &lt;/span&gt;&lt;span style="color: blue"&gt;WHERE &lt;/span&gt;&lt;span style="color: magenta"&gt;object_id &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: magenta"&gt;OBJECT_ID&lt;/span&gt;&lt;span style="color: black"&gt;(N&lt;/span&gt;&lt;span style="color: red"&gt;'[dbo].[Lock_Release]'&lt;/span&gt;&lt;span style="color: black"&gt;) &lt;/span&gt;&lt;span style="color: gray"&gt;AND &lt;/span&gt;&lt;span style="color: black"&gt;type &lt;/span&gt;&lt;span style="color: gray"&gt;in &lt;/span&gt;&lt;span style="color: black"&gt;(N&lt;/span&gt;&lt;span style="color: red"&gt;'P'&lt;/span&gt;&lt;span style="color: black"&gt;, N&lt;/span&gt;&lt;span style="color: red"&gt;'PC'&lt;/span&gt;&lt;span style="color: black"&gt;))&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;DROP PROCEDURE &lt;/span&gt;&lt;span style="color: red"&gt;[dbo]&lt;/span&gt;&lt;span style="color: black"&gt;.&lt;/span&gt;&lt;span style="color: red"&gt;[Lock_Release]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;GO&lt;br /&gt;&lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;ANSI_NULLS &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;QUOTED_IDENTIFIER &lt;/span&gt;&lt;span style="color: blue"&gt;ON&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE &lt;/span&gt;&lt;span style="color: red"&gt;[dbo]&lt;/span&gt;&lt;span style="color: black"&gt;.&lt;/span&gt;&lt;span style="color: red"&gt;[Lock_Release]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: green"&gt;@Name &lt;/span&gt;&lt;span style="color: blue"&gt;NVARCHAR&lt;/span&gt;&lt;span style="color: black"&gt;(&lt;/span&gt;&lt;span style="color: maroon"&gt;4000&lt;/span&gt;&lt;span style="color: black"&gt;),&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid &lt;/span&gt;&lt;span style="color: blue"&gt;UNIQUEIDENTIFIER&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black"&gt;)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;AS &lt;br /&gt;BEGIN&lt;br /&gt;    &lt;br /&gt;    SET TRANSACTION ISOLATION LEVEL SERIALIZABLE&lt;br /&gt;    &lt;br /&gt;    UPDATE &lt;/span&gt;&lt;span style="color: black"&gt;Lock&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;SET &lt;/span&gt;&lt;span style="color: black"&gt;AcquiredDate &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;/span&gt;&lt;span style="color: black"&gt;, &lt;br /&gt;    AcquirerGuid &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: blue"&gt;NULL&lt;br /&gt;    WHERE &lt;/span&gt;&lt;span style="color: black"&gt;AcquirerGuid &lt;/span&gt;&lt;span style="color: gray"&gt;= &lt;/span&gt;&lt;span style="color: green"&gt;@AcquirerGuid&lt;br /&gt;    &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue"&gt;SELECT &lt;/span&gt;&lt;span style="color: green"&gt;@@ROWCOUNT&lt;/span&gt;&lt;span style="color: black"&gt;;&lt;br /&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;END&lt;br /&gt;&lt;br /&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Import the Stored Procedures into Entity Framework (if you use EF)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Create the Distributed Lock Service&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DistributedLockService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IDisposable&lt;br /&gt;    &lt;/span&gt;{&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Guid &lt;/span&gt;AcquirerId { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;LockName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;br /&gt;        &lt;span style="color: blue"&gt;public bool &lt;/span&gt;LockAcquired { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;        /// &lt;/span&gt;&lt;span style="color: green"&gt;ctor&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;        /// &amp;lt;param name=&amp;quot;lockName&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;DistributedLockService(&lt;span style="color: blue"&gt;string &lt;/span&gt;lockName)&lt;br /&gt;        {&lt;br /&gt;            LockName = lockName;&lt;br /&gt;            AcquirerId = &lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;        /// &lt;/span&gt;&lt;span style="color: green"&gt;Attempts to acquire the named lock&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;public bool &lt;/span&gt;Acquire()&lt;br /&gt;        {&lt;br /&gt;            LockAcquired = &lt;span style="color: #2b91af"&gt;Facade&lt;/span&gt;.DataContext.Lock_Acquire(LockName, AcquirerId).FirstOrDefault() == 1;&lt;br /&gt;            &lt;span style="color: blue"&gt;return &lt;/span&gt;LockAcquired;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;        /// &lt;/span&gt;&lt;span style="color: green"&gt;Attempts to release the named lock&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="color: blue"&gt;public bool &lt;/span&gt;Release()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;if &lt;/span&gt;(LockAcquired) &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Facade&lt;/span&gt;.DataContext.Lock_Release(LockName, AcquirerId) == 1;&lt;br /&gt;            &lt;span style="color: blue"&gt;else return true&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;#region &lt;/span&gt;IDisposable Members&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public void &lt;/span&gt;Dispose()&lt;br /&gt;        {&lt;br /&gt;            Release();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;#endregion&lt;br /&gt;    &lt;/span&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You may have to change Facade.DataContext to be your equivalent ORM or Sql Helper class.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Create the Unit Test&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;TestClass&lt;/span&gt;]&lt;br /&gt;    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DistributedLockServiceTest&lt;br /&gt;    &lt;/span&gt;{&lt;br /&gt;        [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;        &lt;span style="color: blue"&gt;public void &lt;/span&gt;CheckThatLockingWorks()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;string &lt;/span&gt;fakeLockName = &lt;span style="color: #2b91af"&gt;Guid&lt;/span&gt;.NewGuid().ToString();&lt;br /&gt;            &lt;br /&gt;            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt; results = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;bool&lt;/span&gt;&amp;gt;();&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManualResetEvent &lt;/span&gt;handle = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManualResetEvent&lt;/span&gt;(&lt;span style="color: blue"&gt;false&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: blue"&gt;object &lt;/span&gt;mutex = &lt;span style="color: blue"&gt;new object&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;Parallel&lt;/span&gt;.Invoke(() =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #2b91af"&gt;Parallel&lt;/span&gt;.For(0, 100, x =&amp;gt;&lt;br /&gt;                {&lt;br /&gt;                    handle.WaitOne();&lt;br /&gt;                    &lt;span style="color: #2b91af"&gt;DistributedLockService &lt;/span&gt;svc = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DistributedLockService&lt;/span&gt;(fakeLockName);&lt;br /&gt;&lt;br /&gt;                    &lt;span style="color: blue"&gt;lock&lt;/span&gt;(mutex) results.Add(svc.Acquire());&lt;br /&gt;                });&lt;br /&gt;            }, &lt;br /&gt;            () =&amp;gt;&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: #2b91af"&gt;Thread&lt;/span&gt;.Sleep(2000);&lt;br /&gt;                handle.Set();&lt;br /&gt;            });&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(1, results.Where(x =&amp;gt; x == &lt;span style="color: blue"&gt;true&lt;/span&gt;).Count(), &lt;span style="color: #a31515"&gt;&amp;quot;The number of trues should be 1 for fake lock: &amp;quot; &lt;/span&gt;+ fakeLockName);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Use it for real…&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DistributedLockService &lt;/span&gt;_lockService = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DistributedLockService&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;JobScheduler&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt;(_lockService.Acquire()) // do something, like start a Job&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So the idea is that you can instantiate the Distributed Lock Service and keep it for as long as necessary, then whenever you wish to perform some action without the possibility of concurrency, do it after acquiring the lock.&amp;#160; Please also note that the lock will last for up to 30 seconds at a time, so you must call Acquire within the 30 second period if you wish to retain non-concurrency. Otherwise the lock will be relinquished to any other requestor.&amp;#160; If this is too short a timeframe, then you can change it inside the Lock_Acquire stored procedure.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The reason why there’s a time limit is in case the acquiring/lock-owning thread throws an exception and does not release the lock.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Please let me know should you find any problems. thanks.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-694073291853181639?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/694073291853181639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=694073291853181639&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/694073291853181639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/694073291853181639'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2011/01/distributed-lock.html' title='Distributed Lock'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3293655684160914432</id><published>2010-09-13T15:24:00.001Z</published><updated>2010-09-15T16:15:41.195Z</updated><title type='text'>Dell XPS M1330, nVidia GeForce 8400 GS overheats and the laptop cuts out</title><content type='html'>&lt;p&gt;I have had this laptop this January 2009 and it’s been fine, but recently it’s been cutting out if I use Google Earth or Bing Maps!&amp;#160; I have measured the temperature at which it cuts out is about 110 degrees.&amp;#160; When it turns on again, it reports either error #M1001 or #M1004.&amp;#160; This is apparently and overheating problem with the nVidia GPU.&lt;/p&gt;  &lt;p&gt;I am contacting Dell about this, however my motherboard was only replaced last month when my graphics card failed with what I can only describe as “on screen display corruption issues”.&amp;#160; Weird symbols and colours appeared.&amp;#160; Oh well, looks like I’ll need another repair, or just have to buy a new laptop as I’m a freelancer, so the loss of earnings will eventually become greater than the cost of a laptop, so I may as well get a new one… hopefully from a more reliable brand.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UPDATE: 15th September 2010: &lt;/strong&gt;A Dell engineer changed the heat sink and now it runs perfectly!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3293655684160914432?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3293655684160914432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3293655684160914432&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3293655684160914432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3293655684160914432'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/09/dell-xps-m1330-nvidia-geforce-8400-gs.html' title='Dell XPS M1330, nVidia GeForce 8400 GS overheats and the laptop cuts out'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-5850506842407858110</id><published>2010-09-13T09:03:00.001Z</published><updated>2010-09-13T09:03:41.247Z</updated><title type='text'>ASP.NET MVC 2, “Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted” and the ValidateInput does not work</title><content type='html'>&lt;p&gt;If you have problems getting the [ValidateInput(false)] attribute to work in a Visual Studio 2010 ASP.NET MVC 2 solution; please remember to put requestValidationMode=&amp;quot;2.0&amp;quot; on the httpRuntime element of the web.config.&lt;/p&gt;  &lt;p&gt;Then everything will be fine. Enjoy.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-5850506842407858110?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/5850506842407858110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=5850506842407858110&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/5850506842407858110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/5850506842407858110'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/09/aspnet-mvc-2-request-validation-has.html' title='ASP.NET MVC 2, “Request Validation has detected a potentially dangerous client input value, and processing of the request has been aborted” and the ValidateInput does not work'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3705089294998929098</id><published>2010-08-23T14:20:00.001Z</published><updated>2010-08-23T14:20:35.926Z</updated><title type='text'>Umbraco 4.x – Warning on upgrading document types</title><content type='html'>&lt;p&gt;Please be aware, though Umbraco is a great Content Management System, once you have deployed an application based on it – it’s very difficult to upgrade items in the meta-database afterwards.&amp;#160; Umbraco Courier does a good job of transferring content, but it doesn’t take into account changes to Document, Media and Member types, nor does it take into account new macros or changes to settings on those entities.&amp;#160; Courier will report the problems as you try to migrate content which is dependent on a latest meta database changes.&lt;/p&gt;  &lt;p&gt;This is akin to developing your database in the development environment, then, once you’ve deployed the software, having to use the SQL Table Designer GUI make all the necessary schema changes manually.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3705089294998929098?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3705089294998929098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3705089294998929098&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3705089294998929098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3705089294998929098'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/08/umbraco-4x-warning-on-upgrading.html' title='Umbraco 4.x – Warning on upgrading document types'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-6643827994247949740</id><published>2010-08-05T09:52:00.001Z</published><updated>2010-08-05T09:54:13.146Z</updated><title type='text'>Dynamic subdomains on Apache and PHP</title><content type='html'>&lt;p&gt;To rewrite subdomain urls internally to subdirectories under the root, ensure mod_rewrite is installed in Apache. Configure .htaccess inside the root directory as follows:-&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 72.44%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 12px"&gt;RewriteEngine On&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 72.24%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 12px"&gt;RewriteCond %{HTTP_HOST} !^www\.mydomain.com&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 73.6%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 12px"&gt;RewriteCond %{HTTP_HOST} ([^.]+)\.mydomain.com&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 6px; font-size: 12px"&gt;RewriteRule ^(.*)$ /home/sites/mydomain.com/public_html/%1/index.html&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Obviously replace “mydomain” and change the path on the last line to where your website physically resides on the server. Use the variable %1 to use the name of the subdomain as the name of the destination subdirectory.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-6643827994247949740?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/6643827994247949740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=6643827994247949740&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/6643827994247949740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/6643827994247949740'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/08/dynamic-subdomains-on-apache-and-php.html' title='Dynamic subdomains on Apache and PHP'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-4486009502867066856</id><published>2010-07-21T16:02:00.001Z</published><updated>2010-07-21T16:02:36.250Z</updated><title type='text'>My iPad Review</title><content type='html'>&lt;p&gt;I got an iPad a few weeks ago and thought I’d share with you the pros and cons I have discovered:-&lt;/p&gt;  &lt;p&gt;Pros&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Great for reading e-books and PDFs&lt;/li&gt;    &lt;li&gt;Makes surfing a web really easy as you can pinch, zoom and scroll really easily using just one or two fingers&lt;/li&gt;    &lt;li&gt;Watching YouTube and videos is a really tactile experience, and so is viewing Photos.&lt;/li&gt;    &lt;li&gt;If you get an iPad you can run both iPhone and iPad apps on it.&amp;#160; This is great if you’re a developer and want to target both platforms and not have to purchase an iPhone. For me the cost of getting into iPad and iPhone development has been about £1000 (£500 for the iPad and about £500 for the Mac Mini). Although they have just put up their Mac Mini price.&amp;#160; If I’d had to purchase an iPhone as well, the cost would be today at about £1700.&amp;#160; I have saved £700!&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Cons&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Apps in the App Store don’t have a trial period, so if you don’t like it, then you can’t get a refund.&amp;#160; Also, sometimes the description of an App can exaggerate how good it really is&lt;/li&gt;    &lt;li&gt;Apps can be a bit too expensive&lt;/li&gt;    &lt;li&gt;Re iTunes;&amp;#160; I can get the IT Crowd from channel 4 for £10.&amp;#160; However, on a Windows PC or a Mac I can go to 4OD on Channel4.com and watch loads of stuff for free.&lt;/li&gt;    &lt;li&gt;No support for Flash, so stuff like 4oD doesn’t work :-(&amp;#160; Also, the BBC News website experience is degraded as they rely on flash&lt;/li&gt;    &lt;li&gt;When I download Spotify I find I cannot play music in the background (although this is an iPhone app, maybe an iPad version will be different)&lt;/li&gt;    &lt;li&gt;When I plug in headphones the sound doesn’t seem to come through – not sure whether this is a fault or a configuration problem &lt;/li&gt;    &lt;li&gt;The soft-keyboard is a bit annoying (although, a keyboard or anything other than a proper physical one is generally annoying!) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All in all, if I had £500 to spend and I &lt;strong&gt;needed&lt;/strong&gt; a computer, I’d probably get a netbook and pocket £100-£200. Just because a netbook supports everything and there’s an abundance of free software out there and it’s compatible with most things (e.g. Flash), and it has a regular keyboard so you can work and play on it.&amp;#160; Sure, it won’t have integrated 3G, but get a bluetooth link to a 3G-enabled mobile phone and you’re sorted.&lt;/p&gt;  &lt;p&gt;Steve Jobs said in his keynote speech, introducing the iPad that it occupies the same market space as netbooks.&amp;#160; Although for me, it’s just a different type of device really – and very niche.&lt;/p&gt;  &lt;p&gt;In summary then… an iPad is&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Less functional than a netbook (you can literally do anything a PC can do, albeit slower)&lt;/li&gt;    &lt;li&gt;More controlled and regulated by Apple HQ&lt;/li&gt;    &lt;li&gt;However a much more tactile, novel and fun experience&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;My gut feeling is that, one day, a manufacturer will invent a powerful netbook with a detachable screen and all the fun of an iPad. At least I hope this will happen, alongside a de-facto open e-book format.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-4486009502867066856?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/4486009502867066856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=4486009502867066856&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4486009502867066856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4486009502867066856'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/07/my-ipad-review.html' title='My iPad Review'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-9128423319227593673</id><published>2010-06-30T16:58:00.001Z</published><updated>2010-06-30T16:58:17.422Z</updated><title type='text'>Get this? Windows Azure MMC, Could not load file or assembly 'Microsoft.Samples.AzureManagementTools.PowerShell, Version=1.1.3779.27370, Culture=neutral, PublicKeyToken=null' or one of its dependencies.</title><content type='html'>&lt;p&gt;You probably have a previous version of the Windows Azure SDK. Delete all but the latest folder from ‘C:\Program Files\Windows Azure SDK’.&amp;#160; For me, I had to delete the folder ‘C:\Program Files\Windows Azure SDK\v1.0’&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-9128423319227593673?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/9128423319227593673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=9128423319227593673&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/9128423319227593673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/9128423319227593673'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/06/get-this-windows-azure-mmc-could-not.html' title='Get this? Windows Azure MMC, Could not load file or assembly &amp;#39;Microsoft.Samples.AzureManagementTools.PowerShell, Version=1.1.3779.27370, Culture=neutral, PublicKeyToken=null&amp;#39; or one of its dependencies.'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3912091476133719525</id><published>2010-06-10T09:32:00.001Z</published><updated>2010-06-10T09:42:15.167Z</updated><title type='text'>Google copies Bing!</title><content type='html'>&lt;p&gt;One day I woke up to find this atrocity!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_R6bT-502dXU/TBCxAHk7azI/AAAAAAAAAE0/NDk6v5o5DC4/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_R6bT-502dXU/TBCxCCb-9iI/AAAAAAAAAE4/vTEPyy5Unjc/image_thumb%5B1%5D.png?imgmax=800" width="574" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And then realised they were trying to do this…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_R6bT-502dXU/TBCzc7_-z4I/AAAAAAAAAFE/KgfS6sk6H-0/s1600-h/googledoesbing%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="googledoesbing" border="0" alt="googledoesbing" src="http://lh3.ggpht.com/_R6bT-502dXU/TBCzduM88hI/AAAAAAAAAFI/q7NFjEJ5b-s/googledoesbing_thumb%5B2%5D.jpg?imgmax=800" width="627" height="469" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I think maybe Google use &lt;a href="http://www.bing.com" target="_blank"&gt;Bing.com&lt;/a&gt; – which is nice. Well done bing.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3912091476133719525?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3912091476133719525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3912091476133719525&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3912091476133719525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3912091476133719525'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/06/google-copies-bing.html' title='Google copies Bing!'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_R6bT-502dXU/TBCxCCb-9iI/AAAAAAAAAE4/vTEPyy5Unjc/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-8229565824924137681</id><published>2010-04-27T15:50:00.001Z</published><updated>2010-04-27T15:50:48.766Z</updated><title type='text'>Escaping javascript strings in Umbraco XSLT macros</title><content type='html'>&lt;p&gt;How to escape string literals in XSLT which appear inside JavaScript function calls:-&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 606px; padding-right: 5px; height: 144px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 11px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;variable&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;apos&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;'&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;variable&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 11px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt; &lt;span style="color: #ff0000"&gt;test&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;data[@alias='popupMessage'] != ''&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 13px; font-size: 11px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;attribute&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;onclick&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 11px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;return window.confirm('&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 29px; font-size: 11px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;value&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;of&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;umbraco.library:Replace(data[@alias='popupMessage'], $apos, concat('\',$apos))&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;disable&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;output&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;escaping&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;yes&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 14px; font-size: 11px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;');&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 11px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;attribute&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 11px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-8229565824924137681?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/8229565824924137681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=8229565824924137681&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8229565824924137681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8229565824924137681'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/04/escaping-javascript-strings-in-umbraco.html' title='Escaping javascript strings in Umbraco XSLT macros'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-270503204430584817</id><published>2010-04-25T15:52:00.001Z</published><updated>2010-04-25T15:52:13.398Z</updated><title type='text'>ASP.NET, hMailServer, error “The SMTP server requires a secure connection or the client was not authenticated” or “SMTP authentication is required”</title><content type='html'>&lt;p&gt;If you receive the above error message when sending email via hMailServer’s SMTP Service, just go into the Admin console –&amp;gt; Settings/Advanced/IP Ranges/My Computer and uncheck the boxes below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_R6bT-502dXU/S9RlKNi5mCI/AAAAAAAAAEs/gV1v0E4JaMo/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_R6bT-502dXU/S9RlK3LHWpI/AAAAAAAAAEw/1Zy9DlWH_h4/image_thumb%5B1%5D.png?imgmax=800" width="526" height="396" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-270503204430584817?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/270503204430584817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=270503204430584817&amp;isPopup=true' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/270503204430584817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/270503204430584817'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/04/aspnet-hmailserver-error-smtp-server.html' title='ASP.NET, hMailServer, error “The SMTP server requires a secure connection or the client was not authenticated” or “SMTP authentication is required”'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_R6bT-502dXU/S9RlK3LHWpI/AAAAAAAAAEw/1Zy9DlWH_h4/s72-c/image_thumb%5B1%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-8017695060801167129</id><published>2010-04-25T10:49:00.001Z</published><updated>2010-04-25T10:49:42.772Z</updated><title type='text'>Windows Server 2008, IIS 7, Shared Configuration, System Corrupted Irrecoverably</title><content type='html'>&lt;p&gt;The story is, I tried to copy IIS7 configuration from one Windows Server 2008 server to another.&amp;#160; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;This overwrote the applicationHost.config&lt;/li&gt;    &lt;li&gt;IIS/App Pools failed because global modules that were on the previous server were not installed on the current&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Attempted to install those modules&lt;/li&gt;      &lt;li&gt;that failed.&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Thought I’d try to rollback, but it doesn’t backup the original IIS7 config&lt;/li&gt;    &lt;li&gt;Uninstalled IIS7&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Tried to reinstall IIS7&lt;/li&gt;      &lt;li&gt;That failed&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Tried to set up Windows Installer tracing with special registry entries&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Tracing doesn’t work, no file is output into the %Temp% directory&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Now wanting to do a system restore&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;There’s no system restore on Windows Server 2008&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;Quite a disproportional dilemma given the cause.&lt;/p&gt;  &lt;p&gt;I like Microsoft – sometimes.&amp;#160; But really, I have had problems with Windows Server set up before… they haven’t put the effort into making this work.&amp;#160; And given that it’s usually professionals who are working setting up boxes, it would be a good idea to give some error messages that mean something.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-8017695060801167129?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/8017695060801167129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=8017695060801167129&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8017695060801167129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8017695060801167129'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/04/windows-server-2008-iis-7-shared.html' title='Windows Server 2008, IIS 7, Shared Configuration, System Corrupted Irrecoverably'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3246715503397602168</id><published>2010-04-13T07:50:00.001Z</published><updated>2010-04-13T07:50:36.037Z</updated><title type='text'>Message: Type 'umbraco.DataLayer.SqlHelperException' in Assembly 'umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.</title><content type='html'>&lt;p&gt;This is most likely because the database is inaccessible to Umbraco.&amp;#160; Check the connection strings are correct and also try connecting using the same connection string credentials with SQL Management Studio.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3246715503397602168?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3246715503397602168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3246715503397602168&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3246715503397602168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3246715503397602168'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/04/message-type-in-assembly-version0300.html' title='Message: Type &amp;#39;umbraco.DataLayer.SqlHelperException&amp;#39; in Assembly &amp;#39;umbraco.DataLayer, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null&amp;#39; is not marked as serializable.'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-7549224460400726122</id><published>2010-03-26T00:06:00.001Z</published><updated>2010-03-26T00:06:37.670Z</updated><title type='text'>MSMQ "The destination queue does not exist” or “BadDestinationQueue” when sending MSMQ messages or WCF net.msmq bound service calls</title><content type='html'>&lt;p&gt;If you’re sending MSMQ messages using the DNS name of the server, you may get one of the above errors… this is easily fixed by adding a new registry key which tells MSMQ to ignore the hostname validation.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Click &lt;strong&gt;Start&lt;/strong&gt;, click &lt;strong&gt;Run&lt;/strong&gt;, type regedit, and then click &lt;strong&gt;OK&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Locate and then click the following key in the registry:      &lt;p&gt;&lt;b&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\MSMQ\Parameters&lt;/b&gt;&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;On the &lt;strong&gt;Edit&lt;/strong&gt; menu, point to &lt;strong&gt;New&lt;/strong&gt;, and then click &lt;strong&gt;DWORD Value&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Type IgnoreOSNameValidation, and then press ENTER. &lt;/li&gt;    &lt;li&gt;On the &lt;strong&gt;Edit&lt;/strong&gt; menu, click &lt;strong&gt;Modify&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;Type 1, and then click &lt;strong&gt;OK&lt;/strong&gt;.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;See the &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;899611" target="_blank"&gt;Microsoft Support Article&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-7549224460400726122?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/7549224460400726122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=7549224460400726122&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/7549224460400726122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/7549224460400726122'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/msmq-destination-queue-does-not-exist.html' title='MSMQ &amp;quot;The destination queue does not exist” or “BadDestinationQueue” when sending MSMQ messages or WCF net.msmq bound service calls'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3422049566251585078</id><published>2010-03-24T20:47:00.001Z</published><updated>2010-03-24T20:47:03.106Z</updated><title type='text'>Buy.at product feeds gzip trailer invalid / corrupt.</title><content type='html'>&lt;p&gt;Please note that buy.at product feeds in gzip format are corrupt.&amp;#160; There is no CRC32 or ISIZE value in the trailer of the file which is required. Please &lt;a href="http://www.gzip.org/zlib/rfc-gzip.html#file-format" target="_blank"&gt;see the gzip spec&lt;/a&gt;. You can see this by opening a valid gzip file and their invalid gzip file in WinRAR or 7-Zip… there’s no input file size or CRC in the file.&lt;/p&gt;  &lt;p&gt;Also see &lt;a href="http://www.affiliates4u.com/forums/buy/88660-buy-feed-download-issue.html"&gt;http://www.affiliates4u.com/forums/buy/88660-buy-feed-download-issue.html&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3422049566251585078?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3422049566251585078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3422049566251585078&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3422049566251585078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3422049566251585078'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/buyat-product-feeds-gzip-trailer.html' title='Buy.at product feeds gzip trailer invalid / corrupt.'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-8332756232286079684</id><published>2010-03-24T09:20:00.001Z</published><updated>2010-03-25T10:11:51.831Z</updated><title type='text'>GZipInputStream, GZipStream, GZipUtil, C#.NET UNIX .gz files - decompression ends prematurely - Workaround</title><content type='html'>&lt;p&gt;I have been trying for days now to decompress a 10MB gzip file using &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;ICSharpCode.SharpZipLib.GZip.GZipInputStream, &lt;/li&gt;    &lt;li&gt;Ionic.Zlib.GZipStream, &lt;/li&gt;    &lt;li&gt;and System.IO.Compression.GZipStream &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Using both my own code and other people’s code from all over the Internet.&amp;#160; I have tried analyzing the file to make sure it’s valid – and it is. The only thing I know about this file is that it’s been compressed by a UNIX based system with the “DEFLATE” method, downloaded over http and can be successfully decompressed by 7Zip, WinZip and WinRAR.&amp;#160; But when it comes to decompressing the file within C# with various libraries, it’s just not happening.&amp;#160; It always prematurely ends the decompression, so I get a truncated file.&lt;/p&gt;  &lt;p&gt;In the end, I decided to wrap a call to gzip.exe which can be downloaded from &lt;a href="http://www.gzip.org/" target="_blank"&gt;http://www.gzip.org/&lt;/a&gt;&amp;#160; or the direct Windows Download is &lt;a href="http://www.gzip.org/gzip124xN.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Put gzip.exe inside your project folder, in Solution Explorer and ensure “Copy to output directory” is set to “Copy always”.&amp;#160; The code for calling the exe is below. &lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 13px; font-size: 13px"&gt;&lt;span style="color: #808080"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;&lt;span style="color: #808080"&gt;/// Uncompresses a gzip file &lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 14px; font-size: 13px"&gt;&lt;span style="color: #808080"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 20px; font-size: 13px"&gt;&lt;span style="color: #808080"&gt;/// &amp;lt;param name=&amp;quot;gzipFilename&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;&lt;span style="color: #808080"&gt;/// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; UngzipFile(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; gzipFilename)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; GZIP_EXE_NAME = &amp;quot;&lt;span style="color: #8b0000"&gt;gzip.exe&lt;/span&gt;&amp;quot;;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; gzipExePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GZIP_EXE_NAME);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 20px; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; args = &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.Format(&amp;quot;&lt;span style="color: #8b0000"&gt;-d \&amp;quot;{0}\&amp;quot;&lt;/span&gt;&amp;quot;, gzipFilename);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 19px; font-size: 13px"&gt;    var p = System.Diagnostics.Process.Start(gzipExePath, args);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;    p.WaitForExit();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; gzipFilename.Remove(gzipFilename.Length - 3, 3);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;UPDATE: &lt;/strong&gt;ok, the files I’m trying to decompress are corrupt – they have no ISIZE or CRC32 GZip File Trailer (well, they are zero, which can’t be good).&amp;#160; I wish there was a way to force it to decompress as the bandwidth usage for uncompressed it massive.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-8332756232286079684?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/8332756232286079684/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=8332756232286079684&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8332756232286079684'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/8332756232286079684'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/gzipinputstream-gzipstream-gziputil.html' title='GZipInputStream, GZipStream, GZipUtil, C#.NET UNIX .gz files - decompression ends prematurely - Workaround'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-6814220607382689520</id><published>2010-03-16T18:29:00.001Z</published><updated>2010-03-16T18:29:24.499Z</updated><title type='text'>How to horizontally centre align an inner div of unknown width within an outer div of known width :: CSS, JQuery, HTML.</title><content type='html'>&lt;p&gt;Situation:&amp;#160; You have a an outer div with the id “outer” and an inner div called “inner”.&amp;#160; The menuCont div is of fixed width; let’s say 960 for this example.&lt;/p&gt;  &lt;p&gt;The inner div contains variable width elements and you cannot know at design time how many elements and of what width they will be.&amp;#160; You cannot do this with CSS alone (but if you know how, please do share!)&lt;/p&gt;  &lt;p&gt;Here’s the solution – it relies on jQuery BTW.&lt;/p&gt;  &lt;p&gt;Set the CSS as follows:&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 568px; padding-right: 5px; height: 149px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 13px; font-size: 13px"&gt;#outer&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;    position:relative;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 14px; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;#inner&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;{&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;    float:left;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;}&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And HTML as follows:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 569px; padding-right: 5px; height: 94px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;outer&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 19px; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt; &lt;span style="color: #ff0000"&gt;id&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;inner&amp;quot; style=”display:none”&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;    &lt;span style="color: #008000"&gt;&amp;lt;!-- Insert variable width elements here --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 15px; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;div&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 1px; font-size: 13px"&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And then JavaScript:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 570px; padding-right: 5px; height: 283px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 14px; font-size: 13px"&gt;$(&lt;span style="color: #0000ff"&gt;document&lt;/span&gt;).ready(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 14px; font-size: 13px"&gt;jQuery.fn.center = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.each(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; el = $(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; w = el.width();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; w_box = 960; &lt;span style="color: #008000"&gt;// TODO: ADD THE CONTAINER WIDTH HERE!&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; w_total = (w_box - w) / 2;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; css = { &amp;quot;&lt;span style="color: #8b0000"&gt;position&lt;/span&gt;&amp;quot;: 'absolute', &amp;quot;&lt;span style="color: #8b0000"&gt;left&lt;/span&gt;&amp;quot;: w_total + &amp;quot;&lt;span style="color: #8b0000"&gt;px&lt;/span&gt;&amp;quot; };&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;            el.css(css)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 17px; font-size: 13px"&gt;       });&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 16px; font-size: 13px"&gt;};&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;$(&amp;quot;&lt;span style="color: #8b0000"&gt;#inner&lt;/span&gt;&amp;quot;).center();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; height: 18px; font-size: 13px"&gt;$(&amp;quot;&lt;span style="color: #8b0000"&gt;#inner&lt;/span&gt;&amp;quot;).fadeIn(); &lt;span style="color: #008000"&gt;// optional! could use show()&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;});&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This solution can definitely be improved – but it’s a start.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-6814220607382689520?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/6814220607382689520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=6814220607382689520&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/6814220607382689520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/6814220607382689520'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/how-to-horizontally-centre-align-inner.html' title='How to horizontally centre align an inner div of unknown width within an outer div of known width :: CSS, JQuery, HTML.'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-4026267548973478938</id><published>2010-03-15T20:45:00.001Z</published><updated>2010-03-15T20:45:06.162Z</updated><title type='text'>HttpModule and Application_Start</title><content type='html'>&lt;p&gt;Unfortunately there is no “Start” event to hook onto for HttpModules.&amp;#160; Instead you should use Init() – be aware though that there may be multiple instances of your http module, serving many threads in the appdomain.&amp;#160; So you need a bit of thread sync’ing in order to ensure that your start-up code only executes once.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; MyHttpModule : IHttpModule&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// Mutex object which gives the lock statement something to get an exclusive lock on&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; _mutex = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// Flags whether the application has started&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; _isInitialised = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        #region IHttpModule Members&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Dispose()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Init(HttpApplication context)&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!_isInitialised) &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;                &lt;span style="color: #0000ff"&gt;lock&lt;/span&gt; (_mutex)  &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;                    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!_isInitialised) &lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;                        Application_Start();&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        }&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// Application start-up code will be executed once here&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #808080"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Application_Start()&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        {&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;            _isInitialised = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;            &lt;span style="color: #008000"&gt;// add code&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-4026267548973478938?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/4026267548973478938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=4026267548973478938&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4026267548973478938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4026267548973478938'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/httpmodule-and-applicationstart.html' title='HttpModule and Application_Start'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-5032230104026893495</id><published>2010-03-15T15:18:00.001Z</published><updated>2010-03-15T15:20:54.036Z</updated><title type='text'>ASP.NET, JQuery, Colorbox, Postback Problem</title><content type='html'>&lt;p&gt;As Colorbox appends inline divs to the body tag, this is outside the form.&lt;/p&gt;  &lt;p&gt;See &lt;a href="http://markive.co.uk/blog/?p=13"&gt;http://markive.co.uk/blog/?p=13&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Change this:&lt;/strong&gt; $('body').prepend($overlay,&amp;#160; $cbox.append($wrap, $loadingBay))&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;To this:&lt;/strong&gt; $('form').prepend($overlay, $cbox.append($wrap, $loadingBay))&lt;/p&gt;  &lt;p&gt;or search in the minified file for “body”, and replace it with “form”.&lt;/p&gt;  &lt;p&gt;I also recommend prepending the project name to the min file and putting a comment the top stating it’s been customised.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-5032230104026893495?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/5032230104026893495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=5032230104026893495&amp;isPopup=true' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/5032230104026893495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/5032230104026893495'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/aspnet-jquery-colorbox-postback-problem.html' title='ASP.NET, JQuery, Colorbox, Postback Problem'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-1948521786210885462</id><published>2010-03-12T15:20:00.001Z</published><updated>2010-03-12T15:41:40.276Z</updated><title type='text'>Umbraco, XSLT :: Reading RSS Feeds, Aggregating and Sorting</title><content type='html'>&lt;p&gt;Here's a quick summary of how to read multiple RSS feeds, merge them, sort them and then output the first 30 items.&amp;#160; You can easily combine and concatenate nodes from external sources into an xsl:variable with xsl:copy-of and GetXmlDocumentByUrl.&lt;/p&gt;  &lt;h4&gt;Preparation &lt;/h4&gt;  &lt;ol&gt;   &lt;li&gt;Set up a doc type named 'RssFeed' with a property called 'url' (textstring) &lt;/li&gt;    &lt;li&gt;Create RSS Feed nodes in the Content section with your chosen feed urls &lt;/li&gt;    &lt;li&gt;Create an XSLT macro with the code that follows. &lt;/li&gt; &lt;/ol&gt;  &lt;h4&gt;XSLT&lt;/h4&gt;  &lt;p&gt;Just put this into an &amp;lt;xsl:template&amp;gt; and it will output the first 30 items.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #008000"&gt;&amp;lt;!-- Find all RSS Feed nodes, create new XML tree with all rss nodes merged into the 'container' node --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;variable&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;rssFeeds&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;container&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;for&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;each&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;$currentPage/ancestor-or-self::root//node [@nodeTypeAlias='Feed Item']&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;variable&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;url&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;string(data[@alias='url'])&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #008000"&gt;&amp;lt;!-- Is the url populated? --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt; &lt;span style="color: #ff0000"&gt;test&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;string-length($url) &amp;amp;gt; 0&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #008000"&gt;&amp;lt;!-- Import the feed--&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;copy&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;of&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;umbraco.library:GetXmlDocumentByUrl( $url )&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;for&lt;/span&gt;-each&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;container&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;variable&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #008000"&gt;&amp;lt;!-- Iterate through the container doc --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;for&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;each&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;msxsl:node-set($rssFeeds)/container/rss/channel/item&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #008000"&gt;&amp;lt;!-- Sort the items --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;sort&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;pubDate&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;order&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;descending&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #008000"&gt;&amp;lt;!-- Only output the first 30 items --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt; &lt;span style="color: #ff0000"&gt;test&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;position() &amp;amp;lt;= 30&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;h1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;attribute&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;href&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;          &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;value&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;of&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;link/text()&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;attribute&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;value&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;of&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;title/text()&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;a&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;h1&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;      &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;value&lt;/span&gt;-&lt;span style="color: #ff0000"&gt;of&lt;/span&gt; &lt;span style="color: #ff0000"&gt;select&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;&amp;quot;description/text()&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;    &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;p&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #f0f0f0; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;if&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre style="background-color: #e6e6e6; margin: 0em; width: 100%; font-family: consolas,&amp;#39;Courier New&amp;#39;,courier,monospace; font-size: 13px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;xsl&lt;/span&gt;:&lt;span style="color: #800000"&gt;for&lt;/span&gt;-each&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-1948521786210885462?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/1948521786210885462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=1948521786210885462&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/1948521786210885462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/1948521786210885462'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/03/umbraco-xslt-reading-rss-feeds.html' title='Umbraco, XSLT :: Reading RSS Feeds, Aggregating and Sorting'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-3070862810624293887</id><published>2010-02-17T14:39:00.001Z</published><updated>2010-02-17T14:39:57.402Z</updated><title type='text'>Javascript in data binding syntax</title><content type='html'>&lt;p&gt;onclick='&amp;lt;%# string.Format(&amp;quot;return OpenWindow1(\&amp;quot;Edit/Supplier.aspx\&amp;quot;, \&amp;quot;{0}\&amp;quot;,\&amp;quot;WindowName\&amp;quot;);&amp;quot;, Eval(&amp;quot;id&amp;quot;)) %&amp;gt;'&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-3070862810624293887?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/3070862810624293887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=3070862810624293887&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3070862810624293887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/3070862810624293887'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2010/02/javascript-in-data-binding-syntax.html' title='Javascript in data binding syntax'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-288924766526045225</id><published>2009-09-22T12:25:00.001Z</published><updated>2009-09-22T12:25:54.243Z</updated><title type='text'>SQL Test Data Generator</title><content type='html'>&lt;p&gt;Great script for generating test data in a SQL Server table:&lt;/p&gt;  &lt;p&gt;declare @select varchar(max), @insert varchar(max), @column varchar(100),   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @type varchar(100), @identity bit, @db nvarchar(100) &lt;/p&gt;  &lt;p&gt;set @db = N'aqs_Lead'   &lt;br /&gt;set @select = 'select '    &lt;br /&gt;set @insert = 'insert into ' + @db + ' (' &lt;/p&gt;  &lt;p&gt;declare crD cursor fast_forward for   &lt;br /&gt;select column_name, data_type,     &lt;br /&gt;COLUMNPROPERTY(    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OBJECT_ID(    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TABLE_SCHEMA + '.' + TABLE_NAME),     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; COLUMN_NAME, 'IsIdentity') AS COLUMN_ID    &lt;br /&gt;from AQSProd2.INFORMATION_SCHEMA.COLUMNS    &lt;br /&gt;where table_name = @db &lt;/p&gt;  &lt;p&gt;open crD   &lt;br /&gt;fetch crD into @column, @type, @identity &lt;/p&gt;  &lt;p&gt;while @@fetch_status = 0   &lt;br /&gt;begin    &lt;br /&gt;if @identity = 0 or @identity is null    &lt;br /&gt;begin    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; set @insert = @insert + @column + ', '     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; set @select = @select&amp;#160; +     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; case @type    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'int' then '1'    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'varchar' then '''test'''    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'nvarchar' then '''test'''    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'smalldatetime' then 'getdate()'    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'bit' then '0'    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; when 'decimal' then '0'    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; else 'NULL'    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; end + ', '     &lt;br /&gt;end    &lt;br /&gt;fetch crD into @column, @type, @identity    &lt;br /&gt;end &lt;/p&gt;  &lt;p&gt;set @select = left(@select, len(@select) - 1)   &lt;br /&gt;set @insert = left(@insert, len(@insert) - 1) + ')'    &lt;br /&gt;exec(@insert + @select) &lt;/p&gt;  &lt;p&gt;close crD   &lt;br /&gt;deallocate crD&lt;/p&gt;  &lt;p&gt;Courtesy of Keith Bloom: &lt;a href="http://stackoverflow.com/questions/1118960/create-test-data-in-sql-server"&gt;http://stackoverflow.com/questions/1118960/create-test-data-in-sql-server&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-288924766526045225?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/288924766526045225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=288924766526045225&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/288924766526045225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/288924766526045225'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2009/09/sql-test-data-generator.html' title='SQL Test Data Generator'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-4280868163485481861</id><published>2009-09-08T15:32:00.001Z</published><updated>2009-09-08T15:32:40.599Z</updated><title type='text'>ThreadPool threads</title><content type='html'>&lt;p&gt;Note to self:&amp;#160; When debugging inside Thread Pool threads, the debugger may miss out lines and exhibit erratic behaviour, which may drive you insane.&amp;#160; Best thing to do is use your own Thread for all but the tiniest operations – or change back to a thread pool thread after debugging. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-4280868163485481861?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/4280868163485481861/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=4280868163485481861&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4280868163485481861'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/4280868163485481861'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2009/09/threadpool-threads.html' title='ThreadPool threads'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4226855027264744802.post-7252983836612114523</id><published>2009-08-29T12:30:00.001Z</published><updated>2009-08-29T12:30:40.203Z</updated><title type='text'>Polymorphic Application Integration End Points</title><content type='html'>&lt;p&gt;From now on, one of absolute “&lt;strong&gt;must-haves” &lt;/strong&gt;for any software engineering effort is, to create polymorphic AI EPs.&amp;#160; Sounds fancy, but it’s not.&lt;/p&gt;  &lt;p&gt;All it really is, is dependency injection or IoC, not at the unit level, but at the application-integration level.&amp;#160; At the unit level, for example, if you create a domain class which talks to a repository object, then you may swap out the repository for a mock repository during an automated unit test.&lt;/p&gt;  &lt;p&gt;At the AI level, this is where you conceptually and logically separate out the application from other services or applications.&amp;#160; e.g., whenever you use the SmtpClient class, you’re binding your code to the concrete implementation of an SMTP end point.&amp;#160; SMTP &lt;strong&gt;is&lt;/strong&gt; an end point, so are web services and WCF services.&amp;#160; In fact, anything outside your domain of control. The database is also integration, hence, we often have database abstraction layers within architectures that are meant to abstract the data-storage technology from the code (ideally we could change the RDBMS from SQL Server to Oracle without changing any code)&lt;/p&gt;  &lt;p&gt;Here are some example application integration end points AIEP:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Currency convert web service&lt;/li&gt;    &lt;li&gt;Email/SMTP service&lt;/li&gt;    &lt;li&gt;Database engine&lt;/li&gt;    &lt;li&gt;Exception Reporting service&lt;/li&gt;    &lt;li&gt;A web-browser (it’s the GUI but it helps to think of it as integration)&lt;/li&gt;    &lt;li&gt;SMS messaging service&lt;/li&gt;    &lt;li&gt;Logging service&lt;/li&gt;    &lt;li&gt;MSMQ messaging&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;All these endpoints are about communicating beyond your application boundary.&amp;#160; By loosely coupling your code to AIEPs, it means you have better ability to test your code in your development environment.&lt;/p&gt;  &lt;p&gt;If you have ever accidentally sent out emails to real users from your test environment, then Polymorphic AIEPs will enable you to swap out your SmtpClient for MockSmtpClient.&lt;/p&gt;  &lt;p&gt;For example:&lt;/p&gt;  &lt;p&gt;public interface ISmtpClientEP{&lt;/p&gt;  &lt;p&gt;void Send(string text);&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;public class SmtpClientEP : ISmtpClientEP{&lt;/p&gt;  &lt;p&gt;public void Send(string text){&lt;/p&gt;  &lt;p&gt;// instantiate the real smtpclient and send the message&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;public class TraceClientEP : ISmtpClientEP{&lt;/p&gt;  &lt;p&gt;public void Send(string text){&lt;/p&gt;  &lt;p&gt;// send your text to anywhere!&amp;#160; e.g. a text file in a local directory?&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Then if you use an IoC Container, such as Structure Map, then you can use this from the client code like this:&lt;/p&gt;  &lt;p&gt;ObjectFactory.GetInstance&amp;lt;ISmtpClientEP&amp;gt;().Send(“hello world”);&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;But remember on application start up to link structure map to the concrete implementation of the class you want to use:&lt;/p&gt;  &lt;p&gt;ObjectFactory.Initialize(x =&amp;gt;   &lt;br /&gt; {&lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; x.ForRequestedType&amp;lt;ISmtpClientEP&amp;gt;()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CacheBy(StructureMap.Attributes.InstanceScope.PerRequest)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .TheDefaultIsConcreteType&amp;lt;SmtpClientEP &amp;gt;();&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;So what have we done here?&amp;#160; We have utilised Structure Map to specify what the concrete implementation of ISmtpClientEP we wish to use.&lt;/p&gt;  &lt;p&gt;Now if you have use conditional compilation arguments you can do this:&lt;/p&gt;  &lt;p&gt;#IF(DEBUG)&lt;/p&gt;  &lt;p&gt;ObjectFactory.Initialize(x =&amp;gt;   &lt;br /&gt; { &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; x.ForRequestedType&amp;lt;ISmtpClientEP&amp;gt;()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CacheBy(StructureMap.Attributes.InstanceScope.PerRequest)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .TheDefaultIsConcreteType&amp;lt;TraceClientEP &amp;gt;();&amp;#160; // use the trace end point for debug &lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;#ELSE&lt;/p&gt;  &lt;p&gt;ObjectFactory.Initialize(x =&amp;gt;   &lt;br /&gt; { &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; x.ForRequestedType&amp;lt;ISmtpClientEP&amp;gt;()   &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .CacheBy(StructureMap.Attributes.InstanceScope.PerRequest)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .TheDefaultIsConcreteType&amp;lt;SmtpClientEP &amp;gt;();&amp;#160; // real one for release compilation!&lt;/p&gt;  &lt;p&gt;}&lt;/p&gt;  &lt;p&gt;#ENDIF&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So polymorphic AIEPs utilise DI (Dependency Injection) to enable you to change (polymorph) your concrete implementations.&amp;#160; This is just like automated-unit testing (TDD), except, in my view TDD can be a large overhead, so my hybrid solution is to use DI for Application Integration End Points and if you want, you can hard-wire you concrete implementations of other classes (classes that are internal to your app), without worrying about affecting other systems or services when you hit Debug.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4226855027264744802-7252983836612114523?l=blog.kristandyson.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.kristandyson.com/feeds/7252983836612114523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4226855027264744802&amp;postID=7252983836612114523&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/7252983836612114523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4226855027264744802/posts/default/7252983836612114523'/><link rel='alternate' type='text/html' href='http://blog.kristandyson.com/2009/08/polymorphic-application-integration-end.html' title='Polymorphic Application Integration End Points'/><author><name>Daysleeper</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
