<?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:rssdatehelper="urn:rssdatehelper"><channel><title>James Sperring</title><link>http://www.jsperring.co.uk</link><pubDate>2011-12-12T10:35:50</pubDate><generator>umbraco</generator><description>Forever in beta</description><language>en</language><item><title>PowerShell 32/64bit Execution Policies</title><link>http://www.jsperring.co.uk/2011/12/9/powershell-3264bit-execution-policies.aspx</link><pubDate>Fri, 09 Dec 2011 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2011/12/9/powershell-3264bit-execution-policies.aspx</guid><description><![CDATA[ 
<p>When it comes to bit-ness of an application, there's generally
only 2 things you need to worry about:</p>

<p>Am I running the right version for the OS?<br />
 Are all the components compatible with the same version?</p>

<p>I don't think I've come across any instances of configuration
settings being applied differently to different versions of the
same application. But PowerShell is different.</p>

<p>When managing environment settings such as Execution Policies in
PowerShell, the settings actually need to be changed for the right
version, and the right version depends on the application calling
the runtime. Shown below are the 2 different versions of the
PowerShell shell which comes with Windows, after running
Get-ExecutionPolicy at the same time:</p>

<p><img src="/media/382/powershellruntimes_498x280.jpg" width="498" height="280" alt="PowerShellRuntime"/></p>

<p>Annoyingly, if these do not match up, and you run an application
built for 32 bit rather than 64 bit without realising it, you will
get a CmdletInvocationException:</p>

<p>&nbsp;<img src="/media/387/cmdletinvocationexception_500x465.jpg"  width="500"  height="465" alt="CmdletInvocationException"/></p>

<p>Hope this helps someone.</p>
]]></description></item><item><title>Custom Configuration Section Collections</title><link>http://www.jsperring.co.uk/2011/11/16/custom-configuration-section-collections.aspx</link><pubDate>Wed, 16 Nov 2011 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2011/11/16/custom-configuration-section-collections.aspx</guid><description><![CDATA[ 
<p>I'm sure this should be easy, but it's taken me most of a
morning of reading MSDN and tweaking code to get it to work. Most
of the documentation that I have found has either been massively
out of context, showing small segments of code and not explaining
where it fits in or what it does; or it's been hugely over
complicated, showing complete examples with masses of boilerplate
code.</p>

<p>I've been trying to get a simple collection, using
&lt;AddElement&gt; tags to add a list of items, similar to how
AppSettings and ConnectionStrings sections work. It was extremely
easy to create a <strong>custom configuration section</strong>,
with a single item and associated properties - creating a
<strong>collection of items</strong>, with add/remove/clear
functionality appeared to be a different matter.</p>

<p>Turns out, it's actually not that difficult. 3 classes, 2
overrides, and some properties. After that, it's just a case of
registering the <strong>custom section in the configuration
file</strong> in the &lt;configSections&gt; section.</p>

<h4>Section class</h4>

<p>The section class inherits from ConfigurationSection, and serves
as the wrapper for your configuration section in the app.config
file. This is what you'll add to the &lt;configSections&gt;
attribute to register the type in the Configuration manager:</p>

<pre class="brush: c#">
public class ElementSection : ConfigurationSection
{
    [ConfigurationProperty("Elements", IsDefaultCollection = false)]
    [ConfigurationCollection(typeof(Elements), AddItemName = "AddElement", ClearItemsName = "ClearElements", RemoveItemName = "RemoveElement")]
    public Elements Elements
    { get { return this["Elements"] as Elements; } }
}
</pre>

<h4>Collection class</h4>

<p>The collection class is required to tell the Configuration
manager what to create and what to use to retrieve the elements.
There are 2 required overrides for this class:</p>

<pre class="brush: c#">
public class Elements : ConfigurationElementCollection
{
    protected override ConfigurationElement CreateNewElement()
    {
        return new Element();
    }

    protected override object GetElementKey(ConfigurationElement element)
    {
        return (element as Element).Name;
    }
}
</pre>

<h4>Element class</h4>

<p>The class that contains your actual elements, all that's
required here is a property for each value you want to store
against the element, which needs to be decorated with the
ConfigurationProperty attribute.</p>

