<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Ben Powell</title><link>http://blog.benpowell.co.uk/</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/benpowell" /><description>my life, opinions and innocuous ramblings</description><language>en</language><managingEditor>noreply@blogger.com (Ben)</managingEditor><lastBuildDate>Sun, 07 Mar 2010 11:20:12 PST</lastBuildDate><generator>Blogger http://www.blogger.com</generator><openSearch:totalResults xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">155</openSearch:totalResults><openSearch:startIndex xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">1</openSearch:startIndex><openSearch:itemsPerPage xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/">25</openSearch:itemsPerPage><feedburner:info uri="benpowell" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Winhost.com - How to REALLY run multiple sites under one account</title><link>http://feedproxy.google.com/~r/benpowell/~3/NgXLrlKTxus/winhostcom-how-to-really-run-multiple.html</link><category>URL Rewrite</category><category>technology</category><category>Webhost4life.com</category><category>IIS7</category><category>Windows Hosting</category><category>Winhost.com</category><author>noreply@blogger.com (Ben)</author><pubDate>Mon, 22 Feb 2010 23:30:44 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-3519638112916781657</guid><description>I've just started trialling Winhost.com. I've been with Webhost4life.com for 4 years now but there are a few things that have started to get on my nerves, so I've decided to try out some of the other big ASP.NET hosting specialist companies out there. Winhost.com offers a month-by-month contract, so I can get out any time (we'll see how easy that is in the future) so I didn't feel too bad about trying it out.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The first thing that struck me was that Winhost.com don't allow you to host multiple domains (or sub domains) as individual websites under one account. Essentially you have one IIS7 Website per account. This is something you can do on Webhost4life.com, and was one of the main reasons I went with them in the first place. I'm a web application developer, which means I want to be able to run numerous websites under one hosting account. It seems that this is a challenge to get for free in a Windows hosting environment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My aim is to do the following (S: is the account root path):&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;http://www.mydomain.com/ =&gt; S:\MyRoot\Main&lt;/li&gt;&lt;li&gt;http://sub1.mydomain.com/ =&gt; S:\MyRoot\Sub1&lt;/li&gt;&lt;li&gt;http://sub2.mydomain.com/ =&gt; s:\MyRoot\Sub2&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What I don't want (which is what Winhost.com suggest) is to end up with:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;http://www.mydomain.com/main/default.aspx&lt;/li&gt;&lt;li&gt;http://sub1.mydomain.com/sub1/default.aspx&lt;/li&gt;&lt;li&gt;http://sub2.mydomain.com/sub2/default.aspx&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Because, face it, that looks like shit.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, we'll turn to IIS7's Url Rewrite feature to get this working. First of all configure your "Application Starting Points" from your Winhost.com Site Manager. You'll need four of them:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;/&lt;/li&gt;&lt;li&gt;/Main&lt;/li&gt;&lt;li&gt;/Sub1&lt;/li&gt;&lt;li&gt;/Sub2&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now login via FTP and create a new web.config file in the root ("/") directory. Paste the following code in:&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="UTF-8"&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.webServer&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;modules&lt;/span&gt; &lt;span class="attr"&gt;runAllManagedModulesForAllRequests&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rewrite&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite to folder1"&lt;/span&gt; &lt;span class="attr"&gt;stopProcessing&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;match&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="(.*)"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;input&lt;/span&gt;&lt;span class="kwrd"&gt;="{HTTP_HOST}"&lt;/span&gt; &lt;span class="attr"&gt;pattern&lt;/span&gt;&lt;span class="kwrd"&gt;="^www.mydomain.com$"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;action&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite"&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="main/{R:1}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite to folder2"&lt;/span&gt; &lt;span class="attr"&gt;stopProcessing&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;match&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="(.*)"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;input&lt;/span&gt;&lt;span class="kwrd"&gt;="{HTTP_HOST}"&lt;/span&gt; &lt;span class="attr"&gt;pattern&lt;/span&gt;&lt;span class="kwrd"&gt;="^sub1.mydomain.com$"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;action&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite"&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="sub1/{R:1}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite to folder3"&lt;/span&gt; &lt;span class="attr"&gt;stopProcessing&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;match&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="(.*)"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;input&lt;/span&gt;&lt;span class="kwrd"&gt;="{HTTP_HOST}"&lt;/span&gt; &lt;span class="attr"&gt;pattern&lt;/span&gt;&lt;span class="kwrd"&gt;="^sub2.mydomain.com$"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;conditions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;action&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="Rewrite"&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="sub2/{R:1}"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rule&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;rewrite&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.webServer&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can remove any other files from the root folder (i.e. "/").&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This should also work on DiscountASP.net, as they appear to have a very similar set up.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-3519638112916781657?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-22T23:30:44.172-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">6</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2010/02/winhostcom-how-to-really-run-multiple.html</feedburner:origLink></item><item><title>ASP.NET MVC Simple authentication without a database</title><link>http://feedproxy.google.com/~r/benpowell/~3/xnMi47BA3wM/aspnet-mvc-simple-authentication.html</link><category>Authentication</category><category>MVC</category><category>technology</category><category>ASP.NET</category><author>noreply@blogger.com (Ben)</author><pubDate>Mon, 22 Feb 2010 02:03:36 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-5014995903958216594</guid><description>Sometimes you just need a really simple authentication method in your ASP.NET MVC applications. The default MVC application has the necessary providers setup so that you can have a more flexible Membership system, but if you just want a single username and password, then this will help you.&lt;div&gt;&lt;br /&gt;&lt;div&gt;In your web.config change the Authentication section to the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="Forms"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;forms&lt;/span&gt; &lt;span class="attr"&gt;loginUrl&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Account/LogOn"&lt;/span&gt; &lt;span class="attr"&gt;timeout&lt;/span&gt;&lt;span class="kwrd"&gt;="2880"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;credentials&lt;/span&gt; &lt;span class="attr"&gt;passwordFormat&lt;/span&gt;&lt;span class="kwrd"&gt;="Clear"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;user&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="test"&lt;/span&gt; &lt;span class="attr"&gt;password&lt;/span&gt;&lt;span class="kwrd"&gt;="test"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;credentials&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;forms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then in the AccountModel.cs file, find the method ValidateUser and change the code to the following:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; ValidateUser(&lt;span class="kwrd"&gt;string&lt;/span&gt; userName, &lt;span class="kwrd"&gt;string&lt;/span&gt; password)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (String.IsNullOrEmpty(userName)) &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ArgumentException(&lt;span class="str"&gt;"Value cannot be null or empty."&lt;/span&gt;, &lt;span class="str"&gt;"userName"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (String.IsNullOrEmpty(password)) &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; ArgumentException(&lt;span class="str"&gt;"Value cannot be null or empty."&lt;/span&gt;, &lt;span class="str"&gt;"password"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; FormsAuthentication.Authenticate(userName, password);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The default setup should now work without using the provider. &lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-5014995903958216594?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-22T02:03:36.280-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2010/02/aspnet-mvc-simple-authentication.html</feedburner:origLink></item><item><title>Howto: Cisco VPN Client on Windows 7 64-bit - Walkthrough</title><link>http://feedproxy.google.com/~r/benpowell/~3/jwFcgGlNzCQ/howto-cisco-vpn-client-on-windows-7-64.html</link><category>technology</category><category>Cisco VPN Client</category><category>Windows 7</category><category>Howto</category><category>Guide</category><category>Microsoft</category><category>Windows XP Mode</category><category>Virtual PC</category><author>noreply@blogger.com (Ben)</author><pubDate>Fri, 19 Feb 2010 07:58:59 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-8756797197848212918</guid><description>Cisco haven't released a 64-bit VPN client, and are very unlikely to do so. They are forcing people to move away from IPSEC, and in all their wisdom, will only support 64-bit machines using the Anyconnect client, which a) doesn't support IPSEC and b) has an implied cost per licence. In essence, they feel they can force companies to invest in new hardware if more and more people get 64-bit client machines.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, Cisco haven't considered those who use Windows Vista and Windows 7 64-bit, but have no way to force the companies that they work with to upgrade their hardware (and pay out lots of money to do so). Hence, many people have been left stranded and have resorted to third parties such as NCP and Shrew who offer paid and free VPN clients for 64-bit machines.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Today, I have finally figured out a work around that still uses the Cisco VPN Client (v5) and no extra third party software. I thought I would share the technique.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The trick is to use &lt;a href="http://www.microsoft.com/windows/virtual-pc/download.aspx"&gt;Windows XP Mode&lt;/a&gt; which is a feature that is limited to Ultimate, Professional and Premium versions of Windows 7. You still have to &lt;a href="http://www.microsoft.com/windows/virtual-pc/download.aspx"&gt;download the feature from Microsoft&lt;/a&gt;, but after installing you'll have a virtual Windows XP installation running under Windows 7. Your machine also needs to support Virtualisation Technology. Microsoft offers &lt;a href="http://go.microsoft.com/fwlink/?LinkId=163321"&gt;a tool to check this support is available&lt;/a&gt;. You may need to flick the switch in your BIOS to enable it (I had to do this on my Dell Precision as it was disabled by default).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First some terminology that will help. I will refer to the &lt;b&gt;HOST &lt;/b&gt;as the machine that is hosting the virtual system (in my case this is Windows 7 Ultimate). The &lt;b&gt;GUEST &lt;/b&gt;is the Windows XP Mode installation.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Once you have downloaded Windows XP Mode from Microsoft and followed the installation instructions, you must then install the second download (see Microsoft download page). At the end of this process, the new Windows XP Mode virtual machine should start up. The next steps are to install some anti-virus software and install the Cisco VPN client in the guest virtual machine. Copy across any Cisco VPN profile (.pcf) files you might need. Your HOST's disk partitions should automatically be shared to allow you to copy files between the HOST and the GUEST.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now comes a little configuration. Our aim is to share the active VPN connection on the GUEST with the HOST. The routing will be doing a little loop through the GUEST, then tunneled through the GUEST VPN (then virtually back through the HOST and out via your router to the internet via that VPN).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Make sure you can access the internet on the GUEST and then try a VPN connection using the Cisco VPN client. If that all works, &lt;b&gt;disable the windows firewall&lt;/b&gt; (&lt;b&gt;Control Panel&lt;/b&gt; -&gt; &lt;b&gt;Windows Firewall&lt;/b&gt;)on the GUEST and continue onto the next step.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Shut down the GUEST. Open up &lt;b&gt;Windows Virtual PC&lt;/b&gt; - &lt;b&gt;Manage virtual machines&lt;/b&gt; from the start menu. Undert he Settings for that machine, switch the &lt;b&gt;Networking&lt;/b&gt; -&gt; &lt;b&gt;Adapter 1&lt;/b&gt; to your network card rather than &lt;b&gt;Shared Networking (NAT)&lt;/b&gt; or &lt;b&gt;Internal Network&lt;/b&gt;. N.B. NAT might still work, but I haven't tested it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we need to share the GUEST VPN connection. We will enable Internet Connection Sharing on the VPN Connection in the GUEST. Go to &lt;b&gt;Control Panel&lt;/b&gt; -&gt; &lt;b&gt;Network Connections&lt;/b&gt; (switch to &lt;b&gt;Classic View&lt;/b&gt; if you can't see that) and you will most likely see &lt;b&gt;Local Area Connection 2&lt;/b&gt;, &lt;b&gt;Cisco Systems VPN Adapter&lt;/b&gt;. Feel free to rename to connection to &lt;b&gt;Cisco VPN Connection&lt;/b&gt;. Right click on the connection and click &lt;b&gt;Properties&lt;/b&gt;. Click on the &lt;b&gt;Advanced&lt;/b&gt; tab and make sure that the &lt;b&gt;Allow other network users to connect through this computer's internet connection&lt;/b&gt; is ticked, as well as the other checkbox below it (not essential). You will receive a long worded warning. Click to continue and accept the change. The warning is simply that Internet Connection Sharing (ICS) will alter your IP Address to the default of 192.168.0.1, which we will be changing in a minute anyway.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we need to &lt;a href="http://portforward.com/networking/static-xp.htm"&gt;setup some static IP addresses&lt;/a&gt; on both the GUEST and &lt;a href="http://portforward.com/networking/static-win7.htm"&gt;HOST&lt;/a&gt;. Usually your router will be giving out IP addresses using DHCP, but we don't want that because we need to add a static route in a minute. If you can exclude a portion of your network IP range to static addressing. Most modern routers allow you to set the &lt;a href="http://www.portforward.com/networking/dhcp.htm"&gt;DHCP&lt;/a&gt; address range. I often exclude the first 50 IP addresses to be safe.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now select the GUESTs main connection &lt;b&gt;Local Area Connection&lt;/b&gt; and right click and select &lt;b&gt;Properties&lt;/b&gt;. Scroll down on the items and select &lt;b&gt;Internet Protocol (TCP/IP)&lt;/b&gt;.  Click on the &lt;b&gt;Properties &lt;/b&gt;button. You need to know the values to put in here. The easiest way to do this is to find out the IP address you have now on the HOST. The easiest way to do this is to open a command window (&lt;b&gt;Start &lt;/b&gt;-&gt; &lt;b&gt;Search Programs&lt;/b&gt; -&gt; Type "&lt;b&gt;cmd.exe&lt;/b&gt;" and click to select the program). Type at the command prompt "&lt;b&gt;ipconfig /all&lt;/b&gt;". You'll see your current &lt;b&gt;IP address&lt;/b&gt;, &lt;b&gt;gateway &lt;/b&gt;and &lt;b&gt;DNS &lt;/b&gt;settings. You'll need all of these, so make a note of them.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Switch back to the GUEST and enter in the IP address you want. e.g. 192.168.1.31, the network mask of 255.255.255.0 and the gateway IP address you just wrote down. Try the internet connection and VPN again. They should still work. Your GUEST is now ready to share its VPN connection.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now we need the HOST to know to route through the GUEST for the VPN connection. To do this, we will setup another static IP address for the HOST. Follow the same process as on the GUEST to set the IP address. E.g. 192.168.1.30. Note that in Windows 7, you'll find the Network connections in a slightly different place. You'll need &lt;b&gt;Control Panel&lt;/b&gt; -&gt; (View By -&gt; Small Icons) -&gt; &lt;b&gt;Network and Sharing Centre&lt;/b&gt; (oooh) -&gt; &lt;b&gt;Change Adapter Settings&lt;/b&gt; (left hand side) and right click on &lt;b&gt;Local Area Connection&lt;/b&gt;. Scroll down the items to &lt;b&gt;Internet Protocol version 4 (TCP/IPv4)&lt;/b&gt; and select it, then click &lt;b&gt;Properties&lt;/b&gt;. The resulting dialog box is more or less the same as Windows XP.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now lets check we can ping the GUEST from the HOST. They should now both be on the same subnet. With the command window that is still open on the HOST, type "&lt;b&gt;ping 192.168.1.31&lt;/b&gt;"&lt;b&gt; &lt;/b&gt;(or your GUEST IP address). &lt;b&gt;If you have Windows Firewall enabled on the GUEST, this WON'T work!&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, we need to add the route. We want to add a persistent route from your HOST through your GUEST, for those routes that the VPN connections support. Usually, these routes fall under certain restricted ranges (the 192.168 range is one of these). If your VPN IP address range is a 192.168 range, then you'll need some extra tweaking). usually the ranges will be in the 10.0.x.x or 172.30.x.x ranges. Mine falls under the 172.30.x.x range.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Using the already open command window I enter the following to add my static (persistent -p) route:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;route -p add 172.30.1.0 mask 255.255.255.0 192.168.1.6&lt;/b&gt;1&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It should say &lt;b&gt;OK!&lt;/b&gt; Then you can use &lt;b&gt;route print&lt;/b&gt; to see the new route in the routing table. If you screwed up and need to delete the route, type &lt;b&gt;route delete 172.30.1.0&lt;/b&gt; (i.e. your target range).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On the GUEST machine, with the VPN connected, ping one of the machines connected to the VPN, i.e. &lt;b&gt;ping myserver&lt;/b&gt;. Notice the IP address to which this corresponds to. Move over to the HOST and ping that IP address (you can't ping it by name, because the DNS requests aren't going via the VPN). If you can see a response from the server, you are now accessing your VPN connection via the HOST. Congratulations, the hardest part is now over.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;To make it easier to connect, Microsoft has built in some cool, application shortcuts into Windows XP Mode. On the HOST follow &lt;b&gt;All Programs&lt;/b&gt; -&gt; &lt;b&gt;Windows Virtual PC&lt;/b&gt; -&gt; &lt;b&gt;Windows XP Mode Applications&lt;/b&gt; -&gt; &lt;b&gt;Cisco Systems VPN Client&lt;/b&gt; -&gt; &lt;b&gt;VPN Client (Windows XP Mode)&lt;/b&gt;. right click on that last application and &lt;b&gt;Pin to Start Menu&lt;/b&gt;. You'll now have a&lt;b&gt; VPN Client (Windows XP Mode)&lt;/b&gt; in your start menu.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Close down the guest (full shutdown). Now double click the start menu item, and you'll see the usual Cisco VPN client, running virtually, but transparently in Windows 7!&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-8756797197848212918?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-19T07:58:59.082-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">7</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2010/02/howto-cisco-vpn-client-on-windows-7-64.html</feedburner:origLink></item><item><title>Support Cancer Research UK with a great wedding idea</title><link>http://feedproxy.google.com/~r/benpowell/~3/T5gxROvrg1Q/support-cancer-research-uk-with-great.html</link><category>UK</category><category>wedding</category><category>charity</category><category>research</category><category>cancer</category><category>marriage</category><author>noreply@blogger.com (Ben)</author><pubDate>Thu, 11 Feb 2010 10:28:26 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-9127220709798707645</guid><description>If you are getting married you might be considering wedding favours. Wedding favors are small gifts given as a gesture of appreciation or gratitude to guests from the bride and groom during a wedding ceremony or a wedding reception.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Traditional wedding favours were small trinket boxes containing sugar cubes or delicate confections, which symbolize wealth and royalty. Today they can be almost anything that the bride and groom wish.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.awin1.com/awclick.php?mid=2783&amp;amp;id=102150"&gt;Cancer Research UK&lt;/a&gt; provides the guest with a donation card, made by the wedding couple. The gift therefore in the spirit of giving from both parties. The minimum donation can be anything, but £1 per guest is the suggested minimum and you can select from a number of&lt;a href="http://www.awin1.com/awclick.php?mid=2783&amp;amp;id=102150"&gt; Cancer Research UK pin badges&lt;/a&gt; as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you are getting married and you want to consider a nice touch with a spirit of charity then this is a great idea.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.awin1.com/awclick.php?mid=2783&amp;amp;id=102150"&gt;Find out more now&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-9127220709798707645?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-11T10:28:26.501-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2010/02/support-cancer-research-uk-with-great.html</feedburner:origLink></item><item><title>Odd behavior for double quote key on US keyboard</title><link>http://feedproxy.google.com/~r/benpowell/~3/7BSJ3WDGskk/odd-behavior-for-double-quote-key-on-us.html</link><category>keyboard</category><category>technology</category><category>Windows 7</category><category>Microsoft</category><author>noreply@blogger.com (Ben)</author><pubDate>Wed, 03 Feb 2010 10:30:26 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-1853291770227781295</guid><description>I've recently invested in a new &lt;a href="http://www.dell.com/us/en/business/desktops/workstation-precision-t5500/pd.aspx?refid=workstation-precision-t5500&amp;amp;cs=04&amp;amp;s=bsd"&gt;Dell Precision T5500&lt;/a&gt; workstation. I'm really happy with it, apart from the fact that:&lt;div&gt;&lt;ol&gt;&lt;li&gt;The fans are really loud and because the fan noise isn't constant, it really gets on my nerves. I'll need to find some kind of cupboard to stick it in out of the way.&lt;/li&gt;&lt;li&gt;I wanted a UK/Ireland keyboard and the Dell representative changed the order in between the quote and final order to a US/Europe keyboard. I'm constantly typing the wrong characters!&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;Anyway, I can cope with the different keyboard layout, but what was really driving me nuts, was the way the keyboard was handling quotation marks. It appeared to use "&lt;a href="http://www.fonts.com/AboutFonts/Articles/fyti/Smartquotes.htm"&gt;smart quotes&lt;/a&gt;", which means that when you hit the quote key, it waits for the next key before it decides which quotation mark it will use. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The problem with this (especially as a programmer), is I just want the bog standard basic "dumb" double quotation mark, and quite often I go back and add quotation marks around text, rather than typing them inline. The only solution I could find until today was to double type the quotation mark and then delete the second one. Highly annoying.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This isn't just a Word feature, but across the board. I'm not sure if it is anything to do with Windows 7 specifically, but I found that if I changed the keyboard via (Control Panel -&gt; Region and Language -&gt; Keyboards and Languages) from "United States - International" to "United States - US", the problem went away.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;i hope this helps others who are experiencing an unexpected odd behavior with double and single quotation marks on their keyboards!&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-1853291770227781295?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-03T10:30:26.638-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2010/02/odd-behavior-for-double-quote-key-on-us.html</feedburner:origLink></item><item><title>Facebook shares private information via your friends</title><link>http://feedproxy.google.com/~r/benpowell/~3/Olngzo_9w-M/facebook-shares-private-information-via.html</link><category>technology</category><category>facebook</category><category>photos</category><category>privacy</category><category>hack</category><category>private</category><author>noreply@blogger.com (Ben)</author><pubDate>Wed, 16 Dec 2009 02:48:33 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-2529526021831002133</guid><description>&lt;div&gt;This week &lt;a href="http://blog.facebook.com/blog.php?post=197943902130"&gt;Facebook made sweeping changes to its privacy&lt;/a&gt; and &lt;a href="http://www.eff.org/deeplinks/2009/12/facebooks-new-privacy-changes-good-bad-and-ugly"&gt;upset a lot of people&lt;/a&gt;. Users were greeted with &lt;a href="http://www.facebook.com/photo.php?pid=4291127&amp;amp;id=504598293&amp;amp;ref=mf"&gt;an obligatory pop-up&lt;/a&gt; which forced them to set their preferred privacy but appeared to default to a "show everyone everything" setting. Many users just clicked OK and carried on their merry way.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Jason Calacanis make a great post in his newsletter this week, and asked whether &lt;a href="http://calacanis.com/2009/12/13/is-facebook-unethical-clueless-or-unlucky/"&gt;Facebook was unethical, clueless or unlucky&lt;/a&gt;. This however is half the story. What nobody seems to have realised yet, is that Facebook have ended up sharing your private information, via your friends' lack of privacy control.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We still have a fair amount of control over our own privacy through Facebook's privacy controls. However, Facebook have now decided (in all their wisdom) to allow people to publish their wall posts. This means that Facebook have created a back door, around your privacy settings, and now, anyone can view your status updates, pictures and anything else you post, when your friends "like" or "comment" on your content in Facebook.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Let's take Jason Calacanis as an example here. Jason has allowed Facebook to show &lt;a href="http://www.facebook.com/jcalacanis?v=wall&amp;amp;ref=search"&gt;his wall&lt;/a&gt; publicly. I presume he'll change this fairly quickly, so here's a screenshot of what I can see at the moment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9pCbQCJMujA/Syihm49JgDI/AAAAAAAAAGQ/ykLKuaoq934/s1600-h/screen_01.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 288px;" src="http://3.bp.blogspot.com/_9pCbQCJMujA/Syihm49JgDI/AAAAAAAAAGQ/ykLKuaoq934/s400/screen_01.jpg" border="0" alt="" id="BLOGGER_PHOTO_ID_5415756241408983090" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Scanning through his wall, you'll see all the things he has commented on, liked or also where friends have liked or commented on content of his.  This includes a picture of him holding his new baby "&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_9pCbQCJMujA/Syih9_MJ5TI/AAAAAAAAAGY/UUWWm1aVRng/s1600-h/screen_02.jpg"&gt;London Athena Calacanis, born December 8th 2009 at 7 pounds 11 ounces&lt;/a&gt;". It also includes &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9pCbQCJMujA/Syi6oxgH67I/AAAAAAAAAG4/hzIJz0a38vA/s1600-h/screen_03.jpg"&gt;a comment on a photos posted by Randi Zuckerberg (Mark Zuckerberg's sister)&lt;/a&gt;, specifically a comment on a private photo of &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9pCbQCJMujA/SyiiXtE0cWI/AAAAAAAAAGo/RUt1qZg8mRg/s1600-h/screen_04.jpg"&gt;Randi and Demi Moore&lt;/a&gt;. Also included are seemingly private family Halloween photos and various other people's photos (including &lt;a href="http://leoville.com/"&gt;Leo Laporte&lt;/a&gt;), and their status updates and comments.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However the problem doesn't stop there. Facebook has always employed a security through obscurity methodology when it came to photos. That meant that you could easily "share" photos with people that weren't on Facebook, but they needed to know the exact link. You might have also noticed that if someone shared one photo, you also had the link to the rest of the photos in that album. &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9pCbQCJMujA/SyiiX1IzLWI/AAAAAAAAAGw/RYWqgsIUVIc/s1600-h/screen_05.jpg"&gt;Randi Zuckerberg's photo album&lt;/a&gt; for instance is linked in the "Back to Album" link. No security is employed here, thus any user, as long as they have the link to one picture, has access to all of the photos in that album. Now that is public, and not just limited to your friends via other public walls of your friends.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can prevent friends from interacting with your content in the future, including preventing friends from posting on your wall, and commenting on photos. You can set "Posts by Friends" and "Comments on posts" to yourself only, but this rather destroys the basic ethos of Facebook. Worst of all, the status updates are a static archive, so if you prevent friends from commenting on your photos today, any previous "comments and likes" will still remain in their Wall history.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, how can you stop this? The basic answer is that you can't. You can protect all of your content through the privacy controls, but you can't prevent your friends from sharing their walls as well. If just one of your friends has shared their wall, then potentially your private content is left open to the world, through what I think is the worst, most public back-door-fuck-up that Facebook has made to date.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-2529526021831002133?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-16T02:48:33.496-08:00</app:edited><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_9pCbQCJMujA/Syihm49JgDI/AAAAAAAAAGQ/ykLKuaoq934/s72-c/screen_01.jpg" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/12/facebook-shares-private-information-via.html</feedburner:origLink></item><item><title>Google Chrome OS is coming</title><link>http://feedproxy.google.com/~r/benpowell/~3/OjO0svLh0zU/google-chrome-os-is-coming.html</link><category>Google Chrome OS</category><category>Google</category><category>Apple</category><category>Microsoft</category><author>noreply@blogger.com (Ben)</author><pubDate>Tue, 24 Nov 2009 23:35:49 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-1480038189780395511</guid><description>According to TechCrunch, today is &lt;a href="http://www.techcrunch.com/2009/11/17/google-chrome-os-launch/"&gt;Google Chrome OS day in Mountain View&lt;/a&gt;, California. Technical details, demos and an overview of what's to come will be presented.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The new operating system targets PCs and will focus on netbooks. &lt;a href="http://googleblog.blogspot.com/2009/07/introducing-google-chrome-os.html"&gt;It is open source and Google plan to launch it to customers in the second half of 2010&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I think we will see a paradigm shift in this operating system, or that is at least my hope. The world has moved on from an operating system that needs to install programs, over to&lt;a href="http://www.youtube.com/watch?v=0QRO3gKj3qw"&gt; a browser based world&lt;/a&gt; where everything is on demand and in the cloud (however safe or unsafe that may be).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Whilst there will always be some need for some users to install software (i.e. to develop software), the day-to-day usage of email, web browsing, sharing documents and communications need no longer be installable software. Google's existing applications prove this, although their current pricing model would seem to be impossible to maintain long term (i.e. free).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Microsoft on the other hand is hedging all their bets on &lt;a href="http://www.amazon.com/gp/product/B002DHLUWK?ie=UTF8&amp;amp;tag=juntocouk-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B002DHLUWK"&gt;Windows 7&lt;/a&gt;, and although it appears to be a rock solid OS, I have my doubts as to how many more versions of Windows we will see in this kind of format. Apple too, who thrive on a closed marketplace of OS and hardware, could be thrown a huge curve ball if this new concept takes off. Ubuntu and other Linux clones are essentially based on the same concepts as the commercial OS's too, so where does that leave them?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'm still puzzled as to how Google are going to get people to switch to Chrome OS. The simple and free part will appeal to those that are not computer literate, and just want to access their email, browse the web, watch YouTube videos and chat online. However, those people are not going to understand how to switch their OS, or even know what an operating system is. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Android appears to be the "model" that Google will try to follow; that is to say, installed by the vendor, but in a world where large PC manufacturer's such as Dell and HP have tied themselves to commercial operating system manufacturers (namely Microsoft), how will Google persuade the PC and netbook vendors to offer a free OS, on which they gain zero revenue?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Time will tell. What are your thoughts on a new free operating system in the marketplace? How does simple and free sound to you?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;UPDATE: The &lt;a href="http://www.youtube.com/watch?v=ANMrzw7JFzA&amp;amp;feature=channel"&gt;presentation&lt;/a&gt; has been made available on &lt;a href="http://www.youtube.com/user/googlechrome"&gt;Google Chrome's Youtube channel&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;UPDATE: 67TZPNXF539A&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-1480038189780395511?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-24T23:35:49.758-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/11/google-chrome-os-is-coming.html</feedburner:origLink></item><item><title>EU has its knickers in a twist over Microsoft Windows 7</title><link>http://feedproxy.google.com/~r/benpowell/~3/VWV4fyqSrYY/eu-has-its-knickers-in-twist-over.html</link><category>technology</category><category>EU</category><category>Microsoft</category><category>politics</category><category>business</category><author>noreply@blogger.com (Ben)</author><pubDate>Thu, 25 Jun 2009 12:08:23 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-8380601602861864911</guid><description>&lt;div&gt;Microsoft has decided that the &lt;a href="http://www.guardian.co.uk/technology/blog/2009/jun/25/windows7-uk-prices"&gt;forthcoming release of Windows 7&lt;/a&gt; will exclude Internet Explorer 8 in the EU, to avoid any further anti-trust fines from the European Commission. Now the&lt;a href="http://www.nytimes.com/2009/06/13/technology/companies/13euro.html?_r=1&amp;amp;ref=world"&gt; EU have their knickers in a twist&lt;/a&gt; because they told Microsoft to stop including Internet Explorer in Windows, but actually that wasn't what they actually wanted. They really wanted Microsoft to offer alternative browsers to customers when the customer installs Windows 7 for the first time. Therein lies a rather short sightedness from the EU, that has genuinely left them looking rather stupid.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Microsoft is unable to pre-install other companies software into the operating system. If they did, that too would be an anti-trust case waiting to happen. Who gets included, who doesn't? Furthermore, can you imagine the licensing implications, the tie in for language support. The list goes on. It is simply never going to happen, and nor should it. PC manufacturers have the responsibility to offer the alternative, not Microsoft.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now the EU is left with egg on its face (yet again), and Microsoft will be giggling like a bunch of school boys. The EU got what it asked for. Case closed. No company should be forced to promote a competitors’ product. Now, how about we take a look at Apple and Safari, oh wise ones in Brussels?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-8380601602861864911?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-25T12:08:23.897-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/06/eu-has-its-knickers-in-twist-over.html</feedburner:origLink></item><item><title>Taking a bite out of Apple</title><link>http://feedproxy.google.com/~r/benpowell/~3/JddE_jH5CLk/taking-bite-out-of-apple.html</link><category>technology</category><category>O2</category><category>music</category><category>Apple</category><category>itunes</category><author>noreply@blogger.com (Ben)</author><pubDate>Wed, 10 Jun 2009 22:57:25 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-3415706968309250044</guid><description>Apple are in the news again today. The first story that caught my eye was that &lt;a href="http://www.timesonline.co.uk/tol/travel/business/article6461347.ece"&gt;O2 is to charge an extra monthly fee for iPhone tethering&lt;/a&gt;. It plans to charge a whopping £15 per month when the new iPhone 3G S models come out, and the base contract cost will also increase for the new model. At first one has a tendency to blame O2, but if you really think about it, the bad guy here is Apple. Apple has mastered a very non-consumer-friendly "exclusivity deal" with O2, and O2 had to bid a lot of money to get the deal. This cost is being passed on to O2 customers.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I actually think that what Apple has done with O2 should be made illegal across the EU and that they should be fined. The French competition agency ruled the &lt;a href="http://www.engadget.com/2008/12/17/oranges-iphone-exclusive-ruled-illegal-in-france/"&gt;Orange-Apple exclusive deal anti-competitive and illegal&lt;/a&gt; back in 2008, and &lt;a href="http://business.timesonline.co.uk/tol/business/industry_sectors/telecoms/article2917665.ece"&gt;the Germans made a similar decision in 2007&lt;/a&gt;. The EU needs to stamp out this practice, and soon.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The second piece of news that I noticed this morning, was a story about &lt;a href="http://www.timesonline.co.uk/tol/news/uk/crime/article6471432.ece"&gt;a criminal gang that published their own songs, but then bought them via iTunes (and Amazon) with stolen credit cards&lt;/a&gt;. Notably, the gang made $300,000 from the royalties on $750,000 of sales.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you do the math, that's a 40%  return for the gang. The real crime is that Amazon and Apple earn the other 60%. &lt;a href="http://www.wired.com/listening_post/2008/03/apple-apparentl/"&gt;Previous estimates have suggested that Apple's iTunes profit margin is around 30%&lt;/a&gt;. Have I missed something here, or are these two figures vastly different?&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So in summary, the British authorities do not see a problem with Apple and a mobile operator openly colluding to restrict competition and fix prices and Apple are taking a rather nice cut on iTunes sales, passing 40% to the producers.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-3415706968309250044?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-10T22:57:25.333-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/06/taking-bite-out-of-apple.html</feedburner:origLink></item><item><title>Dirty workaround for iPhone RDP and Cisco VPN problems</title><link>http://feedproxy.google.com/~r/benpowell/~3/uIkCImv05-8/dirty-workaround-for-iphone-rdp-and.html</link><category>VPN</category><category>IPSEC</category><category>technology</category><category>RDP</category><category>Cisco</category><author>noreply@blogger.com (Ben)</author><pubDate>Mon, 08 Jun 2009 17:30:22 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-8119070093054396960</guid><description>&lt;div&gt;I've been trying to setup my iPhone VPN using the built-in iPhone Cisco VPN IPSEC client. The main reason being is that there is now an Remote Desktop (RDP) client available in the Apple App Store (&lt;a href="http://mochasoft.dk/iphone_rdp.htm"&gt;RDP Lite&lt;/a&gt;) for free and I have servers which require a Cisco VPN client.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, the iPhone only seems to support &lt;a href="http://manuals.info.apple.com/en_US/Enterprise_Deployment_Guide.pdf"&gt;certain&lt;/a&gt; &lt;a href="http://www.cisco.com/en/US/docs/security/vpn_client/cisco_vpn_client/iPhone/2.0/connectivity/guide/iphone.html#wp39406"&gt;Cisco VPN configs&lt;/a&gt;. I have a wide range of VPNs I can test with and &lt;a href="http://discussions.apple.com/thread.jspa?messageID=8308641"&gt;none of them would work&lt;/a&gt;. The suggested Apple/Cisco solution is to configure the Cisco hardware to work with the iPhone, but in my book that's just like drilling out the square hole to fit the round peg.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, I thought of a way around this, which is a dirty, nasty and XXX rated. :-) &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;You can&lt;a href="http://mochasoft.dk/iphone_rdp_xp.htm"&gt; RDP from the iPhone to your PC&lt;/a&gt; if you are on the same LAN. Then, via that RDP session, you can then use your PC's Cisco VPN client to connect to the required remote network and then RDP to the remote server from your PC instead. Whhheeewww....&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you want to connect to your PC from outside your home network then you can &lt;a href="http://www.onecomputerguy.com/networking/xp_vpn_server.htm"&gt;setup your Windows XP box to accept incoming PPTP VPN connections&lt;/a&gt; (which the iPhone seems to connect to quite happily) and &lt;a href="http://www.portforward.com/"&gt;configure your router to forward the connection&lt;/a&gt; through.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It's not pretty, and probably slow, but theoretically it should work...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-8119070093054396960?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-08T17:30:22.525-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/06/dirty-workaround-for-iphone-rdp-and.html</feedburner:origLink></item><item><title>Parliament Hotel - Better than expensing a second home?</title><link>http://feedproxy.google.com/~r/benpowell/~3/lOZUIykMPLU/parliament-hotel-better-than-expensing.html</link><category>scandal</category><category>hotel</category><category>UK</category><category>expenses</category><category>solution</category><category>government</category><author>noreply@blogger.com (Ben)</author><pubDate>Fri, 08 May 2009 05:15:41 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-4886267074484841013</guid><description>With all the fuss going on at the moment over minister's expense claims in the UK, I thought that a much better solution. I think that the state should buy a hotel in Westminster and ministers would stay there whilst conducting their parliamentary business in London.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The underlying problem here is that the vast majority of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;MPs&lt;/span&gt; represent constituencies that are geographically distant from London, and as a result that are required to spend a great deal of time in London to conduct the day-to-day business of being an MP.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The second home allows minister the flexibility of somewhere to stay, rather than paying for a hotel, whilst in London. However, this system has been systematically abused.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If the state was to buy a hotel, many of the basic expenses that are currently individually claimed for by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;MPs&lt;/span&gt; for their second homes (heating, electricity, telephone, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;internet&lt;/span&gt;, cleaning) would all be provided by Parliament hotel on a fixed basis that the tax payer pays for, but with the knowledge that these expenses are fixed. Gone are the expenses for a new boiler, or £600 hanging baskets.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;It would basically be a big halls of residence, and for other civil servants, such as the police, ambulance and fire fighters of London, this is a quite common scenario.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What do you think? Good idea or stupid idea?&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-4886267074484841013?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-08T05:15:41.126-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/05/parliament-hotel-better-than-expensing.html</feedburner:origLink></item><item><title>How to bring down the system in 10 easy steps</title><link>http://feedproxy.google.com/~r/benpowell/~3/NxL8SDwNgIs/how-to-bring-down-system-in-10-easy.html</link><category>credit</category><category>crisis</category><category>change</category><category>government</category><category>establishment</category><category>economy</category><author>noreply@blogger.com (Ben)</author><pubDate>Tue, 07 Apr 2009 02:03:02 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-5535106776405750349</guid><description>&lt;div&gt;&lt;ol&gt;&lt;li&gt;Wait for the government bailouts to invoke &lt;a href="http://www.telegraph.co.uk/finance/personalfinance/investing/3189539/Bank-bail-out-Inflation-and-stupidity-are-here-to-stay.html"&gt;inflationary consequences&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for &lt;a href="http://www.telegraph.co.uk/finance/financetopics/financialcrisis/3166706/Financial-crisis-Rising-unemployment-on-the-way-as-recession-looms.html"&gt;unemployment to rise sharply&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the &lt;a href="http://business.timesonline.co.uk/tol/business/industry_sectors/construction_and_property/article3406268.ece"&gt;housing market to completely collapse&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the &lt;a href="http://www.telegraph.co.uk/finance/personalfinance/borrowing/mortgages/5018160/2m-homeowners-to-fall-into-negative-equity-FSA-warns.html"&gt;home owners to be stuck in negative equitity&lt;/a&gt; and &lt;a href="http://www.telegraph.co.uk/finance/personalfinance/borrowing/mortgages/4734269/Repossessions-set-to-soar-during-2009.html"&gt;lose their homes&lt;/a&gt; when they lose their jobs&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the &lt;a href="http://news.bbc.co.uk/1/hi/uk/7975597.stm"&gt;protests and demonstrations by the hippies and anarchists&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the &lt;a href="http://www.guardian.co.uk/world/2009/apr/06/g20-protest-police-assault"&gt;police brutalitity&lt;/a&gt; to get so bad that the media actually reports it&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the media to have their &lt;a href="http://www.bjp-online.com/public/showPage.html?page=836646"&gt;key rights&lt;/a&gt; (as the &lt;a href="http://en.wikipedia.org/wiki/Fourth_Estate"&gt;fourth estate&lt;/a&gt;) to be removed by the establishment&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the establishment to revoke your &lt;a href="http://www.amnesty-eu.org/static/html/pressrelease.asp?cfid=12&amp;amp;id=257&amp;amp;cat=4&amp;amp;l=1"&gt;human rights&lt;/a&gt;, apply marshal law and implement a policed state&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wait for the protests, widespread strikes and demonstrations by the general public including the middle classes&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Act and collectively stop paying all debts.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;The past 9 months have demonstrated that the system is fallable. The interconnected governments, economies and social constructs are dependent on the free flow of credit. This is why we have seen the billions of dollars pumped into the financial system, even though in the long term the result will be massive inflation and an unimaginable burden of debt that will be passed on to the next generations.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The system is like a river. Every couple of years the public get a chance to slightly alter the course of the river in "democratic" elections, aimed to give us the feeling of choice and a voice. The end result, whoever we choose, is that the water in the river ends up in the sea. Action number 10, cuts off the water, and without water, the river runs dry.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Bringing down the system is risky. The result is most likely to be massive upheaval. Your comfortable lives will melt away, replaced with short to medium term pain; no jobs, starvation, violence and aggression. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, in the long term, people will adapt, and a new system will takes the place of the old. Perhaps better, perhaps the same, perhaps worse, but like a phoenix, it will be stronger and less infallable than the one before.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What might scare you more is that the first 9 steps are passive, and many of them are, or have already occurred. It is only the very last step, that requires your collective and active participation to complete the process.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I think I have outlined how the system has its very own built in self destruct button. But are you prepared to press it? I'm not sure I would.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-5535106776405750349?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-07T02:03:02.702-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/04/how-to-bring-down-system-in-10-easy.html</feedburner:origLink></item><item><title>Implementing RPX without ASP.NET Membership</title><link>http://feedproxy.google.com/~r/benpowell/~3/KtD9STyxC9s/implementing-rpx-without-aspnet.html</link><category>technology</category><category>ASP.NET</category><category>Membership</category><category>RpxNow</category><author>noreply@blogger.com (Ben)</author><pubDate>Tue, 08 Sep 2009 04:46:58 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-3579043136704403240</guid><description>&lt;div&gt;I've almost completed my test of RPX with ASP.NET webforms. My first pass attempted to mix the ASP.NET Membership with RPX, and although I got it working, it felt like a fudge. I wrote a custom Membership Provider, and pushed the RPX identities through it, but somehow it just felt dirty. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In fact I've never liked the ASP.NET Membership model, and it has always bugged me. It forces you into a model of username over email address (where email addresses are always more memorable and unique)  and never seems to deliver a profesional finish. Now OpenID is here to stay, making registration and login so simple, the Membership model feels slightly wonky. It still has its place, especially in intranet applications with Windows / LDAP, but as an internet model it just sucks. Look at any of the big popular websites out there, and then imagine the CreateUserWizard. I know it can be customized, but hell, they could have made it just a little bit more snazzy.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Membership rant aside and to cut a long story short, I dropped the custom Membership Provider. I cut everything down to the bare minimum, and aimed to produce a skeleton website, that uses RPX as an authentication mechanism, and would be my base framework for any new sites I build.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I used two tables, the first stores our base Account information, and it's dead simple, containing only an AccountId and a Nickname. The second table is AccountIdentity and stores identities for each Account, and one Account can be associated to multiple identities. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Why multiple identities? Well, users often have more than one OpenID provider. They might have a Google Account and YahooID, they might also have a Myspace or a Facebook account. Any of these can be used as an OpenID, and the user might want to tie these all together into one Account with us, or not - the choice is theirs.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our AccountIdentity table stores all of the common information provided by the RXPAuthenticationDetails, delivered after a callback to the RPX Service. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In more detail - when a user clicks on the sign-in button, provided by the easy to use login controls RPX Now gives you to get started, you give RPX a Url on your website, to which the user will be redirected to after they have authorised your website with their OpenID provider. In this authentication stage you'll do a couple of things:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Check if the user is already logged in. If so, we are going to check the existing AccountIdentity table to see if this RPX Identity already exists for this user, and if not, we'll add it.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If the user is not logged in, we check the RXPAuthenticationDetails to see if a "LocalKey" was provided. If so, we've already mapped this RPX Identity to an existing user account. We need to load the appropriate account, check the identity does indeed match, and then log the user in.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Finally, if the user is not logged in, and no LocalKey was provided then this user is probably new. We should still check the existing AccountIdentity table to make sure the identity doesn't exist, and then we'll create a brand new account, and store the new associated identity.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;Then we use the Account.AccountId as the Forms Authentication ticket, and sign the user in. That's it, nothing more complicated.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So, what about Roles, and Profiles you ask? Well that's to come...&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-3579043136704403240?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-08T04:46:58.912-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/03/implementing-rpx-without-aspnet.html</feedburner:origLink></item><item><title>Why the Pirate Bay should win</title><link>http://feedproxy.google.com/~r/benpowell/~3/LpITh3RO4PY/why-pirate-bay-should-win.html</link><category>technology</category><category>music</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 01 Mar 2009 00:18:45 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-946469580546870735</guid><description>&lt;div&gt;I don't buy music anymore, yet I don't download either. I'm living in a historic music bubble, deliberately uninterested in any new music, yet enjoying what I already own.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The simple reason why I no longer buy music is that I refuse to support an industry that I feel is deliberately and persistently abusing its customer base.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Every forward thinking company that tries to do something interesting with music and technology is given the middle finger by the music cartel.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I feel sorry for the artists, but they choose to sign up with a bunch of greedy, immoral robbing bastards.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I really hope the Pirate Bay wins, not because they are right, but what they stand for. If they lose, consumers should vote with their cash, and boycott all music until the cartel crumbles.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;We all know that people are downloading copyrighted content via their torrent tracker, but we should put Google in the dock too, because you can find torrents through their search engine as well.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If Google had balls, they would say as much. I would love to see a statement of Google stating that fact. They would certainly win a lot of hearts and minds by doing so.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;"Do no evil", also implies "do some good" too.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-946469580546870735?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-01T00:18:45.256-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/03/why-pirate-bay-should-win.html</feedburner:origLink></item><item><title>RPX OpenID with ASP.NET Webforms and Membership Providers</title><link>http://feedproxy.google.com/~r/benpowell/~3/AuwKTW1ULkw/rpx-openid-with-aspnet-webforms-and.html</link><category>technology</category><category>ASP.NET</category><category>RpxNow</category><author>noreply@blogger.com (Ben)</author><pubDate>Tue, 08 Sep 2009 04:47:26 PDT</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-3081486070989705499</guid><description>&lt;div&gt;This evening I started playing around with &lt;a href="https://rpxnow.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;RPX&lt;/span&gt;&lt;/a&gt;, the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;OpenID&lt;/span&gt; consolidator from &lt;a href="http://www.janrain.com/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;JanRain&lt;/span&gt;&lt;/a&gt;. I hit a few hurdles along the way, and I thought I would share a little of those experiences with others trying out &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;RPX&lt;/span&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My first step was to download the &lt;a href="http://code.google.com/p/rpxlib/"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RXPLib&lt;/span&gt; from Google Code&lt;/a&gt;, which is a full &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;API&lt;/span&gt; wrapper for &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;RPX&lt;/span&gt;. It gives you all the method calls you'll need to work with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;RPX&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;API&lt;/span&gt;. It is built using the .NET 3.5 Framework, but it worked fine with my 2.0 web application.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The &lt;a href="https://rpxnow.com/docs#example_code"&gt;example code&lt;/a&gt; provided by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;RPXNow&lt;/span&gt;.com in &lt;a href="https://rpxnow.com/examples/Rpx.cs"&gt;C#&lt;/a&gt; isn't particularly helpful. It is basically a Windows Console application, which allows you to basically interact with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;API&lt;/span&gt;. N.B. It requires that you pass parameters to the application, so if you struggle to figure that out, view the project properties and edit the "Command Line Arguments" before you start to run the application in debug mode.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Step right past the console app, and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;login&lt;/span&gt; to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;RPXNow&lt;/span&gt;.com, with any &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;OpenID&lt;/span&gt; enabled account and create a website profile. Then use the template created for you, and plug that code straight into your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;login&lt;/span&gt; page of your new website project. Create a call back page to which the authorisation token will be returned to. Add this URL to the script in the place holder (e.g. http://localhost:3456/ReceiveToken.aspx).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Running the web application you'll get a simple "Sign In" link, which when clicked offers a number of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;OpenID&lt;/span&gt; providers to select. You need to select one, which will redirect you to that provider. Agreeing to the conditions of your provider, you &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;login&lt;/span&gt; and are passed back to your token receiving page.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is where you implement your tie in to your Membership Provider. It makes a lot of sense to implement a custom Membership Provider, and hook the user into that.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The key areas you want to consider when a user logs into your application using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;OpenID&lt;/span&gt; is:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;The user won't be using a password to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;login&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Does the email address provided by the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;OpenID&lt;/span&gt; provider already exist in your database?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Does the preferred user name passed back also exist?&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;Because the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;OpenID&lt;/span&gt; user doesn't need a password to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;login&lt;/span&gt; (although you can offer them one), the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;CreateUser&lt;/span&gt; method of your Membership provider will need to have a default password created for them. Ideally you create a random one and email it to them in their welcome email. This does two things. It allows them to continue logging in with their preferred &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;OpenID&lt;/span&gt;, or if they want to, log in with their user name and password.&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If the email address already exists in your database (and ideally email addresses would be unique in your provider), you are able to use the "Mapping" feature of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;RPX&lt;/span&gt;. Mappings lost me to start with, because they are not very well explained on the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;RPX&lt;/span&gt; Now website. Quite simply, it allows you to tie up your existing user, to an identity on &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;RPX&lt;/span&gt;. After authentication in your Token page, you can call the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_27"&gt;RPX&lt;/span&gt; service to map your local &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_28"&gt;UserId&lt;/span&gt; (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_29"&gt;CustomerId&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_30"&gt;AccountId&lt;/span&gt;, etc) to an identity in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_31"&gt;RPX&lt;/span&gt;. In this way, you can map one of your user accounts to multiple &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_32"&gt;RPX&lt;/span&gt; identities.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If the preferred user name returned by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_33"&gt;RPX&lt;/span&gt; already exists in your database, you'll obviously have to offer the user an alternative user name (unless you use email addresses as user names).&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In summary, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_34"&gt;RPX&lt;/span&gt; looks great, and is very simple to implement in a basic format. I'm sure I've only just scratched the surface in the few hours I've played around with it. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Notably, the basic version of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_35"&gt;RPX&lt;/span&gt; is free, but offers a limited subset of features compared to the premium accounts. One of the issues with the basic version is that your users won't log in to your website directly, but be transferred to https://youraccount.rpxnow.com. As a result, users may be put off as they are warned constantly about &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_36"&gt;phishing&lt;/span&gt; these days, and this looks like a blatant &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_37"&gt;phishing&lt;/span&gt; attempt. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Secondly, implementing &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_38"&gt;RPX&lt;/span&gt; means that you are putting all of your eggs into one basket. That's not to say that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_39"&gt;RPX&lt;/span&gt; is going to disappear, but it could. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;However, saying all of that, I think &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_40"&gt;RPX&lt;/span&gt; is a great idea. Having a single simple control that offers users a great selection of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_41"&gt;OpenID&lt;/span&gt; providers in a easy to understand format is what &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_42"&gt;OpenID&lt;/span&gt; needs at the moment.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I look forward to getting something more concrete together soon.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-3081486070989705499?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-08T04:47:26.744-07:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/02/rpx-openid-with-aspnet-webforms-and.html</feedburner:origLink></item><item><title>Paging and sorting in a .NetTiers custom stored procedure</title><link>http://feedproxy.google.com/~r/benpowell/~3/k5_Z3fbe7AE/paging-and-sorting-in-nettiers-custom.html</link><category>technology</category><author>noreply@blogger.com (Ben)</author><pubDate>Wed, 04 Feb 2009 08:54:48 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-4923109322277461116</guid><description>If you use &lt;a href="http://www.nettiers.com/"&gt;.NetTiers&lt;/a&gt; as an Application Framework, you'll have used custom stored procedures in cases where the generic Entity Service Find methods do not offer enough granularity. Specifically, if you have the need to join across database tables, you'll find that a custom stored procedure is certainly the way to go. However, one of the biggest challenges facing developers is how to develop custom stored procedures for .NetTiers that support paging and sorting.&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have struggled to get a stored procedure that would not just provide the paging and sorting we need, but also would work with .NetTiers so that the correct methods would be generated. So therefore I have put this together to help others. &lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;When .NetTiers generates the output code, it looks for &lt;a href="http://nettiers.com/DataLayer.ashx#Custom_Stored_Procedures:_16"&gt;custom stored procedures&lt;/a&gt;, based on a given format, and attempts to work out whether the SQL code is returning a list of known objects, or simply a dataset.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Searching, sorting and paging in combination are usually going to imply the use of dynamic SQL queries, but .NetTiers cannot determine the output from dynamically created queries by parsing the SQL code. Therefore, what you'll find, when you first attempt to create a custom stored procedure, is a new method that returns void. Hence, .NetTiers did not expect any output to be returned from the procedure.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.google.com/search?hl=en&amp;amp;q=Paging+in+SQL+2005&amp;amp;btnG=Search"&gt;Paging in SQL 2005&lt;/a&gt; is well documented, and with the use of PageIndex, ROW_Number() and RowIndex, you can quite easily perform effective and efficent paging against a 2005 database. For paging we need to know which page we are on, how many results there are, and how many pages of data are possible, given the current search criteria. Most important of all, is the total rows returned. Without this value, the ASP.NET Grid paging or ObjectDataSource / EntityDataSource cannot know how many pages are required to be shown.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;My example involves two database tables:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Company: Contain company information
&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Address: Contains address information
&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div&gt;The two tables are linked by the [Company].AddressId to the [Address].AddressId.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Our task is to return a list of companies, by searching on the Address fields. Example:&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-style: italic;"&gt;Return all Companies where the [Address].City='London'&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I have put together a &lt;a href="http://www.box.net/shared/jq9tchg85i"&gt;download to demonstrate .NetTiers Custom Stored Procedure Paging and Sorting&lt;/a&gt; &lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This includes table / procedure create scripts, plus an example query. You'll have to populate the tables yourself. The entire stored procedure is listed below:
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;span class="Apple-style-span" style="font-family: Consolas; font-size: 12px; "&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   1:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;EXISTS&lt;/span&gt; (&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SELECT&lt;/span&gt; * &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;FROM&lt;/span&gt; sysobjects &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;WHERE&lt;/span&gt; type = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'P'&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; name = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'_Company_CustomSearch'&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;DROP&lt;/span&gt;  &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;Procedure&lt;/span&gt; [dbo].[_Company_CustomSearch]&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   5:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   6:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   7:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   8:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;CREATE&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;PROCEDURE&lt;/span&gt; [dbo].[_Company_CustomSearch]&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   9:  &lt;/span&gt;(&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  10:  &lt;/span&gt;    @CompanyId &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt;   = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  11:  &lt;/span&gt;    @CompanyName nvarchar (150)  = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  12:  &lt;/span&gt;    @CompanyAddressTownCity nvarchar (200)  = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  13:  &lt;/span&gt;    @CompanyAddressState nvarchar (200)  = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  14:  &lt;/span&gt;    @CompanyAddressPostcode nvarchar (20)  = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  15:  &lt;/span&gt;    @OrderBy nvarchar (2000) = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  16:  &lt;/span&gt;    @PageIndex &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt; = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  17:  &lt;/span&gt;    @PageSize &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt; = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; ,&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  18:  &lt;/span&gt;    @TotalRows &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;OUTPUT&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  19:  &lt;/span&gt;)&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  20:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  21:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  22:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  23:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  24:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;--&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  25:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @PageIndex &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  26:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @PageIndex = 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  27:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  28:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @PageSize &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @PageSize = 400&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  30:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;--&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  31:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; DATEFORMAT dmy&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  32:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  33:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- Build WHERE Clause&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  34:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;DECLARE&lt;/span&gt; @WhereClause [nvarchar] (2000)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  35:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  36:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'1=1'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  37:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  38:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @CompanyId &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NOT&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; @CompanyId &lt;&gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  39:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = @WhereClause + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND [Company].CompanyId = '&lt;/span&gt; + &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;CAST&lt;/span&gt;(@CompanyId &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AS&lt;/span&gt; NVARCHAR(20))&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  40:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  41:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @CompanyName &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NOT&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; LEN(@CompanyName) &gt; 0&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  42:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = @WhereClause + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND [Company].CompanyName LIKE '&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt; + @CompanyName + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'%'&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  43:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  44:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @CompanyAddressTownCity &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NOT&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; LEN(@CompanyAddressTownCity) &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  45:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = @WhereClause + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND [Address].TownCity LIKE '&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt; + @CompanyAddressTownCity + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'%'&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  46:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  47:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @CompanyAddressState &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NOT&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; LEN(@CompanyAddressState) &gt; 0&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  48:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = @WhereClause + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND [Address].State LIKE '&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt; + @CompanyAddressState + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'%'&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  49:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  50:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @CompanyAddressPostcode &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NOT&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;AND&lt;/span&gt; LEN(@CompanyAddressPostcode) &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  51:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @WhereClause = @WhereClause + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND [Address].Postcode LIKE '&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt; + @CompanyAddressPostcode + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'%'&lt;/span&gt;&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;''&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  52:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  53:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;DECLARE&lt;/span&gt; @PageLowerBound &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  54:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;DECLARE&lt;/span&gt; @PageUpperBound &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;int&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  55:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  56:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- Set the page bounds&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  57:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @PageLowerBound = @PageSize * @PageIndex&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  58:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @PageUpperBound = @PageLowerBound + @PageSize&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  59:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  60:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; (@OrderBy &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;is&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;null&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;or&lt;/span&gt; LEN(@OrderBy) &lt;&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  61:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  62:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- default order by to first column&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  63:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @OrderBy = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'[CompanyId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  64:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  65:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  66:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- SQL Server 2005 Paging&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  67:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;declare&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;as&lt;/span&gt; nvarchar(&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;max&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  68:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  69:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- get row count&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  70:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'SELECT @TotalRows = COUNT(DISTINCT Company.CompanyId)'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  71:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' FROM dbo.[Company]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  72:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' INNER JOIN [Address] ON [Address].AddressId = [Company].AddressId'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  73:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  74:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; LEN(@WhereClause) &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  75:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  76:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' WHERE '&lt;/span&gt; + @WhereClause&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  77:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  78:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  79:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;EXEC&lt;/span&gt; sp_executesql @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt;, N&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'@TotalRows int out'&lt;/span&gt;, @TotalRows &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;out&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  80:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  81:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- Get Data&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  82:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;'WITH PageIndex AS ('&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  83:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' SELECT'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  84:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @PageSize &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  85:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  86:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' TOP '&lt;/span&gt; + &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;convert&lt;/span&gt;(nvarchar, @PageUpperBound)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  87:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  88:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  89:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' ROW_NUMBER() OVER (ORDER BY [Company].'&lt;/span&gt; + @OrderBy + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;') as RowIndex'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  90:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  91:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[CompanyId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  92:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[CompanyName]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  93:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[AddressId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  94:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[CompanyUrl]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  95:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[Telephone]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  96:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  97:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' FROM dbo.[Company]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  98:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' INNER JOIN [Address] ON [Address].AddressId = [Company].AddressId'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  99:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 100:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; LEN(@WhereClause) &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 101:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 102:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' WHERE '&lt;/span&gt; + @WhereClause&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 103:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 104:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 105:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- Group By&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 106:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' GROUP BY '&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 107:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' [Company].[CompanyId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 108:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[CompanyName]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 109:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[AddressId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 110:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[CompanyUrl]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 111:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Company].[Telephone]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 112:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 113:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' ) SELECT'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 114:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' [CompanyId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 115:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [CompanyName]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 116:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [AddressId]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 117:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [CompanyUrl]'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 118:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;', [Telephone]'&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 119:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' FROM PageIndex'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 120:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' WHERE RowIndex &gt; '&lt;/span&gt; + &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;convert&lt;/span&gt;(nvarchar, @PageLowerBound)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 121:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 122:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; @PageSize &gt; 0&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 123:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 124:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' AND RowIndex &lt;= '&lt;/span&gt; + &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;convert&lt;/span&gt;(nvarchar, @PageUpperBound)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 125:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 126:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 127:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SET&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; = @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt; + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;' ORDER BY '&lt;/span&gt; + @OrderBy&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 128:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 129:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- Get Data&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 130:  &lt;/span&gt;--&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;PRINT&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 131:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;EXEC&lt;/span&gt; sp_executesql @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 132:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;PRINT&lt;/span&gt; @&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SQL&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 133:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 134:  &lt;/span&gt;&lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;-- HACK (to get .NetTiers to gen the TList&lt;company&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 135:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IF&lt;/span&gt; USER_NAME() &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;IS&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;NULL&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 136:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 137:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;SELECT&lt;/span&gt; * &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;FROM&lt;/span&gt; Company &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;WHERE&lt;/span&gt; 1=0&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 138:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;RETURN&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 139:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 140:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 141:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 142:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt; 143:  &lt;/span&gt;GO&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If you have any questions or comments, please don't hestitate to ask.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-4923109322277461116?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-02-04T08:54:48.919-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/02/paging-and-sorting-in-nettiers-custom.html</feedburner:origLink></item><item><title>ASP.NET - Disabling the submit button to prevent double submissions</title><link>http://feedproxy.google.com/~r/benpowell/~3/U9jMF6beUSM/aspnet-disabling-submit-button-to.html</link><category>technology</category><author>noreply@blogger.com (Ben)</author><pubDate>Wed, 21 Jan 2009 11:59:15 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-2533666626278790064</guid><description>If a user clicks on a form submit button and the page response is slow, the user may often re-click that button. Because the original request has already been submitted, you may find that the user has made a double submission. In e-commerce sites, the double submission of a credit card payment may be very unpopular with your customers. &lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is a common problem faced by web developers, and there are a variety of ways to try to prevent it. However, I have not seen a really elegant way to solve the problem, so I set about trying to find a simple and effective solution.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There were some key issues I wanted to address:&lt;div&gt;&lt;ol&gt;&lt;li&gt;I wanted to disable the button when it was clicked, but &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;only&lt;/span&gt; if the page was valid
&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I did not want to manually add code to every button in my application
&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I did not want to break the existing validation, especially when using validation groups
&lt;br /&gt;&lt;/li&gt;&lt;li&gt;I wanted to preserve the CausesValidation property
&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;To achieve these goals, I set about creating a custom button that inherited the standard ASP Button. This custom button would replace the existing buttons in my application.
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;First add a new class to your App_Code directory called "EnhancedButton" and then override the OnPreRender event:&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;span class="Apple-style-span" style="font-family: Consolas; font-size: 12px; "&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   1:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;namespace&lt;/span&gt; Junto.WebControls&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   3:  &lt;/span&gt;    &lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;/// &lt;summary&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   4:  &lt;/span&gt;    &lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;/// If CausesValidation then check the current ValidationGroup is valid&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   5:  &lt;/span&gt;    &lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;/// and if so, disable the button.&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   6:  &lt;/span&gt;    &lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;/// &lt;/summary&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   7:  &lt;/span&gt;    [ToolboxData(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"&lt;{0}:EnhancedButton runat=server&gt;&lt;/{0}:EnhancedButton&gt;"&lt;/span&gt;)]&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;public&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;class&lt;/span&gt; EnhancedButton : Button&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;protected&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;override&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;void&lt;/span&gt; OnPreRender(EventArgs e)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  11:  &lt;/span&gt;        {&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  12:  &lt;/span&gt;            &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;if&lt;/span&gt; (&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;this&lt;/span&gt;.CausesValidation)&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  13:  &lt;/span&gt;            {&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  14:  &lt;/span&gt;                StringBuilder sb = &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  15:  &lt;/span&gt;                sb.Append(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"if (typeof(Page_ClientValidate) == 'function') { "&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  16:  &lt;/span&gt;                sb.Append(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"if (Page_ClientValidate('"&lt;/span&gt; + &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;this&lt;/span&gt;.ValidationGroup + &lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"') == false) { return false; }} "&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  17:  &lt;/span&gt;                sb.Append(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"this.value = 'Please wait...';"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  18:  &lt;/span&gt;                sb.Append(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"this.disabled = true; "&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  19:  &lt;/span&gt;                sb.Append(&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;this&lt;/span&gt;.Page.GetPostBackEventReference(&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;this&lt;/span&gt;));&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  20:  &lt;/span&gt;                sb.Append(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;";"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  21:  &lt;/span&gt;                &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;this&lt;/span&gt;.Attributes.Add(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"onclick"&lt;/span&gt;, sb.ToString());&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  22:  &lt;/span&gt;            }&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  23:  &lt;/span&gt; &lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  24:  &lt;/span&gt;            &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;base&lt;/span&gt;.OnPreRender(e);&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  25:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  26:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  27:  &lt;/span&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now, we add the following to our web.config to take advantage of the tagMapping feature:&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;span class="Apple-style-span" style="font-family: Consolas; font-size: 12px; "&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   1:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;pages&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   2:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;controls&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   3:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;add&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;tagPrefix&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="Junto"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;namespace&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="Junto.WebControls"&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;controls&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;tagMapping&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   6:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;add&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;tagType&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="System.Web.UI.WebControls.Button"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;mappedTagType&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="Junto.WebControls.EnhancedButton"&lt;/span&gt; &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   7:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;tagMapping&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   8:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;pages&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The result is that all instances of standard Buttons are replaced with our new Enhanced custom button. You have no need to add extra code in every Page_Load. The Tag Mapping takes care of replacing the standard button across the web application.&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;And Voilà, our job is done!&lt;/div&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-2533666626278790064?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-21T11:59:15.998-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/01/aspnet-disabling-submit-button-to.html</feedburner:origLink></item><item><title>An Open Letter to the People of Israel</title><link>http://feedproxy.google.com/~r/benpowell/~3/AP8TkfYvPkI/open-letter-to-people-of-israel.html</link><category>politics</category><author>noreply@blogger.com (Ben)</author><pubDate>Thu, 15 Jan 2009 23:04:34 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-7712095871867843295</guid><description>&lt;p class="MsoNormal"&gt;When &lt;a href="http://en.wikipedia.org/wiki/Adolf_hitler"&gt;Adolf Hitler&lt;/a&gt; rose to power in 1933 on a wave of nationalism, born out of the failures of a nation after the Great War, he looked for someone to blame. Although anyone fulfilling the role of a non-German was considered fair game, but it was the German Jews that took the full force of the backlash. As Germany expanded its borders through invasion and &lt;a href="http://en.wikipedia.org/wiki/Anschluss"&gt;annexation&lt;/a&gt; the rest of the world resorted to&lt;a href="http://en.wikipedia.org/wiki/Appeasement_of_Hitler"&gt; appeasement&lt;/a&gt;, scarred by memories of the Great War.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Anti-Semitism was a key policy of the National Socialists and in 1939 Adolf Eichmann started to systematically move Jews into designated areas of Polish cities, which was to be the start of the Nazi “&lt;a href="http://en.wikipedia.org/wiki/Final_Solution"&gt;Final Solution&lt;/a&gt;”. During the war the Nazis created &lt;a href="http://en.wikipedia.org/wiki/Ghettos_in_occupied_Europe_1939-1944"&gt;Jewish ghettos across occupied Europe&lt;/a&gt;. Commonly a wall was built around the area, and the Jewish inhabitants were restricted from leaving the ghetto. Food and supplies were strictly controlled by the Nazis and crowded living conditions led to disease and starvation.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;One of the most infamous ghettos was the &lt;a href="http://en.wikipedia.org/wiki/Warsaw_Ghetto"&gt;Warsaw Ghetto&lt;/a&gt; that contained 300,000 – 400,000 people. In 1943 the Jewish population were being subjected to the second wave of deportations to concentration camps and by this time they realised that they were being sent to their deaths. An insurgency was born, and using a handful of small arms and improvised weapons, the inhabitants of the ghetto fought against a superior war machine. The main &lt;a href="http://en.wikipedia.org/wiki/Warsaw_Ghetto_Uprising"&gt;rebellion&lt;/a&gt; was over with a month, and at the end, 13,000 Jewish people had died. The remaining 50,000 inhabitants were captured and shipped off to concentration camps, mainly Treblinka.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Years before in 1922, the &lt;a href="http://en.wikipedia.org/wiki/League_of_Nations"&gt;League of Nations&lt;/a&gt; (pre-cursor to the UN), granted the British a mandate over Palestine. Although Jewish emigration to Palestine had started some time before, it was the rise of Nazism in the 1930’s that started the “Fifth Aliyah”, bringing a quarter of a million Jews to settle in Palestine. In opposition to these large numbers of immigrants, an &lt;a href="http://en.wikipedia.org/wiki/1936%E2%80%931939_Arab_revolt_in_Palestine"&gt;uprising&lt;/a&gt;, started by a general strike by the Arabs in Palestine led Britain to halt further Jewish immigration into Palestine in 1939.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;By the end of World War II, the &lt;a href="http://en.wikipedia.org/wiki/Israel#Zionism_and_the_British_Mandate"&gt;Jewish population of Palestine had increased to 33%, from 11% in 1922&lt;/a&gt;. After 1945, Britain struggled to control Palestine and became embroiled in an increasingly &lt;a href="http://en.wikipedia.org/wiki/British_Conflict_with_Zionism"&gt;violent conflict with the Jews&lt;/a&gt;. On May 14, 1948, the day before the end of the British mandate, the Jewish Agency proclaimed independence, naming the country Israel. Eleven minutes after the Declaration of Independence was signed, US President Truman, recognised the &lt;a href="http://en.wikipedia.org/wiki/Declaration_of_Independence_(Israel)"&gt;State of Israel&lt;/a&gt;, and a nation was born.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Over the years since, Israel has expanded its borders through armed conflict with its neighbours, and now occupies much of this land. Throughout this expansion Israel has been appeased and although several UN mandates have been passed against Israel, many remain ignored. Israel has developed into a strong militarised nation with &lt;a href="http://en.wikipedia.org/wiki/Israel_and_weapons_of_mass_destruction"&gt;biological, chemical and nuclear capabilities&lt;/a&gt;. It remains the most powerful military force in the region.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;In 1967, Israel took control of the Gaza strip, a piece of land bordering Israel and Egypt. It is roughly 41 kilometres long and between 6 – 12 kilometres wide. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;In 1987 the “&lt;a href="http://en.wikipedia.org/wiki/First_Intifada"&gt;First Intifada&lt;/a&gt;” or the “War of Stones” started, and was a mass Palestinian uprising against Israeli rule. Action ranged from civil disobedience to violence. Many suspected Israeli collaborators were killed by their own people. The result was loss of life on both sides, but it also cemented Palestinian identity in the eyes of the rest of the world.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Since 1987, violence has never left the region. Tit-for-tat attacks have continued unabated and many lives have been lost. Peace treaties have been discussed, signed and ignored. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;Under the Oslo Accords, Israel left the Gaza strip in 1994 and the area came under Palestinian control. From this date onwards Israel set about building a wall around Gaza, known as the”&lt;a href="http://en.wikipedia.org/wiki/Israeli_Gaza_Strip_barrier"&gt;Israel – Gaza Strip Barrier&lt;/a&gt;”. There are three crossing points in the barrier, which are controlled by Israel, and are of crucial importance to the 1.4 million inhabitants of Gaza, who are unable to be self sufficient.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Regardless of who has controlled Gaza since, a steady stream of rocket attacks have hit Israeli cities, and Palestinian suicide bombers have been used to create havoc and fear. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;In June 2007 both Egypt and &lt;a href="http://en.wikipedia.org/wiki/Gaza_Strip_blockade"&gt;Israel blockaded the Gaza strip&lt;/a&gt; and Israel sealed the borders and allowing only enough goods in to prevent a humanitarian crisis.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Now the Gaza strip is a ghetto. The inhabitants are walled in. One can draw parallels to the Warsaw ghetto in the 1940’s, but many who do are criticised, such as &lt;a href="http://en.wikipedia.org/wiki/Patrick_Buchanan#A_Palestinian_State"&gt;Pat Buchanan&lt;/a&gt;, who accused Israel of &lt;a href="http://en.wikipedia.org/wiki/Gaza_Strip#Concentration_camp_comparisons"&gt;turning Gaza into a “concentration camp”&lt;/a&gt;. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;One can now see a similarity between the Gazan insurgency and the Jewish insurgency in the Warsaw ghetto. Both fought a superior and better armed opponent in a guerrilla war. Both were confined to a piece of land, unable to move freely, with restricted access to work, food, or medical supplies.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;It is a moral requirement that we see this situation as it is. The world still reels from the guilt of the holocaust, and appeases Israel because of it. But enough is enough. Israel has to be responsible for its actions. It has to realise that it cannot continue on this path, because ironically, it is this very path that has destroyed so much of its own. The Palestinians have nothing more to lose, and they know it. Israel is a hair’s breadth from making a decision it will long regret in the history of humanity. It is arguably on the brink of having committed war crimes against humanity and ethnic cleansing.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;It is Israel that must make the first move. It holds the power and the keys to the kingdom. The only thing that the Palestinian authorities have left in their diplomatic armory is their refusal to recognise the State of Israel, and it is a worthless sticking point that both use to maintain the diabolical status-quo.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;It is important that one realises that criticism of Israeli policies is not anti-Semitic. To draw an analogy with the Nazi era, one can criticise the Nazi state, whilst holding nothing against German people. It is an important differentiation to make between the crimes of a state and its people. The same can be said of Hamas and the people of Gaza.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We cannot undo history, so now we are only left with a valid two state solution that is equitable and honoured by both. There is no reason that the two nations cannot live side by side and prosper. &lt;/p&gt;&lt;p class="MsoNormal"&gt;Where the Nazis fostered the Jews as their nemesis, today it is the turn of Islamic fundamentalism. In reality it is nothing more than a crusade, aimed to gather a population and direct them against a common evil, and prevent them from looking inwards.&lt;/p&gt;&lt;p class="MsoNormal"&gt;If we were able to truly reflect on ourselves and what we have become, I think we would have much to change.&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Now that is change we can believe in.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-7712095871867843295?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-15T23:04:34.953-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2009/01/open-letter-to-people-of-israel.html</feedburner:origLink></item><item><title>Importing (hacking) custom formatted blog XML posts into Blogger</title><link>http://feedproxy.google.com/~r/benpowell/~3/UoG8AGZNlXw/importing-hacking-custom-formatted-blog.html</link><category>technology</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 13:20:39 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-7247350983593001070</guid><description>Some years ago I coded and used a custom blog engine, which used XML as a data store. The format of this XML file was completely unique to this engine, so it has always been too difficult to get this data into Blogger.&lt;br /&gt;&lt;br /&gt;However, in June, Blogger offered up an export/import feature, which allowed users to backup and move posts around between blogger blogs. With this in mind I set about trying to import these old posts into Blogger.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 1: Identity the Blogger Import Format&lt;/span&gt;&lt;br /&gt;I needed to work out what format the blogger import feature used. I tried to import my custom XML, which not surprisingly, didn't work. So with the help of some guidance from the web, and an export of my current Blogger posts, I figured out the format I required.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 2: Transform my custom XML into Blogger XML&lt;/span&gt;&lt;br /&gt;I needed to transform my custom XML format into the Blogger import format (essentially an ATOM feed). The easiest way to do this seemed to be to use XSL. I hacked together a simple XSL document to transform the custom XML into valid Blogger XML.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 3: Create a mechanism for performing the transformation&lt;/span&gt;&lt;br /&gt;I created a simple HTML file that would load the custom XML file, transform this into the Blogger ATOM feed and then save it to disk.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 4: Import the custom posts into Blogger&lt;/span&gt;&lt;br /&gt;I imported the Blogger ATOM feed into the Draft Blogger website, using their import tool. I noticed that several of the posts seemed to have weird characters, and realised that I has an encoding problem.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 5: Force the encoding of the output file&lt;/span&gt;&lt;br /&gt;I forced the file to be stored in a UTF-8 encoding, to preserve some of the characters that ASCII doesn't support.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Step 6: Edit and publish imported posts&lt;/span&gt;&lt;br /&gt;I went through and editing the posts I wanted to edit and then published everything into this blog.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Get the code&lt;/span&gt;&lt;br /&gt;If you have a similar problem, where you have XML in one blog format and want to import into Blogger, I have put together &lt;a href="http://www.box.net/shared/k62sp2smef"&gt;a simple example for transforming the XML as a download&lt;/a&gt;, which you can download and use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-7247350983593001070?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T13:20:39.082-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/11/importing-hacking-custom-formatted-blog.html</feedburner:origLink></item><item><title>Legal music downloads aren't working</title><link>http://feedproxy.google.com/~r/benpowell/~3/-tAACSSgrcY/used-abused-and-totally-screwed.html</link><category>opinion</category><category>music</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 10:30:06 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-4878875048352488600</guid><description>Michael Robertson of &lt;a href="http://mp3tunes.com/"&gt;MP3Tunes.com&lt;/a&gt; writes today in the Register that &lt;a href="http://www.theregister.co.uk/2008/09/09/michael_robertson_music_models/"&gt;legal digital music distribution is commercial suicide&lt;/a&gt;. I thought I'd comment on my feeling towards digital music.&lt;br /&gt;
&lt;br /&gt;
I used to love listening and collecting music. Although I used to baulk at buying CDs (at UK prices), every now and then I would indulge. However, in the last few years my music purchases are rare, and I loathe spending the money on something I believe is over-priced.&lt;br /&gt;
&lt;br /&gt;
The music industry is still trying to convince us that we should pay more for digital music than we did for CDs (£0.99 x ~15 tracks = album cost). I don't download music, because I don't feel it's fair to the artist, and therefore my only option is to stop buying new music in protest. I'll have to stick with what I paid handsomely for over the years before I realised I was being ripped off.&lt;br /&gt;
&lt;br /&gt;
The entire industry is a sham. The consumer is being used, abused and totally screwed. I'd be happy to pay an equitable price for music, and might even get back into collecting music again if I thought I wasn't being ripped off anymore.&lt;br /&gt;
&lt;br /&gt;
Digital music has no fixed physical value, because it requires no physical product to be produced, packaged or distributed. There is no scarcity factor, supply is boundless and demand is fickle. The resulting price should naturally fall very low. Basic economics...&lt;br /&gt;
&lt;br /&gt;
It is kept artificially high through &lt;a href="http://business.timesonline.co.uk/tol/business/industry_sectors/media/article671912.ece"&gt;lack of competition&lt;/a&gt;, quasi "&lt;a href="http://www.usatoday.com/life/music/news/2002-09-30-cd-settlement_x.htm"&gt;price&lt;/a&gt;-&lt;a href="http://business.timesonline.co.uk/tol/business/industry_sectors/technology/article737029.ece"&gt;fixing&lt;/a&gt;", politicians "persuaded" by &lt;a href="http://www.theinquirer.net/en/inquirer/news/2007/08/07/music-industry-body-illegally-funds-lobbyists-spinners"&gt;industry lobbyists&lt;/a&gt; and expensive &lt;a href="http://recordingindustryvspeople.blogspot.com/2008/07/aba-judges-journal-article-large.html"&gt;cartel&lt;/a&gt; lawyers with sharp teeth. None of which the savvy customer really appreciates.&lt;br /&gt;
&lt;br /&gt;
The music industry needs to remember, that without us buying the crap they pump out - they are screwed. Maybe they should consider that next time they are &lt;a href="http://mashable.com/2008/07/24/music-tax-cocaine/"&gt;snorting&lt;/a&gt; &lt;a href="http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/music/article3370224.ece"&gt;cocaine&lt;/a&gt; off a whores tits, funded by us mugs here in consumer-ville.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-4878875048352488600?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T10:30:06.324-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/09/used-abused-and-totally-screwed.html</feedburner:origLink></item><item><title>Chrome is coming - Finally a real challenger to the Microsoft browser throne</title><link>http://feedproxy.google.com/~r/benpowell/~3/8yTCmOQocu8/chrome-is-coming-finally-real.html</link><category>opinion</category><category>technology</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 10:30:06 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-5741148843311173702</guid><description>Google premature announcement of its new &lt;span id="SPELLING_ERROR_0"&gt;browser&lt;/span&gt; platform called &lt;a href="http://googleblog.blogspot.com/2008/09/fresh-take-on-browser.html"&gt;Chrome&lt;/a&gt; has some interesting implications, that have not been discussed widely in the &lt;span id="SPELLING_ERROR_1"&gt;blogosphere&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
I would not be surprised that if we revisit this article in two years time, that Chrome would have a larger market share than &lt;span id="SPELLING_ERROR_2"&gt;Firefox&lt;/span&gt;, and will have severely dented Microsoft's Internet Explorer domination. Chrome has the advantage that it has an easier download path compared to &lt;span id="SPELLING_ERROR_3"&gt;Firefox&lt;/span&gt;. At present the majority of &lt;span id="SPELLING_ERROR_4"&gt;Firefox&lt;/span&gt; enthusiasts are certainly more technically aware, but these people are in the minority on the &lt;span id="SPELLING_ERROR_5"&gt;internet&lt;/span&gt; as a whole. The "average" user is unlikely to ever visit the &lt;span id="SPELLING_ERROR_6"&gt;Firefox&lt;/span&gt; download website and install the &lt;span id="SPELLING_ERROR_7"&gt;Firefox&lt;/span&gt;. Opera has the same problem, regardless of whether they are good browsers or not.&lt;br /&gt;
&lt;br /&gt;
Microsoft's download route is obviously the most direct, downloaded via Windows Update on &lt;span id="SPELLING_ERROR_8"&gt;XP&lt;/span&gt; and Vista, but &lt;span id="SPELLING_ERROR_9"&gt;Google's&lt;/span&gt; download route will be a close second. Prepare to see it packaged in the same manner as the Google Toolbar, hence, straight off the Google front page (to an extremely wide audience) and embedded in other "free" software such as Adobe Flash and Reader.&lt;br /&gt;
&lt;br /&gt;
Assuming the final release of Chrome is bug free, and works, &lt;span id="SPELLING_ERROR_10"&gt;CSS&lt;/span&gt; friendly &lt;span id="SPELLING_ERROR_11"&gt;et&lt;/span&gt; &lt;span id="SPELLING_ERROR_12"&gt;al&lt;/span&gt;, the &lt;span id="SPELLING_ERROR_13"&gt;internet&lt;/span&gt; community will quite quickly switch to the new preferred default browser.&lt;br /&gt;
&lt;br /&gt;
Of the &lt;a href="http://www.alexa.com/site/ds/top_sites?ts_mode=global&amp;amp;lang=none"&gt;top 10 global websites&lt;/a&gt;, over half are pushing the bounds of JavaScript in today's browsers. Google apps (Gmail, Docs, etc), &lt;span id="SPELLING_ERROR_14"&gt;Hotmail&lt;/span&gt;, Yahoo Mail, &lt;span id="SPELLING_ERROR_15"&gt;Facebook&lt;/span&gt;, &lt;span id="SPELLING_ERROR_16"&gt;Youtube&lt;/span&gt;, and &lt;span id="SPELLING_ERROR_17"&gt;Myspace&lt;/span&gt;, have the potential to work &lt;a href="http://www.google.com/googlebooks/chrome/"&gt;better, faster and be more stable&lt;/a&gt; under Chrome. &lt;span id="SPELLING_ERROR_18"&gt;Firefox&lt;/span&gt; and Internet Explorer, will not be able to compete in this areas, in their current builds anyway. This is due to the unique threading sandbox model, and &lt;a href="http://en.wikipedia.org/wiki/Google_Chrome#JavaScript"&gt;compiled JavaScript code&lt;/a&gt;, Chrome will employ.&lt;br /&gt;
&lt;br /&gt;
Chrome also plugs in &lt;a href="http://en.wikipedia.org/wiki/Gears_(software)"&gt;Google Gears&lt;/a&gt;, which gives it an advantage out of the box, so it inherently will support Gears where no other browser does.&lt;br /&gt;
&lt;br /&gt;
Google has found a place from which they can attack the Microsoft domination of the browser market in a way that Netscape, &lt;span id="SPELLING_ERROR_19"&gt;Firefox&lt;/span&gt; and Opera were never been able to do.&lt;br /&gt;
&lt;br /&gt;
Finally, although this is not apparent in Chrome at the moment, it stands to reason that it could also display advertising in a way that the other browsers have not done so to date. It would not be out of the bounds of reality, for Google to have a advertising sidebar that loads based on EVERY page you view. At a minimum, it gives Google advertising tracking that other ad-networks can only dream of, and which Google Toolbar gives them partially at the moment.&lt;br /&gt;
&lt;br /&gt;
Watch this space....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-5741148843311173702?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T10:30:06.328-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/09/chrome-is-coming-finally-real.html</feedburner:origLink></item><item><title>US Energy independence is the key to controlling Russia now</title><link>http://feedproxy.google.com/~r/benpowell/~3/Bynk5nWhU8g/us-energy-independence-is-key-to.html</link><category>opinion</category><category>politics</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 10:30:06 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-9140396968470860620</guid><description>Over the last week &lt;a href="http://www.guardian.co.uk/world/2008/aug/12/georgia1"&gt;Russia has redrawn the geo-political map of a vital strategic region&lt;/a&gt; notes the Guardian today. Russia has shown that it has risen from its embarrassing collapse in the early 90's, like a phoenix from the ashes. Through Georgia and South Ossetia, America and Russia have fought a one way proxy war, and the west decided to leave Georgia in the cold. I have no doubt that they have encouraged the Georgian president, and now the west and President Saakashvili have egg on their faces.&lt;br /&gt;
&lt;br /&gt;
I believe that this debacle was a "test of the water", to see what type of response Russia would give under the new Medvedev/Putin regime. There is a good reason for this interest. Russia maintains strong but loose links to Tehran, and it is Russia that stops the US attacking Iran over its nuclear policy via its veto in the UN Security Council. Both Russia and China supply the majority of missile technology that allow the Iranians to build and maintain the Shahab-3 rocket systems which the Iranians might use to launch nuclear bombs.&lt;br /&gt;
&lt;br /&gt;
The &lt;a href="https://www.cia.gov/news-information/speeches-testimony/2000/walpole_missile_092200.htm"&gt;US strongly believes that it needs to stop the Iranian nuclear industry&lt;/a&gt; in its tracks. It doesn't feel it can risk a Muslim state with the power to develop nuclear weapons, especially one that has proven long range missile delivery systems that in the near future could reach all of Israel (As a note, Pakistan is an "ally" and run by a dictator, hence not "Muslim controlled").&lt;br /&gt;
&lt;br /&gt;
I believe that had their gamble worked in Georgia, an attack on Iran would have been much easier for them to go ahead with. They would have known that Russia did not have the balls to stop them. Now the situation has almost been reversed, and they have absolutely no idea what Putin will do, if, and this is the most probable outcome; Israel bombs key Iranian nuclear facilities.&lt;br /&gt;
&lt;br /&gt;
Please note that Israel needs a very valid reason to bomb Iranian sovereign territory, so be prepared to see something happen that gives Israel "due cause to retaliate", before this November, as President Bush needs Israel to do this before he leaves office.&lt;br /&gt;
&lt;br /&gt;
What is most interesting about all of this, is Europe's response to the whole thing, which was tepid at best. It shows the weight Russia holds in terms of energy in Europe, and the Europeans are quick to appease (and these are Nato countries). I don't blame Europe, since they are energy dependent on Russian oil and gas.&lt;br /&gt;
&lt;br /&gt;
The US is already starting to talk about energy independence, but now they REALLY need it. If the US is to match Russia in the years to come, they need to offer Europe another option for energy generation, that doesn't leave Europe dependent on Russian oil and gas.&lt;br /&gt;
&lt;br /&gt;
Sadly, the US might have left this too late. Their own system of pandering to the oil lobbyists in Washington have made sure that alternative energy has remained on the sidelines. I have no doubt that Houston will remain rich, but the rest of the US will continue to decline as a result of this lack of forethought.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-9140396968470860620?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T10:30:06.332-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/08/us-energy-independence-is-key-to.html</feedburner:origLink></item><item><title>My Solution to Britain's Problems</title><link>http://feedproxy.google.com/~r/benpowell/~3/9DAGkp0gseg/my-solution-to-britains-problems.html</link><category>opinion</category><category>politics</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 10:30:06 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-6119874765268708149</guid><description>The UK is suffering from a social meltdown. The problem is spiralling and if something is not done soon, the morally-destitute youth of today will become the parent's of tomorrow. Parents are unwilling to take the responsibility of controlling and disciplining their children. They no longer understand, or have been taught, the meaning of respect. The media does nothing to help the situation and schools have become the last place where any degree of social responsibility is being taught, and even then, it is almost impossible for them to do so effectively. I generalise, but as this becomes the norm, and the majority of our youth become unproductive and problematic in society we are left with a country that will not be able to compete in a world that has recently seen 3 billion people added to the capitalist economy.&lt;br /&gt;
&lt;br /&gt;
So what can we do to stop the rot? How can we turn this around? Are we doomed to a country where it is no longer a pleasure to live?&lt;br /&gt;
&lt;br /&gt;
I propose that the government needs to enforce a program of social responsibility. It needs to be done through a mandatory program of combined social and military service. It needs to be well thought out, widely supported and effective. The young people placed within the program need to feel that they are achieving something, and earning the respect of their peers. It should not be a waste of their time. Both military and social service &lt;strong&gt;should be undertaken abroad&lt;/strong&gt; and not in the UK. This will teach them the value of life, and what the UK still has to offer compared to abroad in poorer and more troubling areas of the world. Military or civil service should be mandatory for both sexes.&lt;br /&gt;
&lt;br /&gt;
There should be certain exceptions. The vast majority of my German friends have stated that in certain cases a blanket approach is not the way forward. The system in Germany forces all men to take part in either military service, or if you have a valid reason not to military service, you have to do civil service at school leaving age. For students who will undertake long periods of study afterwards, such as doctors, this is simply a break in their studies they do not need, and provides them with no long term benefit.&lt;br /&gt;
&lt;br /&gt;
Therefore, students studying certain professions can do their civil service as part of their studies. Doctors for example could do their civil service after their first few years on study, and as a practical part of their studies give their services abroad in countries where their expertise, even though their studies are uncompleted, will be valuable and welcomed.&lt;br /&gt;
&lt;br /&gt;
The government needs to evaluate the higher education system, plan for which professions will provide our country with the &lt;strong&gt;most beneficial professionals in the medium to long term&lt;/strong&gt;. These people should not have to take part in the civil or military service program. They should have as many resources available for them to improve and deliver in the community around them. If we want to compete on the world stage, against highly technically skilled Indian students and Chinese labour, we need to consider where the UK will fit in the global marketplace.&lt;br /&gt;
&lt;br /&gt;
We forget that the UK is a very small country. We forget that our place in the world stage is 50 years in the making, and from our position at the end of the last world war. We forget that our economy is built on the adventurers, explorers and entrepreneurs (and imperialism) of the past. This power is quickly starting to wane. Our position on the world stage during the past decades is leveraged with our affiliation to the United States. Although the US is not going anywhere soon, its power is in recession. The US has happily outsourced its manufacturing and services, and now in recent years its technological research and development abroad. It only brands goods and services, and that, it not something you should rely on. The new economies of India and China, are starting to become more aware that they don't need to US, and our connection with the United States becomes less and less beneficial, from an economic point of view, if not a militaristic one.&lt;br /&gt;
&lt;br /&gt;
We do not want to end up with a country that is full of young people with no work, no work ethic, and a stagnating economy. I don't believe that any of the British political parties have the forethought to consider our long term survival on the world stage. It will take a definitive plan, hard work, and a drive to succeed to achieve this goal. Other countries are aware of this, and if we don't do something soon, we are doomed to become a second rate nation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-6119874765268708149?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T10:30:06.336-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/07/my-solution-to-britains-problems.html</feedburner:origLink></item><item><title>How is price determined in the stock market?</title><link>http://feedproxy.google.com/~r/benpowell/~3/1QWFwD_2x1A/how-is-price-determined-in-stock-market.html</link><category>opinion</category><category>business</category><author>noreply@blogger.com (Ben)</author><pubDate>Sun, 30 Nov 2008 10:30:06 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-5511084447557369594</guid><description>This question has bugged me for ages. I understand that on a base level, the price of a share or stock, is governed by demand and supply. The supply of a stock is for all intents and purposes, finite, so if the demand for that stock increases, the price increases. Obviously when demand decreases (or supply increases) the price should drop.&lt;br /&gt;
All good, perfectly understood. Now, let's assume I have 1000 shares in Yahoo. Today's share price is roughly $27. That means that I can sell my 1000 shares and I will receive $27,000 dollars for those shares. To sell those shares, there needs to be a buyer, who will pay $27,000 to buy those shares, or a number of buyers, who will all pay $27 per share, for a percentage of those 100 shares (e.g. 10 buyers each buy 100 shares).&lt;br /&gt;
What I would like to know is three things:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;What happens when there isn't a buyer for my shares? &lt;/li&gt;
&lt;li&gt;What happens behind the scenes when I sell my shares?&lt;/li&gt;
&lt;li&gt;What is the underlying process, that allows my 1000 shares to be sold to one or more buyers at the price I agreed with my broker (or online trading account)?&lt;/li&gt;
&lt;/ul&gt;I am trying to understand how the inner working of the stock market function. There needs to be two parties at the exchange, who agree a price, but what doesn't make sense then, is that my price has already been set? It is the point of exchange, which I think is the black box I don't understand.&lt;br /&gt;
I'd love some feedback on this. I am interesting in creating a computer model of a stock market, and I need to understand this issue before I can continue.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-5511084447557369594?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-30T10:30:06.339-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/05/how-is-price-determined-in-stock-market.html</feedburner:origLink></item><item><title>How I built my personal website in 10 easy steps</title><link>http://feedproxy.google.com/~r/benpowell/~3/vmZYfZXtdAk/how-i-built-my-personal-website-in-10.html</link><category>technology</category><author>noreply@blogger.com (Ben)</author><pubDate>Sat, 31 Jan 2009 03:55:22 PST</pubDate><guid isPermaLink="false">tag:blogger.com,1999:blog-3399926169453259985.post-4128217179408195683</guid><description>&lt;ol&gt;&lt;li&gt;Download RSS Toolkit from CodePlex: &lt;a href="http://www.codeplex.com/ASPNETRSSToolkit"&gt;http://www.codeplex.com/ASPNETRSSToolkit&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Link my Blogger posts feed, comments feed, Flickr feed and Last.fm to Feedburner. Force Blogger feeds to output as RSS 2.0 from Feedburner (switch off Smart Feed), otherwise RSS Toolkit can't process the ATOM entry links correctly.&lt;/li&gt;&lt;li&gt;Set each Feedburner feed to the appropriate RssDataSource and set the DataSource to bind to a simple ASP.Net Repeater.
&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Setup the RSS Toolkit Caching using the application settings suggested &lt;a href="http://www.codeplex.com/ASPNETRSSToolkit/Wiki/View.aspx?title=Feed%20Cache&amp;amp;referringTitle=Home"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Revamp website design using templates from the &lt;a href="http://www.oswd.org/design/preview/id/3207"&gt;Open Source Web Design templates library&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Publish, and see results of &lt;a href="http://www.benpowell.co.uk/"&gt;Ben Powell&lt;/a&gt;'s new website.
&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;And, now for some code:&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="csharpcode"&gt;&lt;span class="Apple-style-span" style="font-family: Consolas; font-size: 12px; "&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   1:  &lt;/span&gt;&lt;span class="asp" style="background-color: rgb(255, 255, 0); "&gt;&lt;%@ Register Assembly="RssToolkit" Namespace="RssToolkit.Web.WebControls" TagPrefix="cc1" %&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   2:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;asp:Repeater&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;ID&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="Repeater1"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;runat&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="server"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="RssDataSource1"&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   3:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;HeaderTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;ul&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;class&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="sidemenu"&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;HeaderTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   7:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;li&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;a&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;href&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="&lt;%# Eval("&lt;/span&gt;&lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;link&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;") %&gt;"&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;span class="asp" style="background-color: rgb(255, 255, 0); "&gt;&lt;%&lt;/span&gt;# Eval(&lt;span class="str" style="color: rgb(0, 96, 128); "&gt;"title"&lt;/span&gt;) &lt;span class="asp" style="background-color: rgb(255, 255, 0); "&gt;%&gt;&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;a&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;li&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;FooterTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;ul&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  11:  &lt;/span&gt;        &lt;span class="rem" style="color: rgb(0, 128, 0); "&gt;&lt;!-- Cached at &lt;%=DateTime.Now.ToString()%&gt; --&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;FooterTemplate&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt" style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(244, 244, 244); width: 100%; margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  13:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;asp:Repeater&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size: small; color: black; font-family: Consolas, 'Courier New', Courier, monospace; background-color: rgb(255, 255, 255); margin-top: 0em; margin-right: 0em; margin-bottom: 0em; margin-left: 0em; "&gt;&lt;span class="lnum" style="color: rgb(96, 96, 96); "&gt;  14:  &lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&lt;&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;cc1:RssDataSource&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;id&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="RssDataSource1"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;runat&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="server"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;url&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="http://feeds2.feedburner.com/benpowell"&lt;/span&gt; &lt;span class="attr" style="color: rgb(255, 0, 0); "&gt;MaxItems&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;="10"&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/&lt;/span&gt;&lt;span class="html" style="color: rgb(128, 0, 0); "&gt;cc1:RssDataSource&lt;/span&gt;&lt;span class="kwrd" style="color: rgb(0, 0, 255); "&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Update: Well now this is only 6 steps, but who's counting..&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3399926169453259985-4128217179408195683?l=blog.benpowell.co.uk' alt='' /&gt;&lt;/div&gt;</description><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-31T03:55:22.503-08:00</app:edited><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://blog.benpowell.co.uk/2008/05/how-i-built-my-personal-website-in-10.html</feedburner:origLink></item></channel></rss>
