I posted the following message on a developer list. I’m so frustrated by the lack of alternatives to nCover…..

We’ve been using the free version of NCover in a number of our projects (v1.5.8), and for the most part, we’re happy with what it does.

However we’ve recently come to realise that the free download for nCover doesn’t work on x64 machines (incompatibility when it tries to register the profiling DLL). This prompted me to have a look for another free/OSS product which would work in the same or similar manner as nCover….and i’m coming back empty-handed.

Am i the only person who has questioned why i should need to purchase the enterprise version of the product, just for x64 support? And more importantly, how come there is a complete drought of alternatives for nCover? I’ve found PartCover, but haven’t used it and it doesn’t look to be as complete as nCover….

I’m shocked, given that the OSS community seems mad about creating alternatives and derivatives for toolsets (think NUnit vs MBUNit vs xUnit or NMock vs Rhino Mocks vs Moq …). There seems to be a number of alternatives for other TDD tools, but as far as coverage goes, is nCover really the only thing out there?

If you know any, i’d like to hear about it….

I’m currently in the process of building my source repository at home – after well over a decade of neglect i’m importing everything into SVN and organising my little spike projects from various languages, environments, project, you name it.

In any event, my development machine is a virtualised Windows XP running on a Windows XP host (connected using NAT) with VirtualBox. My laptop has a direct cross-over cable connecting it to my server, so the throughput should be at best 100Mbps. When importing content into the repos, i was concerned by how slow the import felt to take. It was transferring 1MB in about 30-40 seconds, which by all right should have been virtually instant.

Fortunately I was able to find the program iperf which runs on both Linux and Windows. Set-up the server on linux and connected to it from the windows client and was shocked to learn I was achieving (get this) less than 90kbps.

Yes, jaw-drop and all that.

I found these two tickets on the VirtualBox support site which identify it as a limitation of running vbox under NAT, which if you ask me is pretty silly considering i can’t run bridged networking over WiFi.

not    happy    jan.

Well I could tell a lie and say that I knew how to do this, but i dont – so i’ve done a little bit of research and i’m now taking an educated guess as to how I would approach this problem. This might get me disqualified from the comp, but when i was doing interviews, i didnt care so much if someone didn’t know the answer to a problem if they could show that they had the capabilities of working the problem out themselves 🙂

Either way, i’m not convinced this is the most efficient nor is it the best way to solve this problem…There would be a mathematically more appropriate way without all the fussing around.

http://www.dev102.com/2008/08/05/a-programming-job-interview-challenge-14-2d-geometry/

Your input:

1. List of points in a 2D space. If you draw lines between one point to the next one, a closed polygon is created (can be either concave or convex).
2. A single point in a 2D space.

You need to determine whether the given point is inside or outside the given polygon.

According to wikipedia (this is the part i cheated on), we can use the ray-casting algorithm to determine whether a point is inside or outside a polygon.

So my algorithm (this is all my doing) for this process would be:

  1. Loop through all segments of the polygon formed by joining each successive point to the next.
  2. For each segment, determine the equation of the segment using the formula f(x) = mx + b (function for a line).
  3. Determine the equation for a segment from the single point along the x-axis up to the highest value for x in all the existing points, plus 1 (so that we know we get an intersection if one exists). This segment is parallel to the x-axis
  4. Use the formula to determine the intersection of two lines by solving the equations with each other (simultaneous equations). If the equation is unsolvable, then the lines don’t intersect. If they do intersect, then record the intersection and move onto the next segment.
  5. After all segments have been hit-tested, if the number of hits is odd, then the point is within the polygon. If the number of hits is even then the point is outside the polygon.

Not so simple, and i don’t feel it’s elegant enough just yet. 🙁

i’ll submit it anyway – better to be in it and lose, than never try.

I’ve recently been getting my hands dirty with WPF as a successor to WinForms, and one thing is for sure – its like i’m starting from ground zero, all over again…

What I’ve recently wanted to do was to learn the details of animation in WPF. I’ve read a lot about the animation frameworks built into WPF, and the fact that they can be programmed directly into the XAML is quite interesting. Seems that it XAML is a whole lot more than a mark-up language. It’s so expressive it is almost like code.


