Click here to Skip to main content

Articles by Andrew Rissing (Articles: 3, Tip/Tricks: 25)

Articles: 3, Tip/Tricks: 25

RSS Feed

Average article rating: 4.96

Database
Utilities
Posted: 19 Sep 2005   Updated: 16 Jul 2012   Views: 871,102   Rating: 4.94/5    Votes: 80   Popularity: 9.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 279   Downloaded: 21,311
GenericParser is a C# implementation of a parser for delimited and fixed width format files.
DirectX
General
Posted: 17 Feb 2009   Updated: 3 Mar 2009   Views: 27,655   Rating: 4.95/5    Votes: 17   Popularity: 6.08
Licence: The Code Project Open License (CPOL)      Bookmarked: 24   Downloaded: 1,006
An application for visualizing common dendrimer models
C#
General
Posted: 8 Sep 2012   Updated: 10 Oct 2012   Views: 14,107   Rating: 5.00/5    Votes: 18   Popularity: 6.28
Licence: The Code Project Open License (CPOL)      Bookmarked: 44   Downloaded: 424
An intuitive-fluent API for generating Linq Expressions.
No blogs have been submitted.

Average tips rating: 4.77

Database
General
Posted: 3 Jul 2010   Updated: 3 Jul 2010   Views: 4,744   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Using the pattern that Microsoft SQL Server Management Studio creates, it would be something along the lines of:IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[com_CountString]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))DROP FUNCTION...
General Graphics
General
Posted: 20 Feb 2011   Updated: 20 Feb 2011   Views: 4,131   Rating: 4.92/5    Votes: 4   Popularity: 2.86
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Just a few minor improvements to readability and such...The catch/throw isn't needed here, since you are just throwing it without doing anything in the catch block. A try/finally could have been used on its own.The try/finally isn't necessary because a using statement can achieve the same...
C#
Delegates and Events
Posted: 25 Jul 2012   Updated: 25 Jul 2012   Views: 4,732   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
This is an alternative for "Ad-Hoc Expression Evaluation"
General
Posted: 8 Mar 2011   Updated: 16 Mar 2011   Views: 17,672   Rating: 4.81/5    Votes: 11   Popularity: 5.01
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
How to sort a two-dimensional array in C#
Posted: 25 Jan 2012   Updated: 26 Jan 2012   Views: 5,152   Rating: 4.67/5    Votes: 4   Popularity: 2.41
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Using expressions, you can achieve a faster result with less code.public static T New(){ Type t = typeof(T); Func method = Expression.Lambda>(Expression.Block(t, new Expression[] { Expression.New(t) })).Compile(); return method();}Furthermore, this can...
.NET Framework
General
Posted: 11 Oct 2011   Updated: 12 Oct 2011   Views: 3,510   Rating: 3.48/5    Votes: 7   Popularity: 2.15
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
I was actually going to suggest a simpler version of cechode's version, but along the same lines.public static IEnumerable Randomize(this IEnumerable source){ Random r = new Random(); return source.Select(x => new { Key = r.Next(), Value = x }) .OrderBy(x => x.Key) ...
Algorithms & Recipes
General
Posted: 11 May 2011   Updated: 11 May 2011   Views: 3,203   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
Three improvement ideas:-Add check to ensure the enum is a [Flags] enum.-Make the method generic and static with the enum type generic. I don't know how common it would be to have the type already on hand. It makes it simpler to use.-Iterate over all of the values and bit-wise or them...
Math
Posted: 13 Dec 2012   Updated: 17 Dec 2012   Views: 9,796   Rating: 4.00/5    Votes: 5   Popularity: 3.15
Licence: The Code Project Open License (CPOL)      Bookmarked: 8   Downloaded: 0
A method for calculating a Fibonacci number without using loops or recursion.
Exception Handling
General
Posted: 9 Apr 2011   Updated: 9 Apr 2011   Views: 3,974   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
I would actually go the route getting those developers to follow good practice. As a whole, the field would be better off if developers like that were mentored rather than something like this.So, I would recommend using either of the techniques you put forth originally (using the Data...
Programming Tips
General
Posted: 27 May 2010   Updated: 27 May 2010   Views: 8,258   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
A tip to overcome limitations in Blend 3 and Blend 4 RC when dealing with attached dependency properties.
Posted: 18 Jun 2010   Updated: 18 Jun 2010   Views: 7,553   Rating: 4.75/5    Votes: 6   Popularity: 3.78
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Or even...if (frm.ShowDialog() == true){ // do something here}
Posted: 26 Oct 2010   Updated: 27 Oct 2010   Views: 5,208   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Technically, the best approach here for speed and flexibility is to do the following:public class TestClass{ private const string EMP_ID = "EmpId"; public void MyTestMethod() { //GetData fetches data from the database using a SQL query DataTable dt =...
Posted: 30 Nov 2010   Updated: 30 Nov 2010   Views: 2,764   Rating: 4.92/5    Votes: 6   Popularity: 3.74
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
You might want to do some further testing... It seems if you perform the following, the values are actually the same:SET NOCOUNT ONDECLARE @TMP TABLE( EmpName VARCHAR(50), Age INT)PRINT CONVERT(VARCHAR, GETDATE(), 121)INSERT INTO @TMP(EmpName, Age)SELECT 'Ravi Kiran',...
Posted: 1 Dec 2010   Updated: 1 Dec 2010   Views: 3,015   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
I'd recommend a minor tweak to your code to remove the 'magic' string of the mimeType from the code, using the following:static void Main(string[] args){ Bitmap bitMap = new Bitmap(@"test.bmp"); var codecInfo = GetEncoderInfo(ImageFormat.Gif); var paramsEncoder = new...
Posted: 14 Jan 2011   Updated: 14 Jan 2011   Views: 5,019   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Not really that big of a change, but I'd go with an XPath solution. It locates all of the "magic strings" into one spot.var nodes = from element in XElement.Load("Books.xml").XPathSelectElements("/Books/Book/Subject") select new { Value =...
Posted: 10 Feb 2011   Updated: 10 Feb 2011   Views: 3,672   Rating: 4.75/5    Votes: 11   Popularity: 5.15
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Always review all changes before submitting them. Especially, if using a global find and replace.
Posted: 13 Feb 2011   Updated: 14 Feb 2011   Views: 3,948   Rating: 4.75/5    Votes: 8   Popularity: 4.06
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
The following samples should take advantage of using statements and furthermore built in features of the ADO.NET framework. Furthermore, if you open a connection, make sure you open it at the latest time possible and close it as soon as possible.Edit: While I was originally not trying to...
Posted: 31 Mar 2011   Updated: 2 Apr 2011   Views: 7,379   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
How to get that last little nagging line to be covered...
Posted: 22 Jun 2011   Updated: 22 Jun 2011   Views: 8,679   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
A simple trick to remove the delay of Thread.Sleep for unit testing.
Posted: 4 Oct 2011   Updated: 18 Oct 2011   Views: 5,223   Rating: 5.00/5    Votes: 8   Popularity: 4.52
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Or you could just go the other direction and cache the known results ahead of time. You're only looking at 13 numbers in all, so it is not a big memory hog to just store those known values inside of the method and be done with it.static uint Factorial(uint x){ if (x > 12) throw...
Posted: 27 Oct 2011   Updated: 28 Oct 2011   Views: 4,141   Rating: 4.68/5    Votes: 6   Popularity: 3.47
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
I would have actually opted to remove the start index being passed in. Then, you can spruce up the calls with extension methods (albeit not necessary).Usage:removeList.AddRange(html.ToString().GetBetween("");Code:public static class StringUtilities{ ///...
Posted: 5 Dec 2011   Updated: 5 Dec 2011   Views: 2,803   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Or you could just do the following without using System.Management:foreach (var driveInfo in DriveInfo.GetDrives().Where(x => x.DriveType == DriveType.CDRom)){ if (driveInfo.IsReady) Console.WriteLine("CD is ready in drive: " + driveInfo.Name); else Console.WriteLine("CD...
Posted: 5 Jan 2012   Updated: 12 Jan 2012   Views: 7,750   Rating: 4.73/5    Votes: 8   Popularity: 4.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
After describing it so much, I felt the need to go ahead and implement it. So here goes...using System;using System.Collections.Generic;using System.ComponentModel;using System.Linq.Expressions;using System.Reflection;namespace DefaultValue{ /// /// The...
String handling
General
Posted: 31 Aug 2012   Updated: 31 Aug 2012   Views: 4,225   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
A function to generate an endless collection of scrolling text for your use/amusement.
Uncategorised Tips and Tricks
General
Posted: 11 Aug 2011   Updated: 12 Aug 2011   Views: 8,842   Rating: 4.89/5    Votes: 2   Popularity: 1.20
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Using an attached behavior to expose the value of a DataContext for Automation
No reference articles have been posted.

Andrew Rissing
Software Developer (Senior)
United States United States
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.
 
So..If you're not moving forward, you're moving backwards.


Advertise | Privacy | Mobile
Web01 | 2.8.150305.1 | Last Updated 6 Mar 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid