Clinton Rocksmith's Blog

Musings of code, video and audio

Confessions of a Dropbox Junkie

One of the really cool tools that I’ve been using lately is Dropbox, and I thought I share my reasons as to why, so that you too can see the benefits.

1. I’m a developer by day, and it’s great to have my projects stored and safe away from the possibility of a house burning down. But more than that, it means my code is avalable to me on my various machines in my life. And I have heaps.

2. I’m a DJ/Karaoke host by night. In 2001, my entire CD collection was stolen, in 2006 my entire collection was lost when my hard drive died. Never again. I store all my music, (not shared of course) on Dropbox. Sure I could re-download them with iTunes, but not in 1 bulk download method, I’d have to click each song individually. I know, that if I lost my computer, or it was stolen and I had 2 hours to get to a store, buy a new one and get to the gig. My collection can download as I’m playing.

3. I make movies and take photos. These are the most important assets in my life, because it’s moments in time that can’t be replaced. In the case of movies, with so many digital movie cameras out there, the data needs to be stored somewhere safe. Not only on Hard Drives that can fail at my house, but on Dropbox.

4. Cost. The cost of Dropbox is CHEAP! I mean CHEAP! As a developer, to use Microsoft storage in the cloud would cost me $1 less than the cost of DropBox. But I’d have no software to manage my files and the way the data is structured in Azure is NOT like it is on a hard drive (trust me, I know what I’m talking about). So for $1 a month I get great tools and don’t need to worry about all the other logistics of software development.

Dropbox has never failed on me and I will continue to use it. Especially in a world of Digital media.

HTML 5 vs Silverlight vs Flash

In the world of the internet, there is always room for 1 more post about a common platform. Here is my 2 cents…..

I started using Flash in the late 1990′s, while Macromedia still owned it. Why? Because I was frustrated with the lack of features and compatibility across the browsers. Sound familiar?

YES, it is true, that in the very near future, at a single point in time, all browsers will support HTML5/JS and will be equal; It will seem for a year or two that everything is great.

Then new ideas/technology will be invented and inserted into browsers. Why will this happen? Beacuse it happened in the past. Remember that browsers are made by companies in business and competition in business drives business decisions.

Do you think that once all browsers are equal the developers will say, “HEY, we don’t need to make another browser ever again, or make a new release, it’s done!

Another reason that HTML5/JS isn’t the silver bullet it’s sold to us as, is because of something called Hegemony, and arrogance. And to see this in action, simply go to this link and click on any one of the showcases:- (in a non-Safari browser)

http://www.apple.com/html5/

Business is about struggle and ownership. And anyone in business is fully aware of marketshare and influencing the market, especially if they’re on the Stock Market.

SO, if you’re building a potential future Legacy product, and you want it to work in many browsers in the future, pick Silverlight or Flash. Or if you want to ensure that it will have marketshare, just pick Silverlight.

If you want to make it work across multiple devices, code for them natively to support their unique hardware and feature set, it will be cheaper in the long run.

My 2 cents.

Migrate from Three to Vodafone

I’ve been a THREE customer for nearly 18 months along with my wife, and the service worked well, in Sydney. However, after moving to Melbourne, I found it was sub-standard. I couldn’t get reception in the heart of the city, I got none at my desk in a brand new building and none at home. And to top it all off, I almost never got 3G access.

Frustrated, I prepared to write to the TIO (Telecommunication Industry Ombudsman) to get some action, but first I Tweeted the THREE help desk team. They suggested that I migrate or move to Vodafone. The reason being that there are more towers and more infrustructure being built, the challenge for them was me, I am a sceptic. But they peaked my interest.

I continued and got a helpful phone call from a representative, someone who actually earnt the title “customer care” (this is rare these days). But I still wasn’t convinced, stubborn? Who me? ;-) A week had passed and finally, I decided to give it a go. Especially since I’m being charged extra for using other Carrier networks with THREE.

So over the weekend, I lost my THREE service, and I had to wait a day for Apple to unlock the iPhone via iTunes (I thought the internet made everything instant ;-) ) and this morning, I’m using the Vodafone service.

So what’s it like? Well, I get 2-3 bars in my house, and FULL strength 3G goodness at my desk, this is important as the kiddies sometimes need to get picked up from day care early. But the most amazing thing is that I have reception in the elevator and in the carpark at work….. not even my co-worker with Optus gets that!

I was going to leave THREE and move to Telstra at the end of my contract, plus get a new Windows Phone 7 of course, but I’m so impressed with the reception at my desk, that I’m not prepared to risk it. I’m pleased that the service rocks and will be staying with Vodafone at the end of the contract.

If you’re with THREE and are unhappy, migrate to Vodafone, it has been a great move for me.

I want to share this with you as it’s just as important to broadcast positive experiences instead of only the negative ones.

Update: I just told another co-worker in the office and he’s moving from THREE to Vodafone tonight. #VodaWIN

Windows Phone 7 Development – dealing with testers

