<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Michael Holland</title>
        <link>http://geekswithblogs.net/LEV/Default.aspx</link>
        <description> </description>
        <language>en-GB</language>
        <copyright>LEV</copyright>
        <managingEditor>michael@designadot.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Michael Holland</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/LEV/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Deployed Azure ValidateUser failing</title>
            <link>http://geekswithblogs.net/LEV/archive/2011/10/19/deployed-azure-validateuser-failing.aspx</link>
            <description>&lt;p&gt;I have been developing an MVC3 application with the intention of deploying to the Cloud. It was configured to use Forms Authentication with SQL Membership on SQL Azure.&lt;/p&gt;

&lt;p&gt;Everything seemed to be working perfectly locally, but after I deployed the Membership.ValidateUser no longer seemed to work. I could use the Providers to get information from the database (e.g. Membership.GetUser would return an existing account) which meant the database connection was fine and user existed, just the validation failed.&lt;/p&gt;

&lt;p&gt;After a bit of hunting I found the solution to the problem.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Cause:&lt;/b&gt; The default Hashing algorithm type on Azure is SHA1 - my Windows 7 default is HMACSHA256.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Symptom:&lt;/b&gt; The password decryption will fail when deployed to Azure causing the Membership.ValidateUser to return false.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Solution:&lt;/b&gt; Add the hashAlgorithmType="HMACSHA256" attribute to the membership element in your web.config file. It is recommended you also add passwordFormat="Hashed" to the DefaultMembershipProvider (details in the links below).&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Configuration details:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.codeproject.com/KB/aspnet/LoginControlError.aspx"&gt;http://www.codeproject.com/KB/aspnet/LoginControlError.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Provider details:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx"&gt;http://www.hanselman.com/blog/IntroducingSystemWebProvidersASPNETUniversalProvidersForSessionMembershipRolesAndUserProfileOnSQLCompactAndSQLAzure.aspx&lt;/a&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/LEV/aggbug/147373.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2011/10/19/deployed-azure-validateuser-failing.aspx</guid>
            <pubDate>Wed, 19 Oct 2011 14:51:07 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/147373.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2011/10/19/deployed-azure-validateuser-failing.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/147373.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/147373.aspx</trackback:ping>
        </item>
        <item>
            <title>CodeSmith and code generation</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/04/07/the-glory-of-codesmith-and-code-generation.aspx</link>
            <description>For the past three weeks I have been busy with one of those projects where next to no days were allocated to a certain module yet it requires as many days as the length of a piece of string... I am sure everyone gets these from time to time.&lt;br /&gt;&lt;br /&gt;

Like most people I do not like doing many of the repetititive tasks and so use &lt;a href="http://www.codesmithtools.com/"&gt;CodeSmith&lt;/a&gt; to help me out. I had cleared its stats counter before starting this module and was shocked to find that as-of today it had already generated more than 20,000 lines of code!!&lt;br /&gt;&lt;br /&gt;
Now, we use our own code generator to handle the data layer and these lines are not included in the 20,000 lines, so you can only begin to imagine how much time code generation can save you. If you don't already use a code generator then I suggest you spend a few hours looking into it. It will save you many days in the long run! &lt;img src="http://geekswithblogs.net/LEV/aggbug/130810.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/04/07/the-glory-of-codesmith-and-code-generation.aspx</guid>
            <pubDate>Tue, 07 Apr 2009 17:34:21 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/130810.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/04/07/the-glory-of-codesmith-and-code-generation.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/130810.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/130810.aspx</trackback:ping>
        </item>
        <item>
            <title>Smart Client Patterns &amp; Practices</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/03/17/smart-client-patterns--practices.aspx</link>
            <description>I am a firm believer in using programming patterns. It helps to build more stable, predictable and better applications.&lt;br /&gt;&lt;br /&gt;
