Silverlight 2 and Flash 10 put to the test

November 2, 2008 13:03 by Geert van der Cruijsen

Today a colleague of mine send me a link of a very cool site: http://www.shinedraw.com/

The guy who build the site is a webdeveloper with 6 years experience in building flash apps and 1 year of Silverlight experience. On his blog are a lot of apps build both in Flash and Silverlight. Some examples are: loading a big external image into the silverlight / flash app and a fps stress test.

http://www.shinedraw.com/data-handling/flash-vs-silverlight-loading-external-image/

http://www.shinedraw.com/mathematics/flash-vs-silverlight-fps-meter-stress-test/

It's very cool to see that the output of both platforms is almost equal, though in most test Silverlight is performing a bit better then Flash 10.

Also if you look at the code that is used in both examples you have to say that programming in Silverlight is a more pleasant experience.

Both platforms have strengths and weaknesses. Microsoft has visual studio which is far out the best IDE out there. Adobe on the other had has the best tools for designers.

The battle for best rich internet platform rages on!

 

Geert van der Cruijsen


Comments (0)

Silverlight 2 Control Toolkit ready for download

October 29, 2008 21:02 by Geert van der Cruijsen

Yesterday Microsoft released the first version of the Silverlight Extended controls suite on Codeplex.

This control suite contains a number of special controls that are now available for the public to download and use in their own projects.

an example of what kind of controls are included in the toolkit:

  • TreeView
  • Charts
  • Expander
  • AutoComplete
  • NumericUpDown

On the codeplex site there are online demos of all controls which are included in the toolkit and the controls are also documented in the wiki on the page.

 Example of how the Treeview looks and how you use it:

 

Example of the AutoCompleteBox and how to use it in your xaml code: 

 

You can check out the online demos at codeplex: Controls demo and the Charting Demo

I really think Microsoft did a great job at offering these controls to the community and it will make developing in silverlight easier for everyone.

I liked the Charting part the most and i really look forward in using that in my projects in the future. Just look at how nice these controls look and how easy you can fit them into your project:

Geert van der Cruijsen


Comments (0)

Silverlight 2 Release Candidate Available

September 27, 2008 11:41 by Geert van der Cruijsen

Last night Microsoft released the first release candidate for Silverlight 2.0.

 

There are a few new controls added in this release: the Combobox, passwordbox and the progressbar.

you can download the new silverlight release candidate at: http://silverlight.net/GetStarted/sl2rc0.aspx

on Scott Guthries weblog there is a nice explanation on how these new controls work.

New Silverlight controls

the new silverlight Controls (Combobox, passwordbox and the progressbar)

 

note that only the developer tools and runtime are released and not regular silverlight runtime. This is done so developers have time to upgrade their applications before silverlight 2.0 RC1 is actually released to the public.

Happy coding!

Geert van der Cruijsen


Comments (0)

Comparison of Microsoft Silverlight 2 and Adobe Flex by an Adobe Evangelist

July 26, 2008 00:07 by Geert van der Cruijsen

I've found a nice read on a comparison between Microsoft's Silverlight and Adobe Flex by an Adobe Evangelist who took a 3 day Silverlight 2 training.

The weblog post starts of with summarizing the good and bad things of Silverlight but it's also nice to read the comments where a big discussion starts between Microsoft employees, Adobe employees and other developers/designers that have to choose between these 2 technologies.

