Rants Tagged with “Silverlight 2”

<<  <  1  2  3  4  5  6  7  8  9  10  11  >  >>  (Total Pages: 13/Total Results: 127)

Olympics Without Silverlight?

Silverlight Logo

UPDATE: Silverlight is now required to view the video...it no longer allows a downgraded experience.

I've been poking around the NBC-Olympic site.  There has been consternation that Flash is used on the site too.  The deal has been that the video playing would be done using Silverlight (which is why I am linking to http://www.nbcolympics.com/video). The enhanced player is really a nice design and it lets you view four events at once and see real-time stats.  Impressive.

To dig deeper like I like to do, I decided to see what the experience would be like for people who don't have Silverlight installed.  This is the prompt I get from the site:

What's interesting to me is that you can view video without Silverlight, but you get a better experience with Silverlight.  If you can proceed without it, I wonder how many installations this will actually create.  I am sure still a big #, but it would be nice to have required it...oh well.

Silverlight 2 and the Olympics

Silverlight Logo

Tomorrow the Olympics starts and for Silverlight 2 its a big deal. In case you've been under the rock, Microsoft announced at MIX '08 that it had an agreement with NBC to broadcast every minute of every event of the Olympics through a Silverlight 2 driven web site. Its big...really big.

As far as I am concerned, this is a big risk, big reward sort of scenario. Lets discuss reward first. This puts Silverlight 2 squarely in the eyes of lots of end-users. This will help produce ubiquity of the Silverlight 2 runtime. This is going to get a lot of users to install the bits. But what's the risk? There are two risks:

  • Silverlight 2's Installation causes problems
  • Video Streaming can't scale

Installation issues may cause some end-user headaches, but hopefully it should be pretty smooth.  I don't think this will happen.  Video streaming on such a large scale is a bigger risk I think. Microsoft has been in this business a long, long time so I doubt its going to be an issue...but...if it doesn't scale correctly it will be bad.

The problem is that the actually streaming scalability has zero to do with Silverlight 2. Let me say that again, Silverlight 2 can play streamed video but if it doesn't scale, its not Silverlight 2's fault. Unfortunately, the next day it will be the TechCrunch's, CNet's and even Mary Jo's lead story.

As Silverlight 2 developers, we are in with Microsoft on this one.  If it succeeds, it will make the Silverlight 2 RTM that much bigger with more demand for the skills involved.  If it fails, it will be a scar on the face of Silverlight that will be hard to overcome.

I'll be watching with bated breath and clenched cheeks...will you?

The Silverlight Tour Now Available in Spanish!

Silverlight Logo

I am proud to announce that in partnership, with DevWorx of México, the Silverlight Tour will now be available in Spanish for the Latin American and Spanish markets.  The first three classes are happening on:

  • September 29th - October 1st, 2008 - Mexico City, México
  • September 29th - October 1st, 2008 - Guadalajara, México
  • October 8th - 10th, 2008 - Monterrey, México

I gladly welcome DevWorx to the family of Silverlight Tour partners.  If you are want to learn Silverlight 2 and are looking for a class in Spanish, they can definitely help you out!

New DeepZoom Composer Build

Silverlight Logo

Microsoft has released a new version of their DeepZoom Composer tool that adds a number of features including panoramic stiching and integration with PhotoZoom!  Go Grab it!

 

One More Week to Boston

Silverlight Logo

Only another week before my Boston Silverlight Tour stop.  We will be in Boston for the Silverlight Tour on August 11-13th, 2008. 

If you are in the market for three days of intense Silverlight development instruction, take a gander at the site.  You can view the full Outline for the course here:

http://www.silverlight-tour.com/outline.aspx

 

Silverlight Tour: Boston - August 11th-13th

Silverlight Logo

In case you read my blog and didn't know that we were coming to Boston, what are you waiting for? We will be in Boston for the Silverlight Tour on August 11-13th, 2008.  If you're interested in signing up, we are not full yet!

NHibernate.LINQ with ADO.NET Data Services

Silverlight Logo

Now that my ADO.NET Data Services support has been merged into the trunk of NHibernate.LINQ, I do have some caveats about using NHibernate.LINQ with ADO.NET Data ServicesADO.NET Data Services is a beta 1 product so there are some bugs and issues that you will either need to avoid or work around.