Microsoft have not seemed to allocate any resources to their first patterns &amp;amp; practices release for quite some time, but at least the guys have updated the library for VS2008. Get it at &lt;a href="http://smartclient.codeplex.com/"&gt;http://smartclient.codeplex.com/&lt;/a&gt;. &lt;img src="http://geekswithblogs.net/LEV/aggbug/130152.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/03/17/smart-client-patterns--practices.aspx</guid>
            <pubDate>Tue, 17 Mar 2009 13:44:17 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/130152.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/03/17/smart-client-patterns--practices.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/130152.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/130152.aspx</trackback:ping>
        </item>
        <item>
            <title>Upgrading CF 2.0 projects to 3.5 in VS2008</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/03/10/upgrading-2.0-ce-projects-to-3.5-in-vs2008.aspx</link>
            <description>I have been having a lot of trouble moving all my Compact Framework projects to 3.5 over the past few days.&lt;br /&gt;
&lt;br /&gt;
The first problem came in the form of the "Update Web Reference" failing with the following error:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;The custom tool 'MSDiscoCodeGenerator' failed. Could not retrieve the current project.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
From what I can gather, there are leftover's from VS2008 beta... no matter, the only solutions out there involved reinstalling, which means lots of time wasted. The best info I found was &lt;a href="http://blogs.msdn.com/joy/archive/2008/08/26/the-custom-tool-msdiscocodegenerator-failed-while-building-projects.aspx"&gt;here&lt;/a&gt;.
&lt;br /&gt;&lt;br /&gt;
All I can say is that I rediscovered how many hours it takes to install the tools and SDK's that I use every day (i.e. it would be nice if the installation process was much faster).&lt;br /&gt;
&lt;br /&gt;
The final error I had for the day was when compiling my setup project:&lt;br /&gt;
&lt;b&gt;An error occurred while validating.  HRESULT = '80004005'&lt;/b&gt;&lt;br /&gt;
My recommendation here is to delete any references you have to other projects within your solution and recreate them. &lt;img src="http://geekswithblogs.net/LEV/aggbug/129991.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/03/10/upgrading-2.0-ce-projects-to-3.5-in-vs2008.aspx</guid>
            <pubDate>Tue, 10 Mar 2009 19:33:26 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129991.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/03/10/upgrading-2.0-ce-projects-to-3.5-in-vs2008.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129991.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129991.aspx</trackback:ping>
        </item>
        <item>
            <title>Getting Replication to work with SQL Compact 3.5 SP1</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/03/04/getting-sql-compact-3.5-sp1-to-work.aspx</link>
            <description>I have been struggling to get my version of SQL Compact 3.5 SP1 to work. Version 
	3.5 used to work without a hitch but my next project is going to be using SQL 
	Server 2008 which requires the service pack (but I will still have to support 
	SQL2005 applications). The project will have handheld scanners operating at the docks where wireless signal will not be guaranteed and so replication is the best option.&lt;br /&gt;
&lt;br /&gt;
	I could not get the replication working to a SQL2005 publication no matter what I tried and the information I found when Googling did not help, so I did what seemed to be the best advice, I uninstalled all SQL Compact versions from my laptop and then only reinstalled 3.5 SP1.&lt;br /&gt;

