<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.atalasoft.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>Steve's Tech Talk</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/default.aspx</link><description>Ruminations on technology, software and philosophy.
</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Generic Fiddling</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx</link><pubDate>Fri, 08 Aug 2008 12:34:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15189</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>3</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15189.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15189</wfw:commentRss><description>
&lt;p&gt;I spent an hour yesterday playing with generics to get my chops up a little better.&amp;nbsp; After reading &lt;a href="http://blogs.msdn.com/kcwalina/archive/2005/03/15/396086.aspx"&gt;Krzystof Cwalina's post&lt;/a&gt; on the layout of the generic collections, I came up with this little gem:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;public class UniqueCollection&amp;lt;T&amp;gt; : Collection&amp;lt;T&amp;gt;&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void InsertItem(int index, T item)&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; if (Contains(item))&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; throw new ArgumentException("collection already contains item", "item");&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; base.InsertItem(index, item);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected override void SetItem(int index, T item)&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; T itemAtIndex = this[index];&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; Count; i++)&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; if (i == index)&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; continue;&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 (itemAtIndex.Equals(this[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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentException("collection already contains item", "item");&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; base.SetItem(index, item);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is the basis of a simple collection that ensures that all elements (that implement Equals) are unique.&amp;nbsp; At this point you can derive classes from this:&lt;/p&gt;&lt;p&gt;public class UniqueStringCollection :&amp;nbsp; UniqueCollection&amp;lt;string&amp;gt; { }&lt;/p&gt;&lt;p&gt;Note that this implementation is not performant for large collections - there are better ways to guarantee uniqueness, but those depend on the problem domain.&amp;nbsp;&lt;/p&gt;&lt;p&gt;Enjoy.&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;;subject=Generic+Fiddling" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;;title=Generic+Fiddling" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;title=Generic+Fiddling" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;;title=Generic+Fiddling" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx&amp;amp;;title=Generic+Fiddling&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/08/generic-fiddling.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15189" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/C_2300_+generics+collection+programming/default.aspx">C# generics collection programming</category></item><item><title>Multilingual OCR</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx</link><pubDate>Tue, 05 Aug 2008 12:25:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15165</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15165.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15165</wfw:commentRss><description>&lt;p&gt;I frequently look back at the code I've designed with an eye toward improvement.&amp;nbsp; Is it all that it can be?&amp;nbsp; Does it do what it says with few surprises?&amp;nbsp; Is it appropriately extensible?&lt;/p&gt;&lt;p&gt;Today, I'll look at the Atalasoft OcrEngine object.&amp;nbsp; This was my first big project at Atalasoft.&amp;nbsp; I designed it and built it to be interfaced as flexibly as possible with any arbitrary OCR engine, and to that end it has worked well.&amp;nbsp; We have gotten prototype or production engines running with seven different OCR engines.&amp;nbsp; That's seven completely different engines with different needs all running under one uniform interface.&amp;nbsp; I'm proud of that - it was no mean feat.&lt;/p&gt;&lt;p&gt;The hardest part, however, is starting the actual engines.&amp;nbsp; Each has different needs in terms of loading/locating DLLs or COM objects or finding resources.&amp;nbsp; That part is pretty painful and sadly that pain gets transferred to our customers.&amp;nbsp; Worse still, I can't really make it much better since those needs are out of my control.&amp;nbsp; When OEM engine manufacturers ask for API feedback, I usually want changes in loading/unloading or licensing.&amp;nbsp; None have made those changes (and why should they?).&lt;/p&gt;&lt;p&gt;Another problem has to do with how the engines express what languages they can recognize.&amp;nbsp; Here's the issue - for any language, there are at least three different dimensions that determine how to recognize it: the alphabet, the lexical structure, and the syntactic structure.&amp;nbsp; It looks like you should be able to bind that up into one neat package (eg, 'English' or 'Portuguese') but does that cover the differences between Brazilian Portuguese or Portuguese spoken in Portugal?&amp;nbsp; What about languages that are written in both Cyrillic and Latin alphabets?&amp;nbsp; What about dialects like Creole or Pidgin Languages?&lt;/p&gt;&lt;p&gt;In the name of expedience and keeping the .NET flavor as much as possible, I chose to use the class CultureInfo to represent the language(s) that an OCR engine can recognize.&amp;nbsp; It covers most of the ground necessary in that it can distinguish between locale-based differences in cultures that share the same language: Arabic-Egyptian is different from Arabic-Jordan.&amp;nbsp; The problem is that many OCR engines have feature creep in their published languages.&amp;nbsp; For example, I know three engines that publish that they recognize Wolof.&amp;nbsp; I won't diminish the language - 7 million people speak it - but I haven't found a way to construct a CultureInfo object that will represent Wolof.&amp;nbsp; Further, I'm pretty sure that none of these engines has a dictionary for Wolof, they just take advantage of the fact that Wolof is printed with a Latin alphabet.&lt;/p&gt;&lt;p&gt;What should really happen is that there should be another object that represents what you really want: alphabet, dictionary or dictionaries, and possibly grammar rules.&amp;nbsp; Therefore, the correct request for any Wolof-like language would be { Latin, null, null }.&amp;nbsp; The problem is that, in theory, one or more of those underlying engines could magically provide a dictionary for Wolof.&amp;nbsp; The problem from my end is how to expose this now.&amp;nbsp; I have no engines that will tell me if there is a dictionary for a particular language - just the open ended white lie that they can recognize Moldovan or Nahuatl.&amp;nbsp; In fact, I have one engine that doesn't use dictionaries ever.&amp;nbsp; So here I am stuck.&amp;nbsp; I know how to represent the request, but&lt;br&gt;&amp;nbsp;have no engine that can help me fully honor it, so I slink back to CultureInfo and hope it's good enough.&lt;br&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;;subject=Multilingual+OCR" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;;title=Multilingual+OCR" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;title=Multilingual+OCR" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;;title=Multilingual+OCR" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx&amp;amp;;title=Multilingual+OCR&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/05/multilingual-ocr.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15165" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/OCR+architecture+programming/default.aspx">OCR architecture programming</category></item><item><title>Managed C++ and IDisposable</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx</link><pubDate>Fri, 01 Aug 2008 13:40:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15122</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15122.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15122</wfw:commentRss><description>&lt;p&gt;I'm writing some code using the new Managed C++/CLI syntax and I ran into this error:&lt;/p&gt;&lt;p&gt;&lt;font size="3"&gt;error C2039: 'Dispose' : is not a member of 'System::IDisposable'&lt;/font&gt;&lt;/p&gt;&lt;p&gt;the code I started with was this:&lt;/p&gt;&lt;p&gt;image-&amp;gt;Dispose(); // image implements IDisposable&lt;/p&gt;&lt;p&gt;which gave me the same compiler error, so I wanted to eliminate a class/namespace error so I rewrote it as this:&lt;/p&gt;&lt;p&gt;((IDisposable ^)image)-&amp;gt;Dispose();&lt;/p&gt;&lt;p&gt;Which gave the above error.&amp;nbsp; Yikes!&lt;/p&gt;&lt;p&gt;Here's the fix:&lt;/p&gt;&lt;p&gt;use delete.&amp;nbsp; Managed C++ now hides Dispose() inside the finalizer.&amp;nbsp; Just delete the object, it handles the rest. Freaky.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;;subject=Managed+C%2b%2b+and+IDisposable" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;;title=Managed+C%2b%2b+and+IDisposable" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;title=Managed+C%2b%2b+and+IDisposable" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;;title=Managed+C%2b%2b+and+IDisposable" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx&amp;amp;;title=Managed+C%2b%2b+and+IDisposable&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/08/01/managed-c-and-idisposable.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15122" width="1" height="1"&gt;</description></item><item><title>Giving a Technical Presentation</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx</link><pubDate>Thu, 31 Jul 2008 17:31:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15110</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15110.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15110</wfw:commentRss><description>&lt;p&gt;After attending and presenting at IPCV '80, I saw a number of presentations that could've been a lot better.&amp;nbsp; I thought maybe the issue was that there weren't sufficient resources on how to give a technical presentation, so I did a quick google search for "&lt;a href="http://www.google.com/search?hl=en&amp;amp;q=how+to+give+a+technical+presentation&amp;amp;btnG=Search"&gt;how to give a technical presentation&lt;/a&gt;."&amp;nbsp; There are 2.1 million results for that search.&lt;/p&gt;&lt;p&gt;I pored through some of the results and found that they are in line with how I try to approach technical presentations.&lt;/p&gt;&lt;p&gt;I'll break it down into a few things to do and a few things to avoid.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Things to Do&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Know your audience and tailor your talk accordingly&lt;/li&gt;&lt;li&gt;Be concise&lt;/li&gt;&lt;li&gt;Plan one or two goals for your audience and work to meet only those goals (in the education biz, they call these "learning outcomes")&lt;/li&gt;&lt;li&gt;Know where you're presenting and what your equipment will be&lt;/li&gt;&lt;li&gt;Share your passion&lt;/li&gt;&lt;li&gt;Practice your talk&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;b&gt;Things to Avoid&lt;/b&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Reading your slides word for word&lt;/li&gt;&lt;li&gt;Turning your back on the audience&lt;/li&gt;&lt;li&gt;Reading from a script&lt;/li&gt;&lt;li&gt;Giving a wall of math&lt;/li&gt;&lt;li&gt;Skipping around a lot&lt;/li&gt;&lt;li&gt;Overusing gimmicks&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;The most important point in there is practice.&amp;nbsp; Practice with people who you trust to be appropriately critical. Give your talk with a timer to ensure that you're on target.&amp;nbsp; After the practice, write down all comments immediately (and verify that your understand the comments) and immediately address them.&amp;nbsp; I'm pretty good at talking on the fly, but I'm way better if I've practiced a few times.&amp;nbsp; After my first practice, I had these notes - some from me, some from my peers:&lt;/p&gt;&lt;p&gt;0 talk about outline - don't start talk right away&lt;br&gt;1 more about why sparse sampling - application info&lt;br&gt;2 need slide about accuracy&lt;br&gt;3 more visuals&lt;br&gt;4 include failing docs?&lt;br&gt;5 fix typo in in CoordinateGenerator&amp;nbsp; &lt;br&gt;&lt;/p&gt;&lt;p&gt;I addressed these right away.&amp;nbsp; One that wasn't in my list was from Elaine - she told me directly to not read my slides.&amp;nbsp; I made a mental note to work more on flow.&lt;br&gt;&lt;/p&gt;&lt;p&gt;If you practice, you won't ensure success, but if you don't practice you &lt;i&gt;will &lt;/i&gt;ensure failure.&lt;/p&gt;&lt;p&gt;If you're giving a technical talk, google says that there are 2.1 million reasons why you can give a good technical talk.&amp;nbsp; Here are three:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.udel.edu/chemo/teaching/CHEM465S/C465Tips.htm"&gt;Tips for Building and Giving Technical Presentations&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ecow.engr.wisc.edu/cgi-bin/get/cee/939/frattadant/filesongoo/howtoguideareallylousytechnicalpresentation.pdf"&gt;How to Give a Really Lousy Technical Presentation&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://ezinearticles.com/?Effective-Presentations-For-Technical-Professionals&amp;amp;id=1265700"&gt;Effective Presentations for Technical Professionals&lt;/a&gt;&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;;subject=Giving+a+Technical+Presentation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;;title=Giving+a+Technical+Presentation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;title=Giving+a+Technical+Presentation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;;title=Giving+a+Technical+Presentation" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx&amp;amp;;title=Giving+a+Technical+Presentation&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/31/giving-a-technical-presentation.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15110" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/technicaltalk+presentations+technical/default.aspx">technicaltalk presentations technical</category></item><item><title>A Tribute To Robert Carroll</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx</link><pubDate>Fri, 25 Jul 2008 14:15:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15054</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15054.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15054</wfw:commentRss><description>&lt;p&gt;I found out last night that my high school physics teacher, Robert Carroll, &lt;a href="http://obits.nj.com/StarLedger/DeathNotices.asp?Page=LifeStory&amp;amp;PersonId=113371064"&gt;passed away&lt;/a&gt; very recently.&lt;/p&gt;&lt;p&gt;He was a teacher that was hard as nails and had it in his mind that he was going to push his students closer to their actual abilities rather than to the accepted median.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Here are his standards as I remember them:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;He assigned homework practically every night and accepted nothing late without a doctor's note.&lt;/li&gt;&lt;li&gt;All work was turned in with a uniform heading on the paper.&amp;nbsp; Anything that deviated was not graded.&lt;/li&gt;&lt;li&gt;All problems had to be done in given/find/solution form with the final solution boxed in.&amp;nbsp; Anything that deviated was penalized heavily.&lt;/li&gt;&lt;li&gt;No erasing was allowed.&amp;nbsp; Work that was considered to be incorrect could be crossed out with a single line.&amp;nbsp; Anything that deviated was penalized.&lt;/li&gt;&lt;li&gt;Labs were recorded in a bound, unlined lab book.&amp;nbsp; He transitioned you into labs where you wrote out the entire lab (procedure, data, conclusions), neatly and legibly.&amp;nbsp; He collected lab books at random times.&lt;/li&gt;&lt;li&gt;Definitions for units were boilerplate: &amp;lt;x&amp;gt; is the &amp;lt;fundamental/derived&amp;gt; unit of &amp;lt;time/extension/volume/capacity...&amp;gt; in the &amp;lt;standard&amp;gt; system &amp;lt;defined as/based on&amp;gt; ...&amp;nbsp; (Ex: A Newton is the derived unit of force in the MKS system, defined as 1 (kg m)/s2.&lt;br&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;He made it clear that this was a class in which physics was used to teach us procedure.&amp;nbsp; He established the procedures and made it clear what it would cost us to step outside the bounds.&amp;nbsp; The first quiz that he gave was nearly impossible to pass because of the amount of detail.&amp;nbsp; In fact, there were routinely students who lost more points on the quiz than were available.&amp;nbsp; He graded on a curve and that was a survival mechanism.&amp;nbsp; He insisted on using the ironically titled book "Modern Physics" by Charles E. Dull (and others) published in 1955.&amp;nbsp; He also scheduled a mandatory test on senior skip day.&amp;nbsp; And if you did something exceptionally stupid/ill-advised/dangerous you would be given the "&lt;a href="http://www.thefreedictionary.com/dufus"&gt;Dufus&lt;/a&gt; Award" (a rebranded cheerleading trophy) for the class period - his version of a &lt;a href="http://en.wikipedia.org/wiki/Dunce"&gt;dunce cap&lt;/a&gt;.&lt;br&gt;&lt;/p&gt;&lt;p&gt;In the process he did something that few other teachers did: he taught us how to study, how to solve problems, how and when to attend to detail, how to be responsible for our actions or inactions.&amp;nbsp; He demanded good work and accepted little else.&amp;nbsp; A lot of his students went to hardcore engineering programs and had the tools in hand to succeed.&amp;nbsp; Although I did not ask him for this, he wrote honest, top-notch recommendations for college applications.&lt;/p&gt;&lt;p&gt;Out of frustration, my friend Mark Hamm would draw an elaborate caricature of him on the blackboard most mornings.&amp;nbsp; Without missing a beat, Mr. Carroll would look over the work, erase it and deftly draw a cartoon pig with an enormous ass, with an arrow pointing it out (ie, the ham).&amp;nbsp; No spite - he could dish it out and take it.&lt;br&gt;&lt;/p&gt;&lt;p&gt;My oldest brother and his peers formed a group called the Honors Physics Consortium as a coping mechanism and went to the trouble of (eventually) self-publishing a book about their exploits.&lt;/p&gt;&lt;p&gt;Mr. Carroll had a very long career as a teacher: 38 years.&amp;nbsp; That's 38 years of students who went through his class or roughly 800 students in his honors class that were affected by him.&amp;nbsp; While not everyone agreed with his methodology, I believe his method had strongly calculated purpose and prefer to believe that the other 799 students, like me, have come to recognize the benefits of the purpose.&lt;br&gt;&lt;/p&gt;&lt;p&gt;Rest in peace, Mr. Carroll.&lt;br&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;;subject=A+Tribute+To+Robert+Carroll" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;;title=A+Tribute+To+Robert+Carroll" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;title=A+Tribute+To+Robert+Carroll" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;;title=A+Tribute+To+Robert+Carroll" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx&amp;amp;;title=A+Tribute+To+Robert+Carroll&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/25/a-tribute-to-robert-carroll.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15054" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/teaching+teacher+obituary/default.aspx">teaching teacher obituary</category></item><item><title>Debugging Code in the GAC - the best thing since sliced bread</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx</link><pubDate>Thu, 24 Jul 2008 19:07:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:15044</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/15044.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=15044</wfw:commentRss><description>&lt;p&gt;I've been playing around with writing a VS Project Template that includes a Wizard implemented in C#.&amp;nbsp; I had done something similar many years ago when the only choice was C++, and boy have things gotten way better.&lt;/p&gt;&lt;p&gt;Before doing anything else, I read a lot and one thing that caught my eye was that any assembly that is to be used as an add-in needs to be signed and installed in the GAC.&amp;nbsp; This is troublesome as I always assumed that debugging code built this way was going to be, well, a pain in the GAC.&lt;/p&gt;&lt;p&gt;Some googling time later, I found several people who had succeeded, but again with pain - I assumed that this was my lot too.&amp;nbsp; Then I found &lt;a href="http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23"&gt;this blog entry&lt;/a&gt;.&amp;nbsp; Run.&amp;nbsp; Don't walk there and read.&amp;nbsp; It is step by step instructions on how to set up VS to debug code installed in the GAC.&amp;nbsp; It works and it works well.&amp;nbsp; Thanks Doug, for figuring this out and making it available.&lt;br&gt;&lt;/p&gt;&lt;p&gt;This is only half the picture though - to make this a really smooth experience, I added the following to the post-build step in the "Build Events" pane.&lt;br&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" -I "$(TargetPath)" /f&lt;/b&gt;&lt;/p&gt;&lt;p&gt;This works for Visual Studio 2005, since it has the path to gacutil built-in.&amp;nbsp; The line basically means "forcibly install the assembly I've just built into the GAC".&lt;/p&gt;&lt;p&gt;The final bit of icing is to change the Start Action in the Debug pane to "Start external program" and set the path to:&lt;/p&gt;&lt;p&gt;&lt;b&gt;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe&lt;/b&gt;&lt;/p&gt;&lt;p&gt;When you "run" your assembly, it will fire up a new instance Visual Studio and that will allow you to debug your IWizard derived class at the source level.&lt;/p&gt;&lt;p&gt;I'm so pleased at the incredible lack of pain I'm feeling.&amp;nbsp; The pain was all in figuring out how to win the trivia contest before I began.&lt;br&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;;subject=Debugging+Code+in+the+GAC+-+the+best+thing+since+sliced+bread" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;;title=Debugging+Code+in+the+GAC+-+the+best+thing+since+sliced+bread" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;title=Debugging+Code+in+the+GAC+-+the+best+thing+since+sliced+bread" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;;title=Debugging+Code+in+the+GAC+-+the+best+thing+since+sliced+bread" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx&amp;amp;;title=Debugging+Code+in+the+GAC+-+the+best+thing+since+sliced+bread&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/24/debugging-code-in-the-gac-the-best-thing-since-sliced-bread.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=15044" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/VS+VisualStudio+IWizard+projecttemplate+programming+debugging/default.aspx">VS VisualStudio IWizard projecttemplate programming debugging</category></item><item><title>WorldComp and IPCV 08 Day 4 - Wrap Up</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx</link><pubDate>Fri, 18 Jul 2008 15:31:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14971</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14971.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14971</wfw:commentRss><description>Day 4 was the last day and for me it was a blur.  There were a number of sessions that were missing half their speakers, and my eyes were starting to glaze over from some of the talks that featured a 'wall of math'.