<pre class="brush: c#">
public class Element : ConfigurationElement
{
    [ConfigurationProperty("Name", IsRequired = true)]
    public string Name
    { 
        get { return (string) this["Name"]; } 
        set { this["Name"] = value; }
    }
}
</pre>

<h4>app.config registration</h4>

<p>The <strong>app.config file</strong> registration should be
fairly trivial, all that's required is the name you want to give
the section, the namespace and class name, and the assembly
name:</p>

<pre class="brush: xml">
&lt;configuration&gt;
    &lt;configSections&gt;
        &lt;section name="ElementSection"
                     type="namespace.ElementSection, AssemblyName /&gt;
    &lt;/configSections&gt;
&lt;/configuration&gt;&nbsp;
</pre>

<p>And that's all there is to it. If anything is not clear, drop a
comment and I'll try to clarify.</p>
]]></description></item><item><title>vSphere Client White Screen Fix</title><link>http://www.jsperring.co.uk/2011/11/10/vsphere-client-white-screen-fix.aspx</link><pubDate>Thu, 10 Nov 2011 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2011/11/10/vsphere-client-white-screen-fix.aspx</guid><description><![CDATA[ 
<p>There is a known issue when running <strong>vSphere Client
4.1</strong> and accessing the console of a VM running on an
ESX/ESXi 3.x host:</p>

<p><a
href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1026153">
VMWare KB: vSphere Client displays a white screen when accessing
the virtual machine console&nbsp;</a></p>

<p style="padding-left: 30px;">"Symptoms</p>

<p style="padding-left: 30px;">You may observe these after
installing vSphere Client 4.1:<br />
 You see a blank <strong>white screen</strong> when opening the
virtual machine console for a virtual machine running on an
ESX/ESXi 3.x host<br />
 No errors are reported on the vSphere client Virtual machine
consoles to ESX/ESXi 4.0 or 4.1 virtual machines open without any
issues"</p>

<p>The <strong>resolutions</strong> to this are just a little bit
tedious, and after putting it off for a couple of months, I thought
I'd see if I could find another <strong>solution</strong>. And I
did.</p>

<p>In the VMWare forums, there is a comment which mentions that
running bcdedit to disable DEP (Data Execution Prevention) resolved
the issue.</p>

<p><a href="http://en.wikipedia.org/wiki/Data_Execution_Prevention"
title="Data Execution Prevention">DEP</a>&nbsp;is a security
feature switched on by default in most modern OS's, and I'm not
comfortable switching it off entirely, so I tried to just exclude
the VpxClient.exe.</p>

<p>The 4.1 vSphere client was compiled with the NXCOMPAT flag
enabled, which forces DEP to be enabled, and stops you from adding
the application to the exclusions list. I've not been able to find
the exact reason, but whatever it is, it's DEP that causes the
white screen to display.</p>

<p>The NXCOMPAT flag can be removed from an application using the
editbin utility, which comes with most versions of Visual Studio
(including the Express editions).</p>

<p style="padding-left: 30px;">editbin.exe /NXCOMPAT:NO
[FileName]</p>

<p>Running the command above will allow you to add the application
to the exclusions list.</p>

<p>If you do not have editbin available, I have wrapped the
required files up in a zip file, and added a PowerShell PS1 script
to perform all the required actions.</p>

<p>Download it <a href="/media/183/fixviclient.zip"
title="Fix VI Client">here</a>.</p>

<p>Just extract the files to a folder, open
<strong>PowerShell</strong> as Administrator, and run the included
.ps1 script.</p>

<p>Hope it helps!</p>
]]></description></item><item><title>Umbraco Installation</title><link>http://www.jsperring.co.uk/2011/11/9/umbraco-installation.aspx</link><pubDate>Wed, 09 Nov 2011 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2011/11/9/umbraco-installation.aspx</guid><description><![CDATA[ 
<p>Having attempted to run a blog using <strong>BlogEngine
.Net</strong>, I realised I needed (wanted) something a bit more
polished.</p>

