Feeds:
Posts
Comments

Archive for July, 2009

This week Microsoft finally revealed its pricing structure for Windows Azure hosting services. Using Azure to host the simplest website in the world costs a minimum of $0.12 / hour. Work out the math: 0.12 * 24 * 30 = $86.40 / month.

While this might sound reasonable to a large organization with tons of traffic or anyone currently using Amazon EC2 or Rackspace’s Mosso, this is way out of reach for the majority of developers and organizations who are just trying to create a useful webservice or website that could scale in the off chance their idea took off or got mentioned by the press.

Based on this pricing it’s obvious that Microsoft is trying to compete with Amazon and targetting the same market. Nevertheless, I personally had high hopes that Microsoft was actually trying to compete with Google App Engine by offering the first and only affordable and scalable Windows hosting option… which raises the point: (in case anyone from Microsoft is listening) if Microsoft wants .NET to compete long-term as a server-side platform (which is essential for Windows to thrive as a server-side OS), someone is going to have to solve this problem soon or it will find itself playing catch-up.

I love Windows Azure and I believe it is a great, simple and affordable option for the big boys. But as Windows Azure leaves beta and the world says hello, I say goodbye before I have to start coughing up ~$100/mo for my personal websites. Back to shared hosting at GoDaddy ($4/mo for Windows + SQL).

Read Full Post »

Silverlight 3 introduces the WriteableBitmap class and with it, the ability to crop an image programmatically on the client!

All you need to do is create a new instance of the WritableBitmap class as your destination (supplying the dimensions in the constructor). Then create or acquire another instance of the WriteableBitmap class fully loaded with an image (among other ways, you can do this by creating a BitmapSource object from a stream via .SetSource and passing that BitmapSource instance into the constructor of a new WriteableBitmap)

Once you have your source and destination WriteableBitmap classes, just retrieve one pixel at a time from the source instance and set that pixel on a destination instance. The pixels are stored in a property on the object call Pixels which is a 1 dimensional array. Geting the index of a given pixel in an array is simple: index = x + y * width.

In my first pass, I just looped thru pixel by pixel. This was fast but not as fast as using Array.Copy (almost twice as fast)…

private static WriteableBitmap CropImage(WriteableBitmap Source, int XOffset, int YOffset, int Width, int Height)

{

    int SourceWidth = Source.PixelWidth;

    WriteableBitmap Result = new WriteableBitmap(Width, Height);

    for (int y = 0; y <= Height – 1; y++)

    {

        int SourceIndex = XOffset + (YOffset + y) * SourceWidth;

        int DestIndex = y * Width;

 

        Array.Copy(Source.Pixels, SourceIndex, Result.Pixels, DestIndex, Width);

    }

    return Result;

}

The result (a WriteableBitmap) can then simply be used as the source of an Image control to display your cropped image.

Note: WriteableBitmap.PixelWidth is expensive. Be sure to call it only once if possible.

Possible Improvement: Had the source width and destination width been the same I could have done it in a single call to Array.Copy and presumably made it even faster.

It’s high time that web developers are able to do complicated tasks on the client and not forced to use the server just because the client-side platform doesn’t support it. We’re still not all the way there yet but Silverlight gets us a lot closer than anything before it.

Read Full Post »

How many people have Silverlight installed? According to Rich Internet Application Statistics, Silverlight is installed on 30.27% of the machines out there. However, I’ve been tracking stats on my own site: MyPadlock.com (a free password manager for Windows) and have seen a much different number. Here are my results from the previous month:

SLStats

Find out more about tracking Silverlight usage over Google Analytics.

Caveats: There are a number of differences that could account for why I’m seeing a larger percentage than the Rich Internet Application Site. First of all, I doubt I have the same volume of traffic being tracked. However, I do have a fairly healthy volume, most of my visitors are not repeat, and the numbers have shown relative consistency from month to month, so think what you like, but I’m going to rule this out as a relevant factor.

Also note that my site does not use Silverlight in anyway nor does it receive any real traffic from a source that uses Silverlight. Oh, and my own visits are not counted either.

Most likely, the difference is due to differences in audiences. Certainly, a password manager is the kind of software that power users would use for more than novice users. Also, power users are probably more apt to explore new corners of the web are therefore more likely to have encountered Silverlight at some point. And lastly, my site gives away a Windows only app and perhaps Windows users are more likely to have Silverlight installed (might be a reach but worth speculating).

Nevertheless, whatever the reason is, I still belive the statistic is valuable and at the very least, tells me what to loosely expect for anyone thinking of porting a Windows app to Silverlight.

What kind of numbers are you seeing? I’d love to hear from anyone with access to similar stats for their own site(s).

Read Full Post »