Software development, .Net, SQL Server, TDD, Agile, Community and other Odds and Sods
Mitch Wheat has been working as a professional programmer since 1984, graduating with a honours degree in Mathematics from Warwick University, UK in 1986. He moved to Perth in 1995, having worked in software houses in London and Rotterdam. He has worked in the areas of mining, electronics, research, defence, financial, GIS, telecommunications, engineering, and information management. Mitch has worked mainly with Microsoft technologies (since Windows version 3.0) but has also used UNIX. He holds the following Microsoft certifications: MCPD (Web and Windows) using C# and SQL Server MCITP (Admin and Developer). His preferred development environment is C#, .Net Framework and SQL Server. Mitch has worked as an independent consultant for the last 10 years, and is currently involved with helping teams improve their Software Development Life Cycle. His areas of special interest lie in performance tuning
Monday, May 30, 2011
Perth .NET User Group, Thurs June 2nd: Good Things Come to Those Who ‘await’ with Joe Albahari
Join us at the Perth .NET user group, June 2nd 5:30pm, where Joe Albahari will showcase the magic of C# 5's await and async keywords. You'll see how easy asynchronous programming has become with Microsoft's latest CTP, and how much you can achieve without being a guru in multithreading or monadic calculus.
We'll start with very simple examples to introduce asynchronous programming in general: what exactly is it, how does it differ from multithreading, and why do we need it? Then we'll examine the historical support for asynchronous programming in the .NET Framework and what people are doing right now. You'll see why BackgroundWorker and the event-based pattern are clumsy and often inadequate - and how the APM strikes fear, pain (and ultimately asynchrophobia) into the hearts of the even most hard-core programmers. We'll then demonstrate how the async CTP eliminates the problem almost entirely - allowing you to program as you always have.
There will be plenty of practical examples - from making a rich client app responsive to writing high-concurrency apps and games. We'll also cover limitations and discuss when you would use this versus Reactive Extensions. The presentation will assume minimum background knowledge and yet will go fairly deep. We'll also look at what the compiler actually does in translating asynchronous calls, and potential extensibility points. This is a great chance to get to grips with an otherwise difficult-to-research topic.
Joe Albahari is a C# MVP and author of C# 4.0 in a Nutshell and LINQPad. He has presented at TechEd and JAOO, and is a regular speaker in the Perth .NET UG. He has an extensive free online resource on .NET multithreading and parallel programming at www.albahari.com/threading/
Mount .iso files in Windows
I remember Greg Low once talking about the “Resolved: by Design” or “Resolved: as Won't Fix” replies on Connect when the issue being raised or asked for was clearly a good idea (obviously there are time constraints and sometimes things just aren’t possible); his point was that it doesn’t take too many such responses for even someone evangelical in their conscientious raising of issues to be less than enthusiastic about continuing to do so.
Why do I mention that? Well, ever wanted to mount an .iso file natively in windows? Not such a surprising thing to want to do, right? Especially as Microsoft actually provide many downloads in this format (such as the Windows 7 OS, which is what I was installing). Check out this Connect article “Mount .iso files”. It had 919 up-votes at last count!… Something for Windows 8?
I resorted to using one of the many third party installs which do the job: Virtual CloneDrive. But it really does feel like this should be part of Windows. Getting community/user feedback on your products is a great way to improve them, but only if you’re listening.
I wonder what that vote threshold is!
Sunday, May 29, 2011
Free ASP.NET MVC2 Book
Apparently a very good book on ASP.NET MVC 2 is "MVC 2 In Action" from Manning, and while the authors are putting the finishing touches to the MVC 3 version of the book, the entire MVC 2 version is available completely free in Word document form at: https://github.com/jeffreypalermo/mvc2inaction.
Every version of MVC relies on the previous version (except with a few breaking changes), so there is still value in reading this free resource.
Jeffrey Palermo’s original post is here.
Friday, May 27, 2011
ASP.NET Web Forms and ASP.NET MVC Video Training
Microsoft has made the "Pluralsight On-Demand!" 10 part ASP.NET MVC 3 video training course available free of charge. (“Essential Videos” left-hand pane).
Similarly, there is a 9 part ASP.NET Web Forms 4 video training course also available for free.
Thursday, May 26, 2011
TSQL: Finding Maximum, Minimum and Average Data Row Lengths
This is probably a classic example of if you find you are doing something complicated, there’s almost certainly a better way. It’s also an example of if you think something is genuinely useful and can’t understand why it’s not been implemented already, it probably has but you just haven’t found it yet!
I wanted to get a table’s approximate minimum, maximum and average row size, so after a few attempts I came up with this TSQL snippet:
declare @schemaname varchar(200) = 'Person'
declare @columnList nvarchar(max)
[Note: It’s not 100% accurate due to some row overheads, but it is close enough for many purposes.]
At which point, the thought “Surely there exists a built-in method to do this?” crossed my mind, and of course there is!
If you have sufficient permissions you can quickly produce a min, max and average row size for each table in a database (along with fragmentation information) using
DBCC SHOWCONTIG WITH TABLERESULTS
Wednesday, May 25, 2011
Online IDE for 40+ languages
It’s not often I don’t have access to the Visual Studio IDE, but I saw Jon Skeet mention this recently on SO: http://ideone.com/
The Time has Come, the Walrus said…
A big push to move to TFS and away from Visual SourceSafe (strongly resisting urge to berate VSS!)
But what’s this? No event in Perth? Guess that means stick to VSS!! :) (OK, there is a Live Meeting…)
Tuesday, May 24, 2011
Getting Started with Visual Studio LightSwitch
The links include downloading LightSwitch and the training kit, the forums, and the official LightSwitch Developer Center.
Sunday, May 22, 2011
Large Object Heap and Arrays of Double
If you were asked where objects greater than or equal to 85,000 bytes are allocated in .NET, you would no doubt say on the Large Object Heap (LOH). What would you say if you were asked where an array of 1000 doubles would be allocated? Currently, as of .NET 4.0, it will be allocated on the Large Object Heap!
William Wegerson (aka OmegaMan), a C# MVP, posted this item to Connect: Large Object Heap (LOH) does not behave as expected for Double array placement that describes and reproduces the behaviour:
byte arrayLessthan85K = new byte; // Note: 12 byte object overhead 84987 + 12 = 84999
By looking at the garbage collection generation on object creation (GC.GetGeneration), we can identify if objects reside the LOH or not. If immediately created in generation 2 then that suggests we are in the LOH.
The reason why double arrays with 1000 or more items are allocated on the LOH is performance, due to the fact that the LOH is aligned on 8 byte boundaries. This allows faster access to large arrays and the trade-off point was determined to be 1 thousand doubles.
According to Claudio Caldato, CLR Performance and GC Program Manager, “there’s no benefit to applying this heuristic on 64-bit architectures because doubles are already aligned on an 8-byte boundary”. Subsequent changes have been made to this heuristic that should appear in a future release of the .NET Framework.
As a side note, the expected behaviour is seen if you use Array.CreateInstance() :
// As noticed by @Romout in the comments to that post, the same behaviour is not seen when using Array.CreateInstance()
Friday, May 20, 2011
Newline in Summary XML
You probably know this already, but just in case you don’t! If you want line breaks in your popup tooltip descriptions in Visual Studio, you add the <para> element to your XML summary comments e.g.:
and it appears like this:
Saturday, May 14, 2011
SQL Server Compact Toolbox
If you are using SQL Server Compact Edition (CE), and have not seen this already, the SQL Server Compact Toolbox is a Visual Studio 2010 Pro or higher add-in (for SQL Server CE 3.5/4.0) and standalone app (for 4.0), that adds scripting, import, export, migrate, rename, run script, manage replication and more to your SQL Server Compact Data Connections in VS Server Explorer.
Written by Erik Ejlskov Jensen who’s aptly named blog, Everything SQL Server Compact, contains a wealth of tips, tricks and techniques relating to SQL Server Compact.
The toolbox adds several features to Server Explorer:
Another of his posts, SQL Compact 3rd party tools, lists several 3rd party tools for CE, both commercial and non-commercial.
Thursday, May 12, 2011
SQL Server 2008: Query Hash Statistics
Bart Duncan has released a very useful addition to the DataCollector capture/reporting abilities of SQL Server 2008. Query Hash Statistics can do low-overhead query cost monitoring, utilising the query fingerprint and query plan fingerprint (aka query hash/query plan hash) features that were added in SQL Server 2008. Query fingerprints enable you to get the cumulative cost of all executions of a query even if the query is non-parameterized and has different inline literal values for each execution. Previously, the only way to get this type of query performance data was to capture a Profiler trace and run the trace through a post-processing tool.
Once installed, and sufficient data has been collected, you can access the collected information via 2 custom reports.
Sunday, May 08, 2011
Perth .NET User Group Meeting: 6pm Thurs, 12th May: Introduction to the .NET Reactive Extensions (Rx) with Lee Campbell and James Miles
Join us at the Perth .NET user group, Thurs May 12th (6pm) where Lee Campbell and James Miles join up to present an Introduction to Rx, aka the .NET Reactive Extensions. Rx is a product from Erik Meijer's team at Microsoft that allows you to compose asynchronous and event based programs using observable collections and a Linq style syntax.
The presenters will guide you through the background and basics of Rx, and introduce you to the terminology that is peculiar to Rx. James and Lee will compare code written with and without Rx and show case code to demonstrate the power of Rx in the areas of resource management, fluent and familiar Linq syntax, composable nature, testability of asynchronous and concurrent queries, and the and the ability to tame side effects.
I’m under strict instructions to ask everyone to come armed with questions about Rx!
Please Note: this talk will start at 6pm (not our usual time of 5:30pm due to the venue’s availability)
Wednesday, May 04, 2011
Reminder: Perth .NET User Group: ASP.NET MVC framework with Michael Minutillo
Scott Hanselman is fond of saying that programming components are like Lego pieces and right now "the lego pieces coming out of Microsoft are the right size". One important piece of the web stack is the ASP.NET MVC framework. Since its initial release in March 2009 there has been a new version of the framework released every year and it has quickly become the platform of choice for .NET developers creating web sites. January 2011 saw the version 3.0 release which introduces a number of changes and new features. Additionally, at the MIX11 conference earlier this month Microsoft released the "MVC3 tools refresh" which make developing MVC3 applications in Visual Studio 2010 a highly productive experience.
Mike Minutillo is .NET software engineer with a B.Sc. in computer science. In 2000, Mike started writing .NET software to fund his university studies and has been an active member of the .NET community ever since. Mike is a regular attendee at the Perth .NET Community of Practice where he has given presentations on new features of C#, ASP.NET MVC and Test-Driven Philosophy. In 2009 he started the Perth ALT.NET user group which meets monthly to discuss software engineering tools and practices in the .NET development space. Mike is co-author of Professional Visual Studio 2010. He maintains a technical blog at http://wolfbyte-net.blogspot.com/ and can be contacted at http://twitter.com/wolfbyte/.
There will be a door prize of a choice of license from JetBrains (one of ReSharper , TeamCity Build Agent, dotTrace Profiler, dotCover , RubyMine, IntelliJ IDEA, PyCharm).
MSN, Email: mitch døt wheat at gmail.com