I’m a Silverlight developer and currently, do not own a Windows Phone 7.  But I do want to create applications for the Windows Phone 7 platform, so how do I go about this?  Luckily, the emulator is excellent.

Unfortunately, the testers reject an application the minute they find one problem and not all problems/errors.  Thus it took 4 attempts to get my application approved.  If they’d given me a complete list of errors, I would have only needed to re-submit once.

So, based on this experience, I’ve realised that the best way to develop for Windows Phone, or any mobile platform where testers preview your work, is frequently and often.

So for my application, I started out spending the first day doing what’s called Scoping.  I figured out that the application I wanted to make could be split into 5 versions, each one better than the previous.  This makes the development time small for version 1.0, and the process of dealing with the testers the most time consuming.

On an emotional level, the joy of getting an application into the market place has encouraged me to work on the next version with more energy.

From a development point of view, by using this approach, I’ve also learnt more about the platform and because my application is small (to start with), major errors are easier to fix and therefore as the development continues, I leverage this experience to my advantage.  The advantage being that the next version will not be rejected.

Creating the perfect Alpha Channel using Pixel Shaders Part 2

In part 2, we take the Pixel Shader we created in part one and inject it into a Silverlight project.

We look at the standard Color Key effect and how it chokes the element we want to use and we also look at the finished result of the Maori’s walking over the hill.

I also forget how to make a video loop, but I’ve fixed it in the code for you to download and play with. The code also overlays 2 videos and 1 image background so you can see the power of what you’ll be able to create.

You can download the files:- HERE

Creating the perfect Alpha Channel using Pixel Shaders Part 1

Last week I was speaking with Michael Kordahi (aka DelicateGenius) from Microsoft Sydney and he asked me about whether it was possible to get the smooth Anti-Alising that you can get from proper Green Screen work that comes out of After Effects/Premiere/FCP etc.

An interesting question I thought.

The Problem
At the time of writing this, the video formats aren’t supporting Alpha channels in Silverlight. There is a Basic Color Key pixel shader, but it’s a little simplistic and requires that the color being “Key’d” to be the same as the background color of the image being pasted on. In other words, Alpha is either at 100% or 0%.

Flash does have this gradiented Alpha channel stored in the media files, but, I’m not really that excited by flash.

SO! How can we do this? Is it possible? Damn right!

The Solution in Theory
In the movie world we create the image and also a MATTE, a Matte is a black/white/grey scale copy of the video footage we want to SuperImpose. This Matte, in the old days (Star Wars), was used to allow light through the film (the white area) and only expose that part. Then the film was run through again with the other elements and other MATTE’s. This was achieved using an Optical Projector, George Lucas and his team built their own. Amazing eh?

A side by side view of the Maori matte video output

The output from the video editing software

Even though we’re all using computers now, this same MATTE picture can be used to define the Alpha channel for each pixel, enter the HLSL Pixel Shader that is supported in Silverlight.

A Question
This is all well and good, but how do you synchronise the two videos to be in perfect time? I’m glad you asked. You don’t have to.

One of the other passions I have is 3D, stereoscopic film, where the video signals are placed side by side. If you’ve seen some 3D TV, they do this already.

So we put the image on the Left, and the Matte on the right. Send that Video Brush into the Pixel Shader and let it do it’s magic and output a perfectly generated Alpha Channel.

What you’re going to learn is how to create this Pixel Shader from scratch and see how the Pixel Shader functions and how to create your own. In part 2 we’ll import this into our Silverlight project, wire it all up and come up with something world class.

So, let’s do something cool…..

Part Two can be found HERE

Here is the code from the example

// The texture is loaded into this Register as Texture1Sampler
sampler2D Texture1Sampler : register(S0);

float4 main(float2 uv : TEXCOORD) : COLOR
{
//Double the screen Width
float2 currentPixelPosition = uv;

//Multiply the x position to stretch the first half of the screen across to fill the entire screen
currentPixelPosition.x = currentPixelPosition.x * 0.5;

//Grab the current pixel value for the current Pixel Position, referencing the texture
float4 currentPixel = tex2D( Texture1Sampler, currentPixelPosition );

//Check to ensure Alpha is only for first half of screen
float checkX = uv.x * 2;

//check to make sure we don't try and grab the alpha value beyond the screen
if (checkX <= 2.0) {
//Get alpha values from the second half of the screen
float2 alphaPixelPosition = uv;
alphaPixelPosition.x = currentPixelPosition.x + 0.5;
float4 alphaValue = tex2D( Texture1Sampler, alphaPixelPosition );

//Get the red channel to convert to Alpha value, could change to blue/
float value = alphaValue.r;

//Assign the value to the alpha channel
currentPixel.a = value;

//Assign that value as a multiplier to the RGB channels
currentPixel.r = currentPixel.r * value;
currentPixel.g = currentPixel.g * value;
currentPixel.b = currentPixel.b * value;
}
return currentPixel;
}