Things he likes about Silverlight:

  • “The first thing I really like is the concept of threading. Being able to spawn off complex tasks without choking the main thread is pretty cool. You could, for example, show a really smooth animation when you are loading a bunch of data in a separate thread.”
  • “A Silverlight application can directly communicate with the HTML document it is hosted on by simply setting a parameter.”
  • “Being able to code in either C# or VB.NET is also a great feature. Especially since these two languages are pretty familiar to people developing for the Windows platform. I’m not one of them, but I found that C# is similar to ActionScript. Next to those languages you also have XAML, which does more or less the same things as MXML.”
  •  

    after that he tells us the things he doesn't like about Silverlight:

  • Code in XAML and C# is really verbose.”
  • “Styling controls is an absolute nightmare! I honestly think that this is going to be Silverlight’s Achilles’ heel!”
  • “Another thing that I really couldn’t grasp is the lack of HTML tag support in text fields.”
  • “I know the Expression tools are still in beta, but it has to be said that all the tools (including Visual Studio, which is no longer in beta) felt extremely buggy and incomplete.”
  • “Over these three days, I got a strong feeling that Silverlight was created by people who don’t know anything about designers.”
  •  

    In my opinion Silverlight and Adobe Air/Flex can both be big and good in their own things and eventually they will start growing towards each other as .Net and Java are also doing. Adobe has its huge designers userbase while Microsoft has a very big developers userbase. I think Adobe will stay the best thing to use for really nice fancy looking webtools while Silverlight will focus itself on the real rich internet Applications instead of websites which will stay the big focus of Adobe.

    I do agree with him that styling can be pretty hard for designers which aren't used to set all those properties and maybe Silverlight is a bit TOO extensible for them. As an example he shows how to change the rotation of an object in Silverlight and Flex:

    Microsoft Silverlight Adobe Flex

    <Button>
    <Button.RenderTransform>
    <RotateTransform Angle="45"/>
    </Button.RenderTransform>
    </Button>

    <Button rotation="45"/>

    I can see a designer will like the simple rotation property but Microsoft gives us (developers) the option to do all kinds of transformation on the object which is more extensible then the way it's done in Flex.

    About the point where he is complaining about how buggy everything is, I think this changed in a good way from Silverlight 2 Beta 1 to Beta 2 and I'm sure that everything will be really stable at the final release. (of course Visual studio isn't in beta... but the Silverlight developer tools are so that's why Visual studio isn't always that stable while building Silverlight applications at the moment)

    I do think Microsoft will have a hard time to get designers to change to Silverlight from their loved environment which they already know but only time will tell.

    http://www.webkitchen.be/2008/07/17/silverlight-the-good-the-bad-and-the-ugly/

    Geert van der Cruijsen


    Comments (0)

    Display Picture Metadata in your Silverlight 2.0 Deepzoom Application

    April 30, 2008 17:11 by Geert van der Cruijsen

    As i promised 2 days ago here's my post about how to display metadata of sub images in your Silverlight Deepzoom Application. I already typed this post yesterday but because of a stupid mistake i lost my post and now I have to type it again :( (but I think I'll make it a bit shorter)

    To start building your Silverlight 2.0 deepzoom application download Deepzoom Composer from Microsoft here. This tool works quite easy. just add some images in the "import" mode then drag them on your screen in the "compose" mode and then export your deepzoom Project.

    If you want to be able to identify the different sub images in your Multiscaleimage object check the "Create Collection" checkbox.

    deepzoomComposerCollection

    After exporting this will be the result:

    deepzoomexport

    Now to load up this collection of pictures into your own project take a look at this weblog, there is a really good explanation on which steps to take and after you did all those steps i'll explain how to show metada of the different subimages in the deepzoom application.

    So if you are at this point you should have your own working deepzoom application and you want to add picture metadata to your project. If not go back to this weblog or try one of these.

    The only way of identifying the different sub images in the big multiscaleimage is by the Z-Order of the different images. So how do you know which image has what Z-Order you ask? thats where the generated SparseImageSceneGraph.xml comes in which was generated by the Deepzoom Composer.

    <SceneNode

      <FileName> P1000558.JPG</FileName

      <x>0,235460826165879</x>

      <y>0,00108692916410255</y

      <Width>0,218281177677285</Width>

      <Height>0,144923888547009</Height

      <ZOrder>2</ZOrder>

      <Description>Uitzicht van hotelkamer</Description>

    </SceneNode>

     

    As you can see i added my own Description element to every SceneNode in the generated xml so we can use it in our project. We'll use this xml file to query the ZOrder of the subimage and get the description as a result with the use of Linq.

    To do this we'll first have to open the xml file in our code behind page from the page.xaml.cs.

    deepZoomObject.Loaded += delegate(object sender, RoutedEventArgs e)

    {

        _xmlImageMetadata = XDocument.Load("SparseImageSceneGraph.xml");

    };

     

    After that we'll add code to display the metadata when the mouse moves over a sub image in the multiscaleimage.

    deepZoomObject.MouseMove += delegate(object sender, MouseEventArgs e)

    {

        if (mouseButtonPressed) 

        {

            mouseIsDragging = true

        }

        else 

        {

            ImageName.Text = GetMetadata(e.GetPosition(deepZoomObject)); 

        }

        lastMousePos = e.GetPosition(deepZoomObject);

    };

     

    Then we add the function GetMetadata which queries the xml file and gets the description from it.

    private string GetMetadata(Point point)

    {

        Point p = deepZoomObject.ElementToLogicalPoint(point); 

        int subImageIndex = SubImageHitTest(p);

        if (subImageIndex >= 0) 

        {

            var q = from c in _xmlImageMetadata.Elements("SceneGraph").Elements("SceneNode"

            where ((string)c.Element("ZOrder")) == (subImageIndex + 1).ToString()

            select (string)c.Element("Description"); 

            if (q != null)

           

                return q.Single();

           

            else

                return ""

        }

        else 

            return "";

    }

     

    This function uses the function SubImageHitTest which I copied from this weblog:

    int SubImageHitTest(Point p)

    {

        for (int i = 0; i < deepZoomObject.SubImages.Count; i++) 

        {

            Rect subImageRect = GetSubImageRect(i); 

            if (subImageRect.Contains(p))           

                return i; 

        } return -1;

    }

     

    Rect GetSubImageRect(int indexSubImage)

    {

        if (indexSubImage < 0 || indexSubImage >= deepZoomObject.SubImages.Count)        

            return Rect.Empty;

        MultiScaleSubImage subImage = deepZoomObject.SubImages[indexSubImage]; 

        double scaleBy = 1 / subImage.ViewportWidth;

        return new Rect(-subImage.ViewportOrigin.X * scaleBy, -subImage.ViewportOrigin.Y * scaleBy, 1 * scaleBy, (1 / subImage.AspectRatio) * scaleBy);

    }

     

    if you build and start your application now you should be able to see your added metadata when you mouseover a sub image in the MultiscaleImage.

    My working example can be found here: http://www.vdcruijsen.net/projects/SilverlightDeepzoom/test.html

    sourcecode can be downloaded here:

    (you'll have to add your own deepzoom object since i removed that from the zip file)

     

    Happy Coding!

     

    Geert van der Cruijsen

    kick it on DotNetKicks.com


    Comments (2)

    Build your own Silverlight 2.0 Deepzoom application and host it with "Silverlight Streaming"

    April 28, 2008 22:40 by Geert van der Cruijsen

    A few weeks back on MIX'08 Microsoft showed us a stunning demo including new technologies like Seadragon and Silverlight 2.0.

    This demo showed us the collection of memorabilia at Hardrock Cafe. The demo can be found at http://memorabilia.hardrock.com/

    This demo really got my attention and after some searching on the internet i found out i wasn't the only one. There are hundreds of blogposts by people showing how you can build this for yourself and guess what: it's really easy!

    I've spend some days in the weekend and this evening building my own version of a Silverlight Deepzoom Application. Most of my code is "borrowed" or copied from other blog posts which i'll list at the bottom of this post. My goal was to also be able to show metadata at the pictures and after some research it wasn't to hard to do this either. Since i didn't find any other blog posts who explained how to show metadata with your pictures i'll make a seperate blogpost about this tomorrow.

    I've put some of my last vacation photo's online in my own deepzoom test application at: http://www.vdcruijsen.net/projects/SilverlightDeepzoom/test.html (source also linked on that page)

    Download Source: 

    As i said before i won't go explaining the code in this post because i'm gonna do that tomorrow in a separate post where i'll explain how to add metadata to your deepzoom application. if you want more information about Silverlight and Deepzoom check out the following links:

    how it works: http://blogs.msdn.com/jaimer/archive/2008/03/31/a-deepzoom-primer-explained-and-coded.aspx

    lots of how-to's: http://projectsilverlight.blogspot.com/

    more info on silverlight 2.0 http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx

    Another cool thing i found out is that Microsoft is offering is a hosted environment for your silverlight applications. You can get up to 10GB of free space at Silverlight Streaming: http://silverlight.live.com/

    You can upload your Silverlight manifest files + other resource files like video's to Silverlight Streaming and you can link your silverlight object on your own page. The silverlight object in my own example is also hosted at Silverlight Streaming.

    If you have any questions or recommendations about this subject please dont hesitate to send me a mail about it.

    Geert van der Cruijsen

    kick it on DotNetKicks.com

     


    Comments (0)

    Volta or Silverlight 2.0

    April 21, 2008 22:19 by Geert van der Cruijsen

    Last Wednesday evening we had a presentation at the Avanade Netherlands office about Volta and what Volta could do for us in the future. The demo in the presentation showed us the possibilities that Volta can bring to software developing on the web. After this presentation we had a cool discussion about the question if Volta will really make it to the daily life of web based software development.

    In my opinion with my current knowledge about Volta is that a lot of pro’s of Volta are also taken away by using Silverlight 2.0 on the client instead of html/javascript. I’ll sum up most pro’s of using Volta and then compare then to the use of Silverlight 2.0. Ofcourse most things said in this post are just my current ideas and opinions on the 2 projects which are far from complete products today.

     

     

     

    Some pro’s on volta are: Dynamic/easy switching of the place where code is being executed. You can add a single line of code in a class and make it completely run on the client instead of on the server. If you want your code to run on the client Volta will generate javascript from your .net code after it’s compiled to the IL.

    This power of volta makes it easy to just generate all your javascript instead of writing it all by yourself. Everyone knows writing/debugging loads of javascript can be a pain in the ass so of course it’s nice to program in C# or any other .net language you like. You can even set breakpoints on the c# code which you created and step through this when you are actually running generated javascript at that time.

    Volta can also generate javascript which is compatible with the browser which is doing the current request so you don’t have to think about cross browser compatibility anymore.

    All in all at the time Volta will be a fully grown product you can write your whole web application in 1 language instead of also having to write javascript to get your fancy web 2.0 look and feel on your web app.

    After seeing the presentation about Volta I thought the only big feature Volta can bring is the possibility to dynamically change parts of code to run on the client or server. The other nice features are also brought to us with Silverlight 2.0 which makes it possible to write C# for the client side instead of javascript. In my opinion Silverlight even has more and better options to do this because  you have more powerfull tools in the Silverlight runtime which make it possible to make even fancier tools then you can in Javascript. One big example of something Silverlight can do which javascript will never do is that you can make real statefull apps instead of the stateless pages you’ll keep building in Javascript. Opening sockets to the server will never been done by javascript while it is easy to do in Silverlight 2.0

     

    So if javascript is going away in both cases what does Volta bring that silverlight can’t handle? The only big thing that is left is changing your code to run on the server/client by adding a line of code to your class. Ofcourse this can be a really powerfull thing but in my opinion this wont be used that often and especially not in enterprise applications where my focus on my job is at.

    In my opinion Silverlight 2.0 can become a really big revolution on the web IF and only IF Microsoft does everything it can to get the silverlight plugin on ALL pc’s as soon as possible (ofcourse after Silverlight 2.0 is released) The plugin has to be available for every browser no matter what OS. No matter what type of computer. Desktop or mobile. Everyone with Linux and Firefox or Windows and IE will have to get this plugin which has same functionality. So in my opinion Microsoft should develop the plugin for all browsers instead of only for windows+IE and let the moonlight project reverse engineer this plugin for a plugin that runs on linux. Volta instead of Silverlight doesn’t have this problem because the javascript code that’s being generated already runs on all sort’s of browsers on all OS’es.

    We’ll have to see what the future brings but my money is on Silverlight being installed on 95% of all pc’s in a year or 2 so we don’t have to generate Javascript but can just make flashy c# code on the client.

    Another option can also be that Volta will be generating Silverlight code instead of javascript so we get the best of both worlds :)

    Do you have a different opinion? Please let me know in a comment!


    Comments (0)

    Microsoft releases beta versions of IE8 and Silverlight 2.0 at MIX 08

    March 6, 2008 22:44 by Geert van der Cruijsen

    Today Microsoft launched the public beta of Internet Explorer 8 at MIX'08. As i posted in a blogposting yesterday the big change in Internet Explorer 8 is the render engine which is running in "super standard mode" instead of quirks mode that IE7 uses. You can download the public beta here: http://www.microsoft.com/windows/products/winfamily/ie/ie8/default.mspx

    One thing microsoft learned about the release of IE7 was that after the first Beta release of IE7 there were so many reactions, complaints and idea's send by people that it was almost undoable to do something with all the input. With this release of IE8 Microsoft opened up there bug database to the public so everyone can see the known bugs and people can even help prioritize these bugs.

    One of the new feature in IE8 apart from the render engine is the use of "webslices" (http://www.microsoft.com/windows/products/winfamily/ie/ie8/webslices.mspx) these webslices look like a sort of rss technology where you can subscribe yourself to a part of a website instead of an rss feed and the webslice technology will let you know when the data changed.

    Microsoft also released the beta of Silverlight 2.0. Scott Guthrie made a nice post about that on his blog: http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx

    There are also some nice video's on the website of MIX 08. These video's and part of the website are made with silverlight 1.0 so check it out:

    mix website: http://visitmix.com/2008/default.aspx

    mix videos: http://sessions.visitmix.com/

    Geert van der Cruijsen


    Comments (0)