Silverlight and Playready

First of all – the Silverlight DRM client is FREE!

The main component for playing DRM protected content with silverlight streaming was released during the weekend – and it’s called PlayReady Server SDK. There are two distinct license agreements depending on your needs – one for developing PlayReady Server Applications (the SDK itself) and another for deploying a PlayReady Service. About the bucks – no, it’s not free: for developing applications, 30.000$ one time license fee is needed; for the deployment, an additional 30.000$ processor fee OR a 0.001$/license fee is needed. For qualified customers a 120 days eval period is given as well for testing and evaluating. Another possibility is to license the SDK as an ISV to build WPF applications that could process content protected with PlayReady.
The DRM technology itself is existing since 1999 – and PlayReady technology was later introduced to fullfit the ever increasing need for mobile instrumentation. Silverlight not being a mobile only technology (don’t forget – sooner or later it comes to a phone near you, whether it is a Nokia or Smartphone), but thin enough to be a target platform for this technology. In the very soon future the technology will evolve to support literally anything from H.264 to AAC on any PlayReady compatible device and technology.

And now the fun part – how it works?

Silverlight DRM is a small, cross-platform version of the PlayReady client used exclusively by the Silverlight Web browser plug-in. Analogous to other online content services, a Silverlight service that offers protected content uses the PlayReady Server SDK to first encrypt the content. The first time a client tries to playback a protected media comes the individualization feature of the server – it binds the DRM client to the computer it was installed. Client is then authorized to connect to the license server and acquire a license – valid for the duration of the browser session. So every end-user is given an individualized Playready component and different certified license keys. This significantly reduces the danger of global breaks. If a specific version of a PlayReady client becomes compromised, it can be barred from acquiring licenses for new digital media files unless the latest version of the PlayReady client is downloaded that is robust against the circumvention.

If you got interested, you may play around with PlayReady – check the examples site, check the site for licensing, or read about the silverlight client.

Technorati tags: , ,

Open Source Series 2.: NVelocity

Formerly as part of the Apache Jakarta project, now part of the Apache project itself can be found the Velocity project. Since the beginning, it is the de facto tool for generating template driven applications – websites, documents, etc., the list of projects, websites and tools powered by or capable of using Velocity is endless. As for other great and successfull projects (like Hibernate, which also uses velocity for generating POJO files), this was met with the new wind of .NET – there were NVelocity born. So to make it short – NVelocity is a .Net-based template engine – it permits anyone to use the simple yet powerful template language called VTL to reference objects, execute methods, etc defined in .Net code. Speaking of a web application, this leads to the MVC pattern – this simple to use and set up tool enables you to program against modells in your views, and put the controller in charge of binding the two – this (and NHibernate, and ActiveRecord, and Windsor…) is what lead to the born of the Castle and the Rhino projects – but these are in later post :).

So no whistles nor bells, but the main part of NVelocity is:

  • You create the engine – new NVelocity.App.VelocityEngine(ep);
  • You get a template – engine.GetTemplate(“template.vm”);
  • You create a context – new NVelocity.VelocityContext();
  • You fill the context – context.Put(“key”, “value”);
  • Than you merge the context with the template using the engine – template.Merge(context, outputStream);

The extras are coming mostly in the template file, and by the fact, that there are plenty of way to provide plugins into the system – ResourceLoaders for determining where to get the file (from the filesystem? database? embedded resource?), caches of various parts, etc. So, back to template file – what can I do?

  • I can print the value for a key – ${key}
  • I can use property getters and setters – #set ${object}.prop = “value”
  • I can use loops, if-then-else, define macros, etc
  • Call and return any method with parameterlists which may contain values, arrays, dictionaries, etc – ${object}.Method(${key}, “%{key = ‘value’, key2 = ${key}}”);
  • Meanwhile the whole thing is typesafe and – the template gets compiled into an AST tree the first time it met!

So – I think this is a very handy tool for generating source files, for generating documents and for driving data driven websites.

PS: No, it has nothing to do with Microsoft Velocity – that goes into the cache providers series 🙂

This post is part of the open source series

A short overview of cache providers, part 1