One talk that stood out was a math professor who was spearheading an effort to create open source code to cleanly and efficiently process images from ultra low-cost CCD cameras.  He explained the problem domain very well.  It really made it clear as to why most cheap camera output looks like garbage.

I did my presentation in the last slot on the last day.  I can't say I was happy about the timing, but you gotta dance with them what brung ya.  I tried to make the best of it by bringing candy to the talk and to put as much energy into it as possible.  My thought was that the people who stuck through this should get rewarded, not punished for sticking with it.

I felt the talk went well and I think I'll put together several blogs about how to present a technical paper.  I can't say that I'm an expert, but having taught middle and some high school, I did get some good experience explaining the technical to those who were on the edge of understanding.
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;;subject=WorldComp+and+IPCV+08+Day+4+-+Wrap+Up" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+4+-+Wrap+Up" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;title=WorldComp+and+IPCV+08+Day+4+-+Wrap+Up" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+4+-+Wrap+Up" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+4+-+Wrap+Up&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/18/worldcomp-and-ipcv-08-day-4-wrap-up.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14971" width="1" height="1"&gt;</description></item><item><title>WorldComp and IPCV 08 Day Three</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx</link><pubDate>Thu, 17 Jul 2008 13:53:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14960</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14960.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14960</wfw:commentRss><description>The length of the conference is certainly taking its toll.  Between the long days, my body has been trying wake me up in a different time zone.

