“Do what you should do,
when you should do it,
whether you feel like it or not.” Thomas Huxley
Busy or productive…
Being busy does not always mean real work. The object of all work is production or accomplishment and to either of these ends there must be forethought, system, planning, intelligence, and honest purpose, as well as perspiration. Seeming to do is not doing. Thomas A. Edison
SecurityException / IIS .Net Trust Levels / Diagnostic Traces
This dasBlog website is now being hosted at WinHost. In reality, the migration was trivial. Using IIS Manager, there is an option under Deploy to “Export Application…”which saves the entire site to a .zip file. And then after connecting to the new site, one simply runs “Import Application…” and points to the saved .zip file—simple and easy. Except that when navigating to the new site, one is greeted with an unfriendly:
Server Error in ‘/’ Application.
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application’s trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the permission of type ‘System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed.
Source Error:
[No relevant source lines]
plus the detailed call stack…
The quick and dirty fix was to change the .Net Trust Level from High to Internal.
However, this just didn’t feel safe and after doing some searching on the web I found this great post on Useless Inc. It appears that something in the process modified the web.config to add diagnostic tracing for OpenID. Just as Tomer Gabel did, I removed this section from the web.config
<!-- <system.diagnostics> <assert assertuienabled="false"/> <switches> <add name="OpenID" value="4"/> </switches> <trace autoflush="true" indentsize="4"> <listeners> <add name="fileLogger" type="System.Diagnostics.TextWriterTraceListener" initializeData="openidConsumerTrace.txt" traceOutputOptions="None"/> </listeners> </trace> </system.diagnostics> -->
and set the trace to false:
<trace enabled=“false” writeToDiagnosticsTrace=“true” requestLimit=“1000” pageOutput=“false” traceMode=“SortByTime” localOnly=“false” />
and now this site is happily running…
From the book by Geoffrey James
Thus spake the Master Programmer:
“A well-written program is its own heaven;
a poorly-written program is its own hell.”
Microsoft’s support site solved WP7 error 801812DD
While I find it amazing that the USB cable needs to be directly connected to the port on the back of the computer to upgrade to the March 2011 release of the Windows Phone 7 operating system, at least the support page from Microsoft provided useful information:
Now I can happily search the app store, I mean marketplace.
Windows Phone 7 February (and March) 2011 Update from AT&T
Extension methods in C#
Wikipedia has a very good overview of extension methods in C# here.
Basically, if you create a static method in a static class and the first parameter includes the keyword ‘this’ then the first parameter will be the calling object and you’ve created an extension method.
Here is a quick example console application (based on the example from Wikipedia):
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("abcdefg".ExtReverse()); Console.ReadLine(); } } public static class ExampleExtension { public static string ExtReverse(this string input) { char[] chars = input.ToCharArray(); Array.Reverse(chars); return new String(chars); } } }
Uppercase vs. UpperCase
XamlParseException occurred:
The property ‘VerticalGridlinesBrush’ was not found in type ‘System.Windows.Controls.DataGrid’. [Line: 19 Position: 30]
Took me 30 minutes to see that
<Setter Property="VerticalGridlinesBrush">
<Setter.Value>
<SolidColorBrush Color="#FFACACAC"/>
</Setter.Value>
</Setter>
should be
<Setter Property="VerticalGridLinesBrush">
<Setter.Value>
<SolidColorBrush Color="#FFACACAC"/>
</Setter.Value>
</Setter>
Next time I need to hit ctrl+space sooner…
devenv.exe.config
While trying to compile a demo Silverlight application, I ran into this build error:
System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
The link above provided by Visual Studio is only marginally helpful. Luckily there is stack overflow which had this question/answer: http://stackoverflow.com/questions/1823339/error-building-visual-studio-2010-silverlight-4-projects-on-windows-7-with-xp-mod
The location of my devenv.exe.config is C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Sometimes I think Microsoft went overboard with safe computing.
Samsung Focus Windows Phone 7 (WP7) using AT&T

My Samsung Focus came in the mail today to replace the old iPhone 3G I was trying to use. I say trying because with each OS release my old iPhone would get slower and slower. While the iPhone 4 looks like an improvement over the 3G (click here for the apple comparison), I like the idea of using Silverlight and XNA for phone development.
While I love the phone and WP7, getting it working had some hiccups. First upgrading from the iPhone to the Focus wiped my voice mails and I had to call AT&T support to setup voicemail. That said, the AT&T service was very good. Next, I found it impossible to change the Xbox live account without doing a factory reset. It took the first Live account I used and made that the default, and there appears to be no way to set a different account as an Xbox live default. After that, I managed get into a state where the Zune music player would not launch (turning the phone on/off fixed that). And finally, the first application I tried to buy gave me a strange error code; yet, when I tried again a few hours later, everything work.
And yes, despite these snafu’s the phone is great. Why? I’ll save that for another post.
In the mean time, for a good comparison of WP7 devices, check out ElektricForest’s chart.