<p>I've looked around at a couple of CMS (CMSes?) to see if there's
anything I like, and <strong>Umbraco</strong> seems to stand out
from the crowd as being polished, full featured, and easy to use. I
don't want (need) any "power tools" for blogging, but I do want to
be able to add static pages easily, without worrying about it
impacting the blog side of things.</p>

<p>Although this was possible with BE.Net, it seemed to be more
hassle then it was worth, and I quickly gave up.</p>

<p>It's been nearly 2 years since I last wrote a blog post, and
although BE.Net is a good system, I'm going to blame it for me not
keeping up with blogging.</p>
]]></description></item><item><title>What's New in the BCL in .NET 4</title><link>http://www.jsperring.co.uk/2009/10/24/what's-new-in-the-bcl-in-net-4.aspx</link><pubDate>Sat, 24 Oct 2009 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2009/10/24/what's-new-in-the-bcl-in-net-4.aspx</guid><description><![CDATA[ 
<p>An excellent overview of the new additions to the
<strong>BCL</strong> in .Net 4 Beta 2:</p>

<p><a
href="http://blogs.msdn.com/bclteam/archive/2009/10/21/what-s-new-in-the-bcl-in-net-4-beta-2-justin-van-patten.aspx">
http://blogs.msdn.com/bclteam/archive/2009/10/21/what-s-new-in-the-bcl-in-net-4-beta-2-justin-van-patten.aspx</a></p>

<p>Particularly happy with String.IsNullOrWhiteSpace, and looking
forward to playing with the System.Device.Location namespace for
Windows 7.</p>

<p>Check it out, the additions to beta 1 are also listed on an
older post.</p>
]]></description></item><item><title>"There are still remote logins or linked logins for the server 'linkedservername'."</title><link>http://www.jsperring.co.uk/2009/7/9/there-are-still-remote-logins-or-linked-logins-for-the-server-'linkedservername'.aspx</link><pubDate>Thu, 09 Jul 2009 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2009/7/9/there-are-still-remote-logins-or-linked-logins-for-the-server-'linkedservername'.aspx</guid><description><![CDATA[ 
<p>I was trying to clear up a linked server in <strong>MS SQL
2005</strong>, and kept getting:</p>

<p style="padding-left: 30px;">"Msg 15190, Level 16, State 1,
Procedure sp_dropserver, Line 56<br />
 There are still remote logins or linked logins for the server
'linkedservername'."</p>

<p>So I checked sys.linked_logins, and true to it's word, there
were still a couple of linked logins associated with
'linkedservername'. I quickly looked through the system SPs, and
found a sp_droplinkedsrvlogin, so I ran it with the 2 usernames
that were in the sys.linked_logins table, got the satisfying
"Command(s) completed successfully." message, re-ran the
sp_dropserver SP again. Huh? Whaddya mean "There are still remote
logins or linked logins for the server 'linkedservername'."???</p>

<p>I googled about a bit, and all I got was "run
sp_droplinkedsrvlogin for all linked logins...". After a couple of
minutes, I did some digging into what the system SPs were actually
doing:</p>

<pre>
&nbsp;EXEC sp_helptext sp_dropserver;
</pre>

<p>Gave me this snippet:</p>

<pre>
&nbsp;if @droplogins is not null AND @droplogins &lt;&gt; 'droplogins'&nbsp;<br />
&nbsp;begin&nbsp;<br />
&nbsp; raiserror(15600,-1,-1, 'sys.sp_dropserver')&nbsp;<br />
&nbsp; return (1)&nbsp;<br />
&nbsp;end&nbsp;
</pre>

<p>So it seems to remove a linked server that still has logins
associated, you need to run "sp_dropserver 'linkedservername',
'droplogins'".</p>

<p>On further digging, I found that the sp_droplinkedsrvlogin SP
allows the second parameter to be passed in as NULL, and that will
also remove all existing logins from the specified linked
server.</p>

<p>Enjoi!</p>
]]></description></item><item><title>Google to launch new OS</title><link>http://www.jsperring.co.uk/2009/7/8/google-to-launch-new-os.aspx</link><pubDate>Wed, 08 Jul 2009 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2009/7/8/google-to-launch-new-os.aspx</guid><description><![CDATA[ 
<p>In <strong>Google's</strong> latest attempts at&nbsp;slaying
<strong>Microsoft</strong>, they've announced their plans to
release a new&nbsp;<a
href="http://googleblog.blogspot.com/2009/07/introducing-google-chrome-os.html"
 title="Chrome OS">OS based on Chrome</a>.</p>