Day three was dedicated to multimedia and compression.  There were a number of talks that were beyond my attention span but looked worth investigating more.  We also cross-pollinated a little more and looked at conferences outside of imaging, including research to try to read emotion from spoken words.

There was one talk that was short and sweet which was a small bit of research to determine if compression of data for transmission is worth the cost in energy.  I found it in triguing that for a particular class of processor the cost of an ADD instruction is 85 nanojoules.  The idea is to determine if the cost of battery power used in running the code to compress and subsequently transmit the data is less than the cost of transmitting uncompressed data on its own.

Rick and I had a nice talk with him afterwards.
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;;subject=WorldComp+and+IPCV+08+Day+Three" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+Three" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;title=WorldComp+and+IPCV+08+Day+Three" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+Three" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+Three&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/17/worldcomp-and-ipcv-08-day-three.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14960" width="1" height="1"&gt;</description></item><item><title>WorldComp and IPCV Day 2</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx</link><pubDate>Wed, 16 Jul 2008 13:47:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14950</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14950.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14950</wfw:commentRss><description>Day two had a great deal of work concerning feature extraction.  Yesterday seemed to be about putting things into images and today was getting things out.

A few things that caught my eye were some segmentation and classification work, hand tracking and identification, face tracking with pose estimation, automatic location of cracks in a highway, location of crosswalks for the blind, circle detection, and detection of pollution.

