0

Random number of items from a Generic List extension method

Posted by Tim on June 13, 2010 in .NET Framework, C#

Here is a code snippet  for returning N number of items from a generic list using a extension method.  This requires .NET 3.5. public static class Extensions     {         /// <summary>         /// method for returning N number of random items from a generic list     [...]

Tags: ,

 
0

Could not load file or assembly ‘NameOfAssemblyGoesHere’

Posted by Tim on June 11, 2010 in .NET Framework, ASP.NET

Encounted the following error: Could not load file or assembly ‘NameOfAssemblyGoesHere’ or one of its dependencies. An attempt was made to load a program with an incorrect format. The problem happened when deploying a web application to a 64bit server where all the required DLL’s where marked as running only on a 32bit system.   You [...]

Tags: ,

 
0

Change username in ASP.NET Membership Provider

Posted by Tim on May 31, 2010 in .NET Framework, ASP.NET

Found a great article here about the process of changing the username with the ASP.NET Membership Provider. Here is a summary of the process that I found best useful which is one of the comments: 1. Make sure New UserName is Unique 2. Update the aspnet_Users table directly 3. Execute to following code to change [...]

Tags: ,

 
0

IIS Wont start error 13 data is invalid

Posted by Tim on May 26, 2010 in .NET Framework, Windows Server

I got the following error when trying to figure out why I couldn’t start IIS 7 on Windows Server 2008 R2.    I tried to start the World Wide Web Publishing Service but its dependency Windows Activation Service wouldn’t start.   I got the following error in the Event Log: The Windows Process Activation Service service terminated [...]

Tags: ,

 
0

A way around page refreshes/back button problems with a simple concept

Posted by Tim on May 17, 2010 in .NET Framework, ASP.NET, News, Open Source, Uncategorized

The problem: You have a form in which the user fills out and clicks a “submit” button that validates their input, does some processing and output’s some results. The problem being the application needs to cater for page refreshes, back buttons and the case of the page being submitted more than once (latency/slow internet connection). [...]

Tags: , ,

 
0

Search any major auction site in NZ

Posted by Tim on April 1, 2010 in .NET Framework, News

Checkout http://www.auctionsearch.co.nz/ You can search for listings with TradeMe, Zillion and Sella all from the one site, very useful tool for looking for bargins across several systems.   A very good example of using the .NET (C#)  framework.

Tags:

 
0

Could not write lines to file xxx.FileListAttribute.txt Access Denied

Posted by Tim on January 25, 2010 in .NET Framework

Using Visual Studio Team System Edition, you may come across this error when trying to build a solution “Could not write lines to file xxx.FileListAttribute.txt.  Access is denied.” Simple solution..delete the files from the obj directory, reload your solution and attempt to build. Rember: Dont add obj/bin folders to your source safe, and these change [...]

Tags: ,

 
1

The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error

Posted by Tim on January 18, 2010 in .NET Framework, C#

I kept getting this error “The custom tool ‘MSLinqToSQLGenerator’ failed.  Unspecified error.   For me, this was caused when I was using partial classes and had several using statements at the top of the file: using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Linq.Expressions; using System.ComponentModel; using System; {namespace} {code} To [...]

Tags: , ,

 
0

Match Whole Words Regular Expressions

Posted by Tim on January 12, 2010 in .NET Framework, Visual Basic

Example: Dim regExp As New Regex(String.Format(“\b{0}\b”, keyword), RegexOptions.IgnoreCase) This is the same as doing the following: note.note_content.StartsWith(InputKeyword &amp; " ") OR _ note.note_content.EndsWith(" " &amp; InputKeyword) OR _ note.note_content.Contains(" " &amp; InputKeyword &amp; " ") References: http://answers.oreilly.com/topic/217-how-to-match-whole-words-with-a-regular-expression/ http://stackoverflow.com/questions/810078/search-for-whole-word-with-linq-to-sql

Tags:

 
0

Unable to cast object of type ‘ Issue

Posted by Tim on December 22, 2009 in .NET Framework, Visual Basic

I came across this error: System.InvalidCastException: Unable to cast object of type ‘<TakeIterator>d__3a`1[Class]‘ to type ‘System.Collections.Generic.List`1[Class]‘. This occured when trying to use the Take extension (list.Take(n)) from a generic list of objects.   The problem is when you use the Take extension, it returns a new sequence ( IEnumerable). I got around this issue by using: [...]

Tags: ,

Copyright © 2008-2012 Codelab Blog All rights reserved.
Desk Mess Mirrored version 1.9.1 theme from BuyNowShop.com.