The biggest issue is around entity identity. ADO.NET Data Services must know how identity is established for objects in order to support the Data Service. It does this in a two step process:

  • First it looks for attributes that describe the 'primary key'.
  • Failing that, it looks for properties on the entity called ID, or ending with "ID".

The second approach is where I expect most of NHibernate projects to fall into since you really don't want to pollute your objects with technology specific information (the attributes). This approach works well except that there is a bug in the Beta 1 version of ADO.NET Data Services.  If the properties are specified in a base class and the keys are specified ending in "ID" (instead of just being called "ID"), then the search for the identifiers fails and Data Services fails to want to serve these objects.  For example:

public class AbstractCategory
{
  public virtual int CategoryID { get; set; }

  public virtual string CategoryName { get; set; }

  public virtual string Description { get; set; }

  public virtual byte[] Picture { get; set; }

  public virtual IList Products { get; set; }
}

public class Category : AbstractCategory
{
}
}

If this is your scenario, I might suggest waiting for later build of ADO.NET Data Services to be released as this is definitely a bug not expected behavior and I have gotten word from Microsoft that it is fixed in the RTM (which isn't available yet).

The next issue is that for collections, ADO.NET Data Services must understand the types that belong in a collection. In this case our above example will not work either in that having the Products in a Category as a simple IList can't tell ADO.NET Data Services what types of objects to deal with.  If we change this to an IList<Products>, it works fine.  If we have to change our entities to work with ADO.NET Data Services, this is what our new Category might look like instead:

public class Category
{
  public virtual int CategoryID { get; set; }

  public virtual string CategoryName { get; set; }

  public virtual string Description { get; set; }

  public virtual byte[] Picture { get; set; }

  public virtual IList<Product> Products { get; set; }
}

With these changes, ADO.NET Data Services work fine.

If you are new to ADO.NET Data Services, this blog entry may help with some debugging issues in using it:

http://wildermuth.com/2008/06/07/Debugging_ADO_NET_Data_Services_with_Fiddler2

Lastly, I want to follow up on a note that Ayende mentioned on his announcement of my examples.  In his blog post, he said:

From a technological perspective, I think this is awesome. However, there are architectural issues with exposing your model in such a fashion. Specifically, with regards to availability and scalability on the operations side, and schema versioning and adaptability on the development side.

I think he's right in that there is a schema version issue here that needs to be addressed but that the availability and scalability problems are ones that would be in the underlying data model itself. Since ADO.NET Data Services are just a convenience around WCF's REST Service Model, we can scale out or up depending on our needs (as well as caching).

What I think is important is to understand the reason behind ADO.NET Data Services.  It is not a model to replace typical Web Service or Message Bus architectures.  Its not all that fast or efficient.  Its purpose is to allow the creation of a simple model to allow communication across the firewall.  What I mean is that it is meant for the AJAX and RIA developers.  Its a way of communicating data to clients that run on the Internet. 

Its important to understand that data you expose with ADO.NET Data Services is not magically more secure...in fact, since its meant for client-side consumption of data, you should not allow data to be exposed by ADO.NET Data Services that is sensitive. Remember, that consuming data in the client is not secure in itself.  If you wouldn't feel safe consuming data in client-side JavaScript, don't expose it via ADO.NET Data Services.

Silverlight 2 + NHibernate.LINQ == Sweet

Silverlight Logo

UPDATE: Looks like I uncovered a ADO.NET Data Services bug in FF3.  The examples will only work with IE and Safari at the moment.

After a couple of weeks on and off the project, I finally finished the first stab at adding ADO.NET Data Services support to NHibernate.LINQ. To accomplish this I've added three features:

  • Support for IUpdateable to support full NHibernate CRUD.
  • Support for a new Expand extension method to do eager loading via the LINQ interface.  (The Expand method is similar to Entity Framework's Include method.)
  • Finally, using the Expand extension method, I implemented the IExpandProvider interface to allow for expansions via the REST API.

These changes have been posted to the NHContrib project (where the NHibernate.LINQ lives) to allow the committers to validate and add it to new versions of the project. I am sure that it will need some refactoring and tweaking but the basics are done.

In addition, I'll be finishing up my discussion of implementing the IUpdateable interface pretty soon to help those of you adding this support to your projects. I'll also be blogging about how I added the IExpandProvider to help those of you trying to add that to your projects (or even to LINQ to SQL).

To prove out this new support, I've launched a new version of my Simple ADO.NET Data Services project with a NHibernate flavor.  Go visit http://www.silverlightdata.com to see it working.  In addition, I updated that sample to include paging support to make it a little more performant.

Let me know what you think.

Animating Brushes with ObjectAnimationUsingKeyFrames

Silverlight Logo

In my recent class I had a student ask me about animating a brush. I quickly dove into how to animation a *color* in a brush and he indicated that isn't what he wanted.  He had a resource-based brush that he wanted to switch out in the Visual State Manager.  In Blend when he was setting the Brush during the animation recording of the MouseOver event but that wasn't creating a storyboard but changing the natural brush of the control. To solve this we had to dive into the XAML as Blend doesn't seem to know about the ObjectAnimationUsingKeyFrames animation type.

First a small discussion about animations.  Normally animations will take a value and transition between the values.  For example a DoubleAnimation that is set up to change the Opacity of a visual element from zero to one, will interpolate the values to create a smooth transition from invisible to visible. Keyframed animations support several types of interpolation including linear (the default), spline and discrete.  Linear keyframes simply create a smooth transition between values.  Spline keyframes allow you to shape the interpolation between the values to ease-in or ease-out the transition.  Lastly, the Discrete keyframes set a value at the time of the keyframe without any interpolation.

The ObjectAnimationUsingKeyFrames animation allows you to use object instead of primitive values for your animation keyframes. The only type of keyframe allowed in the ObjectAnimationUsingKeyFrames animation are Discrete keyframes.  The reason is that there is no good way to interpolate between object values. So back to our original problem, animation a Brush.  In the MouseOver state, the student wanted to change the Fill of a rectangle from one resource-based Brush to another.  For example, here are the brushes defined in the Resources section:

<UserControl.Resources>
  <LinearGradientBrush x:Key="backBrush"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0">
    <GradientStop Color="#FFFF0000" />
    <GradientStop Color="#FFE50000"
                  Offset="1" />
  </LinearGradientBrush>
  <LinearGradientBrush x:Key="mouseOverBackBrush"
                       EndPoint="0.5,1"
                       StartPoint="0.5,0">
    <GradientStop Color="#FF006DFF" />
    <GradientStop Color="#FF0064E9"
                  Offset="1" />
  </LinearGradientBrush>
  
  ...

The student had set the backBrush to the Rectangle's fill during the design phase and wanted to set the mouseOverBackBrush during the Visual State Manager's MouseOver state. Since Blend wouldn't let us do it, we had to write the ObjectAnimationUsingKeyFrames XAML ourselves.

To do this, we created a Storyboard and an ObjectAnimationUsingKeyFrames element inside the MouseOver state (of the Visual State Manager for our Button's ControlTemplate).  In the new element we specified the Storyboard.TargetName and Storyboard.TargetProperty to "theBack" and "Fill". Inside the animation, we created a DiscreteObjectKeyFrame for our one value.  We just wanted to change it to the since new brush so we only needed one.  We set the Keytime to "0:0:0" to specify that this should happen immediately.  Lastly, we specified the StaticResource for the mouseOverBackBrush as the Value. Here's the entire MouseOver state XAML:

...
<VisualState x:Name="MouseOver">
  <Storyboard>
    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="theBack"
                                   Storyboard.TargetProperty="Fill">
      <DiscreteObjectKeyFrame KeyTime="0:0:0"
                              Value="{StaticResource mouseOverBackBrush}" />
    </ObjectAnimationUsingKeyFrames>
  </Storyboard>
</VisualState>
...

We didn't need to specify another animation in the Normal state the Visual State Manager automatically handles the resetting of our value back to the original state. It just works.  Here's two pictures of the button before and after the mouse over:

You can download the example here.

Silverlight 2 Hotfix just hit Windows Update

Silverlight Logo

Short and sweet...if you are having Silvelright 2 Beta 2 issues with Firefox and media streaming, make sure you check Windows Update for a new fix.  I think the OSX guys can just visit a Silverlight page to get it (using the auto-update stuff).