One thing that is particulrly striking about this conference is its extensive multiculturalarity.  I seen attendees and presenters from Spain, Italy, France, UK, Japan, Korea, China, Vietnam, India, and so on.  It's quite a melange of language and culture and is a great reminder of how important it is to write culture neutral software.  It's also a strong reminder of the inherent biases towards English in pretty much every accepted programming language.

Thinking about this makes me think about the parallels of Latin and English for the publication of scholarly work.  English is a fairly terrible language (yet some how millions of children a year manage to become conversant in it), and it must be a tremendous strain for a presenter to have to field questions in it.  But it still makes me wonder if 17th century and earlier scholars faced the same challenges in communication.

And lest I forget, the gender diversity is also a welcome change when coming from an industry that is traditionally male dominated.
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;;subject=WorldComp+and+IPCV+Day+2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;;title=WorldComp+and+IPCV+Day+2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;title=WorldComp+and+IPCV+Day+2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;;title=WorldComp+and+IPCV+Day+2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx&amp;amp;;title=WorldComp+and+IPCV+Day+2&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/16/ipcv-day-2.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14950" width="1" height="1"&gt;</description></item><item><title>WorldComp and IPCV 08 Day 1</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx</link><pubDate>Tue, 15 Jul 2008 13:43:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14936</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14936.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14936</wfw:commentRss><description>I'm blogging from the road in Vegas and posting this from my phone.  I'm using Opera on a WM6 device and it seems to work admirably.

Our flight was delayed on the outbound side so we ended up getting 4 hours of sleep in a hotel in Milwaukee before heading on to Vegas.  After a few hotel snafus, we got in to catch the last keynote about reconfigurable computing.  Nifty work.

A few notes in no particular order:
* It's nice to see such a diverse crowd.  This is truly an international conference.
* The material has been fairly fascinating and there are some interesting topics.  I can totally see how to create digital watermarks in images based on one of the talks, so if you need that as an Atalasoft customer, let me or sales know.
* Saw some interesting work on fingerprint recognition that would apply to document binarization.
* Found myself asking critical questions in nearly every session.  It's good to geek out.
* At the conference dinner, Rick and I picked our table and companions more or less at random and had some good partners.

