Epic Blog of Awesome


HTML 5: Current browser support

Here’s one of the many sites that gives a “score” on how well html5 standards are supported per browser.

Here’s the summary though… (Score is out of possible 450)

Current           Version     Score
Google Chrome     15.0.874    342
Opera             11.60       325
Mozilla Firefox   8.0         314
Apple Safari      5.1         293
Microsoft IE      9           141

Dev or Beta       Version     Score
Google Chrome     16.0.891    343
Opera             12 alpha    340
Microsoft IE      10          300
Microsoft IE      10 PP       299

Use ViewData and Implement ViewModel Classes: The Official Microsoft ASP.NET Site

Using a ViewModel Pattern

The ViewData dictionary approach has the benefit of being fairly fast and easy to implement. Some developers don’t like using string-based dictionaries, though, since typos can lead to errors that will not be caught at compile-time. The un-typed ViewData dictionary also requires using the "as" operator or casting when using a strongly-typed language like C# in a view template.

An alternative approach that we could use is one often referred to as the "ViewModel" pattern. When using this pattern we create strongly-typed classes that are optimized for our specific view scenarios, and which expose properties for the dynamic values/content needed by our view templates. Our controller classes can then populate and pass these view-optimized classes to our view template to use. This enables type-safety, compile-time checking, and editor intellisense within view templates.

via Use ViewData and Implement ViewModel Classes: The Official Microsoft ASP.NET Site.

U.S. War in Iraq Declared Officially Over – NYTimes.com

End of Iraq War

Flag bearers carried the colors out at the end of the ceremony marking the end of the United States' military involvement in Iraq.

 BAGHDAD — The United States military officially declared an end to its mission in Iraq on Thursday even as violence continues to plague the country and the Muslim world remains distrustful of American power.

via U.S. War in Iraq Declared Officially Over – NYTimes.com.

Clear all Table Data with Constraint Handling T-SQL Script

On most development projects I create a database initialization script that clears data from all tables then inserts a fresh set of sample data into the database. There are several approaches to take but I’ve never seen this one before today. I like it because I don’t have to script the database (and keep that script up to date) and it’s concise. It turns out there’s an undocumented system sp_ procedure that does the heavy lifting. Here’s the script:

--Remove table constraints
EXEC sp_MSForEachTable 'Alter Table ? NoCheck Constraint All'

--Clear data from each table
EXEC sp_MSForEachTable
  DECLARE @MSG nvarchar(4000)
  If CHARINDEX(''[dbo].[sys'', ''?'') = 0
  If ObjectProperty(Object_ID(''?''), ''TableHasForeignRef'') = 1
  -- Just to know which tables used delete syntax.
  SET @MSG = ''DELETE FROM '' + ''?''

  -- Just to know which tables used Truncate syntax.
  SET @MSG = ''TRUNCATE TABLE '' + ''?''

--Restore table constraints
Exec sp_MSForEachTable 'Alter Table ? Check Constraint All'

Experience ASP.NET MVC 3 Beta – the Razor View Engine

Razor is designed to be an alternate view engine for ASP.NET MVC. Initially introduced in WebMatrix and now shipped as part of ASP.NET MVC 3 Beta, Razor allows developers to replace the clunky <% %> syntax with a much cleaner coding model mainly around the sign @. Moreover, it provides some excellent features for Master Page scenarios, while at the same time you won’t lose access to any features you are already familiar with, such as HTML helper methods.

via Experience ASP.NET MVC 3 Beta – the Razor View Engine.

ASP.NET MVC View Model Patterns

Since MVC has been released I have observed much confusion about how best to construct view models. Sometimes this confusion is not without good reason since there does not seem to be a ton of information out there on best practice recommendations.  Additionally, there is not a “one size fits all” solution that acts as the silver bullet. In this post, I’ll describe a few of the main patterns that have emerged and the pros/cons of each. It is important to note that many of these patterns have emerged from people solving real-world issues.

via ASP.NET MVC View Model Patterns.

Object-relational mapping – Wikipedia, the free encyclopedia

Object Relational Mapping

Object Relational Mapping

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in object-oriented programming languages. This creates, in effect, a "virtual object database" that can be used from within the programming language. There are both free and commercial packages available that perform object-relational mapping, although some programmers opt to create their own ORM tools.

via Object-relational mapping – Wikipedia, the free encyclopedia.

Microsoft Ajax Content Delivery Network – ASP.NET Ajax Library

The Microsoft Ajax Content Delivery Network (CDN) hosts popular third party JavaScript libraries such as jQuery and enables you to easily add them to your Web applications. For example, you can start using jQuery which is hosted on this CDN simply by adding a <script> tag to your page that points to ajax.aspnetcdn.com.

By taking advantage of the CDN, you can significantly improve the performance of your Ajax applications. The contents of the CDN are cached on servers located around the world. In addition, the CDN enables browsers to reuse cached third party JavaScript files for web sites that are located in different domains.

via Microsoft Ajax Content Delivery Network – ASP.NET Ajax Library.