Archive

Archive for January, 2010

Events and User group meetings

January 29, 2010 Leave a comment

Singapore Dot Net user group meeting

February UG meeting is held on 4th February 2010, at Level 22 CF12, NTUC Building from 1845 – late. Light Refreshments will be served before the session.

Software Testing in Visual Studio 2010 and Team Foundation Server 2010
Maung Maung Phyo. MVP (Security)
1900 – late

Learn about how Team Lab Management in TFS 2010 enables better collaboration between software developers and testers. We will show you how testers can use Test and Lab Manager to plan tests, associate requirements, execute test cases and reports bugs with invaluable information ensuring that the developers are able to fix the reported bugs.

MS Tech Events

This event gives you a valuable opportunity to learn more about how Microsoft Application Life-Cycle Management (ALM) solution can help you reduce cost, reduce development time, increase quality, and improve project manageability.

Silverlight 4 in a Social Setting @Hackerspace – 10 Feb 2010

Our local MVPs (Justin and Michael) are organizing a social gathering on 10 Feb 2010 from 7pm to 10pm @HackerspaceSG (70A Bussorah Street). See Silverlight 4.0 in action and discuss or brainstorm Silverlight 4 projects.

This is an informal social gathering to amass like minded developers.

Michael Sync (Silverlight MVP) will be sharing with you "What’s New in Silverlight 4.0" in 15 minutes.
Followed by a roundtable session to know everyone. We will also share projects/ideas that developers are working on.

All are welcomed to just show up!! No registrations required!

Actually we were looking for a course like this: Visual Studio Team System Hands-On-Lab. But unfortunately we missed it. Now I have subscribed for the feeds; I will never miss any course.

If you guys have any info regarding this kind of social-technical gatherings or hands-on-lab in Singapore, please share with me.

Using INT or GUID for Primary Keys? Or COMB GUID?

January 21, 2010 3 comments

Today I read an interesting article by Jimmy Nilsson (the author of .Net Enterprise Design) about using auto-generated primary keys in SQL Server. Especially for Surrogate Keys.

Of course, most of our decisions would be to use INT (or BIGINT) as data type and set IDENTITY to true. There is another solution: using GUID. [NEWID in SQL Server].

When a comparison is done between using INT and GUID as primary key, we can list out few important differences:

Pros of using GUID

  1. GUID will be unique through out the database; while INT is not
  2. @@IDENTITY can be a problem while doing INSERT through TRIGGERS. And using @@IDENTITY to get the identity for the recently added row in the table brings the created identity for the current connection.[This could be solved using SCOPE_IDENTITY (see here for an excellent explanation on this!)]
  3. GUID can be used to create primary keys before inserting the value to the database
  4. Integers are not big enough for most of the scenarios; even though you could start from smallest negative value. Anyway BIGINT can be a solution here.
  5. Using INT could be a real night mare when doing manual merge of tables.

Cons of using GUID

  1. 1. In theory GUID presents a risk of getting duplicate GUIDs; but in practice it is not. In the recent windows version (from windows 2000) the algorithm to generate GUIDs doesn’t use the MAC address of the network cars. Instead it is just a random value.
  2. GUID is 4 times larger in size.
  3. There are portability problems, not all the database have GUID as a data type.
  4. Huge overhead; 4 times larger than INT.
    Evolution of COMB GUID

So apparently overhead is the main problem here. When Jimmy Nilsson did real  inserts using GUID as primary key he found out that time taken for inserts with GUID is 30 times greater than inserts with INT. That happened for 2 reasons

1. The generated GUIDs lacked the order; they were random. As you see in the below table only the 4 is common.

C87FC84A-EE47-47EE-842C-29E969AC5131
2A734AE4-E0EF-4D77-9F84-51A8365AC5A0
70E2E8DE-500E-4630-B3CB-166131D35C21
15ED815C-921C-4011-8667-7158982951EA
56B3BF2D-BDB0-4AFE-A26B-C8F59C4B5103

2. SQL insert statement makes the indexes to be reordered and this takes a lot of time. The new ordering for indexes depended on the last bytes

Therefore Jimmy Nilsson arrived at a new algorithm and his new GUID is called as COMB GUIDs.

Jeffery Palermo in his book ASP.NET MVC in Action uses this COMB GUID for his sample code to explain NHibernate. I am using this COMB GUID for my pet project.

Other Resources:

  1. GUIDs as PRIMARY KEYs and/or the clustering key
  2. NHibernate POID Generators revealed : COMB GUID does not cause database fragmentation
  3. INT vs Unique-Identifier for ID field in database
  4. GUIDs are one of the leading causes of index fragmentation
  5. Top tips for effective database managements

Scott “red shirt” Gu

January 21, 2010 Leave a comment

His presentation in Belgium!

image

(via)

I sent the above photo, as a mail to some of my colleagues; surprisingly, most of them didn’t know why every one was wearing Red Shirt! Gu always wear red shirt during presentation.

Anyway, there are loads of presentation slides and demos on Visual Studio 2010 and .Net Framework 4.0 in the above link!

PS: I wear Contact Lenses every day; but man, no one gives a damn about that!

PS2: Man, he is just 34?

Scott Hanselman needs a favour

January 15, 2010 Leave a comment

The folks in the .NET Framework Setup team have a favor to ask, and it’s pretty cool info so I offered to help. Here’s the deal. When .NET 4 releases, the .NET 4 Client Profile will be released as a recommended update on Windows Update (WU) for Vista and Windows 7. It’ll be listed as optional on Windows XP. They need help testing the WU parts. (via)

Categories: Uncategorized

MySQL to SQLServer : Free Migration Assistant

January 13, 2010 Leave a comment

Microsoft announced the first CTP of a SQL Server Migration Assistant (SSMA) for MySQL v1.0 which automates aspects of the migration process to Microsoft SQL Server 2005 & 2008 including SQL Azure Database.

SQL Server Migration Assistant for MySQL is available for free download and preview at SSMA 2008 for MySQL v1.0 CTP1 and will be generally available in the summer of 2010. Customers and partners can also provide feedback via ssmateam@microsoft.com.  (via)

VS 2010 beta1 : Uninstallation problem

January 13, 2010 Leave a comment

Today I tried to uninstall visual studio 2010 beta1 so that I can get my hands wet with VS 2010 Beta 2. Visual Studio 2010 Beta 2 requires us to uninstall Beta 1.

But there was a problem in un installation of visual studio 2010 Beta 1. I got the following error:Setup is looking for file TFSObjectModel-x86.

The solution is very simple. When Visual Studio 2010 Beta 1 was installed, it installed Microsoft Team Foundation Server 2010 Beta 1 Object Model – ENU as a separate installation. So before uninstalling VS2010 Beta 1, one has to uninstall “Microsoft Team Foundation Server 2010 Beta 1 Object Model – ENU”. Below is the image that shows this in the control panel.

image

Hope this helps!