Sunday, December 30, 2007

XBOX 360: Upgrading to XBOX Live Gold Membership

I recently bought an XBOX 360 Live Gold Membership so I could upgrade my Silver membership to Gold for additional benefits you get.

I bought a pre-paid ticket from Game and the idea is you simply scratch off the back and enter the code and it upgrades your XBOX Live account. After I tried this via the XBOX I received an error code (can't remember the number - should have made a note of it). So before phoning customer support, I tried again but this time via http://www.xbox.com using my laptop but received a different error, something along the lines of "the code was invalid or not for this web site...." After phoning support, support knew straight away it was because I didn't set my address, email and phone number in my profile! After setting this information, it worked a charm.Very good support I may add, would of been useful for a more meaningful error message though or validation.

So if you decide to upgrade your XBOX Live Silver account to Gold in the near future, remember to set your address, email and telephone number in your profile!

What's new for device developers in Visual Studio .NET 2008 and the .NET CF 3.5

With the recent advent of Visual Studio .NET 2008 and .NET Compact Framework 3.5 what is new, how will this platform make development easier? well this article talks about some of the great new features available to device application developers.

This article is broken down into sections:

New 3.5 Framework features:
  1. SystemSettings class (Microsoft.WindowsCE.Forms.dll) has a new propery named Platform that gets the operating system of the device. So now it is easier to determine whether you are running on a smartphone or a windows mobile device.
  2. SoundPlayer class (System.dll) - at last! This class initially introduced to the .NET Framework 2.0 is now available on mobile devices using the framework to play wav files.
  3. LINQ - language integrated query designed by Anders Hejlsberg - Chief Architect of C#. The namespace has recently changed (I believe in beta1) from System.Query, System.Xml.Query, System.Data.Query to System.Linq respectively. Compact Framework LINQ support is a subset of the desktop framework. Some of the limitations over the desktop version of LINQ are as follows: only standard operators are supported. LINQ to Xml and LINQ to DataSet is supported. LINQ to SQL and LINQ to Entities are *not* supported for memory constraint reasons, ;( See the LINQ Project web site to learn more on LINQ.
  4. Windows Communication Foundation (WCF). See here for the features of WCF that is supported under the .NET CF 3.5. Some of the limitations are; only HTTP binding support, only XML formating no binary.
  5. System.IO.Compression (System.dll) - at last!! the DeflateStream and the GZipStream classes are both supported on the .NET CF 3.5. We can now enjoy these compression classes on the mobile device that we have enjoyed since .NET 2.0 on the desktop.
  6. The Control class now suports the CreateGraphics method which returns the Graphics object so you can draw using GDI on the following controls:
    1. TabPage.
    2. Panel.
    3. Splitter.
    4. PictureBox.

  7. System.Delegate.CreateDelegate 1 static method is supported.
Device relevent SDK's that ship with Visual Studio .NET 2008:
  1. SQL Server Compact 3.5. This post talks about some of the new features with SQL Server Compact 3.5. Note this version of SQL Server can be used on the desktop as well as mobile devices.
  2. Windows Mobile 6 SDK. Although this SDK does ship with Visual Studio .NET 2008 and installs if you choose to install the CF, doing so when you already have WM6 SDK installed will result in it not being shown in VS 2008. See here for a work around.
Features that plug into Visual Studio .NET 2008:
  1. .NET CF 3.5 Power Toys. Currently in CTP not RTM. Required for WCF proxy generation. These tools do not come with VS 2008, you have to download them separately. There are some other really great tools that come with this install such as:
    1. Remote Performance Monitor.
    2. .NET CF CLR Profiler - very handy tool.
    3. Application Configuration Tool.
    4. Remote Logging Configuration Tool.
    5. .NET CF Network Log Viewer.
You can download a CTP version of .NET CF 3.5 Power Toys here.

Visual Studio .NET 2008 features:

  1. Unit Testing. At last, built in unit testing which allows you to run tests right on your device or emulator. See this post if you are running into issues getting it to work.
  2. Improved documentation. You can filter by supported CF members as the CF documentation is not separate from the desktop. Each member os flagged whether it is supported on the CF. See here for more information on identifying supported members.
Of course there are many more enhancements in Visual Studio .NET 2008 not listed, the ones above are documented because they are specific to device application development.

Types of devices supported by the .NET Compact Framework 3.5:

  1. Windows Mobile 2003 for Pocket PC.
  2. Windows Mobile 2003 for Pocket PC SE.
  3. Windows Mobile 5.0 for Pocket PC.
  4. Windows Mobile 6.0 for Pocket PC.
  5. Windows Mobile 5.0 for Smartphone.
  6. Windows Mobile 6.0 for Smartphone.
  7. Windows Embedded CE 6.0.
NOTE: Windows Embedded pre CE 6.0 is not supported by the .NET Compact Framework 3.5.
I have used old naming for the above re: WM 6. For new naming see this post.

Compact Framework versions supported by Visual Studio .NET 2008 (multi-targeting):
  1. .NET Compact Framework 2.0.
  2. .NET Compact Framework 3.5.
If you want to target CF 1.0 apps, you will need to use Visual Studio .NET 2005 as Visual Studio .NET 2008 doesn't support CF1.0.

For new C# 3.0 and VB 9.0 language features available in the .NET Compact Framework 3.5 as well of course available in the desktop framewok 3.5 with Visual Studio .NET 2008, see here.

Tuesday, December 25, 2007

Microsoft.VisualStudio.SmartDevice. TestHostAdapter.DeviceAgent. NetCFNotInstalledException

You might encounter the following exception when attempting to run a unit test on your device using the new built-in Unit Testing features that come with Visual Studio .NET 2008:

The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Exception of type 'Microsoft.VisualStudio.SmartDevice.TestHostAdapter.DeviceAgent.NetCFNotInstalledException' was thrown.

A simple solution to this is to install the .NET CF 3.5 on your device before running the test.

Monday, December 24, 2007

Ed Gibson Security Article

The following article was sent to me by my MVP lead recently written by Ed Gibson - Chief Security Advisor for Microsoft UK.

=================================================================
“Keep Everything Clear of the Doors”

You’ve seen it, read it, heard it so many times you’ve blocked it out … routine, mundane. . . but instinctively you take the necessary precautions. And the idiots who think they can beat the doors for gosh sakes . . . some make it, most don’t… when will they learn. Even though, I suspect the next time you hear this spoken over the intercom in the Underground, or read the warning label on the inside of the carriage you’ll take just that extra second to really make sure everything is clear of the doors. “Why?”, you ask. “Because you’ve just read this!” No different than the many times you’ve looked at your watch, and then someone else asks you what time it is; you can’t remember, so you look again.

Unremarkably, the same applies when it comes to being more safe online. This past year you bought a brand new state of the art, 2g of RAM, 600g hard drive that will hold more stuff than you or I could ever fill up in a lifetime. It’s loaded with free anti-spam, anti-virus software and everything is going very well, so well in fact that you don’t update your software (Windows Vista has ‘updates’ turned on by default, so unless you mess with it, you’re okay ), run a periodic anti-malware scan, and the wireless is working fine so need to check that. You’ve read about the Government’s GetSafeOnline.org campaign (www.GetSafeOnline.org) that e-Bay, Microsoft, HSBC, Home office, SOCA, and others participate in, you’ve seen the constant news articles about loss or theft of data from the largest of companies and government agencies (and if you’re a victim of HMRC ‘datagate’, you have every right to be angry) but hey, you’ve not been affected . . . why do anything. Victims of online crime… not me, happens only to those people who go to the ‘wrong sites’ . . .who tried to make it thru the doors for gosh sakes, they should have known better.

Not so fast Mr ItAin’tGonnaHappenToMe. That ‘other person’ is going to be you if you don’t take a few moments to make sure your operating system and software are up to date, that your firewall is turned on (both are already done for you if you are operating Windows Vista) your anti-spam and anti-virus software are installed and updated (don’t forget to renew your subscription to the anti-malware software if it is about to expire). Organized criminals are ‘green’, ‘socially conscious agnostics’, they want what is best for you – NOT!! Just like machines, THEY DON’T CARE who you are, where you grew up, what kind of accent you have, whether you’re beautiful (or like me, a face made for radio); they operate without regard to your sex or religious affiliations – I call them “THE EQUALIZERS”. They want what is yours – from your bank account, your identity, or even a bit of your bandwidth – oh yes, they can quite happily use your computer while you do and you may not ever know.

As we approach the Holidays, don’t let the Grinch of Christmas Past ruin your holidays online. Possibly, ‘just because you read this’, you will take a moment and run the Microsoft Malicious Software Removal Tool , will visit www.GetSafeOnline.org , or possibly even give the most important cyber gift of all – a trip to the wild side, www.WindowsMarketplace.com (click on Security Downloads) for free anti-malware. It will take you a few minutes; but a few minutes now might just save you months of hassle down the road. Do you really want to be calling your credit card companies, bank, credit agency, DVLA, DWP, on New Years Eve. Or worse, worry whether someone will be showing up at your doorstep because you couldn’t be bothered to spend a measly 10 minutes with your kids to talk to them about social networking sites (oh yea, they just told their friends on their Facebook site when you were going to be away). . . and you didn’t tell them how to prevent outsiders from accessing their pages. Nor did you tell them in no uncertain terms that even when they close their site everything they put on the Internet IS THERE FOREVER. Oh yes, some make it thru the doors, most don’t . . .when will THEY learn.

I wish you a very happy holiday season – and a safe online journey.

Edward P Gibson
Chief Security Advisor
Microsoft Ltd-UK

Friday, December 21, 2007

WCF Tutorials and Resources

Recently I have been getting to grips with the specific details of WCF - Windows Communication Foundation (.NET 3.0) as it is a very powerful alternative to distributed computing. Although WCF has been released for sometime, only now with the advent of Visual Studio .NET 2008 can the real power begin and make integration and WCF service development easy.

WCF is a massive subject and you will find some books over-complicate or delve in too deep to begin with which makes learning difficult.

A book I am fond of is Pro WCF by Apress which I blogged out a while ago here.

Of course there are lots of WCF samples, whitepapers on Microsoft's WinFx site here.

You will find with Microsoft's site above, most of the code samples are pre VS 2008 so target VS 2005 with the WCF orcas add-in.

I have recently found a set of 15 web casts from Michele Bustamante a Chief Architect of IDesign and a Microsoft Regional Director and a Microsoft Connected Systems MVP.

You can get these web casts from here:

Part 1 SOA Concepts and an introduction to WCF
Part 2 Contracts
Part 3 Contract Versioning
Part 4 Exceptions & Faults
Part 5 Bindings
Part 6 Hosting
Part 7 Messaging Patterns
Part 8 Instancing Modes
Part 9 Concurrency, Throughput and Throttling
Part 10 Security Fundamentals
Part 11 Federated Security
Part 12 Reliable Messaging
Part 13 Transactions
Part 14 Message Queuing
Part 15 Extensibility

You can get the source code for these web casts here.

See here for an example of consuming a WCF service via a Windows Mobile device.

Wednesday, December 19, 2007

KB936021 XSLT BizTalk sub map work around

I wrote an article recently regarding the hot fix released by Microsoft regarding locking down MS XML Core Services (version 3,4,6) to set the resolveExternals property to false by default. Previously this was true. If you haven't read this article, you can here.

Of course this is a simple fix if you are still developing native apps using the MS XML Core Service libraries. Simply set resolveExternals to true before doing a XSLT translation.

This fix unfortunately a little more difficult if you have written you're own maps in any version of BizTalk using XSLT as you have no control over the MS XML Core Services library.

We have written a tool that converts all toplevel maps and imports the sub maps, namespaces, keys, JavaScript and VBScript from any sub map references. The tool does a recusive call as it is possible to have sub maps within sub maps. It is recomended to add the imported namespaces to the exclude-result-prefixes attribute in the top level document as depending on whether there is existing code that reads the output XML with XPath for example, this will prevent that code from breaking.

I'd love to post the source code for the tool here, but it belongs to our client so sadly I can't. It is a relatively simple process using the .NET DOM. As we are using MS XML 3 (in BizTalk 2002) to do the translation, we used MS XML 3 COM object to do a validation after the conversion had taken place. Bear this is mind!

Architecture Journal Reader - Beta

Just released the Architecture Journal Reader tool. Saves the need to read the journal via a traditional web browser.

Get the tool here (beta):
http://www.microsoft.com/downloads/details.aspx?FamilyID=dd466bbb-1b7d-438e-9f9a-954ce2058f15&displaylang=en

Wednesday, December 12, 2007

TechEd 2008

There will not be a MEDC conference next spring (2008), instead the MEDC conference will be integrated into the new Tech Ed Developers conference.

What is TechEd?

TechEd is Microsoft’s premier global conference designed to provide Developers and IT Professionals with the technical education, product evaluation and community resources for architecting, developing, managing, securing, and mobilizing state-of-the-art software solutions for a connected enterprise.

TechEd U.S. 2008 Expands!

To better serve the distinct needs of the developer and IT professional communities in the United States, Tech·Ed U.S. is evolving from a one week conference to two separate back-to-back conferences: Tech·Ed U.S. 2008 Developers, June 3-6, and Tech·Ed U.S. 2008 IT Professionals, June 10-13, in Orlando, FL.

The two week format is designed to provide the same Tech·Ed experience, but with expanded learning opportunities for attendees, which means more sessions and the need for more speakers.

For more information, see here: http://www.microsoft.com/events/teched2007/default.mspx

Friday, December 07, 2007

Windows Vista SP1 RC Released

Windows Vista SP1 Release Candidate was released to the 15,000 beta testers on Microsoft Connect on Wednesday 5 December 2007.

On Thursday 6 December (Yesterday) the RC was made available to MSDN and TechNet subscribers for download. I've just checked, it's on there ready for download.

Windows Vista SP1 RTM is targeted for release sometime in Q1 2008.

SP1 is going to be released in two waves. The initial release of SP1 will include 5 languages (English, French, Spanish, German, and Japanese). The second release containing all 36 basic languages will occur afterwards.

Windows Vista SP1 will provide key improvements around security, performance and reliability, especially around scenarios that are most important to end users and businesses including:

  1. All previously released updates since RTM.
  2. Performance and reliability improvements in core scenarios such as file copy, network browsing, and improved response time to resume from sleep.
  3. The installation experience is improved as compared to the beta. This is evidenced by higher install reliability rates, smaller standalone installer size, less disk space required for install and reduced install time.
  4. There are improvements to the administration experience. One of the most important changes being made is that BitLocker now supports encrypting for multiple volumes.
If you are thinking on running a Vista pilot, you might find this link useful: http://technet2.microsoft.com/WindowsVista/en/library/a825cf2a-5248-4aa7-b8f5-a074339c729c1033.mspx

Thursday, December 06, 2007

List of new features in C# 3.0

I have over the last few weeks compiled a list of new features in C# 3.0 with code samples, they are (in no particular order) as follows:-
  1. Implicitly Typed Local Variables
  2. Extension Methods
  3. Lambda Expressions
  4. Anonymous Types
  5. Auto-Implemented Properties
  6. Object & Collection Initializers

Auto-Implemented Properties: C# 3.0

Another nice feature of C# 3.0 is Auto-Implemented Properties.

Take the following class implementation:

public class Person
{
private string name;
private bool married;
private int age;

public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

public bool Married
{
get
{
return married;
}
set
{
married = value;
}
}

public int Age
{
get
{
return age;
}
set
{
age = value;
}
}
}
The above code is nothing different to what you do every day. C# 3.0 allows you to cut corners and saves you the need to define a field and its getters and setters for each accessor property. The simple object above can now be written as:

public class Person
{
public string Name
{
get;
set;
}

public bool Married
{
get;
set;
}

public int Age
{
get;
set;
}
}
As with all the new C# 3.0 features, they are designed to make your code cleaner and easier to read. Which is great for us lazy programmers!

Of course if you wanted to implement some kind of event notification or anything other than setting a simple property, you would have to go back to pre C# 3.0 and implement the accessor yourself, oh dear ;)

Object & Collection Initializers: C# 3.0

Object & Collection Initializers are a new feature in C# 3.0. They effectively save you the need to write contructors on object initialization.

Firstly, we will talk about object initalizers. Take a look at the following code which is what you would normally write in C#:
//C# 2.0
public class Person
{
private string name = string.Empty;
private int age = -1;
private bool married = false;

public Person(string name)
{
this.name = name;
}

public Person(string name, int age)
{
this.name = name;
this.age = age;
}

public Person(string name, int age, bool married)
{
this.name = name;
this.age = age;
this.married = married;
}

public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

public bool Married
{
get
{
return married;
}
set
{
married = value;
}
}

public int Age
{
get
{
return age;
}
set
{
age = value;
}
}
}
Nothing too complicated there or out of the ordinary.

It's a pain to have to code constructors for objects and especially when you add more properties to an object, in this case generally in the past you'd create a new constructor or modify an existing one. You needn't do this in C# 3.0 anymore as in order to set properties when we instantiate the object, we can simply set the public properties on the same line as we instantiate the object - Much like calling a constructor but without having to write any code! This is where the power of object intializers come into play with C# 3.0. Consider the following code:
//C# 3.0
public class Person
{
private string name = string.Empty;
private int age = -1;
private bool married = false;

public string Name
{
get
{
return name;
}
set
{
name = value;
}
}

public bool Married
{
get
{
return married;
}
set
{
married = value;
}
}

public int Age
{
get
{
return age;
}
set
{
age = value;
}
}
}

In reference to the above code, in C# 2.0 there is no way of setting the objects properties at initialization time without having to call the properties explicitly after we have a reference to the object. Well in C# 3.0 now we can. This is how we do it in C# 3.0:
Person person = new Person
{
Name = "Simon",
Age = 30,
Married = true
};
You could also use the above with Implicitly Typed Local Variables which is another new feature of C# 3.0. I've written an article on this here.

So if I wanted to use the above with an Implicitly Typed Local Variables I could code the above as:
var person = new Person
{
Name = "Simon",
Age = 30,
Married = true
};
Notice the syntax is a little like Anonymous Types.

Intellisense is quite clever also, the compiler and intellisense will not allow you to define a property more than once, if you do, in this case defining name twice you will get a compiler error: "Duplicate initialization of member 'Name'". Once you have set a property, intellisense will omit that property from the list of available properties. Much like overriding methods that we have enjoyed since year dot.

Now that we have covered object initializers, we will talk about collection initializers.
List<Person> peopleCollection = new List<Person>
{
new Person{Name = "Simon Hart", Married=True, Age=30}
};
Nice and clean! How much easier is that. I like this new feature of C# as it makes my code simpler which then makes it easier to change and understand.

Wednesday, December 05, 2007

What is this.... WPF and what is Expression Blend all about?

I have been looking into WPF (Windows Presentation Foundation) for some time now, since probably April last year when it was known as part of WinFX codenamed Avalon. I was impressed last year but even more so now with what you can do with the latest tools.

WinFX was the codename for what is now known as .NET Framework 3.0. Which comprises of the following:
  1. WPF (Windows Presentation Foundation)
  2. WCF (Windows Communication Foundation)
  3. WF (Windows Workflow Foundation)
  4. CardSpace
The nature of this post is to give a quick overview of WPF, I will talk about the other elements of WinFX in later posts. XAML is the new way of defining screens which is XML based. XAML stands for eXtensible Application Markup Language. Pronounced "zaml", I've been pronouncing it as "x-zaml", I must stop ;)

As in Windows Forms you had C# code which effectively specified what was drawn on the screen. With XAML you have well guess...XAML which is separate from your C# code. It is more in-line with how ASP.NET works where you have the HTML/ASP. NET and then you have the code-behind. In fact XAML does work within the Web Browser as known as XBAPs. They are supposed to be fairly interchangeable.

Then a few months back we had "Cider" which was a preview add-in for what was to come in Visual Studio .NET 2008 which allows a very small subset of the XAML designer and functionality. Although this preview was very limited indeed, it gave you an idea what XAML is.

The truth is you can't do much cool XAML with the VS 2008 IDE alone. You can - just to be clear, continue writing WinForm applications in .NET 3.5 and Visual Studio .NET 2008 it's just using WPF enables you to target Vista and give your applications a Vista theme and a much richer look and feel than is easily possible with WinForms does. Do any anything close with WinForms that you can do easily in WPF you have to get you're hands dirty with GDI.

If you can't generate cool apps with VS .NET 2008 then what do you use? This is where Microsoft Expression Blend comes into play. It is designed to allow pure designers to generate screens so the developer can concentrate on the logic for the application. Blend generates XAML automatically so the designer doesn't need to learn XAML.

I have installed Blend recently, it looks rather ummm....feature rich so will require a bit of a learning curb, but looks very powerful.

I found this video recently which talks about WPF and gives examples of what Blend is and I found it very valuable, see for yourself: http://channel9.msdn.com/Showpost.aspx?postid=359715

See here for more information on XAML: http://msdn2.microsoft.com/en-us/library/ms752059.aspx

See here for more information about the Microsoft Expression suite of applications:
http://www.microsoft.com/expression/

For Device Developers:
Unfortunately WPF is not available on devices in CF 3.5.


The WCF subset supported by CF

UPDATE: MSDN link that documents the supported features: http://msdn2.microsoft.com/en-us/library/bb397842.aspx

Andrew Arnott details the elements of the WCF that is supported on the .NET Compact Framework: http://blogs.msdn.com/andrewarnottms/archive/2007/08/21/the-wcf-subset-supported-by-netcf.aspx

Sunday, December 02, 2007

Microsoft Office Mobile 6.1: Upgrade for Microsoft Office 2007 file formats

A couple of days ago Microsoft Office Mobile 6.1 was released and you can upgrade your version of Windows Mobile Office for free to version 6.1 as long as you have a WM 5 or later device and you have a previous version of Office Mobile.

This version supports the new Office 2007 file formats.

Get it here: http://www.microsoft.com/downloads/details.aspx?familyid=4b106c1f-51e2-42f0-ba32-69bb7e9a3814&displaylang=en&tm

Ensure you have ActiveSync 4.5 before installing.

Microsoft SQL Server Compact 3.5 Available

As released with Visual Studio 2008, SQL Server Compact 3.5 is now available in RTM. It is free to use as long as you're not using any type of replication or RDA (remote data access) with a back office SQL Server. Get it here.

SQL Server Compact 3.5 runs side-by-side with SQL Server 2005 Compact Edition (3.0/3.1).

Notice the name change, again ;)

SQL Server 3.5 contains some enhancements such as:

  1. Timestamp datatype - at last! ;)
  2. Transact-SQL enhancements such as:
    1. Nested query in FROM clause
    2. CROSS APPLY and OUTTER APPLY
    3. CASE and DECIMAL
    4. SET IDENTITY INSERT
    5. TOP


SQL Server Compact 3.5 runs under the .NET Compact Framework 2.0. So although it was released at the same time as Visual Studio 2008 and with Visual Studio 2008, you don't actually need VS 2008 or the .NET CF 3.5 to use it. You can use it within your Visual Studio 2005 projects today if you want to.

Read about all the new features here.

This release is supported on Pocket PC 2003 as well as the later devices, WM5, WM6.