Click here to Skip to main content
14,878,669 members

Articles by Andreas Gieriet (Articles: 8, Tip/Tricks: 23)

Articles: 8, Tip/Tricks: 23

RSS Feed

Average article rating: 4.73

DevOps
Unit Testing
Posted: 30 Jan 2012   Updated: 11 Mar 2012   Views: 18,050   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 137
Please Sign up or sign in to vote.
How to define RelationAssert as an extension to the VisualStudio Assert class.
General Programming
Posted: 28 Oct 2010   Updated: 29 Oct 2010   Views: 36,315   Rating: 3.64/5    Votes: 14   Popularity: 4.18
Licence: The Code Project Open License (CPOL)      Bookmarked: 10   Downloaded: 0
Please Sign up or sign in to vote.
Some useful RAII C# helper classes for functionality that does not implement IDisposable
Algorithms
Posted: 12 May 2012   Updated: 14 May 2012   Views: 46,433   Rating: 4.97/5    Votes: 18   Popularity: 6.12
Licence: The Code Project Open License (CPOL)      Bookmarked: 25   Downloaded: 0
Please Sign up or sign in to vote.
Make floating point equality and relation operators reliable based on a comparison epsilon value.
Posted: 20 Jun 2012   Updated: 20 Jun 2012   Views: 14,981   Rating: 5.00/5    Votes: 5   Popularity: 3.49
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Converting Postfix Expressions to Infix"
Posted: 26 Sep 2010   Updated: 26 Sep 2010   Views: 31,111   Rating: 4.45/5    Votes: 7   Popularity: 3.76
Licence: The Code Project Open License (CPOL)      Bookmarked: 13   Downloaded: 169
Please Sign up or sign in to vote.
.NET 4 finally allows to define polymorphic extension visitors
Programming Languages
C#
Posted: 22 Apr 2012   Updated: 21 Aug 2012   Views: 670,444   Rating: 4.89/5    Votes: 57   Popularity: 8.58
Licence: The Code Project Open License (CPOL)      Bookmarked: 89   Downloaded: 0
Please Sign up or sign in to vote.
Different possibilities to escape literals and names/keywords.
Posted: 27 Mar 2012   Updated: 14 Oct 2014   Views: 63,527   Rating: 4.95/5    Votes: 28   Popularity: 7.17
Licence: The MIT License      Bookmarked: 56   Downloaded: 243
Please Sign up or sign in to vote.
This is an alternative for "Dynamically generate a LINQ query with a custom property".
Posted: 26 Apr 2012   Updated: 26 Apr 2012   Views: 24,002   Rating: 4.94/5    Votes: 8   Popularity: 4.46
Licence: The Code Project Open License (CPOL)      Bookmarked: 15   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Mathematical Expression Parser Using Recursive Descent Parsing"

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.86

