<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0">
  <channel>
    <title>Ahmeds'</title>
    <description>Random Expressions</description>
    <link>http://jazsolutions.net/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.6.0.0</generator>
    <language>en-US</language>
    <blogChannel:blogRoll>http://jazsolutions.net/opml.axd</blogChannel:blogRoll>
    <blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink>
    <dc:creator>My name</dc:creator>
    <dc:title>Ahmeds'</dc:title>
    <geo:lat>0.000000</geo:lat>
    <geo:long>0.000000</geo:long>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AhmedsRandomExpressions" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="ahmedsrandomexpressions" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
      <title>Things I would like to see in a new code base</title>
      <description>&lt;p&gt;I was asked by someone recently what I would want to see in a code base that I may've recently inherited. As devs we certainly come across new code bases all the time, some big others small.&amp;nbsp;Here are a few things that I would really like to see:&lt;/p&gt;
&lt;p class="p2"&gt;General code readability &amp;amp; maintainability:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use of consistent coding conventions&lt;/li&gt;
&lt;li&gt;Proper code formatting e.g. no extra spacing or unwanted line breaks (Note: it's easy to reformat code using editors these days though).&lt;/li&gt;
&lt;li&gt;Use of a source control system. Although I don't think anyone really develops without a source control these days (or do they?)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Setup and modularity:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Functionality broken into multiple projects/assemblies&lt;/li&gt;
&lt;li&gt;Layered architecture to separate concerns&lt;/li&gt;
&lt;li&gt;Easy to map namespaces to an assembly. From personal experience, I feel this can cause a lot of confusion sometimes.&lt;/li&gt;
&lt;li&gt;Build script for the solution&lt;/li&gt;
&lt;li&gt;Deployment scripts and/or packages&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Design:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;OO basics are applied (assuming an OO programming language is used)&amp;nbsp;i.e. abstraction, encapsulation, inheritance, polymorphism&lt;/li&gt;
&lt;li&gt;Less depth in inheritance hierarchies. While I understand this can be hard to get away with in large applications I am against inheritance abuse.&lt;/li&gt;
&lt;li&gt;Design patterns&lt;/li&gt;
&lt;li&gt;(Any) &lt;a href="http://en.wikipedia.org/wiki/SOLID" target="_blank"&gt;SOLID&lt;/a&gt; principles in use. I would really like to see Single responsibility, Open/closed and Dependency inversion principles.&lt;/li&gt;
&lt;li&gt;No obvious code smell e.g. code duplication, God objects, spaghetti code etc&lt;/li&gt;
&lt;li&gt;Caching, paging and other general performance considerations in code and database queries&lt;/li&gt;
&lt;li&gt;Well known frameworks in use e.g. NHibernate, jQuery, log4net etc&lt;/li&gt;
&lt;li&gt;Error handling (where it makes sense) and logging&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Testing&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Automated unit/integration tests&lt;/li&gt;
&lt;li&gt;Mocking frameworks in use&lt;/li&gt;
&lt;li&gt;Automated UI testing (if possible)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I'm sure there are other things that could make into this list.&lt;/p&gt;
&lt;p class="p2"&gt;&amp;nbsp;&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2011/07/01/Things-I-would-like-to-see-in-a-new-code-base.aspx</link>
      <author>Ahmed</author>
      <comments>http://jazsolutions.net/post/2011/07/01/Things-I-would-like-to-see-in-a-new-code-base.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=0b3a0fe3-f017-418d-98b1-4fd1e6376d09</guid>
      <pubDate>Fri, 01 Jul 2011 02:09:00 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>Ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=0b3a0fe3-f017-418d-98b1-4fd1e6376d09</pingback:target>
      <slash:comments>52</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=0b3a0fe3-f017-418d-98b1-4fd1e6376d09</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2011/07/01/Things-I-would-like-to-see-in-a-new-code-base.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=0b3a0fe3-f017-418d-98b1-4fd1e6376d09</wfw:commentRss>
    </item>
    <item>
      <title>Type Initializer Exception</title>
      <description>&lt;p&gt;I've blogged about using s&lt;a href="http://jazsolutions.net/post/2006/11/16/Using-static-constructors-for-thread-safe-Singletons.aspx"&gt;tatic constuctors for Singletons&lt;/a&gt;before. Static constructors are invoked only once before any (instance or static) member of the class can be executed. Based on this behavior, it provides an ideal thread-safe initialization section in many scenarios. &lt;/p&gt;  &lt;p&gt;There is however one particular behavior of static constructors that is good to know. If an unhandled exception occurs in a static constructor then the class is effectively unusable. Any other client code trying to use any static/instance member of the *failed* class can expect a type initialization exception in return. Unlike instance constructors, the runtime will not try to re-execute the static constructor if it failed once since static constructors are only supposed to execute once. &lt;/p&gt;  &lt;p&gt;For developers it's something important to keep in mind if you tend to use static constructors frequently. Either explicitly handle the exception or try not to put any code in there that can result in an error e.g. a call to a DB or web service. Stuff like this should be put in a separate initialization method that should be called once. &lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/12/09/Type-Initializer-Exception.aspx</link>
      <author>ahmed</author>
      <comments>http://jazsolutions.net/post/2010/12/09/Type-Initializer-Exception.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=cfdc3adc-d8b9-4c7a-a05c-661c29ccd483</guid>
      <pubDate>Thu, 09 Dec 2010 14:11:20 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=cfdc3adc-d8b9-4c7a-a05c-661c29ccd483</pingback:target>
      <slash:comments>191</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=cfdc3adc-d8b9-4c7a-a05c-661c29ccd483</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/12/09/Type-Initializer-Exception.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=cfdc3adc-d8b9-4c7a-a05c-661c29ccd483</wfw:commentRss>
    </item>
    <item>
      <title>Bulk Loading with SqlBulkCopy</title>
      <description>&lt;p&gt;Bulk copying is the preferred method for loading high volume data. The &lt;a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx" target="_blank"&gt;SqlBulkCopy&lt;/a&gt; API in ADO.NET provides the ability to bulk copy using interfaces that .NET developers are more accustomed to e.g. IDataReader and DataTable. It&amp;rsquo;s similar to the SQL BCP utility however it can provide much more control over the loads. Bulk copying performance over individual inserts is achieved mainly due to a few factors:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Significant reduction in database round trips &lt;/li&gt;
&lt;li&gt;Minimal logging at the database level (under certain conditions) &lt;/li&gt;
&lt;li&gt;Reduced constraint checking by default&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Contrary to popular belief, bulk copy operations can also participate in transactions. SqlBulkCopy has been working quite well for a high volume data loader I developed loading approximate 5 million rows daily on average. Here is an in depth research on SqlBulkCopy API behavior in different scenarios (thanks to the author for all the research): &lt;a href="http://sqlblog.com/blogs/alberto_ferrari/archive/2009/11/30/sqlbulkcopy-performance-analysis.aspx" target="_blank"&gt;SqlBulkCopy Performance Analysis&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Some notes from the article:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQL Server scales quite well for concurrent loads up to a certain threshold. &lt;/li&gt;
&lt;li&gt;Loading into a heap is must faster than an indexed table for obvious reasons. However if indexes are required then it maybe better (in some cases) to disable them during loading and enable them after. &lt;/li&gt;
&lt;li&gt;The batch size can impact performance. The bigger the batch size the better. &lt;/li&gt;
&lt;/ul&gt;</description>
      <link>http://jazsolutions.net/post/2010/10/24/Bulk-Loading-with-SqlBulkCopy.aspx</link>
      <author>Ahmed</author>
      <comments>http://jazsolutions.net/post/2010/10/24/Bulk-Loading-with-SqlBulkCopy.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=a79b38d1-2507-419c-86ff-4ae3b8b888e4</guid>
      <pubDate>Sun, 24 Oct 2010 13:10:00 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>Ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=a79b38d1-2507-419c-86ff-4ae3b8b888e4</pingback:target>
      <slash:comments>84</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=a79b38d1-2507-419c-86ff-4ae3b8b888e4</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/10/24/Bulk-Loading-with-SqlBulkCopy.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=a79b38d1-2507-419c-86ff-4ae3b8b888e4</wfw:commentRss>
    </item>
    <item>
      <title>Generating Sequences In SQL Server</title>
      <description>&lt;p&gt;SQL Server provides auto identity to generate sequential IDs in a table which is handy. But there is no feature (that I know of in 2005 and before) to generate sequential IDs across multiple tables, similar to the &lt;a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/schema.htm#CNCPT611" target="_blank"&gt;Sequence Generator&lt;/a&gt; in Oracle. Recently I came across a requirement where I had to bulk insert parent and child records in 2 separate tables and I did not want to go the &lt;a href="http://msdn.microsoft.com/en-us/library/ms189786.aspx" target="_blank"&gt;Sequential GUID&lt;/a&gt; route.&lt;/p&gt;  &lt;p&gt;While from the surface it may look simple, the challenge with generating unique sequences is reliability in a multi-user environment. This is why I always prefer the database system providing such functionality. Here is something that I came up with that is simple and worked quite well for my needs. It has 2 main components – a table &amp;amp; a stored proc.&lt;/p&gt;  &lt;p&gt;CREATE TABLE [dbo].[EntityIdSequence](    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [SeqNo] [bigint] IDENTITY(1,1) NOT NULL,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; [Used] [bit] NULL     &lt;br /&gt;) ON [PRIMARY]&lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;CREATE PROCEDURE [dbo].[GenerateEntityIdSequences]    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; @count int     &lt;br /&gt;AS     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; SET NOCOUNT ON;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; declare @sequences as table (seqno bigint)     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; while (@count &amp;gt; 0)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; begin     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; insert into [entityidsequence] values (1);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; insert into @sequences values (scope_identity());&amp;#160;&amp;#160;&amp;#160; -- get the last generated id     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; set @count = @count - 1;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; end     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; select seqno from @sequences; &lt;/p&gt;  &lt;p&gt;GO&lt;/p&gt;  &lt;p&gt;Notice that I didn’t have to specify any special transaction isolation level. And I am able to generate a bunch of unique sequences at a time which can cut down on database roundtrips. The real key here is making use of the &lt;a href="http://msdn.microsoft.com/en-us/library/ms190315.aspx" target="_blank"&gt;scope_identity()&lt;/a&gt; system function. Another important thing to remember is that concurrent requests to GenerateEntityIdSequences for multiple sequences could result in skipped sequences e.g. 1,2,4,6,7. But they should always be unique.&lt;/p&gt;  &lt;p&gt;We can also reseed if need be. This can be useful if you wanted to turn off auto ID on an existing table although that would require recreating &amp;amp; repopulating the table. Here is the command for reseeding to start generating sequence from 1000:&lt;/p&gt;  &lt;p&gt;DBCC checkident(‘EntityIdSequence’, RESEED, 999)&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/06/29/Generating-Sequences-In-SQL-Server.aspx</link>
      <author>ahmed</author>
      <comments>http://jazsolutions.net/post/2010/06/29/Generating-Sequences-In-SQL-Server.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=eca13a21-6671-4a5e-b7a7-fd371f7dd7df</guid>
      <pubDate>Tue, 29 Jun 2010 18:17:53 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=eca13a21-6671-4a5e-b7a7-fd371f7dd7df</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=eca13a21-6671-4a5e-b7a7-fd371f7dd7df</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/06/29/Generating-Sequences-In-SQL-Server.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=eca13a21-6671-4a5e-b7a7-fd371f7dd7df</wfw:commentRss>
    </item>
    <item>
      <title>Privacy in the Digital Age</title>
      <description>&lt;p&gt;We have entered an era where broadcasting yourself is the new norm. Social networking sites like Facebook &amp;amp; Twitter enable us to share our information with family and frieds which is great. But this also presents some privacy challenges that are a hot topic of discussion these days. &lt;br /&gt;&lt;br /&gt;Some people might argue that privacy is not as big of a concern as it's made out to be. Just look at the recent FB decision to share user information with search engines. FB is one of the most popular sites on the planet with 500 million users and growing. Even a small percentage is a lot of private information.&lt;br /&gt;&lt;br /&gt;It's true that people are social animals and want to share their information with closed ones. But many people also blindly trust these websites to not misuse their personal information. And that is an important question: can websites that have access to a lot of personal information be trusted? How much control do individuals have over their own information that can be instantly transmitted to 3rd parties around the world for reasons they are completely unaware of.&lt;br /&gt;&lt;br /&gt;It seems like there isn't going to be much privacy for consumers in the digital age unless we demand it from organizations (similar to the FB user backlash). Websites should benefit from their users but not at the expense of their privacy.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/06/02/Privacy-in-the-Digital-Age.aspx</link>
      <author>Ahmed</author>
      <comments>http://jazsolutions.net/post/2010/06/02/Privacy-in-the-Digital-Age.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=0912b750-e7fe-4bb3-ab0a-a9af56c3ce7e</guid>
      <pubDate>Wed, 02 Jun 2010 17:59:00 -1200</pubDate>
      <category>Miscellaneous</category>
      <dc:publisher>Ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=0912b750-e7fe-4bb3-ab0a-a9af56c3ce7e</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=0912b750-e7fe-4bb3-ab0a-a9af56c3ce7e</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/06/02/Privacy-in-the-Digital-Age.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=0912b750-e7fe-4bb3-ab0a-a9af56c3ce7e</wfw:commentRss>
    </item>
    <item>
      <title>What Management Should Know</title>
      <description>&lt;p&gt;I recently read &lt;em&gt;&lt;a href="http://www.amazon.com/gp/product/0130676349" target="_blank"&gt;Agile Software Development with Scrum&lt;/a&gt;&lt;/em&gt; by Ken Schwaber and Mike Beedle. This book does a great job in delivering an important message i.e. software development is a research/creative process. It cannot be planned for using the same processes more applicable to tasks with predictable outcomes. A single piece of functionality can be implemented in different ways depending on programmer experience and other factors. This is why “sprinting” feels more natural when applied to software development. After each development cycle, that shouldn’t span more than a month, the entire team needs to reevaluate their progress and proceed based on the empirical data available.&lt;/p&gt;  &lt;p&gt;While this means trying to get a working quality product out the door it also implies being flexible. This is a difficult proposition for management since it flies in the face of all the nifty looking project plans and customer expectations. This is why the entire company has to be on board with agile software development. It is not just a process limited to the nerds in the corner section cranking out code.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/05/15/What-Management-Should-Know.aspx</link>
      <author>ahmed</author>
      <comments>http://jazsolutions.net/post/2010/05/15/What-Management-Should-Know.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=2700d8bb-827d-47a1-b338-410df7f048cd</guid>
      <pubDate>Sat, 15 May 2010 10:45:43 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=2700d8bb-827d-47a1-b338-410df7f048cd</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=2700d8bb-827d-47a1-b338-410df7f048cd</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/05/15/What-Management-Should-Know.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=2700d8bb-827d-47a1-b338-410df7f048cd</wfw:commentRss>
    </item>
    <item>
      <title>Powered by BlogEngine.NET</title>
      <description>&lt;p&gt;I finally moved to a new blogging engine i.e. &lt;a href="http://www.dotnetblogengine.net/" target="_blank"&gt;BlogEngine.NET&lt;/a&gt;. I’d been using &lt;a href="http://telligent.com/" target="_blank"&gt;Community Server&lt;/a&gt;(now known as Telligent Community)&amp;#160; since 2006 mainly for blogging. I felt it was time to use something more lightweight and community driven. CS has also made some license changes since I started using it.&lt;/p&gt;  &lt;p&gt;Anyway, what was important for me was being able to move my existing blog posts and comments which was simple enough by using this &lt;a href="http://dbvt.com/x/blog/2008/DBVTCS2BE.sql.txt" target="_blank"&gt;script&lt;/a&gt;. I did have to tweak the query a little bit to meet my requirements especially since I’d been using a very old version of CS e.g. the section ID for blog posts was 12 in my case. In addition, I had to write the query to import the existing tags. Here is the query:&lt;/p&gt;  &lt;p&gt;-- Tags &lt;/p&gt;  &lt;p&gt;insert into be_PostTag (PostID, Tag)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; select p.PostID, cat.Name from be_Posts p     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; join CommunityServer.dbo.cs_Posts_InCategories pcat on p.cspostid = pcat.PostID     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; join CommunityServer.dbo.cs_Post_Categories cat on pcat.CategoryID = cat.CategoryID     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; where cat.SectionID = 12&lt;/p&gt;  &lt;p&gt;So far I am liking BlogEngine.NET. It’s simple, configurable, fast and comes with a lot of themes and extensions contributed by the community. Looking forward to blogging with BlogEngine.NET.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/04/03/Powered-by-BlogEngineNET.aspx</link>
      <author>admin</author>
      <comments>http://jazsolutions.net/post/2010/04/03/Powered-by-BlogEngineNET.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=965d5e9d-a6e3-4f79-bb51-6368c330e659</guid>
      <pubDate>Sat, 03 Apr 2010 20:38:59 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>admin</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=965d5e9d-a6e3-4f79-bb51-6368c330e659</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=965d5e9d-a6e3-4f79-bb51-6368c330e659</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/04/03/Powered-by-BlogEngineNET.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=965d5e9d-a6e3-4f79-bb51-6368c330e659</wfw:commentRss>
    </item>
    <item>
      <title>Team Synergy</title>
      <description>&lt;p&gt;We all know how important team synergy is. Be it a sports team or a corporate one, great things can be achieved by people working together. When people click the impossible becomes possible. People can discuss and debate by setting aside egos. The distinction between work and fun is blurred. Being honest is not considered being too direct. Knowing a team member is more than knowing their name and what feature they are working on. A theme based list exists only known to the team members. Others envy the team. One person leaving the team can have a drastic impact.&lt;/p&gt;
&lt;p&gt;In my career I&amp;rsquo;ve been blessed to have worked with a lot of good folks in awesome teams. It&amp;rsquo;s important for me (and I&amp;rsquo;m sure many others) that I look forward to going to work everyday. That includes challenging work and fun people. Having the right mix of people is like having a very delicate balance. You have to be part of one to feel it.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/03/08/Team-Synergy.aspx</link>
      <author>Admin</author>
      <comments>http://jazsolutions.net/post/2010/03/08/Team-Synergy.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=a198f07f-ffe9-4772-b6cb-02a599b9b626</guid>
      <pubDate>Mon, 08 Mar 2010 17:39:00 -1200</pubDate>
      <category>Miscellaneous</category>
      <dc:publisher>Admin</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=a198f07f-ffe9-4772-b6cb-02a599b9b626</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=a198f07f-ffe9-4772-b6cb-02a599b9b626</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/03/08/Team-Synergy.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=a198f07f-ffe9-4772-b6cb-02a599b9b626</wfw:commentRss>
    </item>
    <item>
      <title>Using LogParser with .NET</title>
      <description>&lt;p&gt;In &lt;a href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X" target="_blank"&gt;"The Pragmatic Programmer"&lt;/a&gt;, the authors talk of the Unix philosophy of “small, sharp tools” and the limitations of GUI apps. I strongly agree with them. No doubt GUI apps have their place in the world, but there is something very simple yet powerful about having a console utility that promises to do only one thing and does it well.&lt;/p&gt;  &lt;p&gt;One of my favorite console utilities of late has been &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;amp;displaylang=en" target="_blank"&gt;LogParser&lt;/a&gt;. Talk about a fast sql-like query language with the ability to query multiple data sources and a COM API to boot. Since one of the applications I developed recently required IIS log parsing, I simply couldn't ask for more. But the fact that it can query large files efficiently also makes it quite useful for other stuff. Ever have to search a large CSV file? Why even bother opening it in a text editor when you can query and page through the results. How about querying IIS metabase or the Windows Event Log and storing results in a CSV file? You really have to play with it to realize its full potential.&lt;/p&gt;  &lt;p&gt;As .NET developers we can also harness LogParser's power through its COM API. While COM Interop is probably not the most desirable option, its the only way to consume LogParser in .NET. There is obviously a performance penalty for this, however I've not experienced any significant performance issues while parsing tons of log files every day (assuming the queries themselves execute quickly). Using the LogParser API is pretty straight forward. Let’s say we are interested in getting the unique hosts from log files. The command line query for this would be:&lt;/p&gt;  &lt;p&gt;logparser –i:IISW3C “select distinct to_lowercase(cs-host) from c:&lt;a href="file://%5C%5Clogfiles%5CW3SVC1%5Cex100128.log"&gt;\logfiles\W3SVC1\ex100128.log&lt;/a&gt;”&lt;/p&gt;  &lt;p&gt;Folowing is a C# application that runs the above query for any specified log file. Make sure to install the LogParser utility which will also register the COM DLL. Reference the LogParser.dll from the installation directory and VS will generate the RCWs (runtime callable wrappers) in an assembly named Interop.MSUtil.dll. Here is the code:&lt;/p&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;using&lt;/span&gt; LogQuery &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; MSUtil.LogQueryClassClass;&lt;br&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;using&lt;/span&gt; LogRecordSet &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; MSUtil.ILogRecordset;&lt;br&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;using&lt;/span&gt; LogRecord &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; MSUtil.ILogRecord;&lt;br&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;using&lt;/span&gt; IISW3CInputFormat &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; MSUtil.COMIISW3CInputContextClassClass;&lt;br&gt;&lt;br&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;namespace&lt;/span&gt; LogParserTest&lt;br&gt;{&lt;br&gt;    &lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;class&lt;/span&gt; Program&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;    {&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;        &lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;static&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;void&lt;/span&gt; Main(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt;[] args)&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;        {&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            &lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;if&lt;/span&gt; (args == &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;null&lt;/span&gt; || args.Length == 0)&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            {&lt;/span&gt;&lt;br&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                Console.WriteLine(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;"Please specify a log file path."&lt;/span&gt;);&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;return&lt;/span&gt;;&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            }&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            &lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;try&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            {&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                &lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt; query &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;@"SELECT DISTINCT TO_LOWERCASE(cs-host) FROM {0}"&lt;/span&gt;, args[0]);&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;// Initialize a LogQuery object and use IISW3C input format&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                LogQuery logQuery &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; LogQuery();&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                LogRecordSet recordSet &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; logQuery.Execute(query, &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;new&lt;/span&gt; IISW3CInputFormat());&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                &lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;// Traverse the result set&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;for&lt;/span&gt; (; !recordSet.atEnd(); recordSet.moveNext())&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                {&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                    &lt;/span&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;span style="color: Green; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;// Get the current record&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                    LogRecord logRecord &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;=&lt;/span&gt; recordSet.getRecord();&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                    &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;if&lt;/span&gt; (!logRecord.isNull(0))&lt;/span&gt;&lt;br&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                        Console.WriteLine(logRecord.getValue(0).ToString());&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                }&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            }&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;catch&lt;/span&gt; (Exception ex)&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            {&lt;/span&gt;&lt;br&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;                Console.WriteLine(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;"ERROR: {0}"&lt;/span&gt;, ex.Message);&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;            }&lt;/span&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;        }&lt;/span&gt;&lt;br&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;    }&lt;/span&gt;&lt;br&gt;&lt;blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px; font-weight: normal;"&gt;}&lt;/span&gt;&lt;br&gt;&lt;p&gt;The above example is very simple for demo purpose. For a real world app I would suggest moving the common functionality of querying log files into a base class and delegating the result set processing to derived classes since each query is unique. The derived classes should also expose typed record sets that would be easier to work with.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/02/19/Using-LogParser-with-NET.aspx</link>
      <author>Ahmed</author>
      <comments>http://jazsolutions.net/post/2010/02/19/Using-LogParser-with-NET.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=0c936de6-c8b6-4b9c-94e3-50bd27a1e74e</guid>
      <pubDate>Fri, 19 Feb 2010 15:16:00 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>Ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=0c936de6-c8b6-4b9c-94e3-50bd27a1e74e</pingback:target>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=0c936de6-c8b6-4b9c-94e3-50bd27a1e74e</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/02/19/Using-LogParser-with-NET.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=0c936de6-c8b6-4b9c-94e3-50bd27a1e74e</wfw:commentRss>
    </item>
    <item>
      <title>SQL Short-Circuiting</title>
      <description>&lt;p&gt;Recently I worked on a performance issue of a search query in SQL Server involving quite a few parameters. After making some changes, one thing that I wasn’t too sure of was if the OR operator in SQL short-circuits similar to the &amp;amp;&amp;amp; or || operator in C# . After some googling it seems that there is no guarantee how a (SQL Server specific) query will be evaluated as discussed in this &lt;a href="http://weblogs.sqlteam.com/jeffs/archive/2008/02/22/sql-server-short-circuit.aspx" target="_blank"&gt;blog&lt;/a&gt;. And this obviously can have a significant impact on queries against large tables. Some additional thoughts on the issue can be found in the comments of this forum &lt;a href="http://stackoverflow.com/questions/789231/is-the-sql-where-clause-short-circuit-evaluated " target="_blank"&gt;post&lt;/a&gt; as well. I ended up using dynamic SQL, which wasn’t the most desirable approach but the simplest way to get around this issue.&lt;/p&gt;</description>
      <link>http://jazsolutions.net/post/2010/02/12/SQL-Short-Circuiting.aspx</link>
      <author>Ahmed</author>
      <comments>http://jazsolutions.net/post/2010/02/12/SQL-Short-Circuiting.aspx#comment</comments>
      <guid>http://jazsolutions.net/post.aspx?id=6e148f5f-ace7-4752-94bb-cf522ff16a9d</guid>
      <pubDate>Fri, 12 Feb 2010 03:12:55 -1200</pubDate>
      <category>Software</category>
      <dc:publisher>Ahmed</dc:publisher>
      <pingback:server>http://jazsolutions.net/pingback.axd</pingback:server>
      <pingback:target>http://jazsolutions.net/post.aspx?id=6e148f5f-ace7-4752-94bb-cf522ff16a9d</pingback:target>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://jazsolutions.net/trackback.axd?id=6e148f5f-ace7-4752-94bb-cf522ff16a9d</trackback:ping>
      <wfw:comment>http://jazsolutions.net/post/2010/02/12/SQL-Short-Circuiting.aspx#comment</wfw:comment>
      <wfw:commentRss>http://jazsolutions.net/syndication.axd?post=6e148f5f-ace7-4752-94bb-cf522ff16a9d</wfw:commentRss>
    </item>
  </channel>
</rss>

