Microsoft Chart Controls for the .Net Framework – rendering using a httpHandler

Those of you who have taken a look at the new chart controls might have seen that there are multiple ways of rendering these in ASP.NET.

Since my apps (ajax based, no updatepanels etc) use generic httpHandlers for these kind of things, I went looking for the ‘httphandler way’ of rendering the chart controls – but it does not exist..

So I whipped out reflector and took a look at the chart class, and found the three lines needed for doing this
Read the rest of this entry »

Posted by oyvind.kinsey on November 13th, 2008 under programming, UncategorizedTags: ,  • 7 Comments

A simple reorder list in Ext JS

I’ve been using Ext JS for quite some time now, and I must say, I love it.

There is quite good support for drag’n’drop here, but it lacks one thing; the precious reorder list.
An example of such can be found here

Since doing the google didn’t return anything like this I ended up implementing it my self.
Read the rest of this entry »

Posted by oyvind.kinsey on July 29th, 2008 under programming, UncategorizedTags: , ,  • 2 Comments

“This page contains both secure and nonsecure items.”

With one of my larger webapps I have recently been struggling with the following Security Information message in Internet Explorer:

This page contains both secure and nonsecure items.

Do you want to display the nonsecure items?

This, in general, has to do with mixing of content from different security zones in IE, for example Internet and Local, or http and https.
Read the rest of this entry »

Posted by oyvind.kinsey on May 26th, 2008 under programming, UncategorizedTags: ,  • No Comments

Javascript function overloading

I was reading a post yesterday about function overloading in javascript, and the suggested solution had quite a performance overhead when used with multiple signatures.
In addition, it only used the number of arguments, and not their types and order to distinguish between the signatures.

For some reason I woke up early this morning with a solution to this.
The following code will do all of the above and has the same overhead for all number of signatures.

//returns an overloadable method
Function.CreateOverloaded = function(){
    var overloads = [];
    //creates the overloaded method
    var func = function(){
        var sign = [];
        for (var i=0;i < arguments.length; i++) {
            sign.push(typeof arguments[i]);
        }
        sign = sign.join();
        var func = overloads["(" + sign + ")"];
        if (!func) {throw "No matching signature";}
        return func.apply(this, arguments);
    };

    //method for adding a function with a spesific signature
    func.AddSignature = function(func, sign){
        if (overloads["(" + sign + ")"]){throw "Duplicate signature"};
        overloads["(" + sign + ")"] = func;
    };
    return func;
}

To test it you can use the following code

var myFunc = Function.CreateOverloaded();
myFunc.AddSignature(function(){
    alert("test1");
}, "");
myFunc.AddSignature(function(var){
    alert(var);
}, "string");
myFunc.AddSignature(function(integer){
    alert(integer + "x 5 = " + (integer * 5));
}, "number");
myFunc.AddSignature(function(int1, int2){
    alert(int1 * int2);
}, "number,number");
myFunc.AddSignature(function(string, int){
    alert(string + " equals " + int);
}, "string,number");

myFunct();
myFunc("test2")
myFunc(3);
myFunc(3, 5);
myFunc("five", 5);

Posted by oyvind.kinsey on November 15th, 2007 under programming, UncategorizedTags: ,  • 4 Comments