Why You Should Switch from Subversion to Git

Original: http://thinkvitamin.com/code/why-you-should-switch-from-subversion-to-git/ By Scott Chacon

You may have heard some hubbub over distributed version control systems recently. You may dismiss it as the next hot thing, the newest flavor of kool-aid currently quenching the collective thirst of the bandwagon jumpers. You, however, have been using Subversion quite happily for some time now. It has treated you pretty well, you know it just fine and you are comfortable with it – I mean, it’s just version control, right?

You may want to give it a second look. Not just at distributed version control systems, but at the real role of version control in your creative toolkit. In this article, I’m going to introduce you to Git, my favorite DVCS, and hopefully show you why it is not only a better version control system than Subversion, but also a revolutionary way to think about how you get your work done.

Continue reading

Performance Considerations for Entity Framework 5

Original: http://blogs.msdn.com/b/adonet/archive/2012/04/05/ef5-performance-considerations.aspx

Over the past few weeks the EF team has been putting together a whitepaper that talks about the performance considerations developers should take when using Entity Framework. Performance is one critical aspect of developing modern applications, and this document will help developers make informed design decisions and get the most out of their applications when using the Entity Framework 5 (and also EF 4).

There’s no such thing as a magic bullet when it comes to performance. Some of the topics covered by this whitepaper are:

  • View generation.
  • Caching.
  • Query Execution Options.
  • Inheritance Strategies.
  • Lazy Loading vs. Eager Loading.
  • And more..

The document can be found here: http://msdn.microsoft.com/en-us/data/hh949853. So go ahead: read it, and let us know your thoughts.

David Obando,
Entity Framework Team



Original: http://thomaslarock.com/2012/04/the-6-performance-tuning-mistakes-you-dont-want-to-make/

We’ve all had those moments.

It’s late in the day. You are about to head home a few minutes early so you can bring your daughter to soccer practice on time. Your phone rings. The voice on the other end of the line mutters something about the server “being slow”, and needs you to fix it so the company stops losing more and more money with each passing minute. You hang up the phone and see that the voice on the other end of the line has already sent an email to everyone in the company that blames the database server as the source of the problem and that they have spoken to you and you will have it fixed in the next five minutes.

You need to fix this, and fast. You company, and your family, is counting on you being there for them. You open up SQL Server Management Studio. You want to take action. Everyone is counting on you to get this done, and done right.

I am here to tell you about the six mistakes that many novice DBAs make when it comes to fixing performance issues. These mistakes may get you through the next few minutes but they are often band-aid solutions at best and sometimes they can make performance even worse.

Continue reading

nQuant Reduces The Visual Studio Gallery and MSDN Code Samples page size down by 10%

http://www.mattwrock.com/post/2011/09/30/nQuant-Reduces-The-Visual-Studio-Gallery-and-MSDN-Code-Samples-page-size-down-by-10.aspx (30. September 2011 09:21 by Matt Wrock)

Today the Microsoft Galleries team where I work and which supports the Visual Studio extensions gallery and the MSDN Code Samples gallery, among many others, began quantizing its sprited images with nQuant and has realized a 10% reduction in page size.


A few months ago, the visual studio gallery and the MSDN code samples gallery adopted my OSS project RequestReduce, which merges and minifies CSS as well as automatically sprites and optimizes background images. As I reported then, we experienced a 20% improvement in global page load times. At that time RequestReduce performed lossless PNG compression which can dramatically reduce the size of the sprited images which RequestReduce generates. I had also played with some “lossy” open source command line utilities that further reduced the size of PNG images – sometimes dramatically and often without perceptible quality loss. However, when I integrated these utilities intoRequestReduce and applied it to some of the galleries that the Microsoft Galeries team develops (most notably the Silverlight and Azure galleries), the lossy optimization quality was simply unacceptable.

I did quite a bit of research on the topic of image quantization which is the process of removing colors from an image to produce a much smaller image while utilizing sophisticated algorithms to make this color loss imperceptible (or nearly imperceptible) to the human eye. It quite possibly may even be just as effective on alien eyes but to date, we lack the empirical evidence. You can count on me to update this post as more data accumulates in that exciting area of study.

