XAML Playground
about XAML and other Amenities

Few thoughts on PDC 2010 and the Silverlight destiny…

2010-10-29T22:45:18+01:00 by Andrea Boschin

There is not any doubt, the words I read today in this article and the complete lack of Silverlight during the PDC 2010 has been for me an hard blow. I put a great part of my work in this technology, I immediately recognized as my best friend for fast and reliable developing of applications. And I'm still convinced about this argument, also after the fashion of HTML5 has taken the scene few months ago and now that it has been promoted to a primary actor of the most important conference of Microsoft. This does not mean I really believe that Silverlight has been put in the trashcan and HTML5 has been suddenly put in its place. This will be a story about whom we will know in the next months and I'm confident that what appear to be real now will be demonstrated false soon.

I say these words not as a fanboy, but simply thinking at the reasons that moved me away from the HTML and Javascript world where I was really active. I remember the days when I spent my time trying to make HTML pages similar across four browser. I remember the days when I filled my code with message boxes just to try to understand why my javascript code did not work. I remember the frustrating hours I wasted to try to make good layouts with a technology that is not born to develop applications but only to display rich hypertexts. Yes, all we have to remember that HTML is not for applications. And it is not cross-platform. Developers makes it so. 

I started my story in Silverlight with the very first beta of the version 1.0 and I still have in my ears the voices of people saying: "puah... you have to develop with Javascript... you are crazy!". And they were right, Silverlight 1.0 was ugly because it did not resolved the main problem of the developers, the need of having reliable code that is something Javascript cannot give us. And even Javascript libraries like jQuery can't. I would like to know where are the people that write testable code, the ones that use dependency containers, design patterns, or simply the most effective coding tecniques that have its main reason in protecting the code from errors (expecially runtime errors) and give it maintainability and flexibility. While Silverlight enforces all these tecniques, Javascript doesn't. So the question I asked myself today was: is it what the people really wants?

And my answer is no. I'm confident people like to have effective applications that they can develop in less of half the time they have to use with other technologies. HTML5 will be for sure an interesting thing, but none has to confuse it with a development platform. HTML is the sole language that can be used for websites, where search engines make the difference, but when someone seriously wants to develop "applications", it is an insane choice. Now, and watching at the story behind HTML probably forever. I want to remembers, closing this post, that HTML5 now is far to be final. Just during the demo at the PDC they showed how differently it behave on different browsers and to me none can seriously believe that the actors in the scene will not try to catch HTML5 and make it a weapon to kill the other competitors. This is already happening.

Categories:   News
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Silverlightbox released on Codeplex

2010-10-18T00:03:08+01:00 by Andrea Boschin

Few hours ago I released a new project on Codeplex called Silverlightbox. The purpose of this project is to create a replacement for the javascript lightbox, used widely in many websites to display images and slideshows. The project works adding a silverlight overlay to the page that is showed when an hyperlink to an image is hit.

The Silverlightbox I released is compatible with the javascript lightbox. You can easily change the scripts of lightbox with my scripts and it works seamless without any change to the HTML already tagged for the lightbox. To have a look at how it appear try to click one of these images

Also if I'm a strong fan of Silverlight I provided the Silverlightbox with a minimal fallback javascript version that take place when the client does not have the plugin installed.

How to use Silverlightbox

To add the Silverlightbox to your website you have to link few script in the page. They are a cascading style sheet, the main silverlightbox.js script and the silverlight.js. You have also to link jQuery from the microsoft CDN. jQuery is used for the fallback javascript and for the part that query the page to find links to attach. Here is the code you have to add to the page <HEAD>

<link href="slb/sllightbox.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.js"></script>
<script type="text/javascript" src="slb/silverlight.js"></script>
<script type="text/javascript" src="slb/silverlightbox.js"></script>


Once you have added the script to the page you can easily tag you hyperlink to show the silverlightbox. For this purpose you have to use the rel attribute and optionally specify a title attribute that is used to give a title to the displayed image. The code below show how to link an image to the Silverlightbox

<a href="http://blog.boschin.it/images/pics/DSC_6508.jpg" rel="lightbox" title="Dolphins 1">Show image</a>


Using a special syntax it is possible to create collection of images displayed ad slideshows. A slideshow have the navigation controls and let the user to move alogn the images without closinge the Silverlightbox. Here is how to create a slideshow

<a href="http://blog.boschin.it/images/pics/DSC_6511.jpg" rel="lightbox[dolphins]" title="Dolphins 2">Show image 1</a>
<a href="http://blog.boschin.it/images/pics/DSC_6516.jpg" rel="lightbox[dolphins]" title="Dolphins 3">Show image 2</a>
<a href="http://blog.boschin.it/images/pics/DSC_6519.jpg" rel="lightbox[dolphins]" title="Dolphins 4">Show image 3</a>
<a href="http://blog.boschin.it/images/pics/DSC_6522.jpg" rel="lightbox[dolphins]" title="Dolphins 5">Show image 4</a>

The code create a collection called "dolphins". You can have mltiple collections in a page using different names to group images each other.

Futures

I would want to continue the development of the Silverlightbox that now comes in the minimal release that cover the same features of the javascript counterpart. My intent is to add some interesting features:

1) autoplay of slideshows
2) support for video
3) customizable easing in and out
4) themes

Please let me know if there are other features you like and if you find any issue with the Silverlightbox. For this purpose please use the issue tracker on codeplex.

Link: http://silverlightbox.codeplex.com/

Tags:   , ,
Categories:   News
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

WP7 Fast Tips: Load (decode) and Save (encode) Jpeg files

2010-10-15T11:40:05+01:00 by Andrea Boschin

Notice: I've added the new category "WP7 Fast Tips" to collect fast tips I found while developing my Windows Phone Applications. You Don't expect only great tips in this category but also simple things I need fo remember or I found with some difficulties :)


Working on an application I hope to publish soon on the marketplace, I have the need to save an image from a WriteableBitmap instance into a Jpeg file. It was not an easy search but finally I found a couple of methods, added as Extension Methods to the WriteableBitmap class itself. If you need to encode a jpeg to a byte array you can use this code:

   1: public byte[] EncodeToJpeg(WriteableBitmap wb)
   2: {
   3:     using(MemoryStream stream = new MemoryStream())
   4:     {
   5:         // this is Extensions.SaveJpeg() method
   6:         wb.SaveJpeg(stream, wb.PixelWidth, wb.PixelHeight, 0, 85);
   7:         return stream.ToArray();
   8:     }
   9: }

The parameters of the SaveJpeg method require a stream to write to, the size of the bitmap to generate and the quality from 0 to 100. The fourth parameter, called orientation, currently is not used and you can set it to 0 (zero).

The counterpart of the SaveJpeg methos is LoadJpeg that you can use to take a Jpeg file and load it into a WriteableBitmap instance. A very useful feature. If you need to write the Jpeg to the MediaLibrary probably the better is to pass the generated stream directly to the Save method.

Tags:  
Categories:   TIPS | Windows Phone 7
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Join Silverlight Firestarter!

2010-10-14T21:53:37+01:00 by Andrea Boschin

SLFirestarter_150X240

Silverlight Firestarter is a global event, stremed from Microsoft and presented by Scott Guthrie. During the event you can follw interesting sessions about Silverlight, k questions ad be in touch with your favorite technology.

It is an important event you cannot miss!

When: Thursday, December 2, 2010 8am to 5pm PT

Where: Microsoft corp, Redmond or Streamed Online

To register for the event follow this link and apply for in person or online registration form

http://www.silverlight.net/news/events/firestarter/

Capture

Tags:  
Categories:   News
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed