Anything related to the .NET framework
29 Aug 2011

Windows Phone 7: Professional Tips - Always show the SystemTray

imageIn Windows Phone 7 there is an option to show a little strip at the top of your application which shows time, battery and signal strength. This is called the SystemTray.

My suggestion for a professional applications, is that you should be showing that SystemTray. Full screen games & media viewing excluded, but most tool like applications should be showing it.

My reasoning is two fold:

  1. If you user is spending any time in your application they may need to check their battery or  they will need to check the time. Having it available keeps them in your application and keeps them from being frustrated by the toggling backwards and forwards (glance and go!).
  2. If you application connects to the internet, and you fail to connect you are required to tell the user that it failed. For me internet connection failures are often due to signal or due to being connected to a hotspot. If it fails and I do not have a SystemTray, then I need to leave the application to check those details. Once again, the glance and go principal!

It takes up a few pixel’s but your users will be happier for it being there!

26 Aug 2011

App.Config Transformations: The community shines where Microsoft drops the ball

Last year May, I spoke at DevDays Durban about what is new in ASP.NET 4? One of the highlights of that talk is a feature called Web.Config transforms. In short you have a base web.config and then a file per compiler target (i.e. RELEASE, DEBUG). These extra files contain rules on how to transform your web.config when it is published.

In a way of an example you have might your web.config to use your local SQL Server when in Visual Studio, but when you publish a DEBUG build to testing it changes the config to use the test SQL Server. Or when you publish to production it turns off a bunch of logging and shows friendly error messages.

image

There is TWO caveats in this process:

  1. ONLY works for ASP.NET* projects as this is something the ASP.NET team built into their publishing tool support.
  2. ONLY works for publish, if you have an ASP.NET* project and hit F5, nothing happens Sad smile

*ASP.NET = ASP.NET Core, and thus systems that build on top of it (WebForms, MVC & WebPages) all get it.

This is something we need in EVERY project type and we need with F5. Thankfully some bright people did just that for us, with the VS add-in Slow Cheetah.

So now you get the full experience on any project type, PLUS you get a brilliant feature missing in the ASP.NET one – PREVIEW. You can see what the resulting config will look like!

25 Aug 2011

Windows Phone 7: Professional Tips - Drop the splash screen

The guidelines for WP7 state your application must start within 3 seconds – so many applications include a splash screen to show the user while the rest of the application loads. The splash screen is included by default so you may think you MUST to include it (I did think this too), but the truth is you don’t need to.

If you can (i.e. your application loads under 3 seconds) then you should drop it as it will allow your application to start quicker (about 2 seconds faster in fact), this means your users can get into your application quicker and that will make them happier!

24 Aug 2011

Windows Phone 7: Professional Tips - Storing your settings

In Windows Phone 7 there are two ways to store values State & IsolatedStorageSettings which have their various pro’s and con’s. I prefer to use the IsolatedStorageSettings for most scenarios but this tip will apply to both, so when you see the code referring to one it will work on both.

Very simply the first setting you should store is one called version (or similar) and should have a version indicator. In short it tells you what version of the settings you are working with!

IsolatedStorageSettings.ApplicationSettings["version"] = "1";

Having this field has two advantages for you, first it gives you a very simple way to check if you have settings available & if it is not, then your app is running for the first time.:

if (IsolatedStorageSettings.ApplicationSettings.Contains("version"))
{
    // do something with settings
}

The other advantage is that when you update your application you can upgrade settings easily. 

if (IsolatedStorageSettings.ApplicationSettings.Contains("version"))
{
    switch ((int)IsolatedStorageSettings.ApplicationSettings["version"])
    {
        case 1:
        {
            // upgrade version setting and add missing settings or change existing settings
            break;
        }
        case 2:
        {
            // normal reading of settings
            break;
        }
    }
}
Even if you never use it for upgrades, at least it is there for a simple check and if one day you need it - you are ready to go!
22 Aug 2011

Game development in South Africa and dealing with the Film and Publications Board

imageIf you walk into any store to buy a game or movie you will find a little blue triangle sticker which contains the age restriction from the Film and Publications Board who review and rate content.

Since I created a game recently I decided to see what the process is for classification of a game is and learnt some very interesting things for developers.

Put simply only games/films that are sold or hired require to be classified – so if you are developing a game/films that will be available for FREE then you do not require classification! Below is the email from the head of the classification unit confirming that!

image

GREAT NEWS for hobbyist developers!

If you do plan to sell your game then you need to complete the forms on the website (game submission form), provide a disc with screenshots and videos of your game, a game synopsis and pay the registration fee (currently R1 508.64) and then wait for the classification.

Microsoft have confirmed & I have tested that the forced requirement for the FPB certification in the marketplace no longer exists. You can submit a certification but you are not forced to. Only downside at the moment is Window Phone 7 – when you submit a game for the South African market regardless of price they require the certification which is incorrect. I have submitted a request to Microsoft for details on this and will update you as soon as I have any information.

22 Aug 2011

Community night in September 2011 - IMPORTANT INFO

Community Night, the best way to meet, mingle and learn (if you don’t know about it – read here) happens on the second Tuesday of the month… except in September due to an event at the venue on the Tuesday which can’t be moved.

So for September it will take place the Monday before, in other words Monday the 12th September. Please help get the word out to the various user groups and communities!

See you there!

15 Aug 2011

Codename: Roslyn - the next generation of the C# & VB.NET compilers

277341190_3f098a08a4_oThis past weekend I had the opportunity to present at a fantastic event, Dev4Devs which is a free event where anyone can present on anything (software developer related) for 20min. It is a lot of fun, because of the variety of talks, the variety of people (some new speakers and some experiences speakers) and the HORRID 20min timeline.

This time I presented on a topic I am very interested in, Codename: Roslyn which is the next version of the C# & VB.NET compilers which are fully managed code (C# one written in C# and the VB.NET one written in VB.NET).

Since there is no public bits available I made use of the compiler from Project Mono – which has had similar things (the REPL environment and hosted compiler) for years.

As with all presentations here (or at the end of the post) are my slides, demo notes, demo files and other info!

During my research and prep, I found a bunch of interesting posts and information about it so here is the info I found. I’ve bolded the ones I think are especially interesting.

Image from Ezu

03 Aug 2011

Nugget: Little compiler optimisation

Found this little C# compiler optimisation which is really cool. Here is start code

int y = 0;
int x = 10;

if (x * 0 == 0)
{
    y = 123;
}

Console.WriteLine(y);

If you know a bit of math, anything multiplied by 0 always equals 0 (line 4). So the compiler optimises that out and then because x is never used that is also optimised out and you end up with

int y = 0;

if (0 == 0)
{
    y = 123;
}

Console.WriteLine(y);
So very smart Smile

Pages