Archive for '.NET Programming' Category
LINQ, SqlMetal, Nesting The Generated Code File
7 July 2008LINQ is really cool, SqlMetal has been my code generator of choice (for a book on LINQ, SqlMetal and all of the cool new features)… I like to keep my class file names the same as the class contained in the file. Since SqlMetal generates partial classes, and we don’t want to modify the generated [...]
Excel ODBC Driver for Windows Server 2008 (64 Bit)
10 June 2008So I’m running Windows Server 2008 as a development workstation. I ran into some trouble with a custom .NET application that imports data from Excel files using the ODBC driver.
Error Message in .NET
ERROR [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified
We are using this ODBC connection string (found [...]
HowTo Filter System.IO.Directory.GetFiles with Linq
30 May 2008Here we are going to see an easy way to enumerate files in a directory, filter the files with Linq, then bind the results to a ASP.NET repeater control. We will show you the old .NET 1x way of doing this, then the new and improved Linq way of doing this.
I had a method that [...]
.NET 2.0 Generic Collections to 1.0 and 1.1 Collections
22 October 2007I am always looking around for the Generic equivalents for the non-generic collections. Especially when converting 1.1 code over to 2.0
.comptable td
{
border-bottom: 1px solid #008000;
background-color: #ebf7ff;
}
.comptable .name
{
background-color: #a8cece;
}
Table of Generic Collections to Non-Generic Collections
Non-Generic (1.x)
Generic Replacements (2.0+)
ArrayList
List<T>
CollectionBase
Collection<T>
Comparer
Comparer<T>
CompatibleComparer
Comparer<T>
DictionaryBase
KeyedCollection<TKey,TItem>
Hashtable
Dictionary<TKey,TValue>
ICollection
ICollection<T>
IDictionary
IDictionary<TKey,TValue>
IList
IList<T>
Queue
Queue<T>
ReadOnlyCollectionBase
ReadOnlyCollection<T>
SortedList
SortedList<TKey, TValue>
Stack
Stack<T>
Performance
List<T> : a List<T> uses an underlying array that maintains order, thus inserting and removing from this object [...]
HOWTO obtain the ClickOnce Version at runtime
7 May 2007This article will show you how to get the ClickOnce Version at runtime of you .NET application. My examples are in VB.NET and C# but the same technique would work for any other .NET Assembly.
First you need to add a project reference to System.Deployment
Next import the namespace into your class
VB.NET
Imports System.Deployment
C#
using System.Deployment;
You can obtain the [...]
Publishing a .NET ClickOnce Application to a linux Apache Server
10 December 2006You might think that you can only publish a ClickOnce application to a IIS server. This is in fact not the case, you CAN publish a ClickOnce application to a apache web server either running on Linux or Windows. In fact its pretty simple.
Configure your apache publish directory for ClickOnce applications
At the root directory of [...]
Getting the First and Last day of the month with .NET C#
3 October 2006Ok so now you know how to get the last day of the month with SQL, but how can you get the first day or the last day of the month given a specific date? That problem is so simple with dot net and csharp! There is a convenience constructor for the DateTime object that [...]
C# method to mimic PHP file_get_contents
14 July 2006If your looking for an easy method to get text file contents that will work for System files (using System.IO), and network files (either http or ftp) via a URL (using System.Net.WebClient). This method works just like the PHP method file_get_contents
Converting Julian Date to .NET DateTime
18 February 2006Want to convert a Julian Date to a .NET DateTime? Heres an easy (C#) way to do that
///<summary>
/// Will Convert a 7 digit Julian Date to a .NET DateTime.
/// 7 digit Julian dates are common in some legacy applications
/// such as JDE World, OneWorld, EnterpriseOne. You can easily make this
/// convert 8 digit julians (more [...]
Instant Messengers with Translation built in
23 May 2005Wouldn’t it be great to have Instant Messengers with built-in translation?
This question kept me up all night last night. So this morning I decided to look for a messenger or utility to do this. Guess what I came up with nothing.
I was thinking why is that? Is it because the majority of people using [...]