While investigating this, I came across an algorithm developed by Xiaolin Wu that appeared to optimize RGB images (without transparency) with a quality unmatched by any other algorithm I had experimented with. Unfortunately, the algorithm was not immediately compatible with the transparent PNGs generated by RequestReduce. After several weeks of tinkering during very odd hours, I managed to adapt the algorithm to convert 32 bit transparent PNGs to 8 bit 256 color PNGs with far superior quality than those produced by many popular C command line tools. Furthermore, this is a C# library that can be easily integrated into any other .net assembly, nQuant also provides a command line wrapper which can be used for build tasks or ad hoc optimizations.

If you would like to see how nQuant can optimize images, head on over to nquant.codeplex.com where you can download either the compiled assembly and command line utility or the full source code. The site also provides complete instructions on the propper use of the nQuant API. It is dead simple. Here is an example of how to quantize a single image from within C#:

var quantizer = new WuQuantizer();
using(var bitmap = new Bitmap(sourcePath)){
	using(var quantized = quantizer.QuantizeImage(bitmap, alphaTransparency, alphaFader)){
		quantized.Save(targetPath, ImageFormat.Png);

Using the command line, you would issue a command like this:

nQuant myimage.png /o mynewimage.png

If you would like to not only optimize your images but also minify and merge your CSS as well as sprite your CSS background images into a single sprite, then check out RequestReduce. Unlike other similar optimization tools, you do not need to change your code or rearrange your folder structure and you do not need to supply a wealth of config options to get started. It works with multiple server environments and supports content on a CDN. RequestReduce also includes nQuant which it uses to reduce the size of the images it produces.

For more details on the algorithm included in the nQuant library and my efforts to adapt it to ARGB transparent images, read my post on this subject.

Event Broker for ASP.NET

Event Broker for ASP.NET.

Event Broker for ASP.NET

The Event Broker is an implementation of the Observer pattern. The key benefit of an Event Broker is that it offers a loosely coupled mechanism to broadcast and receive events. This is especially useful in ASP.NET where you want to raise events in one user control, say, and handle them in another without needing to wire up each user control to each other explicitly.

I first came across the Event Broker when developing a Windows Forms application using the Smart Client Application Block and thought it was a really cool idea. I have been using the Event Broker concept ever since in various guises, and it’s especially useful in ASP.NET when you want communication between controls to be loosely coupled.

I thought I’d build a really simple implementation that can be used with Web Forms or MVC and allows you to broadcast and receive named events.

For instance let’s say you’re using Web Forms and you have a user control that has a button and you’d like to notify other user controls on a page that the button was clicked without introducing any coupling between the controls or the page they are sitting on. Using the Event Broker this is really easy to do.

My Event Broker implementation provides a way to broadcast and receive loosely coupled events. Behind the scenes the Event Broker uses the HttpContext.Items to keep track of its information. This means that the loosely coupled events are scoped to each request so events and their handlers inherently know which requests they’re for.

Continue reading

tSQLt – Database Unit Testing for SQL Server

What is tSQLt?

tSQLt is a database unit testing framework for Microsoft SQL Server. tSQLt is compatible with SQL Server 2005 (service pack 2 required) and above on all editions.

Main Features

tSQLt allows you to implement unit tests in T-SQL. This is important as you do not have to switch between various tools to create your code and your unit tests. tSQLt also provides the following features to make it easier to create and manage unit tests:

  • Tests are automatically run within transactions – this keeps tests independent and reduces any cleanup work you need
  • Tests can be grouped together within a schema – allowing you to organize your tests and use common setup methods
  • Output can be generated in plain text or XML – making it easier to integrate with a continuous integration tool
  • Provides the ability to fake tables and views, and to create stored procedure spies – allowing you to isolate the code which you are testing

Practical Performance Profiling: Improving the Efficiency of .NET Code

In Practical Performance Profiling, Jean-Philippe Gouigoux provides both the theory and practical skills necessary to analyze and improve the performance of .NET code. By focusing on the 20% of code defects that account for 80% of performance loss, Jean-Philippe Gouigoux guides the reader through using a profiler and explains how to identify and correct performance bottlenecks. This book is for all developers who wish to boost the performance of their .NET code without having to embark on the steep slopes of tuning.

Continue reading