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

<channel>
	<title>novolocus.com &#187; 2006 &#187; November</title>
	<atom:link href="http://www.novolocus.com/2006/11/feed" rel="self" type="application/rss+xml" />
	<link>http://www.novolocus.com</link>
	<description>Whatever Andy Burns is working on...</description>
	<pubDate>Mon, 05 Jan 2009 16:14:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Interesting article &#34;WSS 3.0s suboptimal support for anonymous access scenarios&#34;</title>
		<link>http://www.novolocus.com/2006/11/30/interesting-article-wss-30s-suboptimal-support-for-anonymous-access-scenarios/</link>
		<comments>http://www.novolocus.com/2006/11/30/interesting-article-wss-30s-suboptimal-support-for-anonymous-access-scenarios/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 11:11:35 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Architecture]]></category>

		<category><![CDATA[Web Content Management]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=119</guid>
		<description><![CDATA[Funny, I heard about a similar thing at the SharePoint UK user group meetings, and it didn&#8217;t sound very hard. This article suggests it is harder than I thought. Shame - I&#8217;ll have to do something similar to this shortly&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Funny, I heard about a similar thing at the <a href="http://suguk.org/">SharePoint UK user group</a> meetings, and it didn&#8217;t sound very hard. <a href="http://blogs.technet.com/lliu/archive/2006/10/14/wss-3-0-s-suboptimal-support-for-anonymous-access-scenarios.aspx">This article</a> suggests it is harder than I thought. Shame - I&#8217;ll have to do something similar to this shortly&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/30/interesting-article-wss-30s-suboptimal-support-for-anonymous-access-scenarios/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Accessibility Guidelines</title>
		<link>http://www.novolocus.com/2006/11/30/accessibility-guidelines/</link>
		<comments>http://www.novolocus.com/2006/11/30/accessibility-guidelines/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 11:11:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[HTML &amp; Web]]></category>

		<category><![CDATA[Accessibility]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=120</guid>
		<description><![CDATA[Yeah, not exciting, but a reminder to myself of the W3C accessibility guidelines at WAI (Web Accessibility Initiative).
Also, the Cabinet office guidelines.
]]></description>
			<content:encoded><![CDATA[<p>Yeah, not exciting, but a reminder to myself of the <a href="http://www.w3.org/WAI/">W3C accessibility guidelines</a> at WAI (Web Accessibility Initiative).</p>
<p>Also, the <a href="http://www.cabinetoffice.gov.uk/e-government/resources/handbook/html/2-4.asp">Cabinet office guidelines</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/30/accessibility-guidelines/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting special folders in C#</title>
		<link>http://www.novolocus.com/2006/11/29/getting-special-folders-in-c/</link>
		<comments>http://www.novolocus.com/2006/11/29/getting-special-folders-in-c/#comments</comments>
		<pubDate>Wed, 29 Nov 2006 11:11:44 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=121</guid>
		<description><![CDATA[Note to self - how to get the path to &#8220;My Documents&#8221; in c sharp.
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
Doesn&#8217;t have a trailing slash.
]]></description>
			<content:encoded><![CDATA[<p>Note to self - how to get the path to &#8220;My Documents&#8221; in c sharp.</p>
<p><code>Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)</code></p>
<p>Doesn&#8217;t have a trailing slash.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/29/getting-special-folders-in-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What the hell are the System.Drawing.Color predefined Colors?</title>
		<link>http://www.novolocus.com/2006/11/28/what-the-hell-are-the-systemdrawingcolor-predefined-colors/</link>
		<comments>http://www.novolocus.com/2006/11/28/what-the-hell-are-the-systemdrawingcolor-predefined-colors/#comments</comments>
		<pubDate>Tue, 28 Nov 2006 12:11:37 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Graphics, Design and UI]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=122</guid>
		<description><![CDATA[The .NET framework has a number of predefined colours in the System.Drawing.Color class. You &#8216;d think this would be easy to iterate over - after all, there&#8217;s quite a lot of them. I can see that that would be useful for, say, drawing palettes.
Well it ain&#8217;t easy. They&#8217;re not an enumeration, so you can&#8217;t iterate [...]]]></description>
			<content:encoded><![CDATA[<p>The .NET framework has a number of predefined colours in the System.Drawing.Color class. You &#8216;d think this would be easy to iterate over - after all, there&#8217;s quite a lot of them. I can see that that would be useful for, say, drawing palettes.</p>
<p>Well it ain&#8217;t easy. They&#8217;re not an enumeration, so you can&#8217;t iterate over them. Instead, to get a list of the colours, you&#8217;ve got to do something like:</p>
<p><code>List&lt;Color&gt; colorList = new List&lt;Color&gt;();</code></p>
<p>Array colorsArray = Enum.GetValues(typeof(KnownColor));<br />
KnownColor[] allKnownColors = new KnownColor[colorsArray.Length];<br />
Array.Copy(colorsArray, allKnownColors, colorsArray.Length);</p>
<p>foreach (KnownColor c in allKnownColors) {<br />
Color col = Color.FromKnownColor(c);<br />
if(( col.IsSystemColor == false) &amp;&amp; (col.A &gt; 0)) {<br />
colorList.Add(col);<br />
}<br />
}<br />
That&#8217;s a lot of work for something obvious like iterating over colours!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/28/what-the-hell-are-the-systemdrawingcolor-predefined-colors/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Two interesting articles about analysis</title>
		<link>http://www.novolocus.com/2006/11/27/two-interesting-articles-about-analysis/</link>
		<comments>http://www.novolocus.com/2006/11/27/two-interesting-articles-about-analysis/#comments</comments>
		<pubDate>Mon, 27 Nov 2006 14:11:52 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=123</guid>
		<description><![CDATA[Two fascinating articles. I agree with Marcus Ranum, it is interesting how in Feynman&#8217;s &#8220;Personal observations on the reliability of the shuttle&#8221; highlights the good quality of the software. Given how software is usually so bad, how did this happen? Well, it seems that NASA recognised that testing is expensive and hard, and that &#8216;have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ranum.com/editorials/must-read/index.html">Two fascinating articles</a>. I agree with Marcus Ranum, it is interesting how in Feynman&#8217;s <a href="http://science.ksc.nasa.gov/shuttle/missions/51-l/docs/rogers-commission/Appendix-F.txt">&#8220;Personal observations on the reliability of the shuttle&#8221;</a> highlights the good quality of the software. Given how software is usually so bad, how did this happen? Well, it seems that NASA recognised that testing is expensive and hard, and that &#8216;have you tried rebooting&#8217; is not an adequate answer to a problem. Good testing takes time, money and aggressive pursuit of something better than &#8216;good enough&#8217;.</p>
<p>Those boys at NASA clearly understand software testing. After all, it ain&#8217;t rocket science.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/27/two-interesting-articles-about-analysis/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Software Time Estimates</title>
		<link>http://www.novolocus.com/2006/11/23/software-time-estimates/</link>
		<comments>http://www.novolocus.com/2006/11/23/software-time-estimates/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 10:11:39 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=124</guid>
		<description><![CDATA[Control is a closed loop process.
You have some input, something happens, you look at the output and adjust your input again. This is implicit in quality procedures everywhere. This is what testing is.
Over the last few days I&#8217;ve been asked to estimate how long various bits of work for a potential customer will take. I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Control is a closed loop process.</p>
<p>You have some input, something happens, you look at the output and adjust your input again. This is implicit in quality procedures everywhere. This is what testing is.</p>
<p>Over the last few days I&#8217;ve been asked to estimate how long various bits of work for a potential customer will take. I&#8217;ve tried to make good estimates, but the truth is that <em>I have never seen a comparison of how long was estimated at the beginning of a project, and how long was actually taken.</em></p>
<p>In other words, I still only have my gut feeling, my perceptions, to guide me as to how accurate I think my estimates are, despite the fact that this is a clearly measurable metric. The control loop is still open.</p>
<p>At the moment I provide estimates like &#8220;I think it&#8217;ll take about 10 days, but I&#8217;m not really very sure&#8221;. Wouldn&#8217;t it be better to know &#8220;Andy normally under estimates by and average of 10%, with a standard deviation of 10%&#8221;.  Then if, for example, I estimated 10 days, we&#8217;d know that it&#8217;d actually 10-12 days, but only 68% of the time, or 9-13 days 96% of the time.</p>
<p>Perhaps this exercise is performed at a management level already - but as the developers are being the ones asked to estimate for technical details, it&#8217;s us that need our accuracy fed back for those aspects.</p>
<p>Now, I realise that there&#8217;s always going to be a human aspect to providing an estimate, that projects often aren&#8217;t that clear and easy to cut up, and that often we&#8217;re working with new things that we simply aren&#8217;t sure about. There&#8217;s also a cost-benefit question as to the effort in feeding back accuracy data. But I think that there are broad trends we should be able pull out.</p>
<p>I guess what I&#8217;m thinking is that we should have a process for optimising our estimates. I guess that this would involve examining statistical methodology. The best we&#8217;ve got at the moment is an informal &#8220;well that look longer/less time than I thought&#8221; after we&#8217;ve completed some work - and over projects that can span years, you just lose track.</p>
<p>It does strike me that it should be straight-forward to collate this data, and then feed it back at the end of the project. Close the loop. Regain some control.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/23/software-time-estimates/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Logging, the .NET Framework, and why I used Log4NET</title>
		<link>http://www.novolocus.com/2006/11/23/logging-the-net-framework-and-why-i-used-log4net/</link>
		<comments>http://www.novolocus.com/2006/11/23/logging-the-net-framework-and-why-i-used-log4net/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 10:11:17 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=125</guid>
		<description><![CDATA[So recently I&#8217;ve had a need to do quite a lot of logging. Moreover, I needed the logging I was doing to be very flexible. I&#8217;m kind of new to .NET, and so I found myself learning about the &#8216;Debugging&#8217; and &#8216;Tracing&#8217; in it. (Incidently, WTF - they couldn&#8217;t call it &#8216;Logging&#8217;? Presumably, this is [...]]]></description>
			<content:encoded><![CDATA[<p>So recently I&#8217;ve had a need to do quite a lot of logging. Moreover, I needed the logging I was doing to be very flexible. I&#8217;m kind of new to .NET, and so I found myself learning about the &#8216;Debugging&#8217; and &#8216;Tracing&#8217; in it. (Incidently, WTF - they couldn&#8217;t call it &#8216;Logging&#8217;? Presumably, this is &#8216;cos Java has a &#8216;Logging&#8217; api).</p>
<p>Long story short, .NET&#8217;s built in logging wasn&#8217;t bad, but the <a href="http://logging.apache.org/log4net/">Log4NET project</a> proved a lot better.<span id="more-125"></span></p>
<p><strong><u>Within the .NET Framework</u></strong></p>
<p>.NET has some classes for doing this - Debug and Trace. They work, and you can configure trace listeners and such. However, writing code to send a debug message only if the logging level is detailed enough is, well, clumsy.</p>
<p>Debug and Trace are pretty much equivalent, except that Debug is not compiled into &#8216;Release&#8217; builds. They have methods like the following:</p>
<p><code>Debug.WriteLine ( string )<br />
Debug.WriteLineIf ( bool condition, string )<br />
Debug.Assert ( bool condition, string message)</code></p>
<p>In addition, Trace has things like:</p>
<p><code>Trace.TraceInformation ( string )<br />
Trace.TraceWarning ( string )<br />
Trace.TraceError ( string )</code></p>
<p>It&#8217;s worth noting that none of these Trace methods have an &#8216;if&#8217; equivalent to &#8216;WriteLineIf&#8217;, and that the Debug class can&#8217;t output different &#8216;levels&#8217; of debug message.</p>
<p>Trace also works with a TraceSwitch class. This allows you to switch levels of logging used, and can be configured through the application config. E.g., this adds a listener to output to the Console:</p>
<p><code>&lt;configuration&gt;<br />
&lt;system.diagnostics&gt;<br />
&lt;trace autoflush="false" indentsize="4"&gt;<br />
&lt;listeners&gt;<br />
&lt;add name="configConsoleListener" type="System.Diagnostics.ConsoleTraceListener" /&gt;<br />
&lt;/listeners&gt;<br />
&lt;/trace&gt;<br />
&lt;/system.diagnostics&gt;<br />
&lt;/configuration&gt;</code></p>
<p>Similarly, TraceSwitches logging levels can be set in this file. The problem with them is, though, that you have to make sure you test the logging level before you call the Trace.TraceInformation style methods. For example:</p>
<p><code>            TraceSwitch sw = new TraceSwitch("General", "Whole App");<br />
sw.Level = TraceLevel.Error;<br />
if (sw.TraceError )<br />
Trace.WriteLine("Error1");</p>
<p>if (sw.TraceWarning)<br />
Trace.WriteLine("Warning1");</p>
<p>if (sw.TraceInfo )<br />
Trace.WriteLine("Info1");</p>
<p>Trace.TraceError("Error2");<br />
Trace.TraceWarning("Warning2");<br />
Trace.TraceInformation("Info2");</code></p>
<p>Produces:</p>
<p><code>            Error1<br />
TraceTest.vshost.exe Error: 0 : Error2<br />
TraceTest.vshost.exe Warning: 0 : Warning2<br />
TraceTest.vshost.exe Information: 0 : Info2</code></p>
<p>In other words, Trace.TraceXXX methods don&#8217;t obey a global logging level.</p>
<p>The final component in the .NET logging are TraceListeners. These listen to Trace or Debug messages, and log them somewhere. Examples that are built in include the Console, a text file, an XML file, and the Windows Event Log. You can have many TraceListeners, but I didn&#8217;t see a way of having different listeners recording different levels of information (e.g. Errors to the event log, but all messages to an XML file).</p>
<p>I wanted to log to the Windows Event Log. Specifically, I wanted to create Warning and Error messages in the event log, but it turns out that the .NET EventLogTraceListener only ever creates items as &#8216;Information&#8217; messages (i.e. messages with the wrong icon). That kind of sucked.</p>
<p><strong><u>Log4NET Logging Framework</u></strong></p>
<p>So I looked at <a href="http://logging.apache.org/log4net/">Log4NET</a>. This is an Apache project, which was originally to build a Java Logging API. Java now has a Logging API, which works in a suspiciously similar way. Anyway, .NET also lacked good logging, so they ported the project to .NET.</p>
<p>Log4NET still has a number of nice features - it&#8217;s much more configurable, supports having different levels of logging, and has more ways of outputting your logged messages (including the RollingFileAppender, which is a nice touch). To use it isn&#8217;t very hard, although the documentation doesn&#8217;t make this terribly clear.</p>
<p>In Log4Net you can define many loggers. These loggers are named, usually the fully specified name of the class that they apply to (e.g. Ford.Vehicles.Cars.FocusSport), though that is not necessarily the case.</p>
<p>They exist in a kind of hierarchy. There is a Root logger, which applies to the whole application, and then loggers inherit from their &#8216;parent&#8217;. For instance, if a log was specified for &#8220;Ford.Vehicles&#8221;, then &#8220;Ford.Vehicles.Cars&#8221; would inherit it&#8217;s logging settings - although it could override them. This is why the fully specified class name is normally used - conveniently, it forms this hierarchy.</p>
<p>Anyway, in your application you create a logger. When you use this to log messages, the logger passes the message to any appenders attached to it. They control recording the message to whatever output they were designed for. Sometimes you may have formatters to control what the output looks like.</p>
<p>Enough of that, how does this work?</p>
<p>Okay, the quickstart.</p>
<p>1)  Add the Log4NET.dll into your project as a reference. (You&#8217;ll have to deploy this DLL when you install your final application).</p>
<p>2)  In your &#8216;main&#8217; class, add the following tag just above the namespace:</p>
<p><code>        [assembly: log4net.Config.XmlConfigurator(Watch = true)]</code></p>
<p>This tells the logging framework to &#8216;watch&#8217; the config file. It will then pick up any changes to logging levels, etc., as they happen (rather than having to restart).</p>
<p>3)  In the class you want to put logging in, create a logger object:</p>
<p><code>    log4net.ILog log =  log4net.LogManager.GetLogger(<br />
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType ); </code></p>
<p>This line uses reflection to get the full class name of the class it is in automatically, which is nice - it makes it a cut and paste operation.</p>
<p>4)  Make your logging calls in your code:</p>
<p><code>        log.Fatal("There has been an exception");</code></p>
<p>5)  In your App.config files add a new Configuration Section:</p>
<p><code>        &lt;configSections &gt;<br />
&lt;section name="log4net" type="System.Configuration.IgnoreSectionHandler" /&gt;<br />
&lt;/configSections&gt;</code></p>
<p>6)  Finally, configure your appenders, loggers, etc.. See http://logging.apache.org/log4net/ for more details, but my example is:</p>
<p><code>  &lt;log4net&gt;<br />
&lt;!-- Define some output appenders --&gt;<br />
&lt;appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"&gt;<br />
&lt;threshold value="Warn" /&gt;<br />
&lt;ApplicationName value="Invoice Email Notifier" /&gt;<br />
&lt;LogName value="Deltascheme Notification Mailer Service" /&gt;<br />
&lt;layout type="log4net.Layout.PatternLayout"&gt;<br />
&lt;conversionPattern value="%date [%thread] %-5level %logger - %message%newline&#8221; /&gt;<br />
&lt;/layout&gt;<br />
&lt;/appender&gt;</p>
<p>&lt;appender name=&#8221;RollingLogFileAppender&#8221; type=&#8221;log4net.Appender.RollingFileAppender&#8221;&gt;<br />
&lt;file value=&#8221;debug.txt&#8221; /&gt;<br />
&lt;appendToFile value=&#8221;true&#8221; /&gt;<br />
&lt;datePattern value=&#8221;yyyyMMdd&#8221; /&gt;<br />
&lt;rollingStyle value=&#8221;Size&#8221; /&gt;<br />
&lt;maximumFileSize value=&#8221;1MB&#8221; /&gt;<br />
&lt;filter type=&#8221;log4net.Filter.LevelRangeFilter&#8221;&gt;<br />
&lt;acceptOnMatch value=&#8221;true&#8221; /&gt;<br />
&lt;levelMin value=&#8221;INFO&#8221; /&gt;<br />
&lt;levelMax value=&#8221;WARN&#8221; /&gt;<br />
&lt;/filter&gt;<br />
&lt;layout type=&#8221;log4net.Layout.PatternLayout&#8221;&gt;<br />
&lt;conversionPattern value=&#8221;%-5p %d %-35.35c{1} %-27.27M - %m%n&#8221; /&gt;<br />
&lt;/layout&gt;<br />
&lt;/appender&gt;</p>
<p>&lt;!&#8211; Setup the root category, add the appenders and set the default level &#8211;&gt;<br />
&lt;root&gt;<br />
&lt;level value=&#8221;ALL&#8221; /&gt;<br />
&lt;appender-ref ref=&#8221;EventLogAppender&#8221; /&gt;<br />
&lt;appender-ref ref=&#8221;RollingLogFileAppender&#8221; /&gt;<br />
&lt;/root&gt;</p>
<p>&lt;/log4net&gt;</code></p>
<p>This defines a Root logger (which logs everything), and adds two appenders to it. One appender only records Warning, Error or Fatal messages, which it puts into the Windows Event Log. The other appender writes to a log file called &#8216;debug.txt&#8217;. This log file is limited to 1Mb in size, after which old records are pushed off the end of the file (which is a nice feature). It also has a filter, and will only record messages that are Information or Warning messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/23/logging-the-net-framework-and-why-i-used-log4net/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Code Access Security when programing Windows Services in .Net</title>
		<link>http://www.novolocus.com/2006/11/23/code-access-security-when-programing-windows-services-in-net/</link>
		<comments>http://www.novolocus.com/2006/11/23/code-access-security-when-programing-windows-services-in-net/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 09:11:24 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=126</guid>
		<description><![CDATA[So, I&#8217;ve been bad about blogging for a while - busy as at work trying to learn things. Anyhoo, I&#8217;ve been writing a Windows Service using the .NET framework&#8217;s ServiceBase class, and I found something interesting when I tried to add Code Access Security (CAS) to it.
My service connects to a SharePoint 2007 service every [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been bad about blogging for a while - busy as at work trying to learn things. Anyhoo, I&#8217;ve been writing a Windows Service using the .NET framework&#8217;s ServiceBase class, and I found something interesting when I tried to add Code Access Security (CAS) to it.</p>
<p>My service connects to a SharePoint 2007 service every so often, queries a List, sends a few emails, and logs some information. The main additional assemblies it uses are Microsoft.SharePoint and Log4NET for the SharePoint and Logging parts respectively.</p>
<p>I tried adding CAS like so:</p>
<p><code>[assembly: FileIOPermission(SecurityAction.RequestOptional,Unrestricted=true)]</code></p>
<p>I knew I&#8217;d need other permissions, and that I definitely wanted this one; my plan was that as RequestOptional would cause all other permissions not requested by RequestOptional or RequestMinimum to be denied, I would get permissions errors. I&#8217;d then work my way through my code, adding the minimum set of permissions I required.</p>
<p>What I got was the security exception &#8220;That assembly does not allow partially trusted callers&#8221;. This wasn&#8217;t the failed permission that I&#8217;d expected, but that one of the assemblies couldn&#8217;t be called as from a partially trusted assembly (which my assembly was, as soon as I started added CAS).</p>
<p>I was surprised. I didn&#8217;t think that the SharePoint or Log4NET dlls would complain about being called from a partially trusted context. At the suggestion of Dominick Baier on Google groups, I used the Lutz Reflector to look inside the assemblies, and checked for the [AllowPartiallyTrustedCallers] attribute.</p>
<p>Both the Log4NET and SharePoint DLLs had this attribute. So they weren&#8217;t causing the exception. Then I tried the System.ServiceProcess dll, which contains the ServiceBase class I was subclassing. <em>Tada!</em> It didn&#8217;t allow partially trusted callers. Thus, when my code was run, naturally, it made calls of it&#8217;s parent class. That parent class existed in an assembly that I couldn&#8217;t access from a partially trusted context.</p>
<p>I guess that makes sense - I mean, quite when would you want something to interact with your services from a partially trusted position? They&#8217;re a bit, well, important for that.</p>
<p>Guess I won&#8217;t be applying CAS that way. Probably don&#8217;t have to, then. If my code can only be called from a Full Trust context, why would an attacker have to abuse my code? Their app would be fully trusted too - it could abuse the machine directly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/23/code-access-security-when-programing-windows-services-in-net/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making VMs faster in VMWare</title>
		<link>http://www.novolocus.com/2006/11/10/making-vms-faster-in-vmware/</link>
		<comments>http://www.novolocus.com/2006/11/10/making-vms-faster-in-vmware/#comments</comments>
		<pubDate>Fri, 10 Nov 2006 14:11:02 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=127</guid>
		<description><![CDATA[A tip from a colleague - to prevent VMs swapping memory to disk (to reduce the VM&#8217;s own footprint) add the falling line to the bottom of the VMX file.
mainMem.useNamedFile = "FALSE"
I make no claims about it&#8217;s safety - but it did seem to stop the disk thrashing. That normally happened a bit - even [...]]]></description>
			<content:encoded><![CDATA[<p>A tip from a colleague - to prevent VMs swapping memory to disk (to reduce the VM&#8217;s own footprint) add the falling line to the bottom of the VMX file.</p>
<p><code>mainMem.useNamedFile = "FALSE"</code></p>
<p>I make no claims about it&#8217;s safety - but it did seem to stop the disk thrashing. That normally happened a bit - even when I had plenty of memory free.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/10/making-vms-faster-in-vmware/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Stop VMs beeping</title>
		<link>http://www.novolocus.com/2006/11/09/stop-vms-beeping/</link>
		<comments>http://www.novolocus.com/2006/11/09/stop-vms-beeping/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 10:11:54 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=128</guid>
		<description><![CDATA[Another tip I always forget - found here.
C:\sc config beep start= disabled 
Be sure to leave a space between the equals (=) sign and the word
]]></description>
			<content:encoded><![CDATA[<p>Another tip I always forget - found <a href="http://geekswithblogs.net/sbargelt/archive/2006/06/01/80332.aspx">here</a>.</p>
<p><code>C:\sc config beep start= disabled </code></p>
<p>Be sure to leave a space between the equals (=) sign and the word</p>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/09/stop-vms-beeping/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Because I always forget how Unicode really works&#8230;</title>
		<link>http://www.novolocus.com/2006/11/07/because-i-always-forget-how-unicode-really-works/</link>
		<comments>http://www.novolocus.com/2006/11/07/because-i-always-forget-how-unicode-really-works/#comments</comments>
		<pubDate>Tue, 07 Nov 2006 14:11:05 +0000</pubDate>
		<dc:creator>Andy</dc:creator>
		
		<category><![CDATA[Coding]]></category>

		<category><![CDATA[Languages]]></category>

		<guid isPermaLink="false">http://www.novolocus.com/?p=129</guid>
		<description><![CDATA[Some notes from work, where I had to summarise what Unicode really is (no, not &#8216;just two bytes per character&#8217;&#8230;). Mostly just copied from Wikipedia, though with some of the gory details removed.
Unicode defines a &#8216;code page&#8217;. I think of this as a &#8216;character space&#8217;, although this isn&#8217;t quite right. Anyway, the point is, Unicode [...]]]></description>
			<content:encoded><![CDATA[<p>Some notes from work, where I had to summarise what Unicode really is (no, not &#8216;just two bytes per character&#8217;&#8230;). Mostly just copied from Wikipedia, though with some of the gory details removed.<span id="more-129"></span></p>
<p>Unicode defines a &#8216;code page&#8217;. I think of this as a &#8216;character space&#8217;, although this isn&#8217;t quite right. Anyway, the point is, Unicode is the set of things which, ultimately, will be displayed.</p>
<p>The encodings are ways of having a bunch of bytes reference one of the points in the code page. They do have different properties. UTF-16 and UTF-8 are the most widely used, and I&#8217;d suggest always using UTF-8 unless you&#8217;ve got a reason to do otherwise.</p>
<p><strong><a href="http://en.wikipedia.org/wiki/UTF-16/UCS-2">UTF-16</a></strong></p>
<p>This encoding uses 16 bits per character for characters within the Basic Multilingual Plane(BMP). For characters in other planes, it uses a second 16 bit word (called a surrogate pair), but as we don&#8217;t use characters outside the BMP (it&#8217;s rare we go outside basic Latin) we don&#8217;t normally see this. Incidentally, it&#8217;s this encoding that makes developers often think that Unicode means 2 bytes per character; that&#8217;s not necessarily the case.</p>
<p><strong>UTF-16 Big Endian, Little Endian </strong></p>
<p>Big Endian and Little Endian define the bit order of these 2 words in the encoding. Apparently, this is for performance reasons on different processors.</p>
<p><em>&#8220;Is UTF-16 Big or Little Endian if you don&#8217;t specify it?&#8221;</em></p>
<p>Both. The UTF-16 (and UCS-2) encoding scheme allows either endian representation to be used, but mandates that the byte order should be explicitly indicated by prepending a Byte Order Mark before the first serialized character. This BOM is the encoded version of the Zero-Width No-Break Space (ZWNBSP) character, codepoint U+FEFF, chosen because it should never legitimately appear at the beginning of any character data. This results in the byte sequence FE FF (in hexadecimal) for big-endian architectures, or FF FE for little-endian. The BOM at the beginning of a UTF-16 or UCS-2 encoded data is considered to be a signature separate from the text itself; it is for the benefit of the decoder. Technically, with the UTF-16 scheme the BOM prefix is optional, but omitting it is not recommended as UTF-16LE or UTF-16BE should be used instead. If the BOM is missing, baring any indication of byte order from higher-level protocols, big endian is to be used or assumed. The BOM is not optional in the UCS-2 scheme.</p>
<p>The UTF-16BE and UTF-16LE encoding schemes (and correspondingly UCS-2BE and UCS-2LE) are similar to the UTF-16 (or UCS-2) encoding scheme. However rather than using a BOM prepended to the data, the byte order used is implicit in the name of the encoding scheme (LE for little-endian, BE for big-endian). Since a BOM is specifically not to be prepended in these schemes, if an encoded ZWNBSP character is found at the beginning of any data encoded by these schemes is not to be considered to be a BOM, but instead is considered part of the text itself. In practice most software will ignore these &#8220;accidental&#8221; BOMs.</p>
<p><strong>UCS-2</strong></p>
<p>Predecessor to UTF-16, it is identical except that it doesn&#8217;t have surrogate pairs. Therefore, it can only encode characters in the BMP.</p>
<p><strong><a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a></strong></p>
<p>A variable-length character encoding for Unicode. While it can represent any Unicode character, the main benefit is that the binary codes for UTF-8 and ASCII are the same (requiring little or no change for software that handles ASCII but preserves other values). For these reasons, it is steadily becoming the preferred encoding for email, web pages, and other places where characters are stored or streamed. It uses 1 to 4 bytes per character.</p>
<p><strong><a href="http://en.wikipedia.org/wiki/UTF-32/UCS-4">UTF-32 or UCS-4</a></strong></p>
<p>A full 4-byte encoding for Unicode. It has the advantage that it is simple, as it isn&#8217;t variable length per character. However, it is very inefficient, as characters outside the BMP are rarely used. For us, what with all the Latin characters that we use, it would add 3 unnecessary bytes per character. UCS-4 is a similar encoding with a slightly larger code page - but the extra space is reserved. Therefore, we can assume that UCS-4 and UTF-32 are the same.</p>
<p><strong>UTF-7</strong></p>
<p>UTF-7 (7-bit Unicode Transformation Format) is a variable-length character encoding that was proposed for representing Unicode-encoded text using a stream of ASCII characters, for example for use in Internet e-mail messages.</p>
<p>The basic Internet e-mail standard SMTP specifies that the transmission format is US-ASCII and does not allow byte values above the ASCII range. MIME provides a way to specify the character set allowing for use of other character sets including UTF-8 and UTF-16. However the underlying transmission infrastructure is still not guaranteed to be 8-bit clean and therefore content transfer encodings (e.g. base64) have to be used with them.</p>
<p><strong>CESU-8</strong></p>
<p>CESU-8 is a variant of UTF-8.It is similar to Java&#8217;s Modified UTF-8 but does not have the special encoding of the NUL character (U+0000). Like Modified UTF-8, it can be decoded into one UTF-16 word at a time. Because it doesn&#8217;t have special treatment of NUL, the resulting string will not be safe for NUL-terminated string handling if the original string contained NUL characters.</p>
<p>In practice, CESU-8 is often used to communicate with the Oracle database software, which in modern configurations apparently uses UTF-16 as an internal character representation. Oracle&#8217;s &#8220;UTF-8&#8243; (actually CESU-8) codec rejects proper UTF-8 sequences for characters from outside the Basic Multilingual Plane, but happily accepts and generates technically invalid UTF-8 sequences for code points in the surrogate range (U+D800 .. U+DFFF), as specified in CESU-8.</p>
<p>Other Definitions:</p>
<p><strong>BOM - Byte Order Mark</strong></p>
<p>The character at code point U+FEFF (&#8221;zero-width no-break space&#8221;), when that character is used to denote the endianness of a string of UCS/Unicode characters encoded in UTF-16 or UTF-32 and/or as a marker to indicate that text is encoded in UTF-8, UTF-16 or UTF-32.</p>
<p>In most encodings the BOM is a sequence which is unlikely to be seen in more conventional encodings or other Unicode encodings (usually looking like a sequence of obscure control codes). If a BOM is misinterpreted as an actual character within the text then it will generally be invisible due to the fact it is a zero-width no-break space. The &#8220;zero-width no-break space&#8221; semantics of the U+FEFF character has been deprecated in Unicode 3.2, allowing it to be used solely with the semantic of BOM.</p>
<p><strong>BMP - <a href="http://en.wikipedia.org/wiki/Basic_Multilingual_Plane#Basic_Multilingual_Plane">Basic Multilingual Plane</a></strong></p>
<p>The Unicode code space for characters is divided into 17 planes, each with 65,536 code points, although currently only a few planes are used:</p>
<ul>
<li>Plane 0 (0000</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.novolocus.com/2006/11/07/because-i-always-forget-how-unicode-really-works/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
