All 40 entries tagged Dotnet

View all 41 entries tagged Dotnet on Warwick Blogs | View entries tagged Dotnet at Technorati | There are no images tagged Dotnet on this blog

March 26, 2007

Podcasts from IE7

My podcast viewer currently runs standalone and as a plug-in for Windows Media Player.
How would people prefer to use it? I would love to make it a ClickOnce application that can be installed without being admin. This however would limit the ability to install the WMP plug-in. On the plus side, you receive automatic updates.
I am investigating ways to make the app ClickOnce install and then register the plug-in later. The problem is that the uninstall would not remove the plug-in for you.

In addition, I need a funky name for the app. PIE is a bit abstract and confusing with other products.
I quite like “PodBouncer”, but I’m open to options. The only real constraint is that the .com domain needs to exist.

March 23, 2007

Prettier Pie

Follow-up to PIE! Podcasts from Internet Explorer from codeMonkey.Weblog();

OK, so the first HTML UI was a bit of a quickie…
I’ve made it a bit nicer now. In future versions you will be able to set your own style sheet as well to completely customise it.

Please send me your thoughts, ideas, comments, etc.

March 22, 2007

PIE! Podcasts from Internet Explorer

Follow-up to Updated Podcasts in Media Player Plugin from codeMonkey.Weblog();

After numerous and continued requests via this blog for a working version of the Windows Media Player podcast viewer plugin, I finally found the time to make it!

I have gone for the name Pie: Podcasts from Internet Explorer
Download it now!

Pie runs as an windows application or as a plug-in for Windows Media Player.
Pie gets the podcasts that have been downloaded by Internet Explorer 7’s feed engine.
You can expand items to read the show notes and click the show title to play.
The playlist button creates and plays a playlist of either all podcasts or just those not yet played.
In addition, an auto-playlist is added to the Windows Media Player library that will have all the podcasts. This is useful if you want to sync them to your MP3 player.
Main Screen
Windows Media Player Plug-in

November 13, 2006

WMP Podcast Plugin

I keep getting the odd comment asking about my Windows Media Podcasting plug-in. The code currently online will not work with the final build of IE7. I need to re-compile against the new common feed list DLLs I think. However, I am so very busy at the moment with 3+ concurrent projects. To be honest, while I like the virtual pats on the back and thank you emails, those are not helping my slightly desperate rent situatiuon. Therefore spending time on a project that will basically have zero return is a luxury I cannot afford.
I do appreciate people showing an interest in the project and I apologise for not being able to continue it at the moment.

October 07, 2006

Nemerle VSIP

I am planning to write my project’s code using Nemerle . It has a good cross section of language features that I will leverage. The concentration on efficient algorithms and data structures will leverage the functional aspects of Nemerle. Whilst the vast .NET libraries and imperative constructs will make image handling and UI code easy.

Of course, being a Visual Studio junkie means I will require decent tool support. Luckily I managed to get the Nemerle VSIP (Visual Studio Integration Package) to work yesterday. Now I can edit code inside Visual Studio with the aid of intellisense, syntax highlighting and built-in compiler support.
The package is still somewhat under development, so I’m not sure how stable it will be. My project will not require too much code so I think it will hold up OK. To be honest, just having a Visual Studio “project” to manage building source, etc is a God send compared to manually writing build scripts and command line compiling!

I’m looking forward to getting this project off the ground. My current goal is writing the proposal document by week 3…

October 01, 2006

Circular, doubly–linked list

Follow-up to Loopy linked lists from codeMonkey.Weblog();

After taking considerable inspiration from a Haskell implementation , I managed to write some Nemerle code that creates a circular, doubly-linked list, without using any mutable variables.
It is not as elegant as the Haskell version because I had to use class fields to get lazy access to variables not yet assigned. Translating lines like:

mkDList xs = let (first,last) = go last xs first
             in  first

into Nemerle is tricky, even with the “lazy” macro.

So here’s the code…

#pragma indent

using System
using Nemerle

[Record] struct Node[T]
    public Prev : LazyValue[Node[T]]
    public Value : T
    public Next : LazyValue[Node[T]]

class LoopList[T]
    private first : Node[T]
    private last : Node[T]

    private this(items : list[T])
        def go = Go(lazy(last), items, lazy(first))
        (first,last) = (, go.last)

    private class Go
        private rest : LazyValue[Node[T]]
        public me : LazyValue[Node[T]]
        public last : LazyValue[Node[T]]

        public this(prev : LazyValue[Node[T]], items : list[T], next : LazyValue[Node[T]])
            match((prev, items, next))
                | (prev, [], next) =>
                    (me, last) = (next, prev)

                | (prev, x::xs, next) =>
                    me = lazy(Node(prev, x, rest))
                    def go = Go(me, xs, next)
                    (rest, last) = (, go.last)

    public static Create(xs : list[T]) : Node[T]

// Test Code

mutable n = LoopList.Create([1,2,3,4])

    Console.Write($"$(n.Value) ")
    n = n.Next

n = n.Prev
Console.WriteLine("and back again")
    Console.Write($"$(n.Value) ")
    n = n.Prev

// Output
1 2 3 4 1 2 3 4 1 2
and back again
2 1 4 3 2 1 4 3 2 1

I’m planning to use this in my 3rd year project. The Weiler-Atherton algorithm requires a CDDL.

August 06, 2006

Loopy linked lists