Time to clean up for day 2.
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;;subject=WorldComp+and+IPCV+08+Day+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;title=WorldComp+and+IPCV+08+Day+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx&amp;amp;;title=WorldComp+and+IPCV+08+Day+1&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/15/worldcomp-and-ipcv-08-day-1.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14936" width="1" height="1"&gt;</description></item><item><title>Off to IPCV08</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx</link><pubDate>Fri, 11 Jul 2008 17:47:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14889</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>0</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14889.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14889</wfw:commentRss><description>&lt;p&gt;Next week &lt;a href="http://www.atalasoft.com/cs/blogs/rickm/default.aspx"&gt;Rick&lt;/a&gt; and I will be in Las Vegas at IPCV08, part of &lt;a href="http://www.world-academy-of-science.org/worldcomp08/worldcomp08/ws"&gt;WorldComp&lt;/a&gt;.&amp;nbsp; In addition to being a huge industry conference with a lot of interesting sessions, I'll be presenting a paper on accelerating the Hough Transform.&amp;nbsp; My session is on Thursday July 17, 4:40 in Ballroom 7 of the Monte Carlo Resort.&lt;/p&gt;&lt;p&gt;In the meantime, &lt;a href="http://www.atalasoft.com/cs/files/folders/14888/download.aspx"&gt;here's an app&lt;/a&gt; with source that I will touch on in my talk.&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;;subject=Off+to+IPCV08" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;;title=Off+to+IPCV08" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;title=Off+to+IPCV08" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;;title=Off+to+IPCV08" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx&amp;amp;;title=Off+to+IPCV08&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/11/off-to-ipcv08.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14889" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/IPCV+IPCV08+worldcomp/default.aspx">IPCV IPCV08 worldcomp</category></item><item><title>Don't Be Stupid (like me)</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx</link><pubDate>Thu, 10 Jul 2008 15:29:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14876</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>1</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14876.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14876</wfw:commentRss><description>&lt;p&gt;I had a frustrating situation last week.&amp;nbsp; I was trying to debug some unmanaged code through a managed project and discovered that something had happened to my system such that it was impossible to start up a project with unmanaged debugging turned on.&amp;nbsp; If you had it switched off, any project would run fine in the debugger.&amp;nbsp; If you had it switched on, the app would crash hard with an ExecutionEngineException before entering Main.&lt;/p&gt;&lt;p&gt;I can't tell you what changed on my system to cause this.&amp;nbsp; I had a few suspicions, but nothing that I could act upon.&amp;nbsp; I reinstalled VisualStudio hoping that would solve the issue, but no go.&lt;/p&gt;&lt;p&gt;After losing two days, I chose to have my machine nuked from orbit.&amp;nbsp; I made a checklist of all the apps that I would lose and copied my documents (stored in My Documents) to an external hard drive.&amp;nbsp; I made one &lt;i&gt;very&lt;/i&gt; stupid mistake. I assumed that source control was my friend (more so than any reasonable person should) and neglected to make a back up of my source tree.&amp;nbsp; When my machine was nuked it took out all the files I had checked out.&amp;nbsp; Was it really 93?&amp;nbsp; Yikes.&amp;nbsp; Most of those were files that I was conditionally compiling out of the existing code, so some 80 or so of those were easy to recreate by breaking the locks and redoing the work of adding in&lt;/p&gt;&lt;p&gt;#if USE_OLD_CODE_LIBRARY&lt;br&gt;...&lt;br&gt;#endif&lt;/p&gt;&lt;p&gt;Fortunately, all the "hard" work I had done had been checked in and I lost only a small amount of that code.&amp;nbsp; What I had lost was mostly managed code, for which I still had copies of the compiled dll's in test rigs on my backup.&amp;nbsp; I pulled those and used &lt;a href="http://www.aisto.com/roeder/dotnet/"&gt;.NET Reflector&lt;/a&gt; to get back an approximation of my original code.&amp;nbsp; In two days, I was back to where I was and in better shape, as I fixed one bug along the way just from reading code (and it turns out, fixed the bug I was looking for when managed debugging went away).&lt;/p&gt;&lt;p&gt;In total, this situation cost me four days and my stupidity cost me two of those.&amp;nbsp; Hindsight tells me that I was not scrupulous enough in making a checklist of things to do before nuking a machine.&amp;nbsp; "What about my source?" should have been number one on my list.&lt;/p&gt;&lt;p&gt;It occurs to me as well that this is exactly something that a tightly integrated source code system like tfs should be able to manage for me.&amp;nbsp; Tfs knows when I save a file locally.&amp;nbsp; Couldn't it also shadow my changes into the server as well?&amp;nbsp; In this way my code is one save away from recovery instead of one check-in or shelve.&amp;nbsp;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;;subject=Don%27t+Be+Stupid+(like+me)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;;title=Don%27t+Be+Stupid+(like+me)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;title=Don%27t+Be+Stupid+(like+me)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;;title=Don%27t+Be+Stupid+(like+me)" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx&amp;amp;;title=Don%27t+Be+Stupid+(like+me)&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/10/don-t-be-stupid-like-me.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14876" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/sourcecontrol+stupidity+engineering+engineeringmalpractice/default.aspx">sourcecontrol stupidity engineering engineeringmalpractice</category></item><item><title>How to Build a Managed/Unmanaged Library</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx</link><pubDate>Wed, 02 Jul 2008 13:55:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14712</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>2</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14712.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14712</wfw:commentRss><description>
&lt;p&gt;If you are tasked with exposing an unmanaged library through managed code, there are several approached that you can take.&amp;nbsp; The approach you take will depend upon what format your unmanaged code is in.&lt;/p&gt;

&lt;p&gt;If you are given an unmanaged dll, it is sensible to simply use P/Invoke to expose the functionality.&amp;nbsp; This will work and will get you going quickly, but it leads to a problem of how to make sure that the dll you have is loaded.&amp;nbsp; If you leave it to the OS, this means that the unmanaged dll needs to live in the same folder as the calling assembly or in the system folder.&amp;nbsp; You can also change the path that is searched for loading a dll by calling a P/Invoke of SetDllDirectory, or you can manually load the dll in your own code.&amp;nbsp; If you do that, your dll loader needs to be called before the first P/Invoke into the dll.&lt;/p&gt;

