﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>tobi commented on Solving an OutOfMemoryException</title><description>And I want to add that this is a nice candidate to be unit-tested with Microsoft Pex. Testing for all relevant inputs that this code does not crash (at the very least) would be an excercise of 2 minutes with pex.
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment8</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment8</guid><pubDate>Fri, 07 Jan 2011 21:27:32 GMT</pubDate></item><item><title>tobi commented on Solving an OutOfMemoryException</title><description>Interesting and for many unexpected is the fact that you can actually manually implement what a regex does. It is like building a compiler: Many think it is nearly impossible without a phd but the ones who have actually done it know that it is not brain surgery.
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment7</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment7</guid><pubDate>Fri, 07 Jan 2011 21:26:24 GMT</pubDate></item><item><title>Paulo Morgado commented on Solving an OutOfMemoryException</title><description>On a similiar situation, I've used a regular expression and a match evaluator to do the replacing.
  
  
My expression looks for patterns that are a reference to a tree (a dictionary of dictionaries) and replaces the references with its values.
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment6</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment6</guid><pubDate>Thu, 06 Jan 2011 11:24:21 GMT</pubDate></item><item><title>bob commented on Solving an OutOfMemoryException</title><description>&gt;At any rate, this code is much more complicated
  
  
nice comments in the code too
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment5</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment5</guid><pubDate>Thu, 06 Jan 2011 02:36:01 GMT</pubDate></item><item><title>configurator commented on Solving an OutOfMemoryException</title><description>Why do you need to check that values aren't being followed by a digit?
  
Is the problem if you've got a parameter @a1 and another parameter @a10? Because then @a10 would be replaced first anyway.
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment4</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment4</guid><pubDate>Thu, 06 Jan 2011 00:56:19 GMT</pubDate></item><item><title>Erik Juhlin commented on Solving an OutOfMemoryException</title><description>Another nice thing with Tobi's suggestion is that you won't get "double replaces". E.g. if the value of @a contains '...@b...', @b shouldn't be replaced and won't be with Tobi's way...
  
  
Tobi, [\w\d_] can be \w instead. \w includes both digits and underscore...
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment3</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment3</guid><pubDate>Wed, 05 Jan 2011 21:58:10 GMT</pubDate></item><item><title>Ayende Rahien commented on Solving an OutOfMemoryException</title><description>Tobi,
  
This is a nice one :-)
</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment2</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment2</guid><pubDate>Wed, 05 Jan 2011 15:35:25 GMT</pubDate></item><item><title>tobi commented on Solving an OutOfMemoryException</title><description>You could use Regex.Replace on the pattern @"@(?
&lt;paramname[\w\d_]{1,128})(?!\d|_)" and in the match handler you figure out which parameter was matched. That would do a single scan over the string.
&gt;</description><link>http://ayende.com/4742/solving-an-outofmemoryexception#comment1</link><guid>http://ayende.com/4742/solving-an-outofmemoryexception#comment1</guid><pubDate>Wed, 05 Jan 2011 15:19:43 GMT</pubDate></item></channel></rss>