I've been playing with Nemerle today. It's a functional/OO hybrid for the .NET CLR. I needed a circular linked list for a project I'm working on. Basically a linked list where the end points back to the start.
Whilst Nemerle allows mutable variables, I felt dirty leaving all the beauty of "no side effects" programming behind. Luckily Nemerle allows lazy evaluation using some macro magic behind the scenes (That's right Dan, I said the "L" word ;)). This meant I could reference the first item effectively inside its own definition. (The laziness is not exactly first class like in Haskell, but it certainly works for me here.)
#pragma indent

using System
using Nemerle

class LoopList[T]
private first : LazyValue[LoopListItem[T]]

public this(values : list [T])
def build(xs)
| [] => first
| head::tail => lazy( LoopListItem(head, build(tail)) )
first = build(values)

public First : LoopListItem[T]

[Record] struct LoopListItem[T]
public Value : T
public Next : LazyValue[LoopListItem[T]]

// Test code:
mutable item = LoopList([1,2,3]).First

Console.Write($"$(item.Value) ")
item = item.Next

// Outputs:
// 1 2 3 1 2 3 1 2 3 1
Next I need to figure out a circular doubly linked list…

August 05, 2006

BindingListView speedy sorting

I received some feedback about my BindingListView library saying it was very slow for sorting large lists. At first I thought 20,000 objects in a view was a bit extreme, but I tested with a DataView object and it worked OK. So I decided to hunt down the bottleneck in BindingListView sorting.
Using the CLR Profiler I determined it was reflection calls taking most of the execution time (no suprises there, reflection is very slow!)
When sorting the BLV used reflection to read the sorted property value from each object. The sorting 20,000 objects means and lot of calls to "GetValue", resulting in crippled performance.
The solution came from .NET 2.0's System.Reflection.Emit.DynamicMethod class. Using this class I was able to emit the IL (Microsoft .NET Intermediate Language) that directly accessed an object's property. (Of course the name of the property is supplied at runtime.)
I actually generate a few different methods depending on it the property is a value type or reference type. Since a value type needs to be boxed before we can compare using IComparable.
Here is one of the methods:
private static Comparison BuildRefTypeComparison(PropertyInfo pi, ListSortDirection direction)
MethodInfo getMethod = pi.GetGetMethod();
Debug.Assert(getMethod != null);

DynamicMethod dm = new DynamicMethod("Get" + pi.Name, typeof(int), new Type[] { typeof(T), typeof(T) }, typeof(T));
ILGenerator il = dm.GetILGenerator();

// Get the value of the first object's property.
il.EmitCall(OpCodes.Call, getMethod, null);

// Get the value of the second object's property.
il.EmitCall(OpCodes.Call, getMethod, null);

// Cast the first value to IComparable and call CompareTo,
// passing the second value as the argument.
il.Emit(OpCodes.Castclass, typeof(IComparable));
il.EmitCall(OpCodes.Call, typeof(IComparable).GetMethod("CompareTo"), null);

// If descending then multiply comparison result by -1
// to reverse the ordering.
if (direction == ListSortDirection.Descending)

// Return the result of the comparison.

// Create the delegate pointing at the dynamic method.
return (Comparison)dm.CreateDelegate(typeof(Comparison));

Emitting IL by hand is not pretty (see my previous post for an idea to improve this problem). Using Reflector (or ILdasm) certainly is a must if, like me, you are an IL newbie. I wrote some simple example methods in C#, compiled them, then viewed in Reflector to see the IL they produced.

The end result in my speed test harness was BindingListView sort actually out performing the DataView!
Using 200,000 objects (10x more than the reported amount). Sorting on an Int32 property.
Old BindingListView took 146,823ms
New BindingListView took 16,564ms
DataView took 20,654ms

All the code is online at Source Forge

August 04, 2006

Runtime code generation, with macro ease

.NET 2.0 has some very cool stuff in System.Reflection.Emit, namely the DynamicMethod class. DynamicMethod will let you create a new method at runtime that lives inside your current assembly. The only hitch is that you have to create the method using IL – not a high level language like C#/VB/Boo/etc.

My thought for today is: Can we use the syntactic macro abilities of .NET languages like Boo and Nemerle to create dynamic method code whilst remaining in the source language.

For example (psuedo–Nemerle):

myMethod = dynamic( Console.WriteLine("Hello, World") );
myMethod() // Call the dynamically generated method

At compile time this would take the AST passed to the "dynamic" macro, call out to the Nemerle compiler and retrieve the IL. This IL is then used to create a sequence of Emit*() calls needed to create the dynamic method. Finally the macro creates a delegate that can be used to call the method.

Whilst that may seem rather complex, once working it totally removes the need to drop to IL to generate dynamic methods at runtime. I've not had time to think through the implementation details of this. For now I'm just throwing the idea out there – If someone wants have a go, please feel free! The main sticking point is really working out an escaping system to allow interpolation of real code and IL emits. This can probably be done using a second macro "normal" that switches back to normal code.

There is something rather magic about using compile–time macros to generate code for runtime methods. It feels like both sides of meta–programming sync up so nicely, adding a whole new dimension to "code that writes code"! :)

June 27, 2006

Rhino Mocks Boo Macros Released

Writing about web page

My Boo syntactic macros for the Rhino Mocks mock object library are available to test. I've only spent a few days working on them but they are already powerful.

For download links and docs see preliminary documentation

Google Ads

Search this blog

Most recent comments

  • I scratched my eye while i was holding some kind of plastic packaging.. Anyways the corner of the pl… by Ercan on this entry
  • About a year ago my contacts that i was wearing, i guess were fautly, because shortly after they wer… by Jon on this entry
  • I got shower gel in my eye 4 and a half days ago, and becasue i rubbed my eyes a lot, i have scratch… by Chris on this entry
  • This website may help–health/tc/Eye–Injuries–Home–Treatment by S on this entry
  • I somehow got dirt, or debris in my eye. The terrible pain sent me in a tailspin. I was afraid of sa… by Bobbi on this entry


August 2017

Mo Tu We Th Fr Sa Su
Jul |  Today  |
   1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31         


Blog archive

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder