Monthly Archives: September 2010

MOSS 2007: Get Feature ID the easy and lazy way

Quick MOSS tip-o-the-day:

If you need to retrieve the ID (GUID) of a Feature, for running STSADM commands, etc, there’s a quick and easy way to do this for features that are currently activated:

1. Go to your Site Settings, where your features are listed and you see the Activate/Deactivate buttons.


2. Press the Deactivate button (don’t worry, this goes to a confirmation page, so you’re not causing anything to happen yet)


3. While you’re on the confirmation page, take a look at your browser address bar – voila, your feature ID:




How to: Make a Light Saber from a Wii Remote in .NET (C#)

Here’s a quick and fun project that I just used as a fun coding exercise. I was just walking through Toys R Us the other day, and saw a Light Saber shell designed to enclose a Wiimote. I thought that would be cool, but even though I’m not much of a Star Wars nerd, I do know that most light sabers fall short of a quality audio experience.

So wouldn’t it be cool if my PC could simulate the light saber sound effects from a Wiimote?

Here we go…

Pair The Wiimote with your PC

Your PC needs to be Bluetooth capable (or have a Bluetooth adapter installed). With your Wiimote in hand, press the 1 and 2 buttons until the blue LEDs start flashing. While they’re flashing, you can add it as a Bluetooth device to your PC.


If prompted for a pairing code, just select “Pair without using a code”, and the Nintendo input device will appear.



Plan a little (How to make Light Saber Audio)

A light saber essentially has 2 ongoing sounds. The first is the low, droning “hummmmmmm” that’s always there. So we’ll need a constant “hummmmm” wave file. And the second is a higher-pitched “swing” sound. Our app should just play both in a loop, and increase the volume of the “swing” sound proportional to the amount of motion detected in the Wii controller. Spec – done.

Getting The Code Together

I got the following components to make this come together:

  • WiimoteLib (.NET code library for Wiimote) –
  • Googled “Light Saber Sound Effect” to find the droning, constant “hum”
  • Found a Sci-Fi electricity sound to be the “swing” (I must admit, this could be better, but it’s good enough for this app)
  • DirectX / DirectSound managed wrappers (Microsoft.DirectX.dll and Microsoft.DirectX.DirectSound.dll)

Use DirectSound and WAV Files

Because we’re looping sounds, we need a bit higher performance than MP3 files and Windows Media Player components. That’s why it’s important to use the DirectSound library with playback loop buffering and uncompressed audio files.

Make sure you compile the application as 32-bit (x86) as DirectX may complain with 64-bit or Any CPU compilation.

Calculating Light Saber Motion

So, I’ve got the following app set up (hit Turn On to enable the Saber sounds, and if you have a Wiimote connected, it will detect it on app startup):


To calculate the Wiimote “swing” motion, this gets a little difficult. Wiimotes report what position they’re in (X, Y, and Z) axis, but there’s no way to tell how fast they’re moving through the air (i.e., true acceleration). If you’ve ever been able to trick your Wii and become an accomplished Wii bowler from the couch, then you know what I mean.

So after a few different methods, here’s the way I’ve calculated the Saber “swing” motion:

  • Re-evaluate the Wii controller position no more than every 50 milliseconds
  • Measure the most recent X, Y, and Z positions with the previously reported ones, and calculate the differences
  • Add the differences together (X+Y+Z) to get the cumulative “motion change factor” (I called this the “Saber Force”)
  • Use the “Saber Force” to set the volume of the Swing WAV file.

This works okay, but could probably be improved to make it smoother and more responsive.

Other Notes

I would suggest playing with the “Constant Hum” and “Swing Intensity” sliders after turning the saber on, just to get the feel of how this thing works. Once you hit the “Turn Wiimote into Saber” button, the Swing Intensity slider is disabled and controlled by the Wiimote motion calculations. There’s little to no exception handling or app state management as this is a quick and dirty play application. If you wanted to actually create something with this, it does provide a good starting point with ideas.


Download WiiSaber Source Code (Visual Studio 2010)

The .zip contains the compiled application (if you just want to run it and play), the Visual Studio solution, and the reference DLLs and sound files that I used.

Live Silverlight Smooth Streaming with NimbusHD and Expression Encoder 4 – An Intro

[UPDATE: This functionality has been removed. See this post for more info.]

Smooth Streaming is changing fast. The team at Microsoft has and continues to make improvements in Smooth Streaming technologies, one of which recently has been Live Smooth Streaming with Expression Encoder.

I’m happy to report that NimbusHD now supports Push Live Smooth Streaming, which has been the #1 request from most of our clients for some time now. This supports hardware encoders, however, I’m going to focus on how this is now possible with Expression Encoder 4 Pro. In this exercise, we’re going to accomplish the following workflow:

  1. Set up a Live Publishing Point for my event through the NimbusHD Admin Center.
  2. Stream the event from Expression Encoder 4 Pro, with client DVR support.
  3. Adjust our Content Distribution Networks on the fly.
  4. End the live stream, leave DVR active.
  5. Shut down the Publishing Point, and transfer our Live Event content to On-Demand Content.

If you don’t already have an account, go get a trial at (free for 14 days).

Set Up The Publishing Point

For the first step, go to the Live tab of NimbusHD Admin, and click Create Publishing Point…


Title it, and set the Estimated Length (this isn’t something to stress over, it just helps set the correct DVR timeline).

Hit OK, and Nimbus will create and configure a Live Smooth Streaming publishing point for you, generate your push server address, and configure a set of client player parameters.


You’ll notice that the Status is Idle, Ready to Start and the default CDN is Akamai. Now, let’s start broadcasting something…

Stream The Event

Fire up Expression Encoder 4 Pro. (This is important – without the Pro version, Live IIS Smooth Streaming is limited.)

If you see the initial “Load a new project” wizard screen, click “Live Broadcasting Project”.


Set up your sources (outside the scope of this post), and we’ll tweak the settings for our live stream. To start, I’ll just select a preset of IIS Smooth Streaming, VC-1 codec @ 480p. There is no restriction on what bitrates, or how many bitrates you can push to Nimbus at any one time. However, pushing more than a couple bitrates (especially high-resolution ones) takes a pretty decent machine.


If you wish to adjust which bitrates you are encoding, you can do so under the Video section of the Encode tab.


Now, under the Output tab, check the Streaming box, and copy and paste the Encoder Stream URL provided by Nimbus.


Before Expression Encoder can connect to the Publishing Point, it must be started. Click Start Live Streaming in the NimbusHD Admin panel.


You’ll now notice that the status changes to Ready, waiting for encoder to connect…


So let’s connect – press Connect in Expression Encoder.


You’re now ready to roll… hit Start to begin streaming!


It’s worth noting a couple of things here that are happening in the background. NimbusHD is maintaining DVR support for your event, so your viewers can skip backward and surf through the previous event content (just like your cable/satellite DVR at home). Your event is also being recorded – we’ll get to this later.

Generate a player for Viewers

Your clients will need to be able to see this, so they’ll either need a link, or you can embed a player on your own site.


You can use the Player Quick URL if you want to use a simple NimbusHD player embedded on a blank page, or hit Generate Player / Embed HTML if you want to generate a player for your own site.


Adjust Content Distribution Networks on the fly

One of the major cool points of NimbusHD is the Content Delivery Network support, for scalability and optimal bandwidth/quality for your viewers. We support 3 out of the box (Akamai is the default) and your CDN of choice can be changed per-publishing point, and in real time for new viewers.

If you want to change from, say, Akamai to EdgeCast, hit the Change CDN… button.


… select your new CDN, and press OK…


That’s it… we’re done.

End Live Stream

You’ll notice that when you disconnect Expression Encoder, the Publishing Point changes status to Live Streaming Stopped, DVR Active.


DVR Active means that your viewers can still surf through the event in DVR mode, even though there is no new live content being delivered.

(One important note: If you experience a network interruption, you will need to shutdown and restart the Publishing Point. This is due in part to DVR functionality, as well as limitations of Encoder’s timecoding and IIS Smooth Streaming’s design. We’re working on making this better, but for the time being, it’s important to have a solid network connection.)

Transfer Live Event to On-Demand Content

The first thing that you’ll probably want to do after broadcasting your live event is to make it available to those who missed it. When your event is done, press Shutdown / End Event.

Your live event will automatically be transferred into a “Live Stream Archive” media bin. It’s instantly available for on-demand viewing!



At this point, it’s just like other on-demand media assets. You’ll probably want to trim it via the clip editor, and then make it available on your web site, or send a link out to those who missed the event.


The Live Smooth Streaming capabilities of NimbusHD are very powerful, even at this stage. There are a lot more exciting things to come (live viewer geolocation mapping has been suggested already), so stay tuned.