&lt;p&gt;Using P/Invoke works, but may be costly in the marshaling, especially if you have to call the routine repeatedly.&lt;/p&gt;

&lt;p&gt;What I prefer to work with is an unmanaged static library.&amp;nbsp; With that, you can build a managed C++ wrapper that exposes the functionality that you need.&amp;nbsp; The C++ compiler does some fairly amazing things in terms of knowing when to do unmanaged/unmanaged transitions, but sometimes it does some surprising things that will cost.&lt;/p&gt;

&lt;p&gt;Let's assume that you are a good developer and have built a customer management API using STL collections. &amp;nbsp; You might expose a method like this:&lt;/p&gt;
&lt;code&gt;public __gc class CustomerRelations {&lt;br&gt;
public:&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; bool IsCustomerAvailable(String *name)&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; StringAdapter cstringName(name);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; vector&amp;lt;Customer *&amp;gt; customers = GetCustomers(); // lib call&lt;br&gt;
&amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  for (int i=0; i &amp;lt; customers.size(); i++) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;  if (cusomters[i]-&amp;gt;MatchesName(name))&lt;br&gt;
&amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  &amp;nbsp;&amp;nbsp;  return true;&lt;br&gt;
&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;  return false;&lt;br&gt;
&amp;nbsp;&amp;nbsp;  }&lt;br&gt;
};&lt;br&gt;
&lt;br&gt;
&lt;/code&gt;
&lt;p&gt;The problem here is that the API is chatty - it's nice to have the interface right to the metal of the vectory, but the question is, when this is compiled and linked, will the STL code be managed or unmanaged.&amp;nbsp; Worse than that, if the compiler generates a managed version of one of the STL routines, it will use it in all the unmanaged code as well.&amp;nbsp; In other words, code that you thought was supposed to be pure unmanaged will be doing very granular transitions between managed and unmanaged calls, and that will be be pretty much out of your control.&lt;/p&gt;
&lt;p&gt;One way around this is to make sure that all code that is touching unmanaged APIs is also unmanaged.&amp;nbsp; This can be handled by writing classes or top level functions that are themselves unmanaged and less chatty.&lt;/p&gt;
&lt;p&gt;This works, but is prone to error - if you screw up, you may inadvertently tank your performance.&amp;nbsp; I found this out, by the way, by stepping into an unmanaged library routine with unmanaged debugging off.&amp;nbsp; The debugger kept executing code until it hit the next unmanaged frame, which was in the middle of deep library code in STL.&lt;/p&gt;
&lt;p&gt;Here's the flawless solution - make the exposed API as chunky as possible.&amp;nbsp; It's really tempting to give direct access to collections, but this is problematic.&amp;nbsp; It's far better, if you can, to use managed collections to hold your unmanaged objects.&lt;/p&gt;
&lt;p&gt;One approach to make sure that you don't expose anything is to use the old-school C trick of making your API completely opaque.&amp;nbsp; You can do this by making two header files, one public and one private.&amp;nbsp; The public one defines opaque types:&lt;/p&gt;&lt;p&gt;
&lt;code&gt;
// public API&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;#pragma managed(push, off)&lt;br&gt;&lt;br&gt;
namespace StupendoCustomer {&lt;br&gt;typedef struct t_CustomerStruct *t_CustomerHandle;&lt;br&gt;
extern t_CustomerHandle GetCustomerByName(wchar_t *name);&lt;br&gt;
extern bool IsCustomerAvailable(wchar_t *name);&lt;br&gt;
extern INT32 GetCustomerCount();&lt;br&gt;
extern void GetCustomers(t_CustomerHandle *arr, INT32 startIndex, INT32 count);&lt;br&gt;
} // namespace&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;br&gt;#pragma managed(pop)&lt;br&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;code&gt;// private API - in a different file&lt;br&gt;
namespace StupendoCustomer {&lt;br&gt;
const UINT32 kCustomerMagicNumber = 0x00C5708e6; // arbitrary&lt;br&gt;
typedef struct t_CustomerStruct {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; UINT32 m_magic;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerObject *m_customer;&lt;br&gt;
};&lt;br&gt;
} // namespace&lt;/code&gt;&lt;br&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;In this case, managed&amp;nbsp; code will see nothing more than an anonymous struct for the customer, whereas unmanaged code gets the actual definition of the struct.&amp;nbsp; The m_magic field is a trick to put in a sanity check so that if the lower level API gets passed a pointer to something other than the real structure, it can be checked quickly.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The GetCustomerCount/GetCustomers pair is a way to show how you can hide the collection code by letting the caller allocate space for the array and then fetch elements from it.&amp;nbsp; The calling code, presumably managed, would most likely wrap the objects in its own class and make a collection of those objects.&lt;/p&gt;&lt;p&gt;Beware that you understand who owns the pointer to the struct and who is responsible for disposing it (might also be a job for smart pointers).&amp;nbsp; Chances are that if you're writing a managed wrapper for the customer object, it will have to implement IDisposable.&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;;subject=How+to+Build+a+Managed%2fUnmanaged+Library" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;;title=How+to+Build+a+Managed%2fUnmanaged+Library" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;title=How+to+Build+a+Managed%2fUnmanaged+Library" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;;title=How+to+Build+a+Managed%2fUnmanaged+Library" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx&amp;amp;;title=How+to+Build+a+Managed%2fUnmanaged+Library&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/07/02/how-to-build-a-managed-unmanaged-library.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14712" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/code+C_2B002B00_+managed+unmanaged/default.aspx">code C++ managed unmanaged</category></item><item><title>A Geek Chooses Lunch</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx</link><pubDate>Wed, 25 Jun 2008 13:55:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14523</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>4</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14523.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14523</wfw:commentRss><description>
&lt;p&gt;Not so much on programming, but on geekery.&lt;/p&gt;
&lt;p&gt;One local lunch spot faxes us a list of daily specials and I decided that I wanted pizza, but the question was whether to choose the $6.25 10" two topping pizza with a 12 ounce soda or split a $9.45 16" one topping pizza with a 2L birch beer.&amp;nbsp; I love birch beer, so that's not&amp;nbsp; a deciding factor.&lt;/p&gt;
&lt;p&gt;What I did (and iteratively adjusted it with Elaine) was to normalize the meals into units of price per food, where the food units were square inch-liter-toppings.&amp;nbsp; &lt;br&gt;&lt;/p&gt;
&lt;p&gt;So in this case you take the price divided by the area of the pizza x toppings x volume of soda.&amp;nbsp; Ignoring the egregious mixing of metric and English units, this is fairly reasonable.&amp;nbsp; I did the math with a calculator, but for this blog, I popped this into a spread sheet and got the following results, using πr&lt;sup&gt;2&lt;/sup&gt; for area of the pizza:&lt;br&gt;&lt;/p&gt;
&lt;p&gt;The personal 2-topping pizza meal is 10.61 cents/in2-L-topping, whereas the large pizza is 2.35 cents/in&lt;sup&gt;2&lt;/sup&gt;-L-topping.&amp;nbsp; This is normalized, so the value of the larger pizza is clearly greater.&amp;nbsp; In addition, the area of the personal pizza is 78.54 in&lt;sup&gt;2&lt;/sup&gt;, whereas the area of the large pizza is 201.06 in&lt;sup&gt;2&lt;/sup&gt;, therefore my share of the large is greater than the whole small.&amp;nbsp; The soda is similar a better deal.&lt;/p&gt;
&lt;p&gt;Rick and I shared a large with Buffalo chicken as the topping and there are left-overs for today.&amp;nbsp; In addition, we answered the trivia question about encephalitis and got free garlic bread sticks.&amp;nbsp; It was a good lunch.&amp;nbsp; And yes, we really are that geeky.&lt;br&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;;subject=A+Geek+Chooses+Lunch" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;;title=A+Geek+Chooses+Lunch" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;title=A+Geek+Chooses+Lunch" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;;title=A+Geek+Chooses+Lunch" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx&amp;amp;;title=A+Geek+Chooses+Lunch&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/25/a-geek-chooses-lunch.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14523" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/geek+math+lunch+quantifying+appliedmath/default.aspx">geek math lunch quantifying appliedmath</category></item><item><title>Woo-hoo! Compiler Bug!</title><link>http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx</link><pubDate>Fri, 13 Jun 2008 15:26:00 GMT</pubDate><guid isPermaLink="false">647108ca-f046-4d8d-9feb-a7fbd2049b37:14322</guid><dc:creator>Steve Hawley</dc:creator><slash:comments>2</slash:comments><comments>http://www.atalasoft.com/cs/blogs/stevehawley/comments/14322.aspx</comments><wfw:commentRss>http://www.atalasoft.com/cs/blogs/stevehawley/commentrss.aspx?PostID=14322</wfw:commentRss><description>&lt;p&gt;I just finished tracking down a Visual C++ compiler bug.&amp;nbsp; This bug exists in the optimizer in VC 2003 and 2005.&amp;nbsp; It &lt;b&gt;does not&lt;/b&gt; exist in VC 2008.&amp;nbsp; It only happens with optimization turned on (ie, Release build).&lt;/p&gt;

