<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://orb-software.com/cs/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Green Dragon's Lair</title><link>http://orb-software.com/cs/blogs/greendragonslair/default.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2008 (Build: 30417.1769)</generator><item><title>The root cause for application performance problems might seem to be totally unrelated</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/05/24/the-root-cause-for-application-performance-problems-might-seem-to-be-totally-unrelated.aspx</link><pubDate>Sat, 24 May 2008 22:11:48 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:13</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=13</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=13</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/05/24/the-root-cause-for-application-performance-problems-might-seem-to-be-totally-unrelated.aspx#comments</comments><description>&lt;p&gt;I just read a post on &lt;a href="http://blogs.msdn.com/tess/default.aspx"&gt;If broken it is, fix it you should&lt;/a&gt;, where he&amp;#39;s &lt;a href="http://blogs.msdn.com/tess/archive/2008/05/14/asp-net-performance-issue-large-number-of-application-restarts-due-to-virus-scanning.aspx"&gt;debugging a performance problem in an ASP.Net application&lt;/a&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The most recent one was one where the ASP.NET site would respond slowly at regular intervals (read: it grinded to a halt every few hours).&amp;#160; &lt;/p&gt;    &lt;p&gt;&lt;strong&gt;First shot at gathering data:&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;We started off by getting a memory dump with &lt;a href="https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en"&gt;debug diag&lt;/a&gt; when the process was responding slowly.&amp;#160; Unfortunately at the time that the dump was taken no requests were executing (i.e. ~* e !clrstack showed no managed stacks and ~* kb showed all the threads in their idle states), so we didn&amp;#39;t get much of a clue as to why the process was responding so slowly.&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;It&amp;#39;s an interesting read, but the conclusion was even more surprising:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Why did the appdomain restart?&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;After adding logging per the &amp;quot;&lt;a href="http://blogs.msdn.com/tess/archive/2006/08/02/asp-net-case-study-lost-session-variables-and-appdomain-recycles.aspx"&gt;ASP.NET Case Study: Lost session variables and appdomain recycles&lt;/a&gt;&amp;quot; article the following showed up in the eventlog&lt;/p&gt;    &lt;pre&gt;_shutDownStack:    at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()
   at System.Web.Hosting.HostingEnvironment.InitiateShutdown()
   at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace)
   at System.Web.HttpRuntime.OnCriticalDirectoryChange(Object sender, FileChangeEvent e)
   at System.Web.FileChangesMonitor.OnCriticaldirChange(Object sender, FileChangeEvent e)
   at System.Web.DirectoryMonitor.FireNotifications()
   at System.Web.Util.WorkItem.CallCallbackWithAssert(WorkItemCallback callback)
   at System.Web.Util.WorkItem.OnQueueUserWorkItemCompletion(Object state)
   at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