In the following few paragraphs I'll try to a give a less-or-more comprehensive view over the world of cache providers. What we call a cache provider? The first thing people generally do is cache things within their web processes. But this means your cache is duplicated multiple times, once for each thread. This is a waste of memory and you'll get low cache hit rates. If you're using a multi-threaded language or a shared memory API like the built-in System.Web.Cache with in-memory settings, you can have a global cache for all threads, but it's per-machine. It doesn't scale to multiple machines. Once you have 20 webservers, those 20 independent caches start to look just as silly as when you had 20 threads with their own caches on a single box. Cache providers' servers and clients work together to implement one global cache across as many machines as you have – like the state server or sql server options for System.Web.Cache. But is the default implementation of System.Web.Cache flawless and perfect? Some says no – there may be improvement both the server and client sides.


Why bother with a linux damon cache implementation made by danga? Answer is easy: first of all – there is a win32 implementation for it. Secondly – there are thons of different APIs to access it from .NET. Three of those APIs am I going to further investigate – the .NET memcached client library, the Memcached Client, and BeIT Memcached. (interesting thing to mark – 3 projects, 3 different forge – sourceforge, codeplex and google code 🙂 )

The .NET memcached client library is the one, that mostly follows the schema and technology of the java client – it's a 1:1 port of that one.

The BeIT client comes with many bells and whistles, like socket pooling, uses the ketama algorithm for sticking keys to servers (key – server assigment stays the same even if there are new servers added or removed between), most of the simple value types have their own optimized serialization, have compression schemas, automatic key prefixing, dead server detection, etc.

The Memcached client comes with nearly the same set of features, except for an additional one – a provider project to wire it up into System.Web.Cache without any additional steps.

As a special experiment, there are .NET implementations of the memcached server as well, and compared to the native C implementation, they even doesn't work that bad. One of the implementations I tried was part of the experimental hive of the Rhino framework – I'll try to cover that framework in a later post 🙂

33 easy steps to dive into WCF

¾  Step 1 – Read Principles of Service Design: Patterns and Anti-Patterns for an overview of SOA basics (~20 -30 min.)

¾  Step 2 – Read Windows Communication Foundation Road Map to get an understanding of WCF goals, and its role in SOA enterprise architecture (~20 -30 min.)

¾  Step 3 – Read On the road to Indigo: Prescriptive Guidance for Today’s Technologies by Richard Turner to get an understanding of current state of all Microsoft distributed application technologies (20-30 min) 

¾  Step 4 – Read Windows Communication Foundation Architecture Overview by Yasser Shohoud to learn WCF basics: Addresses, Bindings, and Contracts (~45 min.)

¾  Step 5 – Read Windows Communication Foundation Architecture Overview to learn WCF basics: Endpoints, Bindings, Contracts, Behaviors (~45 min.)


¾  Step 6 – Complete virtual lab “Understanding Windows Communication Foundation” (90 min.)

¾  Step 7 – Complete virtual lab “The Fundamentals of Programming the Windows Communication Foundation Virtual Lab” (90 min.)

¾  Step 8 – Look through WCF latest news and announcements (~20 min.)

¾  Step 9 – Download and build the Data Contract Samples

¾  Step 10 – Read the article “Serialization in Windows Communication Foundation”

¾  Step 11 – Read Craig McMurty’s Blog on “Versioning Windows Communication Foundation Services”

¾  Step 12 – Read the article and review the code for “Discover Mighty Instance Management Techniques For Developing WCF Apps” (Code)

¾  Step 13 – Read the MSDN Documentation on “Synchronous and Asynchronous Operations”

¾  Step 14 – Read Steven M. Cohn’s blogs on “WCF: Asynchronous Operations”

¾  Step 15 – Read the MSDN Article “Build a Queued WCF Response Service

¾  Step 16 – Read Designing and Implementing Services for a high level conceptual orientation to design and implement WCF services.

¾  Step 17 – Read Hosting WCF Services

¾  Step 18 – Read WCF Essentials – What You Need To Know About One-Way Calls, Callbacks, And Events by Juval Lowy (Source code included)

¾  Step 19 – Read Build a Queued WCF Response Service by Juval Lowy (Source code included) for a brief introduction to WCF queued calls followed by an interesting problem-how to get results out of a queued call-and the solution via some cool WCF programming techniques.

¾  Step 20 – Review Build a Queued WCF Response Service  on Dr Dobb’s Portal

