Click here to Skip to main content
15,892,537 members

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

Articles: 3, Tip/Tricks: 25

RSS Feed

Average article rating: 4.91

Desktop Programming
Windows Forms
17 Feb 2009   Updated: 3 Mar 2009   Rating: 4.81/5    Votes: 18   Popularity: 5.92
Licence: CPOL    Views: 53,759     Bookmarked: 24   Downloaded: 1,226
Please Sign up or sign in to vote.
An application for visualizing common dendrimer models
Programming Languages
C#
19 Sep 2005   Updated: 2 Aug 2017   Rating: 4.93/5    Votes: 108   Popularity: 9.94
Licence: MIT    Views: 2,226,002     Bookmarked: 356   Downloaded: 39,583
Please Sign up or sign in to vote.
GenericParser is a C# implementation of a parser for delimited and fixed width format files.
C# 4.0
8 Sep 2012   Updated: 10 Oct 2012   Rating: 5.00/5    Votes: 19   Popularity: 6.39
Licence: CPOL    Views: 40,284     Bookmarked: 47   Downloaded: 510
Please Sign up or sign in to vote.
An intuitive-fluent API for generating Linq Expressions.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.79

Database Development
SQL Server
30 Nov 2010   Updated: 30 Nov 2010   Rating: 4.92/5    Votes: 6   Popularity: 3.83
Licence: CPOL    Views: 9,120     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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',...
Desktop Programming
Windows Forms
20 Feb 2011   Updated: 20 Feb 2011   Rating: 4.92/5    Votes: 4   Popularity: 2.96
Licence: CPOL    Views: 16,092     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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...
WPF
18 Jun 2010   Updated: 18 Jun 2010   Rating: 4.75/5    Votes: 6   Popularity: 3.70
Licence: CPOL    Views: 16,650     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Or even...if (frm.ShowDialog() == true){ // do something here}
DevOps
Testing
22 Jun 2011   Updated: 22 Jun 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 19,144     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
A simple trick to remove the delay of Thread.Sleep for unit testing.
11 Aug 2011   Updated: 12 Aug 2011   Rating: 4.89/5    Votes: 2   Popularity: 1.47
Licence: CPOL    Views: 15,030     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
Using an attached behavior to expose the value of a DataContext for Automation
Expression blend
27 May 2010   Updated: 27 May 2010   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 16,940     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
A tip to overcome limitations in Blend 3 and Blend 4 RC when dealing with attached dependency properties.
General Programming
Performance
26 Oct 2010   Updated: 27 Oct 2010   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 13,650     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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 =...
Sorting
8 Mar 2011   Updated: 16 Mar 2011   Rating: 4.96/5    Votes: 12   Popularity: 5.17
Licence: CPOL    Views: 79,294     Bookmarked: 9   Downloaded: 0
Please Sign up or sign in to vote.
How to sort a two-dimensional array in C#
Programming Languages
C#
25 Jan 2012   Updated: 26 Jan 2012   Rating: 4.67/5    Votes: 4   Popularity: 2.81
Licence: CPOL    Views: 18,981     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
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...
11 Oct 2011   Updated: 12 Oct 2011   Rating: 3.48/5    Votes: 7   Popularity: 2.94
Licence: CPOL    Views: 15,881     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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) ...
11 May 2011   Updated: 11 May 2011   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 12,290     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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...
13 Dec 2012   Updated: 17 Dec 2012   Rating: 4.00/5    Votes: 5   Popularity: 2.80
Licence: CPOL    Views: 33,737     Bookmarked: 9   Downloaded: 0
Please Sign up or sign in to vote.
A method for calculating a Fibonacci number without using loops or recursion.
9 Apr 2011   Updated: 9 Apr 2011   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 12,120     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
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...
1 Dec 2010   Updated: 1 Dec 2010   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: CPOL    Views: 9,551     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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...
14 Jan 2011   Updated: 14 Jan 2011   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 9,850     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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 =...
31 Mar 2011   Updated: 2 Apr 2011   Rating: 5.00/5    Votes: 7   Popularity: 4.23
Licence: CPOL    Views: 16,130     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
How to get that last little nagging line to be covered...
4 Oct 2011   Updated: 18 Oct 2011   Rating: 5.00/5    Votes: 8   Popularity: 4.52
Licence: CPOL    Views: 22,436     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
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...
5 Dec 2011   Updated: 5 Dec 2011   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: CPOL    Views: 8,020     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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...
5 Jan 2012   Updated: 12 Jan 2012   Rating: 4.73/5    Votes: 8   Popularity: 4.27
Licence: CPOL    Views: 29,810     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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...
C# 4.0
25 Jul 2012   Updated: 25 Jul 2012   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 10,321     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Ad-Hoc Expression Evaluation"
31 Aug 2012   Updated: 31 Aug 2012   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 11,450     Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
A function to generate an endless collection of scrolling text for your use/amusement.
C++
10 Feb 2011   Updated: 10 Feb 2011   Rating: 4.95/5    Votes: 11   Popularity: 4.95
Licence: CPOL    Views: 13,970     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
Always review all changes before submitting them. Especially, if using a global find and replace.
SQL
3 Jul 2010   Updated: 3 Jul 2010   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: CPOL    Views: 17,040     Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
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...
Visual Basic
13 Feb 2011   Updated: 14 Feb 2011   Rating: 4.76/5    Votes: 9   Popularity: 4.55
Licence: CPOL    Views: 16,760     Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
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...
Web Development
HTML
27 Oct 2011   Updated: 28 Oct 2011   Rating: 4.68/5    Votes: 6   Popularity: 3.65
Licence: CPOL    Views: 17,620     Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
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{ ///...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Architect
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.