Archive for August, 2009

These days I started looking into Silverlight and unfortunately my time was spent more on finding sollutions than actually implement something. I am so used to ASP and WinForms that somehow the new way of doing things in SilverLight is making me dizzy.

I started looking into DataGrid mostly and found two strange things:

  1. There is no double click event on a row
  2. The <enter> key is not caught in the OnKeyDown handler.

Of course there are solutions to this and based on some nice community posts I made my own implementation for the datagrid which is listed below
Read the rest of this entry »

Comments 4 Comments »

I guess every developer was asked at some point about making a website for a friend only to be taken aback by the technological limitations of the hosting provider.

I am a professional Asp.Net developer (of course I am versed also in winforms and all the other areas of .Net programming, but web applications are my specialty) and I am accustomed to work in relation with databases. When someone wants a website that normally requires at least a few tables and there is no database engine available, what do you do? Over the years I used two techniques: use xml based storage and javascript storage. Of course they are limited but the whole point is that for small scale applications they are sufficient. Here are some examples:

  1. http://www.orionmodels.ro : this is a javascript storage based application. It comprises of classic HTML, asynchronous loading using XMLHttpRequest and a script containing object definition and object instances (the models are actually javascript objects that are instanciated and then processed in the various pages of the application)
  2. http://www.mcmserv.ro: this is an xml storage based application. It is written in ASP.Net 2.0 and all the objects are serialized in xml on the web server. Pretty nifty and also has an html editor which saves html in the actual xml serialization (unfortunately that is on the administration side which is not available to outside)

Overall I am pleased with the results but it’s a technical trick and not something I endorse. Buy the heck a subscription with a database, normally it’s just a few dollars more.

P.S. Don’t mind the website’s design, I am not a designer … only a developer.

Comments 2 Comments »

I am certain that many of you encountered a need for a code like this:

switch (controlVariable)
{
    case 1:
        int i = 10;
        Console.Out.WriteLine(i);
        break;
    case 2:
        int i = 20; // compiler error here
        Console.Out.WriteLine(i);
        break;
}

This is not possible because the whole switch acts as a “declaration space” and only one declaration of the “i” variable is allowed. In order to overcome this, one has somehow to trick the compiler into considering each case as having its own declaration space. How we make this? Use the brackets:

switch (controlVariable)
{
    case 1:
    {
        int i = 10;
        Console.Out.WriteLine(i);
        break;
    }
    case 2:
    {
        int i = 20;
        Console.Out.WriteLine(i);
        break;
    }
}

Comments No Comments »

Read about it on ScottGu’s blog

Comments No Comments »