Jamal's Professional Blog

Tuesday, 30 September 2008

Visual Studio 2010 and MS .NET Framework 4.0

Yesterday, Microsoft Redmond unveiled the next version of Visual Studio and .NET Framework:

Within last 4 years MS had been so fast on releasing development related stuff! I've seen lots of IT guys arguing this and the way MS is maturing it's framework so fast! Seriously, what do you think?

Labels: , , , ,

Friday, 22 August 2008

Entity Framework 3rd Party Providers

You may have already noticed 11 days back Entity Framework matured out of beta. Luckily, I've already got projects running EF and will be definitely blogging around some best practices and issues later time. But for now, I'm just sharing the following list of soon-to-be 3rd party providers for EF:

Providers Planning Publicly Available Versions in 2008 (Q3 & Q4 CY2008):

  • Devart (formerly Core Lab) - Providing connectivity to Oracle, MySQL, PostgreSQL and SQLite databases
  • Firebird - Providing connectivity to Firebird databases
  • IBM - Providing connectivity to both IBM DB2 data server and Informix Dynamic Server (IDS) database
  • Npgsql - Providing connectivity to PostgreSQL database versions 7.3+ and 8.x
  • OpenLink Software - Providing connectivity to OpenLink Virtuoso, Oracle, Informix, Ingres, Sybase, MySQL, PostgreSQL, DB2, Progress and Microsoft SQL Server databases, and any data source accessible via OpenLink ODBC or JDBC bridge drivers
  • Phoenix Software Solutions - Providing connectivity to SQLite databases
  • Sun Microsystems - Providing connectivity to MySQL databases
  • Sybase - Providing connectivity to SQL Anywhere databases
  • VistaDB Software - Providing connectivity to VistaDB database

Providers Planning Publicly Available Versions in Early 2009 (Q1 CY2009):

  • Synergex - Providing connectivity to Synergy/DE databases

Providers Committed to Supporting the Entity Framework:

  • DataDirect Technologies - Providing connectivity to multiple data stores including Oracle, Sybase, Microsoft SQL Server and DB2 via DataDirect Connect® for ADO.NET

Third Party Provider Support for the Entity Framework RTM

Technorati Tags:

Labels: ,

Friday, 27 June 2008

String.Empty vs. ""

Throughout my MS.NET years I was occasionally asked about differences between C# String.Empty and the empty string literal (""). And also when implementing C# and .NET coding-style documents this has always been challenging since everybody has his own opinion, experience, and taste.
A) string s1 = String.Empty;
B) string s2 = "";
Here’s some advice which might come handy:
Performance
String.Empty is a static read-only public field which is initialised by the static constructor of the String class. Simplified MSIL code generated for statement A is ldsfld String.Empty; this simply pushes the reference of a specific field (String.Empty in this case) into local stack of your executing method after invoking static constructor of the class if not previously executed – this is a 5 bytes instruction though. Note that String.Empty field actually assigns the empty literal ("") to a static field only once and during first access to the String class and this is no big deal; then the resulting reference to constant "" value (from string pool - see below) will be reused for your application domain lifetime (your windows process whatever it is, your hosting environment whatever it is…)
On the other hand, the C# statement B results into ldstr "" MSIL statement; again a 5 bytes instruction. ldstr pushes the supplied literal into AppDomain's internal string pool (CLR internal GlobalStringLiteralMap C++ class) if not previously loaded into the map. The reason is obvious: more efficient memory usage by sharing string literals in memory - a technique called string interning.
When comparing the two alternatives, statement A is so straightforward in CLR implementation making it simple and fast, whilst statement B goes through the overhead of checking the AppDomain's string pool (an internal hash-table) bringing very small performance penalty. BUT:
  1. A and B have JIT compile-time differences and JIT-Compiler will eventually generate nearly same results in either cases; this also implies there is absolutely no performance penalty when your assembly [not framework assemblies] is NGENed (using ngen.exe for example)
  2. During JIT-compilation of your executing method there is this very small (nearly zero) performance penalty which is paid only once. In other words, worrying about performance differences between statement A and B is pointless.
Coding Style
Well, whenever it comes to developing an effective coding-style document, I've realised we're not only talking about technology and it also involves aesthetics and human nature! I suppose we all do agree that increasing readability to at least reduce maintenance costs is a generally accepted coding-style design measure; this may hardly become a baseline for coding-style challenges.
What I'll say here, is only my personal opinion and favourite syntax supported by 16+ years of extensive coding effort - yet it does not necessarily reflect community preference: the String.Empty syntax usually results into higher readability by adding distinctness compared to the "" syntax. I'll definitely go for the first one as I feel more comfortable when reviewing and skimming someone else’s code. The "" syntax is not visually clear enough [needs more attention to see whether or not spaces are contained - could make eyes fatigued for very lengthy code]. Also, it is not clear with non-fixed-size fonts where the number of involved spaces matters [in very rare cases – like when using spaces for print or control alignments]. This is because these fonts usually have narrowed space characters not appropriate for extensive coding.

Labels: , , ,

Sunday, 8 June 2008

Microsoft Distributed Cache - Velocity

"Velocity" is a distributed in-memory caching platform for building scalable, high-performance enterprise and web data-driven applications. Read More...

Microsoft's "Velocity" is very much similar to memcached (pronounced mem-kash-dee), but Microsoft's "Velocity" has nothing to do with The Apache Velocity Project which is an open-source Java templating platform.

I recommend all scalability, availability, and performance lovers give Velocity CTP1 a test drive.

Labels: , , , , ,

Thursday, 5 June 2008

Vista is Green

Microsoft Windows Vista™ features a low-power "Sleep" mode whilst the computer is not in use. Sleep allows consumers saving energy as much as shutdown, yet interestingly fast in resume. Sleep is nearly a mixture of XP's Hibernate and Standby features. As in hibernation, it resumes from disk in case of power failure; otherwise, resumes from memory as in normal standby. Surprisingly, sleep performance is consistent enough by the mercy of new Microsoft Superfetch™ technology.

Based on LBNL study on 2002, typical Intel Pentium 4 PC with 17" CRT display consumes 128.5 watts when idle but running. According to EPA, generating 1kw/h of electricity in the US results in 700g of CO2 emissions; therefore, using "Sleep" feature to save energy when not using PCs result in 760kw/h saving, eliminating 534kg of CO2 emissions annually which is equates to 10% of a private vehicle emissions.

Ten of these PCs left on when not in use results in the equivalent of one more car on the road in terms of greenhouse gas contribution annually.

Also based on ICG consulting calculations, 1 acre of forest sequesters 3326kg of CO2 emissions annually. So eliminating 534kg of this amount means 0.161 acres of trees not required.

For every 6 PCs left on when not in use, an acre of trees is required to sequester the greenhouse gas that is released due to generating the power to leave them fully on while not in use.

For more information please refer to VistaEnergyConserv.doc

Labels: , , , ,