cameronfletcher.com

random thoughts and discussions on the things that interest me

Flip-flops, Beer, and a Bottle Opener

I bought got my brother to buy some flip-flops at the weekend. Check them out:

flipflop_top

And guess what is located on the sole of the them? That’s right, a bottle opener. One per flip-flop:

flipflop_bottom

Now I just need a beer. And a holiday…

Hard Drive Weight Increasing?

Possibly the funniest technical question I’ve seen posted on a technical message board. Ever. Worth a look and you’re guaranteed a laugh.

http://social.answers.microsoft.com/Forums/en-US/vistahardware/thread/720108ee-0a9c-4090-b62d-bbd5cb1a7605

An error was encountered. Please return to the previous page and try again.

If you are trying to use the ASP.NET website administration tool and are getting a web page stating “An error was encountered. Please return to the previous page and try again.” it is possible that you have the same error as me (see below). Another symptom is clicking on the “How do I use this tool?” link and being presented with a message stating “Tool Has Timed Out”.

asp_error

It would appear that Microsoft, in its wisdom, has developed a tool that cannot handle the path of the web application it is designed to administer containing non-standard characters. Or spaces. To fix, simply copy your solution to a path that doesn’t contain any non-standard characters. Or spaces.

eg. Changing C:\Will (Not.) Work\see.sln to C:\WillWork\see.sln

It’s an easy fix to a problem most likely created by a tool both from, and within, Microsoft.

Telephones and 24 (the TV series)

Having watched 24 (the TV series), I have always wanted a Cisco phone that would ring with the same ringtone as used by CTU. To get the ringtone onto the phones I needed to enable the TFTP server on the router and edit the ringlist.xml file as so:

<CiscoIPPhoneRingList>
    <Ring>
        <DisplayName>CTU 24</DisplayName>
        <FileName>ctu.raw</FileName>
    </Ring>
</CiscoIPPhoneRingList>

Having tried to follow the Cisco guidelines to create the ringtone myself (unsuccessfully – it kept skipping and not repeating itself correctly), I stumbled upon a site that allowed me to download a ringtone that worked. When I copied the ringtone to my router and reset the phones then I was in business.

Below are some images of my Cisco 7912G phone hooked up to Unified CallManager Express running on my Cisco 2801 router.

cisco7912g01

Logged on to Cisco Unified CallManager Express, power suppiled via PoE.

cisco7912g02

Selection of the CTU 24 ringtone from the settings menu.

My Server Room

Below are some images of my server room. It’s located as far away from earshot as possible which isn’t easy considering it’s in a small flat!

server01

Well, here’s my server cabinet. You can see I’ve still got 6U free, so that should leave space for UPS, NAS, and a few more servers!

server02

Here’s an up close image of my Cisco 2801 router and my Linksys SWR2024W switch. You can also see a bit of my 48-port patch panel.

server03

Here is my messy wiring. About 40 of the ports are patched to outlets but you can see I currently have hardly any of them connected. I’m waiting on patch cables as I have a very low success rate when crimping my own.

Internal Interfaces

Occasionally there is the need to expose, for the purposes of an API or such like, a property of a class that has different external and internal implementations. Consider the code below: a person class with an Id property that is set to -1 by default with an external get property and an internal set property.

public class Person
{
    private int _id = -1; // default value

    public int Id
    {
        get { return this._id; }
        internal set { this._id = value; }
    }
}

If there are several classes that implement the Id property in this manner and there is a need to reference them through a common interface externally then implementing the following on each of the classes should be sufficient:

public interface IIdentifiable
{
    int Id { get; }
}

However, to reference these classes internally using the same common interface may be insufficient as it does not allow a call to the internal set property. Clearly it would not be efficient, or necessarily easy, to cast the classes to their individual types prior to making the call. One solution is to use a separate interface for internal operations; an interface with internal scope:

internal interface IIdentifiableInternal : IIdentifiable
{
    new int Id { get; set; }
}