&lt;p&gt;Finding this bug was interesting in that we had a defect reported from a customer that caused an exception to be raised when trying to load a particular image.&amp;nbsp; This image had an error in it and was causing a throw deep within the codec.&amp;nbsp; This looked like an easy bug to find. Unfortunately for me, unit tests would pass on my machine, but not on the build server.&amp;nbsp; This turned a routine bug into a nightmare bug - the debugger was not likely to help me.&amp;nbsp; What I ended up doing was taking the library that (most likely) contained the bug and built it release, and used that in the debug build on my machine.&amp;nbsp; This allowed me to reproduce the bug (and proving that it was a release bug).&amp;nbsp; Using divide and conquer, I found where the exception was being thrown and to my great surprise, where the catch was being totally missed.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;The bug is this:&lt;/p&gt;

&lt;p&gt;if you have a try/catch block in C++ that only calls "pure" C code, the optimizer sees an opportunity to remove the catch block as C can't throw.&amp;nbsp; If however, the C code calls back into C++ and that code throws, the exception will blow past the handler.&lt;/p&gt;

&lt;p&gt;It is arguable that C++ code called from C should never throw without catching before returning to the caller.&amp;nbsp; If the catch block is outside the C, it could cause memory or resource leaks.&amp;nbsp; In this particular case, the function being called was a function pointer acting as an event handler.&amp;nbsp; Basically, it was signaling to the caller, "something bad has happened - I've cleaned up, now it's your turn".&lt;br&gt;&lt;/p&gt;

&lt;p&gt;To illustrate how this happens, I've created a minimal code example to reproduce it.&amp;nbsp; This code is a simple C++ app that calls a C function, PerformOperation with a C++ callback.&amp;nbsp; PerformOperation prints a message than calls the callback if it's non-null.&amp;nbsp; The C++ implementation of the callback throws an empty class to signal a failure.&amp;nbsp; The calling code should catch this error and report failure.&amp;nbsp; In debug, you get correct behavior.&amp;nbsp; In release, you get an unhandled exception.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;File - Perf.h - a header describing an external operation in C:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
#ifndef _H_Perf&lt;br&gt;#define _H_Perf&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;extern "C" {&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;typedef void (*fPerformer)();&lt;br&gt;&lt;br&gt;extern void PerformOperation(fPerformer pf);&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;}; // _cplusplus&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;#endif&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;File - Perf.c - an implementation of the function PerformOperation&lt;/p&gt;

&lt;p&gt;&lt;code&gt;#include "Perf.h"&lt;br&gt;#include "stdio.h"&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;extern "C" {&lt;br&gt;#endif&lt;br&gt;&lt;br&gt;void PerformOperation(fPerformer pf)&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; printf("Performing operation...");&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (pf)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; pf();&lt;br&gt;}&lt;br&gt;&lt;br&gt;#ifdef __cplusplus&lt;br&gt;};&lt;br&gt;#endif&lt;br&gt;&amp;nbsp;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;
File - OptimizerBug.cpp - calls the performer from C++ with a C++ callback that throws&lt;/p&gt;