It still kept failing. You can imagine the frustration because I have used replication many times on many projects and knew/thought that my setup was correct.&lt;br /&gt;&lt;br /&gt;
The error I was getting was &lt;b&gt;“SQL Server Reconciler has failed”&lt;/b&gt; with the following info from the log:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;
Hr=80045005 ERR:Initialize failed for DistributorSessionID =  0&lt;br /&gt;
Hr=80045005 The subscription to publication 'Pubname' could not be verified. Ensure that all Merge Agent command line parameters are specified correctly and that the subscription is correctly configured. If the Publisher no longer has information about this subscription, drop and recreate the subscription.  -2147201019
&lt;/b&gt;
&lt;br /&gt;
&lt;br /&gt;
Access to the IIS server extension worked fine (e.g. use a link similar to&lt;br /&gt; “http://&amp;lt;servername&amp;gt;/Mobile/sqlcesa35.dll?diag”&lt;br /&gt; to check connection and version information).&lt;br /&gt;
However I noticed that the version number of the SQLCESA35.DLL was wrong… it should have been 3.5.5692.0, but was showing 3.5.5386.0 instead. It also showed that the Reconciler Test had failed for the 8.0 database test.&lt;br /&gt;
&lt;br /&gt;
I then used the SQL Compact Server Tools wizard to create a new virtual folder in IIS and when I connected to it &lt;br /&gt;(e.g. “http://&amp;lt;servername&amp;gt;/SSCE351/sqlcesa35.dll?diag”)&lt;br /&gt; the version information was correct and the Reconciler Tests all passed.&lt;br /&gt;
&lt;br /&gt;
I tried my synchronisation again and everything worked properly.&lt;br /&gt;
&lt;br /&gt;
I hope this helps somebody else out there save some time! &lt;img src="http://geekswithblogs.net/LEV/aggbug/129828.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/03/04/getting-sql-compact-3.5-sp1-to-work.aspx</guid>
            <pubDate>Wed, 04 Mar 2009 10:55:05 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129828.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/03/04/getting-sql-compact-3.5-sp1-to-work.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129828.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129828.aspx</trackback:ping>
        </item>
        <item>
            <title>Regex.IsMatch for Compact Framework</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/02/27/regex.ismatch-for-compact-framework.aspx</link>
            <description>A good majority of my work is for mobile applications using the Compact Framework. Something really annoying I came across today was that if I used a variable for the pattern in my Regex then the IsMatch did not work, but if I used a constant then it did.&lt;br /&gt;&lt;br /&gt;

So, for example, if I used:&lt;br /&gt;
string val = "YELLOW";&lt;br /&gt;
string pattern = "(YELLOW)$";&lt;br /&gt;
&lt;br /&gt;
The following statement does not give the correct result (true):&lt;br /&gt;

bool flg1 = Regex.IsMatch("YELLOW", pattern);&lt;br /&gt;&lt;br /&gt;

But the following does:&lt;br /&gt;
bool flg2 = Regex.IsMatch(val, "(YELLOW)$");&lt;br /&gt;&lt;br /&gt;

&lt;br /&gt;

So far I have not found a workaround (e.g. creating a Regex object and trying to use IsMatch using it also does not work if the pattern is from a var), but am investigating... if anybody has a solution then please let me know...
&lt;br /&gt;&lt;br /&gt;

&lt;b&gt;26 March 2009 - Okay, a colleague has finally helped me out with this one. There is a workaround so instead of using the IsMatch, rather return a Match object and then use the Success property to determine if the match was successful. Thanks &lt;a href="http://geekswithblogs.net/MobileLOB/Default.aspx"&gt;Rich&lt;/a&gt;!
&lt;/b&gt;
&lt;br /&gt;&lt;br /&gt;

Solution below:&lt;br /&gt;&lt;br /&gt;

Regex r = new Regex(this.txtPattern.Text), RegexOptions.IgnoreCase);&lt;br /&gt;
bool pass = r.Match(this.txtInput.Text).Success;&lt;br /&gt;
this.txtFeedback.Text = (pass ? "Matched" : "No match");&lt;br /&gt;

 &lt;img src="http://geekswithblogs.net/LEV/aggbug/129720.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/02/27/regex.ismatch-for-compact-framework.aspx</guid>
            <pubDate>Fri, 27 Feb 2009 13:45:04 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129720.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/02/27/regex.ismatch-for-compact-framework.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129720.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129720.aspx</trackback:ping>
        </item>
        <item>
            <title>SELECT COUNT DISTINCT</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/02/25/select-count-distinct.aspx</link>
            <description>I found something really cool with SQL yesterday that I did not think it would do; give me the distinct count of a field.

For example, to calculate the number of payment terms being used for our customers in the UK I can use the following statement:

SELECT COUNT(DISTINCT [Payment Terms Code]) 
FROM [Customer]
WHERE [Country_Region Code]='GB'
 &lt;img src="http://geekswithblogs.net/LEV/aggbug/129669.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/02/25/select-count-distinct.aspx</guid>
            <pubDate>Wed, 25 Feb 2009 10:59:02 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129669.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/02/25/select-count-distinct.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129669.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129669.aspx</trackback:ping>
        </item>
        <item>
            <title>Windows Service Template</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/02/05/template.aspx</link>
            <description>Following on from my previous post, once I had created all the core code that I needed to run my Windows Service application, I decided I had to take it one step further and save the project as a template.&lt;br /&gt;
&lt;br /&gt;

If you have never created your own templates before then you may be missing a trick. They are VERY useful when you find you keep creating the same type of item or project and end up cutting and pasting old code.&lt;br /&gt;
Templates save you this hassle, and they are very easy to create:
&lt;li&gt;Click File/Export Template...&lt;/li&gt;
&lt;li&gt;Follow the wizard...&lt;/li&gt;
&lt;br /&gt;
A template is saved in a ZIP to your documents folder under Visual Studio's templates folder. When you create a new project using the template all the files contained within the template will be copied to your new project, ready to use.&lt;br /&gt;
&lt;br /&gt;

Another nifty feature is that the new project's namespace value will match the name of the project you just created. &lt;img src="http://geekswithblogs.net/LEV/aggbug/129233.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/02/05/template.aspx</guid>
            <pubDate>Thu, 05 Feb 2009 23:17:22 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129233.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/02/05/template.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129233.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129233.aspx</trackback:ping>
        </item>
        <item>
            <title>Debugging Window Service applications</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/02/05/debugging-window-service-applications.aspx</link>
            <description>Here is a neat and simple solution enabling you to develop, test and debug your Windows Service application before you deploy it.&lt;br /&gt;&lt;br /&gt;

&lt;li&gt; When in DEBUG mode run a WinForm application with Start, Pause, Resume and Stop buttons&lt;/li&gt;
&lt;li&gt; When in RELEASE mode run the code as you would your real service.&lt;/li&gt;

&lt;br /&gt;Begin by creating your Windows Service project in Visual Studio 2008.&lt;br /&gt;

&lt;br /&gt;

I decided that the best place to handle the mode detection would be in the program.cs file. Open it and modify it to look similar to the following, and hey presto - you have an easy to debug Windows Service:&lt;br /&gt;&lt;br /&gt;

&lt;pre&gt;
static void Main()
{
#if DEBUG
	System.Windows.Forms.Application.Run(new frmHarness());
#else
	ServiceBase[] ServicesToRun;
	ServicesToRun = new ServiceBase[] 
	{ 
		new Service() 
	};
	ServiceBase.Run(ServicesToRun);
#endif
}
&lt;/pre&gt;


 &lt;img src="http://geekswithblogs.net/LEV/aggbug/129232.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/02/05/debugging-window-service-applications.aspx</guid>
            <pubDate>Thu, 05 Feb 2009 22:56:02 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/129232.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/02/05/debugging-window-service-applications.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/129232.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/129232.aspx</trackback:ping>
        </item>
        <item>
            <title>Using REGEX to find text within brackets or parenthesis</title>
            <link>http://geekswithblogs.net/LEV/archive/2009/01/17/using-regex-to-find-text-within-brackets-or-parenthesis.aspx</link>
            <description>REGEX is not exactly my favorite technology to have to work with, but there are times when it is definitely the right tool for the job. Recently I needed to parse a large text file that contained blocks of information within curly brackets - {}.&lt;br /&gt;&lt;br /&gt;

I found a great solution for the REGEX at:&lt;br /&gt;
&lt;a href="http://blog.stevenlevithan.com/archives/balancing-groups"&gt;http://blog.stevenlevithan.com/archives/balancing-groups&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;

Note that balancing groups is only in the Microsoft REGEX classes... if you are using a different library you may have to follow an alternative, less powerful route where you know the number of levels that may be used:
&lt;a href="http://blog.stevenlevithan.com/archives/regex-recursion"&gt;http://blog.stevenlevithan.com/archives/regex-recursion&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;

KUDOS to Steve...&lt;br /&gt;&lt;br /&gt;

My final solution by the way was:&lt;br /&gt;
@"\{(?&amp;gt;[^{}]+|\{(?&lt;depth&gt;)|\}(?&amp;lt;-Depth&amp;gt;))*(?(Depth)(?!))\}"&lt;/depth&gt; &lt;img src="http://geekswithblogs.net/LEV/aggbug/128758.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>LEV</dc:creator>
            <guid>http://geekswithblogs.net/LEV/archive/2009/01/17/using-regex-to-find-text-within-brackets-or-parenthesis.aspx</guid>
            <pubDate>Sat, 17 Jan 2009 23:05:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/LEV/comments/128758.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/LEV/archive/2009/01/17/using-regex-to-find-text-within-brackets-or-parenthesis.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/LEV/comments/commentRss/128758.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/LEV/services/trackbacks/128758.aspx</trackback:ping>
        </item>
    </channel>
</rss>
