Monthly Archives: November 2010

How to Calculate a Median in T-SQL

Expectantly, you’d assume that Microsoft had built in a function to calculate a median of a set of values. Expect less! Or, rather none. There is no built-in function in T-SQL to calculate a median. I do not know the … Read More »»»

Posted in MSSQL | Tagged , , , , , , , | Leave a comment

How to Get Distinct Values From a LINQ Query

Ever wondered how to get a distinct value set from a LINQ query? Maybe you got that query from a database: var q = dataSet.Tables[0].AsEnumerable(); Or maybe it’s a query on a LINQ query: var q = from oq in … Read More »»»

Posted in Basics | Tagged , , , , , , | Leave a comment

IIS 6 Problem With Not Showing Default.aspx as the Default Document

Have you ever hosted your .NET site on IIS? Both hosting your site on a Windows server and maintaining it in IIS is quite easy, considering both come from Microsoft. If you ever did, you know you can specify your … Read More »»»

Posted in IIS | Tagged , , , , , , , , | Leave a comment

Get a Culture-Specific Month Name or a Month Abbreviation

Many a time, you need your application to support multiple languages and thus formats of how things should be displayed. For instance, US uses month/day/year for the date, while Germany uses day.month.year and Russia uses day-month-year. Given that a user … Read More »»»

Posted in C# | Tagged , , , , , , , | 5 Comments

How to Easily Toggle a Bit Column in the Database

Surely at some point you had a bit field in the database that indicated a yes or a no or some other binary flag. In this post, I’m going to give you three examples of how to toggle that bit. … Read More »»»

Posted in MSSQL | Tagged , , , , | Leave a comment

I Have a Gmail Account, How Can I Show All Unread Emails But Only in My Inbox?

With the amount of emails that all of us are getting in our inboxes these days, sometimes we’d simply bulk mark the messages as read, filtering out the ones that we want to look at. Problem being, you do not … Read More »»»

Posted in Other | Tagged , , , , | Leave a comment

Standard OpenXML Cell Numbering Formats

When working with OpenXML documents, you can always specify a numbering format implicitly in the stylesheet and then set it on a desired cell or cells. If you choose to use those, your custom numbering formats are going to start … Read More »»»

Posted in Microsoft Excel | Tagged , , , , , , , , , | 1 Comment

How to Set Up WordPress Pretty Permalinks in IIS6

WordPress supports pretty permalinks, which are user-friendly URLs for your posts, pages, tags, etc. They work perfectly fine if you have your WordPress installation running on Apache web server and are being processed by an Apache add-on module called mod_rewrite. … Read More »»»

Posted in WordPress | Tagged , , , , , , , , , , | Leave a comment

How to Concatenate Column Values Using T-SQL

Sometimes you would want to concatenate column values in T-SQL and there are different ways to achieve that. Consider the two tables below: +——–+—————+ | MakeId | Name | +——–+—————+ | 1 | BMW | | 2 | Mercedes-Benz | … Read More »»»

Posted in MSSQL | Tagged , , , , , , , , | 1 Comment

What is the Difference Between Left, Right and Full Outer Join?

Joining tables is fun but you’ve got to know which of them outer joins to use, too. Hell, why is it called outer joins anyways?! Consider, simply, two tables, L and R (am I being original yet? :)). Now, let’s … Read More »»»

Posted in MSSQL | Tagged , , , , , , , | Leave a comment