¾  Step 21 – Read the MSDN article on Sessions, Instancing, and Concurrency

¾  Step 22 – Read Understanding Windows Communication Foundation Extensibility for an overview of WCF’s extensibility points (~20-30 min.) 

¾  Step 23 – Watch MSDN Architecture Webcast: Extending Windows Communication Foundation by Aaron Skonnard for a demonstration of several key extensibility points (~70 min.)

¾  Step 24 – Review the following SDK extensibility samples (~180 min.)

¾  Custom Service Host

¾  Message Inspectors

¾  Transport Extensibility Samples

¾  Channels Extensibility Samples

¾  Message Encoder Extensibility Samples

¾  Instancing Extensibility Samples

¾  Step 25 – Review “Administration and Diagnostics” branch in MSDN documentation (~30 min.)

¾  Step 26 – Review the following integration and interop scenario guides (~120 min.)

¾  Integrating with COM Applications

¾  Integrating with COM+ Applications

¾  Integration with .NET Remoting

¾  Interoperability with WSE 3.0

¾  Interoperability with ASP.NET Web Services

¾  Step 27 – Review the following migration related articles (~120 min.)

¾  All About ASMX 2.0, WSE 3.0, and WCF (Aaron Skonnard)

¾  Anticipating Adopting the Windows Communication Foundation: Easing Future Migration  (From ASP.NET)

¾  WCF and ASP.NET Compatibility Mode (Wenlong Dong’s Blog)

¾  Migrating ASP.NET Web Services to WCF

¾  Migrating WSE 3.0 Web Services to WCF

¾  Step 28 – Read Windows Communication Foundation Transactions Overview to get an understanding of WCF transaction management functionality (~30 min.)

Follow up by going through Writing a Transactional Application

¾  Step 29 – Go through Reliable Messaging demystified blog entry by Shy Cohen (~10 min.) 

¾  Step 30 – Listen to Secure, Reliable Transacted Messaging with WCF (Part 1)  podcast on Channel 9 (~30 min.)

¾  Step 31 – Listen to Secure, Reliable Transacted Messaging with WCF (Part 2)  podcast on Channel 9 (~30 min.)

¾  Step 32 – View MSDN TV episode Reliable Messaging in Windows Communication Foundation (~15 min.)

¾  Step 33 – Complete “Reliable and Transacted Messaging with the Windows Communication Foundation Virtual Lab” (~90 min.)


Technorati tags: , , ,

Open Source Series 1.: Introduce to the series

In this series (probably) lesser known but very valuable opens source projects will be searched for, found, and most important – write about 🙂

In the following parts I try to cover some of my favourites first, but beside having open eyes I have ears as well – if you know some OS project gems, that are useful, don’t hesitate to comment/contact.

Technorati tags:

How to put ControlState into ViewState and how to put ViewState into session

It’s a common problem, that your viewstate is bloating up under heavy usage (complex data editing scenarios with multiple grids enabling editing, etc). ASP.Net 2.0 comes up with a handy solution for such cases by letting you easily redefine your PageStatePersister in your page with (under .NET 1.0/1.1 this could be done using LoadPageStateFromPersistenceMedium and SavePageStateToPersistenceMedium):

    protected override PageStatePersister PageStatePersister
            return new SessionPageStatePersister(this);

After changing this (and applying a custom base page for all my pages with:

<pages pageBaseType=”PageBase” />

for this to work it is needed to derive all your aspx pages from that page!)

I got the result from ~3500 viewstate bytes to ~1500 viewstate bytes. But what can I do with that 1500 bytes? What is in it? I started ViewStateDecoder 2.1, and checked into it, what I saw was surprising: all usual viewstate data was wiped out, but there were still the controlstate! So it’s not the same as the PersistanceMedium calls as they were formerly… How to get rid of that 1500 byte? After using the Reflector a bit I found out, that all depends on a browser capatibility called RequiresControlStateInSession, when it’s set to true, than the controlstate is persisted into the session as well. Last question was: how to let the system know, that my browser has the RequiresControlStateInSession capatibility? It’s easy with the new syntax for browserCaps:


And the day is saved, now I have a viewstate of a 57 bytes, which contains a pair of a boolean and an ID 🙂