TechEd NZ 2010 – The “Ivan” Factor
The Mindscape crew were up in force at TechEd New Zealand this week presenting on a number of development related topics. We had a lot of fun and all enjoyed the great vibe that the Microsoft team put on for us this year*
I wanted to extend a big congratulations to our very own Ivan who walked away with the honor of the best talk of the conference for his most excellent session on the Parallel Extensions (and he even got a second session in the top 10 with his Deep Dive into how LINQ works**). Clearly everyone enjoys his clarity of thought, witty presentation humor and his ability to really inform his audience about the topic at hand.

Ivan presents at Tech Ed – Photo by Ollie Dale
Here are some choice quotes from the #tenz twitter stream regarding Ivans talks at TechEd:
@nzben: There definitely needs to be an “Ivan” factor on room allocation at #tenz.50+ people overflowing from NZ4.
@seanrcross: #tenz top tip. When going to Ivan Towlson talks, go early. Standing room only again
@kiwipom: Ivan needed a bigger room for his #tenz session http://yfrog.com/eu1ntgj
* – Some more than others, although going against the punters odds JD did not pass out on the conference floor this year
** – I may have to yield control over the LightSpeed LINQ provider now!
Nightly news, 3 September 2010
Tagged as LightSpeedNot much to relate this week as we’ve been at TechEd for most of it, but we’ve managed to fit in a few fixes. Here’s the deal.
LightSpeed
- Go To Linked Entity now works if the .lsmodel files are in project subfolders
- We’ve added a workaround for the ObjectDisposedException bug in the .NET TransactionScope class
- We’ve fixed an error on SimpleDB if you were using Count with paging
- Fixed an error during model creation on VS2010
- Fixed an issue where abstract STI base classes were incorrectly not considered for designer database sync
All these fixes are in the latest nightly builds. Enjoy!
String formatting in WPF and Silverlight
If you’re building controls or applications that display numbers and dates, you’re going to want to have a good understanding of how to format them nicely. In WPF and Silverlight, this is achieved using the static String.Format method which has a few overloads. The method overload we’ll be looking at takes in a string and an object as the parameters. The string parameter is a format string which will be used to format the given object. The object is whatever we want to convert to a string such as a double or a DateTime. In this blog post we will look at just a few of the many format strings provided by WPF and Silverlight for formating doubles and DateTimes. The general structure of a format string is: “{0:*}” where the * is replaced with the format string itself.
C# String format for double
Most format strings for double values are comprised of some numbers or symbols followed by a decimal point followed by some more numbers or symbols. The most common string format for formatting a double value is to specify the number of decimal places. As seen in the examples below, the number of following zeros define the exact number of decimal places to display. The number of “#” symbols can be used to define a maximum number of decimal places while only displaying digits if they are not zero. The last example below shows how “0.0#” can be used to specify that at least one decimal place is always shown, but only a maximum of two decimal places.
// exactly two decimal places String.Format("{0:0.00}", 123.4567); // "123.46" String.Format("{0:0.00}", 123.4); // "123.40" String.Format("{0:0.00}", 123.0); // "123.00" // at most two decimal places String.Format("{0:0.##}", 123.4567); // "123.46" String.Format("{0:0.##}", 123.4); // "123.4" String.Format("{0:0.##}", 123.0); // "123" // one or two decimal places String.Format("{0:0.0#}", 123.4567); // "123.46" String.Format("{0:0.0#}", 123.4); // "123.4" String.Format("{0:0.0#}", 123.0); // "123.0"
C# String format for DateTime
Format strings for DateTime objects are built up as a sequence of grouped letters. Each letter targets a particular part of the DateTime such as the year, day or hour. The number of letters in each group defines how that part should be formatted. Below is a list of some of the letters and the results of applying them to a DateTime.
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 0); String.Format("{0:y yy yyy yyyy}", dt); // "8 08 008 2008" year String.Format("{0:M MM MMM MMMM}", dt); // "3 03 Mar March" month String.Format("{0:d dd ddd dddd}", dt); // "9 09 Sun Sunday" day String.Format("{0:h hh H HH}", dt); // "4 04 16 16" hour 12/24 String.Format("{0:m mm}", dt); // "5 05" minute String.Format("{0:s ss}", dt); // "7 07" second String.Format("{0:t tt}", dt); // "P PM" AM or PM
By using any combination of these letter groups within a format string, you can display a DateTime in any possible way you need. Between each letter group, you may also want to include a symbol such as a comma, colon or slash. The slash and colon symbols are special characters known as the date separator and time separator respectively. One thing to keep in mind is that the date and time separator characters may be displayed differently depending on the current culture of the application. Month and day names will also be displayed in different languages based on the culture.
// DateTime format examples String.Format("{0:MM/dd/yy}", dt); // "03/09/08" String.Format("{0:dddd, MMMM d, yyyy}", dt); // "Sunday, March 9, 2008" String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9/3/2008 16:05:07"
Format strings in XAML
If you ever come across a situation where you need to set a property of an object in XAML to be a format string, you may notice a small problem. Format strings such as the ones described in this blog post start and end with the curly bracket symbols. So the following code will fail to compile because the curly bracket is a special character which XAML will interpret in its own way rather than using it as a string.
<MyFormattingObject FormatString="{0:0.0}" />To get around this issue, all we need to do is place an empty pair of curly brackets before the format string to tell XAML to interpret it as a string value.
<MyFormattingObject FormatString="{}{0:0.0}" />More information
For a more extensive list of format string tips and tricks, you can follow this link to find DateTime formats, and check here to find string formats for doubles.
Nightly news, 27 August 2010
Well, that was August. Four releases in four weeks. Mindscape HQ has been a non-stop riot of launch parties and last-minute brow-furrowing attempts to think of amusing discount codes. Despite all that we still have few updates in the nightlies.
LightSpeed
- Fixed an issue where auto through entity tables were not created during database sync if the source was a STI derived entity
- Added a check for the Client Profile when creating a new LightSpeed model
WPF Diagramming
- Fixed DiagramPrinter printing nodes whose elements had been set to invisible
We’d like to remind customers that most of the Mindscape crew will be at TechEd New Zealand for the first three days of next week and this is likely to impact forums support. Please be patient — we’ll respond to posts when we can.
SimpleDB Batching in LightSpeed 3.11
Tagged as LightSpeedOne of the enhancements made to LightSpeed 3.11 was to improve the efficiency of inserts when working with SimpleDB. If you’ve not heard of SimpleDB, it’s a cloud based database offering from Amazon. It’s not a traditional relational database, but rather a key/value store which is pretty neat if you’re into that sort of thing. We first released support for mapping over SimpleDB last year and got a great response from people wanting to explore SimpleDB. Nicely, LightSpeed is still the only .NET ORM that supports SimpleDB :-)
Storm clouds
One of the potential performance problems with cloud based databases is that queries take the form of a web request. As you’ll be well aware, these are an order of magnitude slower that calling a database running on your machine, or even on your same network segment. Unfortunately this means that if you wanted to push a heap of inserts into your database the SimpleDB provider would chug away making a call… getting a response… making the next call… getting a response… and so on. This latency made performance really quite slow for large data loading exercises.
Batched put attributes
Jeremy started investigating what could be done and found Amazon had enhanced the API for SimpleDB (and surfaced it through their .NET wrapper) to allow for “batched puts” which is SimpleDB lingo for batching of inserts. With a little bit of work on the core engine, LightSpeed can be configured to batch up inserts into collections of 25 – which is the limit that Amazon imposes on the batch size. This yields ~25x performance for inserts.
Turning on batching for SimpleDB
As this capability was not being released as part of a major version change we’ve left it to developers to enable this functionality. It’s pretty easy to do, just add the following to your connection string for SimpleDB providers:
Enable Batch Insert=true
More improvements planned
Currently batching is only enabled for the insert operations. Support for update operations is planned and then we will likely investigate some additional performance enhancements we can make to ensure that LightSpeed continues to earn it’s name. Also, a special mention must be made to our LightSpeed user “MiddleTommy” who has provided great feedback on working with LightSpeed which lead to this enhancement being made – thanks! :-)
Hope that helps all our SimpleDB users out there! Also, if you’re tinkering with SimpleDB, be sure to check out our SimpleDB Management Tools which gives a SQL Management Studio feel to working with SimpleDB directly from within Visual Studio.
![]()
BrainDump (1)
Community Code (1)
Events (7)
General (34)
Lab Samples (2)
LightSpeed (144)
MegaPack (3)
News (52)
NHibernate Designer (4)
Products (68)
Projects (4)
Screencast (6)
SharePoint (2)
Silverlight (7)
Silverlight Elements (14)
SimpleDB Management Tools (12)
Visual Studio (4)
VS File Explorer (6)
WPF (34)
WPF Diagramming (17)
WPF Elements (30)
WPF Property Grid (26)
![]()
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
![]()
JB’s Blog
JD’s Blog
Loud Thinking
Martin Fowler’s Bliki
Rowan Simpson
Scott Hanselman
ScottGu’s Blog





Posted by Jeremy Boyd on 2 September 2010