<p style="padding-left: 30px;">Google Chrome OS is an open source,
lightweight operating system that&nbsp;<br />
 will initially be targeted at netbooks. Later this year we will
open-source its&nbsp;<br />
 code, and netbooks running Google Chrome OS will be available
for&nbsp;<br />
 consumers in the second half of 2010. Because we're already
talking to&nbsp;<br />
 partners about the project, and we'll soon be working with the
open source&nbsp;<br />
 community, we wanted to share our vision now so everyone
understands&nbsp;<br />
 what we are trying to achieve.</p>

<p>Apparently built on top of&nbsp;the linux kernel, the security
architecture is being completely redesigned to make it as secure as
possible, as they did with the Chrome browser. And although the job
they did&nbsp;<a href="http://blogs.zdnet.com/security/?p=1858"
title="Chrome vulnerability">on</a>&nbsp;<a
href="http://www.milw0rm.com/exploits/6353"
title="Chrome vulnerability">Chrome</a>&nbsp;wasn't exactly
perfect, it has been unbreakable to truly exploitable
vulnerabilities&nbsp;in&nbsp;<a
href="http://arstechnica.com/security/news/2009/03/chrome-is-the-only-browser-left-standing-in-pwn2own-contest.ars"
 title="CanSecWest">competitions</a>.</p>

<p>They seem to be targeting the perfect market with
<strong>netbooks</strong>, and I can certainly see the appeal this
kind of OS will have for such a platform. But other than for
kiosks, and possibly some older machines struggling under the
weight of Windows, I don't see much appeal for day to day use.</p>

<p>I don't know what the figures are for the amount of netbooks
versus laptops and desktops, but I'm pretty sure that although this
will definitely make a dent in Microsoft's share of the portable
market, it's certainly not going to be a giant killer, not with
it's first incarnation at least.</p>
]]></description></item><item><title>A win for Privacy?</title><link>http://www.jsperring.co.uk/2009/7/6/a-win-for-privacy.aspx</link><pubDate>Mon, 06 Jul 2009 00:00:00 GMT</pubDate><guid>http://www.jsperring.co.uk/2009/7/6/a-win-for-privacy.aspx</guid><description><![CDATA[ 
<p><a href="http://news.bbc.co.uk/1/hi/technology/8135850.stm"
target="_blank"
title="Phorm shares fall as BT opts out">This</a>&nbsp;seems like
it was always inevitable to me:</p>

<p style="padding-left: 30px;">Shares in the online ad firm Phorm
have fallen by&nbsp;<br />
 more than 40% after BT said it had no immediate&nbsp;<br />
 plans to use the service that tracks online behaviour.</p>

<p><strong>Phorm</strong> builds a profile of users by scanning
for&nbsp;<br />
 keywords on websites visited and then assigns&nbsp;<br />
 relevant ads.</p>

<p>Considering it's main purpose, and it's method for doing so, I
hope this is the beginning of the <strong>end for&nbsp;<a
href="http://www.phorm.com/" target="_blank"
title="Phorm">Phorm</a></strong>. However, if what they say about
their success elsewhere is true, we may not be so lucky:</p>

<p style="padding-left: 30px;">"In addition to making excellent
progress in&nbsp;<br />
 South Korea, we are engaged in more than 15&nbsp;<br />
 markets worldwide including advanced negotiations&nbsp;<br />
 with several major ISPs."</p>

<p>Fingers crossed though.</p>

<p>Enjoi!</p>

<p>UPDATE:<br />
 Add to this,&nbsp;<a href="http://www.talktalk.co.uk/"
title="TalkTalk">TalkTalk</a>&nbsp;has also&nbsp;<a
href="http://www.theregister.co.uk/2009/07/08/phorm_talktalk_terminated_confirmed/"
 title="TalkTalk terminates Phorm">pulled out</a>, so it's looking
even better for UK users.</p>
]]></description></item></channel></rss>