General Programming
Regular Expressions
Posted: 13 Feb 2012   Updated: 14 Feb 2012   Views: 18,411   Rating: 4.50/5    Votes: 4   Popularity: 2.71
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
A "single-liner" to decode quoted-printable data.
String
Posted: 24 Feb 2012   Updated: 24 Feb 2012   Views: 8,600   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
This alternative is not substantially different, it simply splits the function into two:one for clippingone for comparingpublic static string ExtClipRight(this string a, int n){ return (n < 0 || a.Length <= n) ? a : a.Substring(0, n);}...public static bool...
Posted: 18 Apr 2012   Updated: 18 Apr 2012   Views: 8,691   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "String.Insert - insert a separator on given positions"
Programming Languages
C#
Posted: 1 Jun 2012   Updated: 1 Jun 2012   Views: 16,822   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to split an array into multiple arrays"
Posted: 12 Jan 2013   Updated: 12 Jan 2013   Views: 14,800   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
Short tip to show a convenient use of the lesser known xor operator
Posted: 3 Apr 2012   Updated: 9 Apr 2012   Views: 71,104   Rating: 4.96/5    Votes: 17   Popularity: 6.11
Licence: The Code Project Open License (CPOL)      Bookmarked: 32   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to use the IEnumerable/IEnumerator interfaces"
Posted: 21 May 2012   Updated: 22 May 2012   Views: 29,330   Rating: 4.00/5    Votes: 3   Popularity: 1.91
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
How Linq extension methods benefit from interfaces inheriting from interfaces
Posted: 27 Jan 2013   Updated: 28 Jan 2013   Views: 20,013   Rating: 5.00/5    Votes: 3   Popularity: 2.39
Licence: The Code Project Open License (CPOL)      Bookmarked: 8   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Sorting using C# Lists"
Posted: 23 Apr 2012   Updated: 23 Apr 2012   Views: 12,232   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Converting InFix to PostFix using C#"
Posted: 18 Jun 2015   Updated: 18 Jun 2015   Views: 5,020   Rating: 4.75/5    Votes: 3   Popularity: 2.27
Licence: The Code Project Open License (CPOL)      Bookmarked: 5   Downloaded: 0
Please Sign up or sign in to vote.
A generic fluent implementation for a prioritized IComparer class
Posted: 26 Feb 2012   Updated: 28 Feb 2012   Views: 15,610   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Great analysis!I found out that Regex can be accelerated by a factor of about two.Instead of new Regex(@"\n", RegexOptions.Compiled|RegexOptions.Multiline);you can speed up by using:new Regex(@"^.*?$", RegexOptions.Compiled|RegexOptions.Multiline);But admittedly, nothing beats...
Posted: 21 Dec 2010   Updated: 21 Dec 2010   Views: 6,700   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
For those who like dense code, here is a sample :) - Make the dictionary static readonly, init directly- Swap the arguments in the lambda expressions and call by direct pop from the stack- Make the regex simpler and put the logic of parsing into the Exec (the regex only tokenizes the...
Posted: 13 Mar 2012   Updated: 15 Mar 2012   Views: 10,380   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Partial DateTime Object Equality"
Posted: 27 Dec 2010   Updated: 5 Jan 2011   Views: 15,315   Rating: 4.40/5    Votes: 4   Popularity: 2.65
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
This topic is also covered by the RAII topic as described in RAII (Resource Acquisition Is Initialization) C# Helper Classes[^].Applying the RAII pattern results in more expressive code:using (new RAIIGuard(()=>owner.Cursor, c=>owner.Cursor = c)){ owner.Cursor =...
Posted: 24 Feb 2012   Updated: 24 Feb 2012   Views: 11,200   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
I prefer the [Conditional("DEBUG")] attribute over #if DEBUG.This is especially advised for your logging example.E.g.[System.Diagnostics.Conditional("DEBUG")]private void Validate() { /* check instance integrity */ }or[System.Diagnostics.Conditional("DEBUG")]public static...
Posted: 14 Jun 2012   Updated: 14 Jun 2012   Views: 7,951   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "How to Toggle String Case in .NET"
Posted: 18 Apr 2012   Updated: 14 Apr 2013   Views: 51,654   Rating: 4.97/5    Votes: 13   Popularity: 5.54
Licence: The Code Project Open License (CPOL)      Bookmarked: 18   Downloaded: 0
Please Sign up or sign in to vote.
Make loops behave deterministic-by-construction
Posted: 20 Feb 2012   Updated: 20 Feb 2012   Views: 8,560   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
How about transforming first into a Regex and then letting the Regex do the work? E.g.:public static Regex GetRegex(string wildcard){ string pattern = Regex.Replace(wildcard, @"([^?*]+)?([?*])?", m => Regex.Escape(m.Groups[1].Value) +...
Posted: 11 Nov 2012   Updated: 11 Nov 2012   Views: 9,780   Rating: 5.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 4   Downloaded: 0
Please Sign up or sign in to vote.
XML Serialize versus hand crafted CoDec (as alternative to "Advance String Split and Joiner")
Posted: 30 Apr 2012   Updated: 4 Dec 2013   Views: 72,619   Rating: 4.83/5    Votes: 4   Popularity: 2.91
Licence: The Code Project Open License (CPOL)      Bookmarked: 8   Downloaded: 0
Please Sign up or sign in to vote.
Wrapping Interlocked.Exchange to mimic a thread safe one-shot bool flag
C# 4.0
Posted: 5 Jun 2012   Updated: 5 Jun 2012   Views: 13,722   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Sorting Strings based on the position of the block letter"
Posted: 24 Feb 2012   Updated: 25 Feb 2012   Views: 5,720   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
To not having spoiled the client code with #if DEBUG, you might use the following:[STAThread]static void Main(){ Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { Debugging.DebugSetupConsole(); ...
C++98
Posted: 7 Feb 2012   Updated: 12 Feb 2012   Views: 23,950   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 7   Downloaded: 0
Please Sign up or sign in to vote.
HTML page with all syntax/grammar productions of C++98/C++11
Visual Basic
Posted: 19 Jun 2012   Updated: 19 Jun 2012   Views: 8,670   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 3   Downloaded: 0
Please Sign up or sign in to vote.
This is an alternative for "Call Functions Until One Meets Condition"
Web Development
HTML
Posted: 15 Feb 2012   Updated: 15 Feb 2012   Views: 9,961   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 2   Downloaded: 0
Please Sign up or sign in to vote.
I think the following Regex and HtmlDecode would do:string html = ...;string textonly = HttpUtility.HtmlDecode( Regex.Replace(html, @"|", ""));Any HTML construct that would not be stripped off properly by this?

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.

Andreas Gieriet
Founder eXternSoft GmbH
Switzerland Switzerland
I feel comfortable on a variety of systems (UNIX, Windows, cross-compiled embedded systems, etc.) in a variety of languages, environments, and tools.
I have a particular affinity to computer language analysis, testing, as well as quality management.

More information about what I do for a living can be found at my LinkedIn Profile and on my company's web page (German only).