&lt;p&gt;&lt;code&gt;#include &amp;lt;iostream&amp;gt;&lt;br&gt;#include &amp;lt;tchar.h&amp;gt;&lt;br&gt;#include "Perf.h"&lt;br&gt;&lt;br&gt;using namespace std;&lt;br&gt;&lt;br&gt;class PerfError { };&lt;br&gt;&lt;br&gt;static void CPPPerform()&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw PerfError();&lt;br&gt;}&lt;br&gt;&lt;br&gt;int _tmain(int argc, _TCHAR* argv[])&lt;br&gt;{&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; bool fail = false;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; PerformOperation(CPPPerform);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (PerfError) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; fail = true;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; (fail ? "fail." : "pass.");&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;br&gt;Here's what happens - in a debug build, you will see "Performing operation...fail." - this is correct output.&amp;nbsp; In a release build, the code will crash with an unhandled exception.&amp;nbsp; I need to also stress that the function PerformOperation needs to live in its own file.&amp;nbsp; If it lives in OptimizerBug.cpp, the optimizer goes even further and notices that PerformOperation can be inlined, and since it's only being used once, the callback can be inlined too and that it will always throw.&amp;nbsp; It's a nice chunk for call-&amp;gt;call optimization, but it makes the bug go away.&amp;nbsp; If the implementation is in a different file, the optimizer doesn't inline.&lt;/p&gt;
&lt;p&gt;Here's the assembly output for the release build in VC 2005:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;; 20&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; bool fail = false;&lt;br&gt;; 21&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; try {&lt;br&gt;; 22&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; PerformOperation(CPPPerform);&lt;br&gt;;&lt;br&gt;; Here's the call to PerformOperation&lt;br&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; push&amp;nbsp;&amp;nbsp;&amp;nbsp; OFFSET ?CPPPerform@@YAXXZ&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ; CPPPerform&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call&amp;nbsp;&amp;nbsp;&amp;nbsp; _PerformOperation&lt;br&gt;&lt;br&gt;; 23&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;; 24&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; catch (PerfError) {&lt;br&gt;; 25&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; fail = true;&lt;br&gt;; 26&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;; 27&amp;nbsp;&amp;nbsp; : &lt;br&gt;; 28&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; (fail ? "fail." : "pass.");&lt;br&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;br&gt;;&lt;br&gt;; and here's the call to cout, operator &amp;lt;&amp;lt; - you'll notice&lt;br&gt;; that the fail = true is not here.&lt;br&gt;;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; push&amp;nbsp;&amp;nbsp;&amp;nbsp; OFFSET ??_C@_05MFHHNNDH@pass?4?$AA@&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; push&amp;nbsp;&amp;nbsp;&amp;nbsp; OFFSET ?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A ; std::cout&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call&amp;nbsp;&amp;nbsp;&amp;nbsp; ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator&amp;lt;&amp;lt;&amp;lt;std::char_traits&amp;lt;char&amp;gt; &amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add&amp;nbsp;&amp;nbsp;&amp;nbsp; esp, 12&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; ; 0000000cH&lt;br&gt;&lt;br&gt;; 29&amp;nbsp;&amp;nbsp; : &lt;br&gt;; 30&amp;nbsp;&amp;nbsp; : &amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xor&amp;nbsp;&amp;nbsp;&amp;nbsp; eax, eax&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There is a workaround - the most basic is to refactor to never throw in a C++ callback called from C.&amp;nbsp; Where this is not possible, the routine with the catch block needs to be surrounded by:&lt;/p&gt;&lt;p&gt;#if NDEBUG&lt;br&gt;#pragma optimize("", off)&lt;br&gt;#endif&lt;br&gt;&lt;/p&gt;&lt;p&gt;#if NDEBUG&lt;br&gt;
#pragma optimize("", on)&lt;br&gt;
#endif&lt;br&gt;
&lt;/p&gt;&lt;p&gt;This bug is NOT fixed by changing the catch to catch(...) - the optimizer will take out the handler no matter what.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On a more meta level, I want to talk more about bugs that happen only in release and not in debug.&amp;nbsp; These are among the most frustrating bugs as it looks like you have to shed your main tool for tracking them down - your debugger.&amp;nbsp; In my case, I was able to isolate the behavior and build that particular component with release.&amp;nbsp; You can still use the debugger in release, but it's not as useful as you might think since the optimizer may shift the order of operations of things and you will see some truly bizarre behavior.&amp;nbsp; For example, I watched the execution of an if (condition) statement where condition was false - and the debugger stepped into the block (!!).&amp;nbsp; This was because a lot of the method had been optimizer rearranged to reduce size and increase speed.&amp;nbsp; I find it easier to use the Disassembly window in VisualStudio so I can better see what the compiled code is.&amp;nbsp; While doing this, I spotted the missing catch block - quite the WTF.&lt;br&gt;&lt;/p&gt;
&lt;div class = "shareblock"&gt;&lt;strong&gt;Share this post:&lt;/strong&gt; &lt;a href = "mailto:?body=Thought you might like this: http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;;subject=Woo-hoo!+Compiler+Bug!" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;email it!&lt;/a&gt; |  &lt;a href = "http://del.icio.us/post?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;;title=Woo-hoo!+Compiler+Bug!" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;bookmark it!&lt;/a&gt; |  &lt;a href = "http://www.digg.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;;phase=2" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;digg it!&lt;/a&gt; |  &lt;a href = "http://reddit.com/submit?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;title=Woo-hoo!+Compiler+Bug!" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;reddit!&lt;/a&gt; |  &lt;a href = "http://www.dotnetkicks.com/submit/?url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;;title=Woo-hoo!+Compiler+Bug!" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;kick it!&lt;/a&gt; |  &lt;a href = "https://favorites.live.com/quickadd.aspx?marklet=1&amp;amp;;mkt=en-us&amp;amp;;url=http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx&amp;amp;;title=Woo-hoo!+Compiler+Bug!&amp;amp;;top=1" target="_blank" title = "Post http://www.atalasoft.com/cs/blogs/stevehawley/archive/2008/06/13/woo-hoo-compiler-bug.aspx"&gt;live it!&lt;/a&gt;&lt;/div&gt;&lt;img src="http://www.atalasoft.com/cs/aggbug.aspx?PostID=14322" width="1" height="1"&gt;</description><category domain="http://www.atalasoft.com/cs/blogs/stevehawley/archive/tags/code+C_2B002B00_+optimizer+bug/default.aspx">code C++ optimizer bug</category></item></channel></rss>