Here, we implement the IIdentifiable interface and declare the Id property as new, effectively hiding its IIdentifiable implementation. We don’t reflect this in quite the same manner in our implementation of the IIdentifiableInternal interface on our class though. Instead, we explicitly implement the IIdentifiableInternal interface:

public class Person : IIdentifiableInternal
{
    private int _id = -1; // default value

    public int Id
    {
        get { return this._id; }
    }

    int IIdentifiableInternal.Id
    {
        get { return this._id; }
        set { this._id = value; }
    }
}

The external members of the class now include the public get method of the Id property, as does the public IIdentifiable interface. However, internally the class can be referenced using the IIdentifiableInternal interface which allows access to both the get and set methods of the property.

What has been demonstrated is how to take a number of classes with common members that have both public and internal scope and provide a means to reference them through a common interface, both internally and externally.

As a final point, if you have a linked library which you want to have access to the internal interfaces then you can use the following assembly attribute to expose internal to the specified assembly:

[assembly: InternalsVisibleTo("MyLibrary.InterfaceExample")]

Overridden method OnMeasureItem is not being invoked

I just ran into an issue when subclassing the ComboBox class whereby the OnMeasureItem method that I was overriding was not being called. I had set the DrawMode to OwnerDrawFixed in the constructor for my ComboBox which had in turn filtered through to the designer (non-default value). When I amended the value in the constructor to OwnerDrawVariable the change did not then filter through to the designer (no surprises there). The result being that my constructor had the following code:

this.DrawMode = DrawMode.OwnerDrawVariable;

However, this was clearly at odds with the designer. So in order to stop this occurring again, and to stop any modification of the DrawMode via the designer, I changed the line in the constructor of my ComboBox to reference the base like so:

base.DrawMode = DrawMode.OwnerDrawVariable;

I then added the DrawMode property with the new keyword to replace the base version (see below). You need to include the property setter as the designer will still try to assign a value to DrawMode.

[Browsable(false)]
public new DrawMode DrawMode
{
    get { return base.DrawMode; }
    set { }
}

After tidying up the designer code everything works like a dream.

Failed to create web application: /Root/RequestHandlerExt

If you are on step 3 of the 172 steps required to install OCS 2007 and feel like banging your head against any wall you can find to relieve the pain then it is not unlikely that you are in the position I have been in all day and have been presented with the following error message during the webcomponents.msi installation against (in my case) Windows Server 2008 and IIS 7:

Failed to create web application (-2147024809 /Root/RequestHandlerExt)

The log file, which the OCS installer recommends you look at, contains something like this:

WriteMetabaseChanges: 
Error 0x80070057: failed to create web application: /Root/RequestHandlerExt 
Error 26105 Failed to create web application (-2147024809/Root/RequestHandlerExt) 
MSI (s) (F8!14) [15:33:01:268]: 
Product: Microsoft Office Communications Server 2007 R2, Web Components Server 
Error 26105 Failed to create web application (-2147024809/Root/RequestHandlerExt) 
WriteMetabaseChanges: Error 0x80070057: failed to create ASP App

First check that you have the IIS 6.0 compatibility tools installed (see Lee Desmond’s blog for more info). If you have done this and are still getting this error then several sites mention performing an uninstall of OCS, IIS followed by a re-install as a solution.

In my case this was not really an option as I had several websites running on this computer already. It turns out that this was the issue (unsurprisingly, really) and that the installer is looking for the Default Web Site. I performed the migration of site id 1 to a new site and manually revoked the original configuration of the default web site. The install completed successfully after this. I would say to watch out for the IIS7 mmc snap-in and its massive inability to handle renaming of websites with host headers if you’re attempting this yourself and have sites with host headers, obviously.

Welcome to my Blog

Having decided it was time to get myself on the blogging bandwagon I started to look for a blogging engine that would suit my needs. I was initally taken by some of the MSDN blogs provided by Community Server that use the paperclip theme but further investigating led me to BlogEngine.NET, an open source project built on .NET which can only be described as awesome. My choice to go with this piece of software was confirmed when I found a paperclip theme for it provided by Caio Proiete who had taken the time to port it from the orignial. And this is the result. Welcome to my blog.

« Newer Posts