<window x:Class="WPFAnimatingPath.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
</window><window .Resources>
<storyboard x:Key="pointAnimation">
<pointanimation From="55, 10" To="55, 150" RepeatBehavior="Forever" AutoReverse="True" Storyboard.TargetName="seg1" Storyboard.TargetProperty="Point1" AccelerationRatio="0.5" DecelerationRatio="0.5" Duration="0:00:10" />
<pointanimation From="105, 150" To="105, 10" RepeatBehavior="Forever" AutoReverse="True" Storyboard.TargetName="seg2" Storyboard.TargetProperty="Point1" AccelerationRatio="0.5" DecelerationRatio="0.5" Duration="0:00:05" />
</storyboard>
</window>
<grid>
<button Name="btnAnimate" Margin="0,37,0,0" Click="btnAnimate_Click">
<stackpanel Height="200" Width="160">
<textblock TextAlignment="Center" Height="40" VerticalAlignment="Bottom" FontSize="16">Click me</textblock>
<path Stroke="BlueViolet" StrokeThickness="2" Width="160" Height="160">
</path><path .Triggers>
<eventtrigger RoutedEvent="Path.Loaded">
<beginstoryboard>
<storyboard>
<doubleanimation Storyboard.TargetName="rotation" Storyboard.TargetProperty="Angle" From="-30" To="30" Duration="0:0:05" RepeatBehavior="Forever" AutoReverse="True" AccelerationRatio="0.5" DecelerationRatio="0.5" />
</storyboard>
</beginstoryboard>
</eventtrigger>
</path>
<path .RenderTransform>
<rotatetransform x:Name="rotation" CenterX="80" CenterY="80" Angle="0" />
</path>
<path .Data>
<pathgeometry>
</pathgeometry><pathgeometry .Figures>
<pathfigure StartPoint="0, 80">
<linesegment Point="30, 80" />
<quadraticbeziersegment x:Name="seg1" Point1="55, 10" Point2="80, 80" />
<quadraticbeziersegment x:Name="seg2" Point1="105, 150" Point2="130, 80" />
<linesegment Point="160, 80" />
</pathfigure>
</pathgeometry>

</path>

</stackpanel>
</button>
</grid>

What i’ve written here is a simple application which displays a button on the page. Like my last post about XAML and the mindset change, this code allows me to embed whatever i want into the content of the Button, and in this case, i have 2 bezier arcs which form a pseudo SINE wave. when you click the button, the arcs animate and flow in a throbbing fashion.

These are the basics which demonstrate:

  • Window Resources
  • Embedded Content
  • Drawing arcs/lines
  • Animating objects

In (the now famous) Project P, working with Microsoft CMS’s security model had me ripping my hair out.

Whenever I made a call to the context.Searches.GetByGuid() method, the system would throw a COMException, citing the quite unhelpful message “Server Error. Please contact your administrator”

For future reference (in case anyone comes across this themselves) the problem was caused because the GUID i was passing into the application was not formatted in the correctly for what CMS was expecting.

My code was doing:
string inputGuid = myGuid.ToString();

But it turns out it actually needed to be:
string inputGuid = myGuid.ToString(“B”);

The difference (according to MSDN) is that .ToString() with no overload assumes the format identifier of “D” which results in a GUID formatted without curly braces. Format “B” provides the same guid string but with curly braces.

Why this needed to throw a “Server error” exception, is beyond me. A simple ArgumentException would have sufficed, or better still it could take in a Guid as the parameter instead of a string.

For a blow-by-blow account of this problem, visit my newsgroup post about UserHasRightToBrowse Always Returns True

Covariance and Contravariance are terms used in programming languages and set theory to define the behaviour of parameter and return types of a function.

Yes, that’s a mouthful, but in a nutshell:

  • Covariance mandates that the return type and the parameters of a function must be a subtype of the original base class type for any superclass
  • Contravariance allows the return type and/or the parameter types to be super-types of the defined types and not necessarily sub-types

Nothing better than using an example:

[HTML1]

In this example:

  • Animal is a superclass.
  • Human is a subclass of Animal, with a covariant (no change) override to the CreateChild method to return the looser type Animal
  • Dog is a subclass of Animal, with a contravariant override to the CreateChild method to return the stronger type Dog

More reading on Eric Lippert’s blog series on Covariance and Contravariance in C#

EDIT: I thought it best prudent that I clarify that this is only one example of where variance is used. Method signatures, delegates and arrays are some more examples of where the theory of co and contra variance can be found.

Dual booting Linux and Windows – Free
Resizing Windows partition into adjacent free space – Free
Realising that activating second primary partition, has wiped partition table – Priceless
For some things, you deserve a kick in the head. For everything else, there’s data recovery.

As you might have guessed, i’ve lost a lot of time at this point, and some data, though fortunately a fair bit was recoverable. What i did lose (and really peeves me) was my development Virtual Machines, with VS/SQL/IIS all configured and ready…Now to go through the long process of rebuilding VMs.