_shutDownMessage: Change Notification for critical directories.
bin dir change or directory rename
HostingEnvironment initiated shutdown
HostingEnvironment caused shutdown
&lt;strong&gt;Change in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5fe0fce6\53087c60\hash\hash.web&lt;/strong&gt;&lt;/pre&gt;

  &lt;p&gt;The next step was to figure out who was touching the hash.web by monitoring the file with &lt;a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx?PHPSESSID=d926bdd849b5aab10f7263dd7f5904f2"&gt;process monitor&lt;/a&gt;, and It turned out, it was antivirus scanning the file, which in turn triggered the filechangesmonitor to recycle the appdomain.&lt;/p&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=13" width="1" height="1"&gt;</description></item><item><title>Playing with XNA - Part 1</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/05/02/playing-with-xna-part-1.aspx</link><pubDate>Fri, 02 May 2008 16:32:10 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:10</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=10</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=10</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/05/02/playing-with-xna-part-1.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve been playing with XNA a bit lately. Here&amp;#39;s what I&amp;#39;ve got so far. From what I&amp;#39;ve seen at the tutorials on the web, they don&amp;#39;t show to work with XNA in an OO way, so this sample might be useful to get a starting point. (I know about the XNA Creator Club, haven&amp;#39;t checked it out yet).&lt;/p&gt; &lt;p&gt;You&amp;#39;ll need the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=15fb9169-4a25-4dca-bf40-9c497568f102&amp;amp;displaylang=en"&gt;XNA Redistributable Framework 2.0&lt;/a&gt; for this to work.&lt;/p&gt; &lt;p&gt;In the sample, press E and Q to zoom out and in, W and S to move up and down and A and D to move right and left. Also press the right and left arrow keys to start the point field spinning around the Y axis.&lt;/p&gt; &lt;p&gt;You can grab the source with the binaries here : &lt;a href="http://orb-software.com/files/solarsystem.zip"&gt;Solar System&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;img src="http://orb-software.com/images/solarsystem1.gif" alt="" /&gt; &lt;/p&gt; &lt;p&gt;I plan on taking this and making it into a solar system simulation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=10" width="1" height="1"&gt;</description></item><item><title>Thinking about where I want to go</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/thinking-about-where-i-want-to-go.aspx</link><pubDate>Mon, 28 Apr 2008 20:07:47 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:9</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=9</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=9</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/thinking-about-where-i-want-to-go.aspx#comments</comments><description>Things have been pretty hectic at work lately, so I haven&amp;#39;t had much time to write here. Recently things have reached a plateu of some sort, so I&amp;#39;m coming home earlier and got some free time. I&amp;#39;m thinking about what do I want to do with that free time... right now I&amp;#39;m playing with XNA, toying with the idea of creating a solar system simulator, or at least that can play around with particles and gravity...&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=9" width="1" height="1"&gt;</description></item><item><title>Fixed Length Strings in Antlr</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/fixed-length-strings-in-antlr.aspx</link><pubDate>Mon, 28 Apr 2008 20:07:06 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:8</guid><dc:creator>admin</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=8</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=8</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/fixed-length-strings-in-antlr.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve been doing some work recently with Antlr parsing a syntax file from an ERP system that enables you to output changes you&amp;#39;ve done to one system and take them to another system.&lt;/p&gt; &lt;p&gt;The problem was that the syntax was simple enough to be parsed by simple string cutting, but it was complicated and ambiguous enough to make it a headache trying to build an entire framework around parsing it.&lt;/p&gt; &lt;p&gt;So I turned to Antlr... Thing is that Antlr is great in parsing all kinds of stuff, but when it comes to strings that are fixed length, it&amp;#39;s not so good, as there&amp;#39;s no native way to indicate in the lexer that you want a certain length of text, and no more than that, especially when the length of the text comes from previously found tokens, for example when you have something like this: &amp;quot;4test&amp;quot; where the 4 is the length of the text, and &amp;quot;test&amp;quot; is of course the text itself.&lt;/p&gt; &lt;p&gt;I did some googling and didn&amp;#39;t find a conclusive answer to this problem, so I wrote up a little bit of code which works fine for me, though you&amp;#39;d probably have to change it a bit to match your requirements.&lt;/p&gt; &lt;p&gt;In the lexer, you add the following token:&lt;/p&gt; &lt;p&gt;FIXEDLENGTHSTRING : length=INT {start = input.Mark();}&amp;nbsp; WS &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool failedToMatch = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int textLength = int.Parse( $length.Text );&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuilder sb = new StringBuilder();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (textLength &amp;gt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0 ; i &amp;lt; textLength ; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!failedToMatch)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; int currentChar = input.LA(1);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // must start with a capital letter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((i == 0) &amp;amp;&amp;amp; (currentChar &amp;lt; &amp;#39;A&amp;#39; || currentChar &amp;gt; &amp;#39;Z&amp;#39;))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; failedToMatch = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ((currentChar &amp;gt;= &amp;#39;A&amp;#39; &amp;amp;&amp;amp; currentChar &amp;lt;= &amp;#39;Z&amp;#39;) || (currentChar &amp;gt;= &amp;#39;a&amp;#39; &amp;amp;&amp;amp; currentChar &amp;lt;= &amp;#39;z&amp;#39;) || (currentChar == &amp;#39; &amp;#39;) || (currentChar &amp;gt;= &amp;#39;0&amp;#39; &amp;amp;&amp;amp; currentChar &amp;lt;= &amp;#39;9&amp;#39;))&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sb.Append((char)currentChar);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input.Consume();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; failedToMatch = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (failedToMatch)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input.Rewind(start);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $type = INT;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $text = sb.ToString();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input.Rewind(start);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $type = INT;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }; &lt;br /&gt;WS&amp;nbsp; :&amp;nbsp;&amp;nbsp; (&amp;#39; &amp;#39;|&amp;#39;\t&amp;#39;)+ ;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;INT :&amp;nbsp;&amp;nbsp; (&amp;#39;0&amp;#39;..&amp;#39;9&amp;#39;)+ ;&lt;/p&gt; &lt;p&gt;Here&amp;#39;s a quick overview. In my case, the format was &amp;lt;number&amp;gt; &amp;lt;space&amp;gt; &amp;lt;text&amp;gt;, so as you can see, I&amp;#39;ve defined the INT token as a sequence of numerics, and the WS token is a space or tab.&lt;/p&gt; &lt;p&gt;In my case, there were cases where it was ambiguous whether the upcoming text was indeed a fixed length string, or just happened to be a number and a space after it, so in some cases I&amp;#39;ve had to backtrack and declare that this was actually an INT token. &lt;/p&gt; &lt;p&gt;If you&amp;#39;ll look at the first line, you&amp;#39;ll see that I&amp;#39;ve marked the place in the input character stream after the INT token. When / if I have to rollback, I&amp;#39;ll be rolling it back to this spot, and claiming that it&amp;#39;s actually an INT, as well as restoring the characters that I might have consumed so that other tokens can have a go at it.&lt;/p&gt; &lt;p&gt;You can see the rollback toward the end of the code with Input.Rewind(start) and $type = INT;&lt;/p&gt; &lt;p&gt;Note that I&amp;#39;m capturing the text of the length token with &amp;quot;length=INT&amp;quot; and converting it to an integer later on while I&amp;#39;m still parsing the token itself.&lt;/p&gt; &lt;p&gt;The parts after that are just a simple loop that checks for some prerequisites to make sure that this is text is really what I want, and consuming the input with input.Consume() if it&amp;#39;s ok.&lt;/p&gt; &lt;p&gt;The trick comes in this line &amp;quot;$text = sb.ToString();&amp;quot;, this enables me later on in the parser to handle the FIXEDLENGTHSTRING token as a single entity, and get back just the text that I really want, so using it in the parser grammar becomes as simple as &amp;quot;firstEntityName=FIXEDLENGTHSTRING&amp;quot; and after that &amp;quot;{ currentNode.SubItems.Add(new LinkEntitiesUpdateDetail($firstEntityName.text,$firstEntityType.text,$secondEntityName.text,$secondEntityType.text,$secondEntityOrder.text)); }&amp;quot;&lt;/p&gt; &lt;p&gt;Footnotes:&lt;/p&gt; &lt;p&gt;1. This is relevant to Antlr 3.0&lt;/p&gt; &lt;p&gt;2. I&amp;#39;m referring to INT and WS as tokens, but since we&amp;#39;re inside the lexer, this isn&amp;#39;t accurate, they&amp;#39;re really just pieces of text at this point.&lt;/p&gt; &lt;p&gt;3. In Antlr, internal variables are defined with $variable, so writing $type would convert it to _type and $variable.text would convert it to variable.Text(). Those variable names may not have changed since Antlr 2.x, but using the $ format would make sure that if it does change, you&amp;#39;ll be safe. Also, there are quite a lot of code generation language targets for Antlr, so this enables you to copy and paste your grammar between targets.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=8" width="1" height="1"&gt;</description></item><item><title>Invalid attempt to MetaData when reader is closed - Solved</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/invalid-attempt-to-metadata-when-reader-is-closed-solved.aspx</link><pubDate>Mon, 28 Apr 2008 20:06:24 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:7</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=7</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=7</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/28/invalid-attempt-to-metadata-when-reader-is-closed-solved.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m working with NHibernate and ActiveRecord, and a few months ago I started getting InvalidOperationException - Invalid attempt to MetaData when reader is closed whenever I&amp;#39;d run queries inside a SessionScope.  &lt;p&gt;It took me a bit of time, but I finally resolved this problem down to statically initiallizing fields that access the database through AR, so if you have in your class something like this: &lt;br /&gt;public class X &lt;br /&gt;{ &lt;br /&gt;SomeEntity entity = Find(2); &lt;br /&gt;X() {...} &lt;br /&gt;} &lt;br /&gt;you&amp;#39;ll get the exception while loading it inside a session scope. &lt;br /&gt;The solution would be to move the initialization to a non-default constructor, something like this: &lt;br /&gt;public class X &lt;br /&gt;{ &lt;br /&gt;SomeEntity entity; &lt;br /&gt;X() {//do not initialize here } &lt;br /&gt;X(...) { entity = Find(2); } &lt;br /&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=7" width="1" height="1"&gt;</description></item><item><title>Done upgrading to CS 2008</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/25/done-upgrading-to-cs-2008.aspx</link><pubDate>Sat, 26 Apr 2008 07:07:59 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:2</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=2</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=2</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2008/04/25/done-upgrading-to-cs-2008.aspx#comments</comments><description>&lt;p&gt;Well, I&amp;#39;m finally done upgrading to CS 2008 (or rather, wiping everything and starting anew, since apparently I&amp;#39;ve had a version that was too old, and the upgrader was having troubles with). &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I&amp;#39;ll be importing some of the previous blog posts so you&amp;#39;ll be seeing some duplicates. Once I&amp;#39;m done with that, I&amp;#39;ll start posting the XNA stuff that I&amp;#39;m doing.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Also, note that there is a new &lt;a href="http://orb-software.com/cs/blogs/MainFeed.aspx"&gt;RSS feed&lt;/a&gt;, though the old one should also still work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=2" width="1" height="1"&gt;</description></item><item><title>Chasing down a FileNotFoundException with no filename</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2007/07/25/chasing-down-a-filenotfoundexception-with-no-filename.aspx</link><pubDate>Wed, 25 Jul 2007 22:03:41 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:6</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=6</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=6</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2007/07/25/chasing-down-a-filenotfoundexception-with-no-filename.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve spend 9 hours today after deploying the server side WCF service of our POS application chasing down the most bizzare exception I&amp;#39;ve ever seen. I got a FileNotFoundException that didn&amp;#39;t had a filename, and that gave me an HRESULT of 0x8007007E, which is really a COM error code, rather than a .Net error code.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;The biggest problem was that nothing I did gave me results of any kind: asp.net permissions, changing the virtual directory, enabling the Fusion log, uninstalling and reinstalling the .Net framework, nothing.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Eventually I managed to narrow it down after digging through google, turns out this error happens when .Net tries to resolve a reference to an unmanaged dll and fails. In my case it was the Sql Server Native Client, sqlncli.dll, which wasn&amp;#39;t installed on the server. I found it out by running &lt;a href="http://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx"&gt;FileMon&lt;/a&gt;, and almost immediatly seeing it search for sqlncli.dll and failing.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;I&amp;#39;ve seen several people on google trying to find a resolution to their variation of this problem, and most of them solved by guessing at the missing dll, so save yourself the time, when you get such an exception, start FileMon and check for the missing files.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=6" width="1" height="1"&gt;</description></item><item><title>Ambiguous Match Found exception and a recursive function</title><link>http://orb-software.com/cs/blogs/greendragonslair/archive/2007/07/06/ambiguous-match-found-exception-and-a-recursive-function.aspx</link><pubDate>Fri, 06 Jul 2007 21:34:17 GMT</pubDate><guid isPermaLink="false">8b790afd-b89f-4210-a7b4-2a08d0fa9c78:5</guid><dc:creator>admin</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/rsscomments.aspx?PostID=5</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://orb-software.com/cs/blogs/greendragonslair/commentapi.aspx?PostID=5</wfw:comment><comments>http://orb-software.com/cs/blogs/greendragonslair/archive/2007/07/06/ambiguous-match-found-exception-and-a-recursive-function.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;ve had the wildest goose chase this thursday hunting down a bug...&lt;/p&gt; &lt;p&gt;I&amp;#39;m using ActiveRecord, and was calling ActiveRecordStarter.Initialize, when I started getting an AmbiguousMatchFound from ActiveRecord. From the little that there was out there on this exception, it was supposed to be because of two classes having the same name and the runtime wasn&amp;#39;t able to distinguish between them, which is wierd in itself, as the compiler shouldn&amp;#39;t allow something like that to compile in the first place.&lt;/p&gt; &lt;p&gt;I&amp;#39;ve tried stuff like getting all the types in all the assemblies in the current appdomain to see if maybe I did had duplicate class names by mistake, but the only duplicates were from generic anonymous delegates and they were defined as internal classes in any case.&lt;/p&gt; &lt;p&gt;I&amp;#39;ve spent the entire day trying to figure out what changed, luckily I&amp;#39;m working with Vault, so I pulled yesterday&amp;#39;s daily build by CruiseControl.Net, and it didn&amp;#39;t exhibit the problem, so I knew it had to be something I did today.&lt;/p&gt; &lt;p&gt;The only real change I&amp;#39;ve done today was add new two ActiveRecord classes, so I took a closer look at them.&lt;/p&gt; &lt;p&gt;One of the classes was a CompositeKey for the other one, and when you have a composite key class in ActiveRecord, you must implement Equals and GetHashCode so the reference equality tests could check the key values rather than just the reference itself.&lt;/p&gt; &lt;p&gt;I noticed that the Equals function was indicated as recursive by Resharper (which implemented it for me in the first place), and that seemed odd to me... Resharper creates one overriding function with an object parameter and one function with the type of the key that is called from the overriding function after testing that the object passed is indeed of that type.&lt;/p&gt; &lt;p&gt;For some reason, the specific type function was missing, and therefore the general object function was calling itself. I don&amp;#39;t know what it caused inside ActiveRecord, but my guess is that during initialization, ActiveRecord uses the Equals function in some way, and that recursive call got it confused.&lt;/p&gt; &lt;p&gt;Once I&amp;#39;ve added the specific type function, everything was back to normal... after almost 8 hours of hair tearing...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://orb-software.com/cs/aggbug.aspx?PostID=5" width="1" height="1"&gt;</description></item></channel></rss>