Tuesday, December 2, 2008

Silverlight 2, Firefox 3 and Windows Vista problem...

We discovered another Silverlight 2 Firefox 3 compatibility issue today. Don't get me wrong, I'm a huge Silverlight fan and a huge Firefox fan, and will put it on record that the 2 work really well together contrary to what many others might say. None the less, small issues do creep up from time to time.

The Silverlight 2 app we are developing wasn't working on Firefox 3 on a test machine with Windows Vista Enterprise. It was working fine in IE7 on that machine, and the strange thing was it was working fine on a colleagues windows Vista machine in Firefox3 (therefore i was certain it was machine specific).

I uninstalled the Silverlight 2 Plugin (v2.0.31005.0) but still noticed it in the Firefox plugins. I uninstalled and reinstalled Firefox 3 but it was still there, strange as like i said I'd uninstalled the plugin.

To sort it out I uninstalled Firefox 3 again, and deleted the Mozilla Firefox folder in my program files folder, in order to make sure i get a fresh start. After reinstalling Firefox I noticed the Silverlight plugin was no longer showing which is what i wanted. than after a reinstall of the Silverlight 2 plugin, All was working.

Strange, but it seemed Firefox was getting confused if it had the plugin or not and that was causing the problem.

Friday, November 21, 2008

Silverlight 2 App not showing in FireFox 3

Found out something interesting today. Silverlight Apps only work in Firefox 3 if the countainer div tag of the asp:Silverlight tag has an explicit height and not a height of 100%.

I also found an interesting post here which mentioned that the !DOCTYPE tag can also cause strange behaviour when Silverlight is concerned in certain browsers. I was experiencing a problem with the height of the Silverlight App on my page in IE6, and removing the !DOCTYPE tag sorted this out.

Tuesday, September 9, 2008

VS2008 Repository Factory Confused...

When using the VS2008 Repository Factory to build a Data layer recently, I noticed that one of the generated repository classes wasn't compiling and this baffled me greatly.

(NOTE: For those of you that don't know the Repository Factory, unfortunately I'm not going to go into much detail in this post. Rather see codeplex for further details on the VS2005 version, and here regarding the VS2008 version. )

The following generated code was throwing a wobbly on "CastDBNull", as it seemed the factory didn't generate such a method.

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Text;
using Microsoft.Practices.Repository;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.SqlClient;


namespace Community.Service.WCF.DataAccess.BusinessEntities.UserRepositoryArtifacts
{
///
/// Construct a User object from OUT and IN/OUT parameters.
///

internal sealed class GetISOCommunityUserByUserGCNFactory : ISimpleDomainObjectFactory
{
public User Construct(Database db, DbCommand command)
{
User user = new User();

user.IsFollowMeEnabled= CastDBNull.To<Boolean>(db.GetParameterValue(command, "IsFollowMeEnabled") , false);

return user;
}
}
}

When you look at the above code, its obvious its trying to handle scenarios where your database returns DBNull and where your business entity doesn't.

To fix this, I decided to implement my own "CastDBNull" method, so I goolged the method name and found a few usefull blogs on the topic, with one more notable than others due to its simplicity (see http://petesbloggerama.blogspot.com/2006/12/it-aint-null-until-i-say-its-null.html)

public static class CastDBNull
{
public static T To <> (object value, T defaultValue)
{
return (value != DBNull.Value) ? (T)value : defaultValue;
}
}

Thats all for now folks!

Thursday, August 14, 2008

Silverlight Error Code 2104 - IIS6

I built a small Silverlight 2 Beta 2 application the other day as a POC for a current project and published it to my companies IIS 6 hosted website, but the darn thing didn't work off the bat. IE 7 gave me the error Error Code 2104 - Could not download the Silverlight application. Check web server settings. To fix this problem you need to add the following 3 MIME Types to your website via IIS 6:

Extension: .xap
MIME Type: application/octet-stream

Extension: .xaml
MIME Type: application/x-silverlight-2-b2
(Note: for Silverlight 2 full release, use application/x-silverlight-2)

Extension: .xbap
MIME Type: application/x-ms-xbap

That should do the trick!

Some blogs and forums out there suggest adding .xaml application/xaml+xml but this doesn't work for silverlight 2 beta 2.

Friday, August 8, 2008

Expression Encoder 2 + Firefox 3 + Silverlight plugin version 2.0.30523.6 = PROBLEMS!


Mozilla Sets New Guinness World Record with Firefox 3 Downloads.

If you were 1 of the 8,002,530 people who downloaded Firefox 3 on its first day of release, or even perhaps someone who downloaded it a couple days later (like me), you may have noticed that it was (or is) reacting badly with your Silverlight websites.

Problem 1
The main issue you might be experiencing may be that you're still being prompted to download and install the Silverlight plugin when visiting your site, eventhough you've already installed it. This is (and was for me) a rather annoying problem. The fix is simple enough. You need to download the Silvelright 2 beta 2 SDK and then replace the silverlight.js on your hosted Silverlight website with the new silverlight.js that comes with the SDK.

NOTE: once you've installed the SDK, the silverlight.js file is located in C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Tools path.

PROBLEM 1 solved!

Check out http://www.timheuer.com/blog/archive/2008/07/02/updating-your-silverlight-javascript-detection.aspx for more discussion on the topic.

Problem 2
A rather serious issue experienced with a site I was developing was that the Silverlight videos hosted on the site would not play on Firefox3. The site uses an Expression Encoder 2 player template. The player would load on the screen and the video would start playing, however it seemed that once the video finished streaming from the server to my client in the background it would just stop playing and all hell would break loose in the form of javascript errors, even sometimes causing the browser to close completely.

I spent the better half a week trying to find a solution, but with no such luck. The client machines that were experiencing the problem were running the Silvelright 2 Beta 2 plugin version 2.0.30523.6 (which to my knowledge at the time was the latest version) but once version 2.0.30523.8 was released and I installed it on the clients it solved the problem.

Thank you Microsoft and Silverlight for fixing it!


Firefox3 by my opinion is still the best browser out there. If you don't have it yet, get it here.

Sunday, July 20, 2008

Videos with Expression Encoder 2 and Silverlight - Part 1

When the idea of hosting videos on Youtube for a particular site we were building went heads up at the last minute and we urgently needed to find another solution fast, Silverlight and Expression Encoder 2 came to the rescue!



*This Bear video is often used in Microsoft Media and Video demos.
**I'd like to thank Tim Heuer (http://www.timheuer.com) who often provides extremely helpful information regarding Silverlight and its capabilities.

I have arrived!

Hi there, welcome to my very first post on my very first blog!

Q: Who am I and whats this all about?
A: I'm a Software Developer. I live in Cape Town, South Africa, often referred to as "The Mother City". This is my personal public space on the world wide web where I can ramble on about pretty much anything - such as life, love, the integral workings of the infinite mind of Rogan Flitton, but more importantly Microsoft.NET, Web 2.0, Silverlight and anything else I'm fortunate enough to spend late nights coding away on!

When I was first asked to start a blog and begin documenting my experiences around .NET, Web 2.0 and Silverlight, I was intrigued and excited by the idea. Lets face it, the IT industry is vast and continuously changing with new concepts technologies, methodologies and ways of doing things creeping up daily. And for this reason, like all software developers out there, I spend a large portion of my time on blog sites like this one in order to keep up to speed with whats new and happening out there, and also, more often than not, for pieces of code and discussions which may help to solve the various problems which face me in my day to day tasks. Therefore, this blog is a means to share all knowledge I gain, and to hopefully help fellow developers out there, the same as other blogs have often helped me.