<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0AEQX85fSp7ImA9WhBWFE4.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407</id><updated>2013-04-08T10:41:40.125-05:00</updated><category term="computer problems" /><category term="computer science" /><category term="dot net" /><category term="LINQ" /><category term="SQL" /><category term="javascript" /><category term="GoDaddy" /><category term="silverlight" /><category term="Regular Expressions" /><category term="programming" /><category term="graphics" /><category term="games" /><category term="Oracle" /><category term="widgets" /><category term="XAML" /><category term="JQuery" /><category term="1and1" /><category term="ajax/atlas" /><category term="AI" /><category term="asp.net" /><category term="IronPython" /><category term="Free Template" /><category term="WPF" /><category term="C++/cli" /><category term="C# 4.0" /><title>Taking Dot Net "Old School"</title><subtitle type="html">Playing with old ideas/concepts using the newest tools!</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://oldschooldotnet.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>67</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/TakingDotNetoldSchool" /><feedburner:info uri="takingdotnetoldschool" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;DEMNR3g5eSp7ImA9WhVTEEk.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-6407569993611463311</id><published>2012-02-23T19:20:00.000-06:00</published><updated>2012-02-23T19:21:36.621-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-23T19:21:36.621-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>I’m a 5.8 out of 6 programmer</title><content type="html">If you go to &lt;a href="http://inter-sections.net/2007/11/13/how-to-recognise-a-good-programmer"&gt;How to recongnise a good programmer&lt;/a&gt;, you will see one man’s idea of how to spot a good programmer.&amp;nbsp; When looking around the web, &lt;a href="http://groups.google.com/group/comp.databases.pick/browse_thread/thread/6826b34c57b330a5/61108d82f02bf021?lnk=raot"&gt;I stumbled upon this conversation about it&lt;/a&gt;.&amp;nbsp; The last post tried to adapt this to diesel mechanics.&amp;nbsp; I’ve added my comments in &lt;span style="color: red;"&gt;red&lt;/span&gt;&lt;span style="color: white;"&gt; to the post, since I think the poster does not have a clue what a programmer does.&amp;nbsp; Maybe I can enlighten him a bit. (I’ve also colored his adaptation in &lt;/span&gt;&lt;span style="color: #4bacc6;"&gt;blue&lt;/span&gt;&lt;span style="color: white;"&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Let's see how it applies to my business model. &lt;br /&gt;I have a fleet of eighteen wheelers and I need to hire a bunch of mechanics to service Volvo, Kenworth and Mack trucks.&lt;/span&gt; &lt;br /&gt;
&lt;span style="color: red;"&gt;Wow, to compare mechanics to programmers in the first place ... this guy hasn't a clue what a programmer does.&amp;nbsp; But, just to play along lets see how this works out&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;The article gives me two possible hiring scenarios which I've adapted to my business.&lt;/span&gt; &lt;br /&gt;
Positive indicators: &lt;br /&gt;
Passionate about technology &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Heard about the latest F1 regenerative energy systems.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;No, how about more like "Really likes to work on Trucks"?&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Programs as a hobby &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Tinkers with his own dirt bike.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;&amp;lt;Sigh&amp;gt; I can see he just does not get it.&amp;nbsp; More like: Loves to work on Trucks so will do it on his/her own time.&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
Will talk your ear off on a technical subject if encouraged &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;NASCAR galore.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&lt;span style="color: red;"&gt;If you think NASCAR is a technical subject in you field then you will quickly be out of business.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Significant (and often numerous) personal side-projects over the years &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Remember his Radio-Flyer cart !&lt;/span&gt;&lt;span style="color: red;"&gt;Amazing how poorly you build your straw man!&amp;nbsp; If I applied this to mechanics, I would say "Has always had grease under his fingernails." or maybe "Has rebuilt many different Trucks starting in High school"&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Learns new technologies on his/her own &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Reads "Popular Mechanics" magazine. &lt;/span&gt;&lt;span style="color: red;"&gt;WTF! You really believe you can learn new technologies in "Popular Mechanics"?&amp;nbsp; There is no way you can run a successful company ... Ok, I'll continue to play along.&amp;nbsp; If I applied this to Truck mechanics, I would say "Keeps himself trained on the latest engine designs.&amp;nbsp; Learns about all popular engine modifications."&lt;/span&gt;&lt;br /&gt;
Opinionated about which technologies are better for various usages &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;He's keen on Brembo brakes.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;OK, I'll assume you know the difference between technologies and products, right?&amp;nbsp; This is where some of your analogy starts to break down. When was there a major new development in internal combustion engine design?&amp;nbsp; Basic diesel technology is how old?&lt;/span&gt;&lt;br /&gt;
Very uncomfortable about the idea of working with a technology he doesn't believe to be “right” &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Hates the old carburetor thing.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;So you think that a great diesel mechanic would love to get a job with you working on your "Water and Chicken poop powered" Trucks?&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Clearly smart, can have great conversations on a variety of topics &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;iTune, iPhone, Roberta Black, Iraq etc.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Another place that this analogy breaks down.&amp;nbsp; &amp;lt;Sigh&amp;gt; I'll just keep quiet on this one.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Started programming long before university/work &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;As a teenager repaired the toaster and changed the kitchen faucet.&lt;/span&gt;&lt;span style="color: red;"&gt;More like, knew what a torque wrench was before he started his first mechanics class.&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Has some hidden “icebergs”, large personal projects under the CV radar &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Wants to tinker with a jet ski watercraft. &lt;/span&gt;&lt;span style="color: red;"&gt;Close, more like, knows how to alter a jet ski engine to get a 50% power boost without damaging the engine.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Knowledge of a large variety of unrelated technologies (may not be on CV) &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Knows the difference between a CD, a regular DVD and a blue-ray DVD.&lt;/span&gt;&lt;span style="color: red;"&gt;If you are not being deliberately stupid, then &amp;lt;sigh&amp;gt; I’ll just keep quiet.&lt;/span&gt;&lt;br /&gt;
Negative indicators: &lt;br /&gt;
Programming is a day job &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Does truck service &amp;amp; repairs for a living.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;More like "Never turns a wrench unless he is paid to, and even then he bitched about it.&amp;nbsp; Why does he do it - its a paycheck."&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Don’t really want to “talk shop”, even when encouraged to &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Prefers to check the service manuals and do the job at hand.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Here you have is completely backward.&amp;nbsp; This is a prime example of "Learns new technologies on his/her own" above.&amp;nbsp; Instead, the correct example would be, "Never wants to learn the tips and tricks of other experts, but would rather scratch his ass and complain about the pay"&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Learns new technologies in company-sponsored courses &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;If I am going to send him to a GM training course he will gladly obliged.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Nope, more like "Hey Bob, we are going to expand and start working on FIAT's.&amp;nbsp; The Community College is offering night courses." and Bob replies, "Screw you boss, if you want me to go, it's during work hours, your paying and I'm not going to make up the time."&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Happy to work with whatever technology you’ve picked, “all technologies are good” &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;If we decide to buy GM trucks he will gladly work on them&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;GM trucks? No more like now your going to work on HVAC systems and by-god they had better be as good at is as they were at diesels.&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
Doesn’t seem too smart &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;He does not seem interested in iTune, iPhone, Roberta Black, Iraq etc.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Another place that this analogy breaks down.&amp;nbsp; &amp;lt;Sigh&amp;gt; I'll just keep quiet on this one.&lt;/span&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Started programming at university &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Learned how trucks are built, how to service them and had hands on practical experience under the supervision of master mechanics in an accredited school with his major in Volvo engine and control module diagnostic and repair and minor in Kenworth engine and transmission repair and has a "specialist" certification.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Another place that this analogy breaks down, but I'll give it a try.&amp;nbsp; First time the future mechanic ever heard of a ratchet wrench when he got the list of required tools for his new degree. If we were to equate a CS degree to a tech degree and certification, it the tech degree and certification would guarantee that the student has shown that he knows exactly what each tool is, how it is used and if necessary, how to make one from scratch.&lt;/span&gt;&amp;nbsp; &lt;br /&gt;
All programming experience is on the CV &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;Left out his alma-mater racing club where he is the chief mechanic.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;&amp;lt;sigh&amp;gt;&lt;/span&gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Focused mainly on one or two technology stacks (e.g. everything to do with developing a java application), with no experience outside of it &lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;He is focused on Volvo and Kenworth and has really no experience with Tatra, Zim, Hino, FIAT and other trucks.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: red;"&gt;Almost right, if the other types of trucks used different types of engines built with different materials and you needed a completely different set of tools that the mechanic would have no idea how to use.&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #4bacc6;"&gt;I don't know why, but I would hire the guy/gal with the negative indicators. Lucian&lt;/span&gt; &lt;br /&gt;
Well, Lucian, what your saying is that you would rather have a person that only learned what a wrench is after he started school, only does the work because he is getting a paycheck, doesn't even like talking about what he does, refuses to learn anything unless he is paid to do it and thinks that he is equally skilled at working on HVAC as he is on a diesel engine because "All technologies are good"?&lt;br /&gt;
Wow, I give your company 6 to 8 weeks before either the "mechanics" you hire starts your building on fire, or you are sued out of business because a "mechanic" put Mack parts on a Kenworth. (remember, all technology is good, right?)&lt;br /&gt;
This is why comparing a mechanic (a job where there is always only one way that things go together) and a programmer (a job where there are literally a million ways to do things.&amp;nbsp; Most of them the wrong way, but quite a few almost correct if not equally correct.)&lt;br /&gt;
When every Trucking company builds there own engines, changes the type of engine every couple of years, fixing the engine can be done 1000 different ways, and require the mechanics to use a whole different set of tools for each new type, then we can START to compare diesel truck mechanics to programmers.&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/mzoMDoFntik" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/6407569993611463311/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=6407569993611463311" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6407569993611463311?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6407569993611463311?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/mzoMDoFntik/im-58-out-of-6-programmer.html" title="I’m a 5.8 out of 6 programmer" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2012/02/im-58-out-of-6-programmer.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMCQ3Y7fCp7ImA9WhdbFk0.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-43312403711087971</id><published>2011-10-14T10:44:00.004-05:00</published><updated>2011-10-14T10:51:02.804-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-14T10:51:02.804-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C# 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="Oracle" /><category scheme="http://www.blogger.com/atom/ns#" term="LINQ" /><title>Merging multiple DataTables from different databases in parallel</title><content type="html">&lt;p&gt;In a previous post (&lt;a href="http://oldschooldotnet.blogspot.com/2008/10/linq-to-rescue.html"&gt;LINQ to the rescue!&lt;/a&gt;) I used linq to merge multiple DataTables, sort them and exclude duplicates.&lt;/p&gt;&lt;p&gt;But, what about filling those DataTables in the first place.&amp;nbsp; If, like I, you have multiple databases in production at work and need to show to the users a “database agnostic” view of their data, you need to query all those databases and merge the data. &lt;/p&gt;&lt;p&gt;Querying a large number of databases in serial is a slow process, but playing with threads seems … dangerous.&lt;/p&gt;&lt;p&gt;Well, with the new Parallel libraries, this becomes very simple to do, even with Oracle ( ;-) )&lt;/p&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; dbs = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color:#a31515"&gt;&amp;quot;Database1&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;Database2&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;Database3&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;Database4&amp;quot;&lt;/span&gt; };&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; dts = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;DataTable&lt;/span&gt;[dbs.Count];&lt;/li&gt;
&lt;li&gt;            &lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#2b91af"&gt;Parallel&lt;/span&gt;.For(0, dbs.Count, i =&amp;gt; LoadData(dbs[i], dts, i));&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; myTable = dts[0];&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;for&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;int&lt;/span&gt; i = 1; i &amp;lt; dbs.Count; i++) myTable.Merge(dts[i]);&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; dtLinqData = (&lt;span style="color:#0000ff"&gt;from&lt;/span&gt; MyRow &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; myTable.AsEnumerable()&lt;/li&gt;
&lt;li&gt;                    &lt;span style="color:#0000ff"&gt;orderby&lt;/span&gt; MyRow.Field&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color:#a31515"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;) &lt;span style="color:#0000ff"&gt;ascending&lt;/span&gt;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;                    &lt;span style="color:#0000ff"&gt;select&lt;/span&gt; MyRow).Distinct().CopyToDataTable();&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; LoadData(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; db, &lt;span style="color:#2b91af"&gt;DataTable&lt;/span&gt;[] dts, &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; index)&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#2b91af"&gt;DataTable&lt;/span&gt; returnValue = &lt;span style="color:#0000ff"&gt;null&lt;/span&gt;;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; connection = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;OracleConnection&lt;/span&gt;(GenerateConnectionString(db, &lt;span style="color:#a31515"&gt;&amp;quot;MyUserId&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515"&gt;&amp;quot;MyPassword&amp;quot;&lt;/span&gt;)))&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt;
&lt;li&gt;        &lt;span style="color:#0000ff"&gt;using&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; dataAdapter = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;OracleDataAdapter&lt;/span&gt;(&lt;span style="color:#a31515"&gt;&amp;quot;SELECT * FROM CUSTOMER&amp;quot;&lt;/span&gt;, connection))&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt;
&lt;li&gt;            returnValue = &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af"&gt;DataTable&lt;/span&gt;();&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;            dataAdapter.Fill(returnValue);&lt;/li&gt;
&lt;li&gt;        }&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;    dts[index] = returnValue;&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; GenerateConnectionString(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; instance, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; userId, &lt;span style="color:#0000ff"&gt;string&lt;/span&gt; password)&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;
&lt;li&gt;    &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#a31515"&gt;&amp;quot;data source = {0}; user id = {1}; password={2}; pooling=true; Connection Lifetime=60; Max Pool Size=50&amp;quot;&lt;/span&gt;, instance, userId, password);&lt;/li&gt;
&lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/OoBUx_N5uzQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/43312403711087971/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=43312403711087971" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/43312403711087971?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/43312403711087971?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/OoBUx_N5uzQ/merging-multiple-databases-in-parallel.html" title="Merging multiple DataTables from different databases in parallel" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/10/merging-multiple-databases-in-parallel.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUUDRXg5cSp7ImA9WhdTEEs.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-3245390523494736135</id><published>2011-07-07T13:27:00.000-05:00</published><updated>2011-07-07T13:27:54.629-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-07T13:27:54.629-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="computer science" /><title>Viewing the contents of a binary file in Visual Studio</title><content type="html">&lt;p&gt;The toolset included in Visual Studio is just massive.&amp;nbsp; I swear that I could use Visual Studio for a lifetime and I still would not have plumbed all its depths.&lt;/p&gt; &lt;p&gt;With that thought in mind, I just realized that I need not look for poor third party applications to look inside a binary file.&amp;nbsp; I can use my trusty IDE Swiss Army knife, Visual Studio.&lt;/p&gt; &lt;p&gt;There are two ways to view and edit a binary file in Visual Studio:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Simply open a file with the extension of .BIN  &lt;li&gt;After selecting the file in “Open –&amp;gt; FIle…” but before you click the “Open” button, instead click on the dropdown arrow on the “Open” button and select “Open With …”.&amp;nbsp; Then select “Binary Editor” from the list.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Either way you are then presented with the standard type of Binary File editor (3 columns, 1- The Offset, 2- The binary data &amp;amp; 3- The ASCII representation of the binary data).&lt;/p&gt; &lt;p&gt;In this editor, you can copy, paste, add, alter and delete bytes!&lt;/p&gt; &lt;p&gt;If only I had known this years ago!&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/xfsROubFJZE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/3245390523494736135/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=3245390523494736135" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3245390523494736135?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3245390523494736135?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/xfsROubFJZE/viewing-contents-of-binary-file-in.html" title="Viewing the contents of a binary file in Visual Studio" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/07/viewing-contents-of-binary-file-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QGSX0yfyp7ImA9WhZXE00.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-5480950578023249965</id><published>2011-05-01T22:02:00.001-05:00</published><updated>2011-05-01T22:02:08.397-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-01T22:02:08.397-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="computer problems" /><category scheme="http://www.blogger.com/atom/ns#" term="Oracle" /><category scheme="http://www.blogger.com/atom/ns#" term="computer science" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL" /><title>Oracle Greater Than/Less Than calculations in the select list</title><content type="html">&lt;p&gt;At work I recently had a simple need.&amp;#160; I had a table with data.&amp;#160; One of the columns is a date-time stamp – lets call it “Last_Login_Date”.&amp;#160; I wanted a “Boolean” column that was a false if the value was less than 60 days old and true if it was older than 60 days. (Yes, I know that Oracle does not have a Boolean data type so how about Zero (0) for false and One (1) for true, OK?)&lt;/p&gt;  &lt;p&gt;Ok, you would think that this would be simple: Just add the calculation in the select list, right? SYSDATE - Last_Login_Date &amp;gt; 60 AS Is_Old_Account.&lt;/p&gt;  &lt;p&gt;But no, nothing can be easy can it.&lt;/p&gt;  &lt;p&gt;With a fairly cryptic combination of Oracle commands I replicated what I wanted.&amp;#160; Here it is:&lt;/p&gt;  &lt;p&gt;DECODE(GREATEST(FLOOR(SYSDATE – NVL(LAST_LOGIN_DATE, TO_DATE('2000/01/01', 'yyyy/mm/dd')), 60), 60, 0, 1) AS IS_OLD_ACCOUNT&lt;/p&gt;  &lt;p&gt;And, here is the breakdown:&lt;/p&gt;  &lt;p&gt;First NVL incase the field had never been populated.&lt;/p&gt;  &lt;p&gt;Next, FLOOR to turn the difference into an integer (probably not needed, but during debugging, having an integer was easier to deal with.&lt;/p&gt;  &lt;p&gt;Then, GREATEST takes two values, the date difference and my max value.&amp;#160; So, if the date difference is less than 60, the&amp;#160; GREATEST function will return 60.&lt;/p&gt;  &lt;p&gt;Lastly DECODE will look at the value and say – If it is 60 return 0, else return 1.&amp;#160; &lt;/p&gt;  &lt;p&gt;So, the end result is if the value is 60 or less, the value is 0 else it is 1.&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;Note:&amp;#160; I could have ran the SQL twice with a JOIN command and add to the where clauses the filters of&amp;#160; SYSDATE - Last_Login_Date &amp;gt; 60 and SYSDATE - Last_Login_Date &amp;lt;= 60 and a dummy column in the select list added in out “Boolean” column IS_OLD ACCOUNT, but this did not seem very efficient.&lt;/font&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/SbdKQUVDofM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/5480950578023249965/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=5480950578023249965" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/5480950578023249965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/5480950578023249965?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/SbdKQUVDofM/oracle-greater-thanless-than.html" title="Oracle Greater Than/Less Than calculations in the select list" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/05/oracle-greater-thanless-than.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE4MQXw8eSp7ImA9WhZRGUU.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-2775909560005262839</id><published>2011-04-16T14:43:00.000-05:00</published><updated>2011-04-16T14:43:00.271-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-16T14:43:00.271-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="computer problems" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="computer science" /><title>Calculating the average of two angles (two bearings actually)</title><content type="html">&lt;p&gt;I recently needed to find the average of two angles.&amp;#160; I was programmatically creating a irregular polygon. I wanted to draw a small square at the points of the polygon, and I wanted the squares to be rotated to the average of the two lines that met at that point.&lt;/p&gt;  &lt;p&gt;The issue is that if you have two bearings, one at 20° and one at 350°, or one at 15° and one at 315°. If you just average the two numbers, you get 185°, but the more appropriate number is 5°.&amp;#160; This is called by some a “Wraparound issue” and if you search the web you will see lots of ways to solve this problem. Unfortunately they mostly try to solve it using a mathematical equation.&amp;#160; Now for people that have read this blog for awhile know that I am not allergic to math, but if we can solve this problem simply with an algorithm, we should … that’s what computers are for, right?&lt;/p&gt;  &lt;p&gt;So, here is my algorithm and the thought behind it.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;(Assumptions: 0 &amp;gt;= bearings &amp;lt; 360)&lt;/p&gt;  &lt;p&gt;First if you look at the difference between the two bearings, you will see that there are two possibilities, the actual difference is greater than 180° or less than 180°.&amp;#160; Since we are only concerned about “fixing” the issue when the difference is greater than 180°, that is the first thing we will check.&lt;/p&gt;  &lt;p&gt;We will call the smaller value bearing &lt;strong&gt;bearingA&lt;/strong&gt; and the larger value bearing &lt;strong&gt;bearingB&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Since we know that bearingB has a larger value and that the difference is greater than 180, so bearingB &amp;gt; 180.&lt;/p&gt;  &lt;p&gt;So, if we subtract 360&amp;#160; –&amp;#160; bearingB, then just add bearingA + bearingB and divide the total in half, we are 90% there.&lt;/p&gt;  &lt;p&gt;One last check. If the result is less than 0, we need to add 360 back in.&lt;/p&gt;  &lt;table border="1" cellspacing="0" cellpadding="12" width="434"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="189"&gt;&lt;u&gt;So, example #1&lt;/u&gt;           &lt;pre&gt;20° &amp;amp; 350°&lt;br /&gt;350 – 20 &amp;gt; 180&lt;br /&gt;350 – 360 = –10&lt;br /&gt;(–10 + 20) / 2 = 5&lt;br /&gt;5 ≥ 0&lt;br /&gt;= 5 °&lt;/pre&gt;&lt;br /&gt;      &lt;/td&gt;&lt;br /&gt;&lt;br /&gt;      &lt;td valign="top" width="243"&gt;&lt;u&gt;So, example #2&lt;/u&gt; &lt;br /&gt;&lt;br /&gt;        &lt;pre&gt;15° &amp;amp; 315°&lt;br /&gt;315 – 15 &amp;gt; 180&lt;br /&gt;315 – 360 = –45&lt;br /&gt;(-45 + 15) / 2 = –30&lt;br /&gt;–30 &amp;lt; 0–30 + 360 = 354°&lt;/pre&gt;&lt;br /&gt;      &lt;/td&gt;&lt;br /&gt;    &lt;/tr&gt;&lt;br /&gt;  &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;And here is the code:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;double&lt;/span&gt; GetAverageBearing(&lt;span style="color:#0000ff"&gt;double&lt;/span&gt; bearingA, &lt;span style="color:#0000ff"&gt;double&lt;/span&gt; bearingB)&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt;&lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (bearingA &amp;gt; bearingB)&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; temp = bearingA;&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;                bearingA = bearingB;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                bearingB = temp;&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            }&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (bearingB - bearingA &amp;gt; 180) bearingB -= 360;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; finalBearing = (bearingB + bearingA)/2;&lt;/li&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (finalBearing &amp;lt; 0) finalBearing += 360;&lt;/li&gt;&lt;li&gt;            &lt;/li&gt;&lt;li style="background: #f3f3f3"&gt;            &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; finalBearing;&lt;/li&gt;&lt;li&gt;        }&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/sSizZfPsUSA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/2775909560005262839/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=2775909560005262839" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2775909560005262839?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2775909560005262839?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/sSizZfPsUSA/calculating-average-of-two-angles-two.html" title="Calculating the average of two angles (two bearings actually)" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/04/calculating-average-of-two-angles-two.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MESHc4fCp7ImA9WhZRE0U.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-3062253920477984312</id><published>2011-04-09T16:42:00.000-05:00</published><updated>2011-04-09T16:43:29.934-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-09T16:43:29.934-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C++/cli" /><category scheme="http://www.blogger.com/atom/ns#" term="IronPython" /><title>Scripting C++/cli with IronPython (Visual Studio 2008 &amp; IronPython 2.6.1)</title><content type="html">&lt;p&gt;Even though there has been a lot of talk about IronPython, there has been very little info about how to use it with C++/cli.&amp;#160; I’ve actually found posts claiming that it is not possible to use IronPython with C++/cli.&lt;/p&gt;  &lt;p&gt;Well, it is possible and easy, once you have a working example.&amp;#160; If, not then … well, lets just hope your hair will grow back.&lt;/p&gt;  &lt;p&gt;Ok, I’m never one to take the easy way out, but I started by creating a C# dll that called my IronPython script and then called the C# dll from C++/cli.&amp;#160; That worked but seemed overly complicated.&amp;#160; If you do not mind a middleman then I guess it is ok, but if you want to go straight from C++/cli to IronPython, read on.&lt;/p&gt;  &lt;p&gt;When I first tried to write a call to an IronPython script from&amp;#160; C++/cli, I tried a direct conversion of C# code into C++/cli code.&amp;#160; That didn’t work, so I then tried using RedGate’s .Net Reflector and the &lt;a href="http://www.sandpapersoftware.com/Main/Reflector.html"&gt;C++/cli add-in for .Net Reflector&lt;/a&gt;.&amp;#160; This got me 70% there.&amp;#160; Combining both with some trial and error got me the rest of the way.&amp;#160; &lt;/p&gt;  &lt;p&gt;Funny, but when you look at the code, it seems so simple – yet getting there was not easy.&lt;/p&gt;  &lt;p&gt;So, the following snippet shows a simple usage of IronPython as a scripting language.&amp;#160; It takes the first parameter passed in prints it to the console, passes it to the IronPython script: ipyStrings.ipy, then prints to the console the value of the same parameter that was passed back.&amp;#160; The IronPython code takes the string, prints it, reverses it, then sends it back.&lt;/p&gt;  &lt;p&gt;C++/cli code:&lt;/p&gt;  &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;   &lt;div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px"&gt;Code Snippet&lt;/div&gt;    &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;     &lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #ffffff; padding-top: 0px"&gt;       &lt;li&gt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; main(&lt;span style="color: #0000ff"&gt;array&lt;/span&gt;&amp;lt;System::String ^&amp;gt; ^args) &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;{ &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;try&lt;/span&gt; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160; { &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt;(args-&amp;gt;Length&amp;gt;0) &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; String^ filename = &lt;span style="color: #a31515"&gt;&amp;quot;ipyStrings&amp;quot;&lt;/span&gt;; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; String^ path = Assembly::GetExecutingAssembly()-&amp;gt;Location; &lt;/li&gt;        &lt;li&gt;&amp;#160; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ScriptEngine^ engine = Python::CreateEngine(); &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ScriptScope^ scope = engine-&amp;gt;CreateScope(); &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ScriptSource^ source = engine-&amp;gt;CreateScriptSourceFromFile &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; (String::Concat(Path::GetDirectoryName(path), &lt;span style="color: #a31515"&gt;&amp;quot;\\&amp;quot;&lt;/span&gt;, filename, &lt;span style="color: #a31515"&gt;&amp;quot;.ipy&amp;quot;&lt;/span&gt;)); &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console::WriteLine(args[0]); &lt;/li&gt;        &lt;li&gt;&amp;#160; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; scope-&amp;gt;SetVariable(&lt;span style="color: #a31515"&gt;&amp;quot;passedArgs&amp;quot;&lt;/span&gt;, args[0]);&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; source-&amp;gt;Execute(scope); &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console::WriteLine(scope-&amp;gt;GetVariable&amp;lt;String ^&amp;gt;(&lt;span style="color: #a31515"&gt;&amp;quot;passedArgs&amp;quot;&lt;/span&gt;)); &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt;(Exception ^e) &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; { &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console::WriteLine(e-&amp;gt;ToString()); &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Console::ReadLine(); &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160; &lt;/li&gt;        &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 0; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;} &lt;/li&gt;     &lt;/ol&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Python code:&lt;/p&gt;  &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;   &lt;div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px"&gt;Code Snippet&lt;/div&gt;    &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;     &lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #ffffff; padding-top: 0px"&gt;       &lt;li&gt;import clr &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;&amp;#160; &lt;/li&gt;        &lt;li&gt;print &lt;span style="color: #a31515"&gt;&amp;quot;Passed in: &amp;quot;&lt;/span&gt; + passedArgs &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;passedArgs = passedArgs[::-1] &lt;/li&gt;        &lt;li&gt;&amp;#160; &lt;/li&gt;        &lt;li style="background: #f3f3f3"&gt;print &lt;span style="color: #a31515"&gt;&amp;quot;Sending back: &amp;quot;&lt;/span&gt; + passedArgs &lt;/li&gt;     &lt;/ol&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/sCFfwnGdAYE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/3062253920477984312/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=3062253920477984312" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3062253920477984312?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3062253920477984312?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/sCFfwnGdAYE/scripting-ccli-with-ironpython-visual.html" title="Scripting C++/cli with IronPython (Visual Studio 2008 &amp;amp; IronPython 2.6.1)" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/04/scripting-ccli-with-ironpython-visual.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cESX46fSp7ImA9WhZREUQ.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-6811017108629581901</id><published>2011-04-07T12:37:00.001-05:00</published><updated>2011-04-07T12:56:48.015-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-07T12:56:48.015-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C# 4.0" /><category scheme="http://www.blogger.com/atom/ns#" term="games" /><category scheme="http://www.blogger.com/atom/ns#" term="graphics" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Random Numbers on a Bell Curve in C#</title><content type="html">&lt;p&gt;Have you ever wanted to generate some random numbers but with a distribution pattern other than the normal even pattern?&lt;/p&gt; &lt;p&gt;Well in a recent project I did.&amp;nbsp; I wanted a weighted distribution pattern that looked like a bell curve.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I looked around yes there were some answers, but most got a lot deeper into math than I wanted or needed.&amp;nbsp; I simply wanted to generate a number with the probability that it was in the center of the range be greater than the probability that it was on the edges – in other words, it fit on a Bell Curve.&lt;/p&gt; &lt;p&gt;I cannot credit what post where gave me the simple solution, or I would post a link.&amp;nbsp; Here is a simple Extension Method to the Random class.&amp;nbsp; &lt;/p&gt; &lt;p&gt;It takes two parameters: &lt;/p&gt; &lt;ol&gt; &lt;li&gt;Steps: How many numbers in each “Chunk” do you want.&amp;nbsp; If you want a number between 0 &amp;amp; 600 and set the Steps equal to 50, then the midpoint value (300) will be much more likely than 0 or 300.  &lt;li&gt;MaxValue: The possible range for the random number will be 0 to MaxValue - 1.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Now keep in mind that this is not mathematically perfect.&amp;nbsp; If you do not choose a step value that is a divisor of your MaxValue then you will not get the full range.&amp;nbsp; But, having said that, this is a great “Quick &amp;amp; Dirty” way to get a good approximation of a random bell curve.&lt;/p&gt; &lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt; &lt;div style="padding-bottom: 2px; padding-left: 5px; padding-right: 5px; font-family: verdana, tahoma, arial, sans-serif; background: #000080; color: #fff; font-weight: bold; padding-top: 2px"&gt;Code Snippet&lt;/div&gt; &lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt; &lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; background: #ffffff; padding-top: 0px"&gt; &lt;li&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;RandomExtender&lt;/span&gt;  &lt;li style="background: #f3f3f3"&gt;{  &lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; NormalNext(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Random&lt;/span&gt; rnd, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Steps, &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; MaxValue)  &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {  &lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; count = 0;  &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; val = 0;  &lt;li&gt;&amp;nbsp; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (Steps &amp;lt; 1) &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; 0;  &lt;li&gt;&amp;nbsp; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;while&lt;/span&gt; (++count * Steps &amp;lt;= MaxValue) val += rnd.Next(Steps);  &lt;li&gt;&amp;nbsp; &lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; val;  &lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }  &lt;li style="background: #f3f3f3"&gt;} &lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt; &lt;p&gt;Here is a picture of 20,000 random numbers with Steps = 50 &amp;amp; MaxValue = 600.&lt;/p&gt; &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_t6xxfboJxk0/TZ32WvePuAI/AAAAAAAAAEY/XjNnnSeUQa0/s1600-h/BellCurve%5B3%5D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="BellCurve" border="0" alt="BellCurve" src="http://lh5.ggpht.com/_t6xxfboJxk0/TZ32XKkTs-I/AAAAAAAAAEc/aoPF2MH_seM/BellCurve_thumb%5B1%5D.png?imgmax=800" width="339" height="182"&gt;&lt;/a&gt;&lt;/p&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/Lr1jyglp3KQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/6811017108629581901/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=6811017108629581901" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6811017108629581901?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6811017108629581901?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/Lr1jyglp3KQ/random-numbers-on-bell-curve.html" title="Random Numbers on a Bell Curve in C#" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_t6xxfboJxk0/TZ32XKkTs-I/AAAAAAAAAEc/aoPF2MH_seM/s72-c/BellCurve_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2011/04/random-numbers-on-bell-curve.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4GRXs-cCp7ImA9WxFaEU8.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-6133461467795551193</id><published>2010-07-12T09:59:00.004-05:00</published><updated>2010-07-14T12:35:24.558-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-14T12:35:24.558-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C++/cli" /><title>c++ dll error when using MD[d]</title><content type="html">It is possible for any programmer, even one that has been in the "trade" for a loooong time, to be an absolute idiot - especially when they are learning something new. Not always does hard learned skills help when trying something new.&lt;br /&gt;&lt;br /&gt;Take my latest gaff as an example. Now I've been coding C++/cli mixed mode dlls since 2005, but I'd taken some time off right before Windows 7 arrived. Well, it was time to get back into the saddle, so I started work on a long dormant project and got it to a Beta state.&lt;br /&gt;&lt;br /&gt;I rolled out the debug dll to my testers and when they tested it on Windows 7, Boom!.&lt;br /&gt;&lt;br /&gt;Ok, time for some research .... lots of time for research.&lt;br /&gt;&lt;br /&gt;Well, I finally found - that in a non-/cli C++ dll, I could use the /MT compiler switch and it would work just fine on XP and Win7. But if I used the /MD compiler switch, which is required to use C++/cli, it would still run on a clean XP install, but not on a clean Win7 install.&lt;br /&gt;&lt;br /&gt;Arrrgggg!&lt;br /&gt;&lt;br /&gt;After many posts on many different forums, I decided to try making a install package (which I've NEVER had to do before - its just a dll after all!) but Visual Studio pulled in two additional files, that it said were needed to run.&lt;br /&gt;&lt;br /&gt;Well - Success!! Sort of. But, I happily posted my results on the various forums. One reply (Thanks Peter) pointed out that they were Debug files and that it may be a licence issue if I were to disseminate them. &lt;br /&gt;&lt;br /&gt;That got me to wondering if this was all a Debug/Release mode issue.&lt;br /&gt; &lt;br /&gt;Well, it was.  I started with a new copy of my Win7 Virtual PC that also installs the C++ runtime files.&lt;br /&gt; &lt;br /&gt;I then pushed a debug version to it just to verify that we still had the issue.  Yep.&lt;br /&gt; &lt;br /&gt;Then I pushed a release version to it and viola!  It works.  Dumb, dumb, dumb!  &lt;Hitting head on wall&gt;&lt;br /&gt; &lt;br /&gt;Why do I make things so hard for myself?&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/NV87UR9C9g4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/6133461467795551193/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=6133461467795551193" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6133461467795551193?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6133461467795551193?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/NV87UR9C9g4/c-dll-error-when-using-mdd.html" title="c++ dll error when using MD[d]" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/07/c-dll-error-when-using-mdd.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0AMRXo4eCp7ImA9WxFbFU8.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-1463649293795654150</id><published>2010-07-07T11:19:00.004-05:00</published><updated>2010-07-07T11:56:24.430-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-07T11:56:24.430-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="C++/cli" /><title>C++/cli -&gt; calling c# dll -&gt; calling OpenFileDialog issue</title><content type="html">I write extensions to a Cartography program called Campaign Cartographer 3 (CC3 for short). It is sold by one of the most involved companies I have ever had the pleasure to be associated with &lt;a href="http://www.profantasy.com"&gt;ProFantasy&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To program an extension to CC3, you need to be able to write old school windows dlls. You remember the ones! They have a DllMain function? I saw that shudder, you do remember.&lt;br /&gt;&lt;br /&gt;Well, whenever I can I use C++/cli (the .net version of C++) and if the extension is very complicated, I do most of my coding in C# and reference the C# dll from C++/cli. You can mix and match plain old C++ and C++/cli (and C#) through IJW (Believe it or not, that stands for "It Just Works"). As a matter of fact all my newer extensions hook into C++/cli, even if I do not use it - I want it there just in case.&lt;br /&gt;&lt;br /&gt;Well, in my latest project, a self-contained wiki-like document reader/writer (hard to explain - maybe in a later post), I needed to call the standard .net openFileDialog and saveDileDialog controls.&lt;br /&gt;&lt;br /&gt;All of a sudden, I'm getting COM errors!?!? &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;'System.Threading.ThreadStateException' occurred in System.Windows.Forms.dll&lt;br /&gt;&lt;br /&gt;Additional information: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;OLE calls? How old an error is that!?&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;Well, it seems that if you try to call the .net file dialogs from C++/cli you need to do it from a STA Thread. But, since I cannot access the main thread, remember this is someone elses application - all I have access to is my DllMain. Well, after searching around and asking about how to deal with this error on StackOverflow.com - I got my answer, sort of.&lt;br /&gt;&lt;br /&gt;The helpful people over at StackOverflow pointed out that I needed to start my own thead as an STAThread. They also gave me advice on how to do this via COM.&lt;br /&gt;&lt;br /&gt;Well, I'm not adverse to admit that the amount of COM knowledge I have could be held in a teacup. But the Thread advice solved the problem. I just did it the C++/cli way!&lt;br /&gt;&lt;br /&gt;First you need to isolate the code you want to run into a class.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;ref class StaClass&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;void CallWiki() &lt;br /&gt;&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;WikiNotes::FrmWiki fw; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;fw.ShowDialog();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Then from my main C++/cli code, I just create a new thread and call "CallWiki"&lt;br /&gt;&lt;br /&gt;&lt;code&gt;StaClass wiki = gcnew StaClass;&lt;br /&gt;&lt;br /&gt;ThreadStart^ threadDelegate = gcnew ThreadStart(wiki, &amp;StaClass::CallWiki); &lt;br /&gt;Thread^ newThread = gcnew Thread(threadDelegate, 0); &lt;br /&gt;newThread-&gt;SetApartmentState(ApartmentState::STA); &lt;br /&gt;newThread-&gt;Start();&lt;/code&gt; &lt;br /&gt;&lt;br /&gt;Remember though, if you want to wait until your new thread finishes, like I did, then you can:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;while (!workerThread-&gt;IsAlive);&lt;br /&gt;regularThread-&gt;Join();&lt;br /&gt;&lt;/code&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/5k1BY3stm8k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/1463649293795654150/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=1463649293795654150" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1463649293795654150?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1463649293795654150?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/5k1BY3stm8k/ccli-calling-c-dll-calling.html" title="C++/cli -&gt; calling c# dll -&gt; calling OpenFileDialog issue" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/07/ccli-calling-c-dll-calling.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ICQXw-eyp7ImA9WxFUFUQ.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-7326090934267938051</id><published>2010-06-26T19:46:00.000-05:00</published><updated>2010-06-26T19:46:00.253-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-26T19:46:00.253-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Fixing "Random" Default Button Behavior (asp.net)</title><content type="html">Way back when I first started developing web applications, I quickly determined that you had to have the default button as the first submit button in the HTML markup.&lt;br /&gt;&lt;br /&gt;A recent trouble ticket at work detailed that the default button was behaving erratically. It seemed that it was working only every other time. Yet, the location of the button never changed, so how could that be?&lt;br /&gt;&lt;br /&gt;Here is a link of an example where I have recreated the issue.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.leesaunders.net/examples/defaultbutton/broken.aspx"&gt;Broken Default Button&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To recreate the broken behavior, set the focus in one of the textboxes or a radiobuton and then press the enter key.  The panel should minimize and a second panel should now become visible. click on the button in the upper right corner to re-expand the original panel and repeat the test.&lt;br /&gt;&lt;br /&gt;every time both panels are visible, the default button switches to the button in the lower panel.&lt;br /&gt;&lt;br /&gt;The fix is quite simple. Using asp.net 2.0 or higher simply add this one line to the Page_Load function: Page.Form.DefaultButton = "Button ID";&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.leesaunders.net/examples/defaultbutton/fixed.aspx"&gt;Fixed Default Button&lt;/a&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/SdvBUFxi49c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/7326090934267938051/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=7326090934267938051" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/7326090934267938051?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/7326090934267938051?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/SdvBUFxi49c/fixing-random-default-button-behavior.html" title="Fixing &quot;Random&quot; Default Button Behavior (asp.net)" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/06/fixing-random-default-button-behavior.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IEQX87fip7ImA9WxFUEUU.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-1253272064575933002</id><published>2010-06-22T00:45:00.000-05:00</published><updated>2010-06-22T00:45:00.106-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-22T00:45:00.106-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C# 4.0" /><title>Dynamic type simplifies returning an anonymous type from a function</title><content type="html">Ever since Microsoft added anonymous types to C#, I've tried to use them in the manner that Microsoft themselves described: "Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type."&lt;br /&gt;&lt;br /&gt;And, it seemed to me that one of the best uses for one of these "temporary" objects is as a return type from a function. Yet, Microsoft expressly designed anonymous types to not be usable as a return type. Sure, you could have the return type as Object, but then you could not cast it back as the type because it is "anonymous".&lt;br /&gt;&lt;br /&gt;Here is a &lt;a href="http://tomasp.net/blog/cannot-return-anonymous-type-from-method.aspx"&gt;Blog Post&lt;/a&gt; the explains how to return an anonymous type using a casting function.&lt;br /&gt;&lt;br /&gt;Now though it is much simpler. All you need to do is set the return value to "dynamic". Since the dynamic type is determined at run time instead of compile time, compiler type checking is bypassed. At run time, when dynamic variables are referenced, they then have their methods and properties verified. So you can, in code, reference a property without having the compiler knowing if the type actually has the property.&lt;br /&gt;&lt;br /&gt;One caveat: This will only work within the same assembly. From a design standpoint, this makes sense. Why pass along an anonymous type between assemblies? It just does not make any sense. Inside a single assembly it is local and you are in full control, but between assemblies? You never know who is going to use it. You cannot assume that they would have any idea what is being returned.&lt;br /&gt;&lt;br /&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;br /&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="background: #ddd; overflow: auto"&gt;&lt;br /&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;[] args)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt; &lt;span style="color:#0000ff"&gt;var&lt;/span&gt; d = ReturnAnonamoustype();&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt; &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.WriteLine(d.Name);&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt; &lt;span style="color:#2b91af"&gt;Console&lt;/span&gt;.Read();&lt;/li&gt;&lt;br /&gt;&lt;li&gt;}&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff"&gt;dynamic&lt;/span&gt; ReturnAnonamoustype()&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff"&gt;new&lt;/span&gt; { Name = &lt;span style="color:#a31515"&gt;&amp;quot;Bob&amp;quot;&lt;/span&gt;, Age = 50 };&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/7wu32l5SIvI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/1253272064575933002/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=1253272064575933002" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1253272064575933002?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1253272064575933002?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/7wu32l5SIvI/dynamic-type-simplifies-returning.html" title="Dynamic type simplifies returning an anonymous type from a function" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/06/dynamic-type-simplifies-returning.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkMEQHw_fCp7ImA9WxFVGEU.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-1093183113450938667</id><published>2010-06-18T12:00:00.000-05:00</published><updated>2010-06-18T12:00:01.244-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-18T12:00:01.244-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Returning a string array to Javascript from Sliverlight</title><content type="html">This took a lot of trial and error, but I finally figured out how to return to Javascript a string array.  There where many different examples out on the web to call Javascript, passing a string array.  But, no examples had Javascript calling a Silverlight function with a string array as the return value.&lt;br /&gt;&lt;br /&gt;I first tried the direct approach:&lt;br /&gt;&lt;br /&gt;javascript:&lt;br /&gt;&lt;code&gt;&lt;pre&gt;function TalkToSilverlight(data) {&lt;br /&gt;    var control = document.getElementById("silverlightControl");  &lt;br /&gt;    var myStringArray = control.Content.Page.ReturningStringArray();&lt;br /&gt;    alert('length = ' + myStringArray.length + " : Value of First Element = " + myStringArray[0]);&lt;br /&gt;}&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Silverlight C#&lt;br /&gt;&lt;code&gt;&lt;pre&gt;public App()&lt;br /&gt;{&lt;br /&gt;    HtmlPage.RegisterScriptableObject("Page", this);&lt;br /&gt;    //The rest I've elided&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;[ScriptableMember]&lt;br /&gt;public string[] ReturningStringArray() &lt;br /&gt;{&lt;br /&gt;    return new [] { "e", "i", "e", "i", "o" };&lt;br /&gt;}&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Well to make a long story short, a small little mention of the IList interface on MSDN was the key, all I "needed" to do (as opposed to all the changes I tried) was change the return value from string[] to IList&lt;string&gt;.&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/lGVyRvSXkFw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/1093183113450938667/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=1093183113450938667" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1093183113450938667?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1093183113450938667?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/lGVyRvSXkFw/returning-string-array-to-javascript.html" title="Returning a string array to Javascript from Sliverlight" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/06/returning-string-array-to-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIBSHszfSp7ImA9WxFVE0Q.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-6196220665619407643</id><published>2010-06-12T19:41:00.003-05:00</published><updated>2010-06-12T19:55:59.585-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-12T19:55:59.585-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Free Template" /><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><title>Serendipity strikes again</title><content type="html">Can you believe it? After working my free asp.net template example and learning how to take a free web template and integrating it into asp.net, I acquired quite a few skills.&lt;br /&gt;&lt;br /&gt;And now the company that I work for has started to work on a new web offering and for the first time decided to use an outside company to do the web UI design. They delivered HTML, CSS and images. So, now I am doing professionally exactly what I did previously for fun.&lt;br /&gt;&lt;br /&gt;It is almost as if I was practicing for my current task. If that is not Serendipity, then I do not know what is.&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/IcsBSR7BeXs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/6196220665619407643/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=6196220665619407643" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6196220665619407643?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6196220665619407643?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/IcsBSR7BeXs/serendipity-strikes-again.html" title="Serendipity strikes again" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/06/serendipity-strikes-again.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4NQns_cCp7ImA9WxFXE0o.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-3000329665846933007</id><published>2010-05-20T10:52:00.003-05:00</published><updated>2010-05-20T10:56:33.548-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-20T10:56:33.548-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="1and1" /><category scheme="http://www.blogger.com/atom/ns#" term="GoDaddy" /><title>Closing Down 1and1, Finally!</title><content type="html">Warning!  I am finally moving my last domain, leesaunders.net, to GoDaddy.  I've waited this long because this domain hosts all my examples and I wanted to spare everyone from the pain as long as possible.&lt;br /&gt;&lt;br /&gt;Well, last night the domain was transfered to GoDaddy and will be down until GoDaddy can bring it back up in my new hosting package.&lt;br /&gt;&lt;br /&gt;Sorry for the blackout - but, it is all for the best.&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/T98A-4bELoI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/3000329665846933007/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=3000329665846933007" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3000329665846933007?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3000329665846933007?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/T98A-4bELoI/closing-down-1and1-finally.html" title="Closing Down 1and1, Finally!" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/05/closing-down-1and1-finally.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAGQXozfip7ImA9WxFQF0w.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-8863760611800334342</id><published>2010-05-12T19:35:00.003-05:00</published><updated>2010-05-12T20:05:20.486-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-12T20:05:20.486-05:00</app:edited><title>Is UI or AI more important in board game programming?</title><content type="html">Board games with a great UI with such a poor AI that you can always win with half your brain tied behind your back. Or, Board games with a great AI with such a poor UI that it is almost physically painful to play.&lt;br /&gt;&lt;br /&gt;We've all seen both. &lt;br /&gt;&lt;br /&gt;We've all played both.&lt;br /&gt;&lt;br /&gt;But what about the great/mediocre combinations? Where should developers spend their time? Perfecting the AI or the UI?&lt;br /&gt;&lt;br /&gt;Obviously, (from all the professionally produced board game programs I purchased over the years) the UI sells units. &lt;br /&gt;&lt;br /&gt;But, it is the AI keeps you playing. And its the AI that convinces me to buy when the program can be downloaded for a demo. I just recently experienced that with &lt;br /&gt;&lt;a href="http://railgamefans.com/ebp/index.htm"&gt;Empire Builder Pronto&lt;/a&gt;. The UI is mediocre ... to be kind. &lt;br /&gt;&lt;br /&gt;But the UI! Wow, I have not been able to beat the AI yet and that is why I plunked down the cash to buy the game.&lt;br /&gt;&lt;br /&gt;So, all you board game programmers out their: make sure the UI is playable, but make your AI as tough as you possibly can!&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/6mSTjIo3VmM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/8863760611800334342/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=8863760611800334342" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/8863760611800334342?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/8863760611800334342?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/6mSTjIo3VmM/is-ui-or-ai-more-important-in-board.html" title="Is UI or AI more important in board game programming?" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/05/is-ui-or-ai-more-important-in-board.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIEQ3w5fSp7ImA9WxBWE0k.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-1172056464677579045</id><published>2010-02-04T22:35:00.004-06:00</published><updated>2010-02-04T22:35:02.225-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-04T22:35:02.225-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>ASP.Net - Multiple Bin Folders support a plug-in website</title><content type="html">It was way back in 2001 when I was tasked at my company to implement our internal web application in ASP.Net. This site not only reported on most of the company's critical functions but also contained very complex data management screens. The sheer size of the site precluded it from being in a single dot net solution.&lt;br /&gt;&lt;br /&gt;So, after many hours of searching the Internet in vain for a solution, I finally started to experiment on my own. I discovered that any project could be added to the site by copying the compiled DLLs into the sites bin directory. This works, but it is not the most elegant solution.&lt;br /&gt;&lt;br /&gt;Well, many years to late, at least for the company site, I've discovered a much more elegant solution. (And when I say I've discovered it, I mean that I've finally found the information on the internet :-))&lt;br /&gt;&lt;br /&gt;Here is the link to the original information:&lt;br /&gt;&lt;a href="http://www.hanselman.com/blog/PermaLink.aspx?guid=4d0ef4fb-f8ae-4355-a658-3c0432c98dbe"&gt;http://www.hanselman.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This post refers to ASP.Net 1.1, but I've taken the time to verify that this still does work in ASP.Net 3.5.&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/iroe6Np41uQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/1172056464677579045/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=1172056464677579045" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1172056464677579045?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/1172056464677579045?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/iroe6Np41uQ/aspnet-multiple-bin-folders-support.html" title="ASP.Net - Multiple Bin Folders support a plug-in website" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/02/aspnet-multiple-bin-folders-support.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUAQXw_cCp7ImA9WxBXGEQ.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-5466430796715475893</id><published>2010-01-30T16:24:00.004-06:00</published><updated>2010-01-30T16:24:00.248-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-30T16:24:00.248-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="computer science" /><title>StrSpn &amp; StrCSpn in C#</title><content type="html">After converting the c/c++ string tokenizing command strtok to c#, I thought I would look around to see there were any other interesting string commands in c/c++ that had not been integrated into c#.  What I found was strspn and strcspn.&lt;br /&gt;&lt;br /&gt;strspn (String Span) Returns the length of the longest substring that begins at the start of the string and consists only of the characters found in the supplied character array.&lt;br /&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;br /&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;br /&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; strspn(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; InputString, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;[] Mask)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; count = 0;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; c &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; InputString)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (!Mask.Contains(c)) &lt;span style="color:#0000ff"&gt;break&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        count++;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; count;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;strcspn (String Complement Span) Returns the length of the longest substring that begins at the start of the string and contains none of the characters found in the supplied character array.&lt;br /&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;br /&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;br /&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; strcspn(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; InputString, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;[] Mask)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;    {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff"&gt;int&lt;/span&gt; count = 0;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; c &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; InputString)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;        {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            &lt;span style="color:#0000ff"&gt;if&lt;/span&gt; (Mask.Contains(c)) &lt;span style="color:#0000ff"&gt;break&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            count++;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;        }&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; count;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;    }&lt;/li&gt;&lt;br /&gt;&lt;li&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/Y2R8X3Jpz7M" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/5466430796715475893/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=5466430796715475893" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/5466430796715475893?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/5466430796715475893?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/Y2R8X3Jpz7M/strspn-strcspn-in-c.html" title="StrSpn &amp; StrCSpn in C#" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/strspn-strcspn-in-c.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUcCQX88fyp7ImA9WxBXFEo.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-4836419141005898769</id><published>2010-01-25T20:31:00.004-06:00</published><updated>2010-01-25T20:31:00.177-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-25T20:31:00.177-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="computer problems" /><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>C# TechTip #1 Using MaxLength as AutoTab</title><content type="html">So, for all those old VB6 programmers out there: Remember The Visual Basic Programmers Journal TechTip publications.&lt;br /&gt;&lt;br /&gt;For me, those pamphlets where the most eagerly waited part of my VBPJ publication. Here are the links to PDF versions.&lt;br /&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip1.pdf"&gt;VBPJ TechTips #1&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip2.pdf"&gt;VBPJ TechTips #2&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip3.pdf"&gt;VBPJ TechTips #3&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip4.pdf"&gt;VBPJ TechTips #4&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip5.pdf"&gt;VBPJ TechTips #5&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip6.pdf"&gt;VBPJ TechTips #6&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip7.pdf"&gt;VBPJ TechTips #7&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip8.pdf"&gt;VBPJ TechTips #8&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip9.pdf"&gt;VBPJ TechTips #9&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip10.pdf"&gt;VBPJ TechTips #10&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip11.pdf"&gt;VBPJ TechTips #11&lt;/A&gt;&lt;br /&gt;&lt;A href="http://vb.mvps.org/articles/techtips/techtip12.pdf"&gt;VBPJ TechTips #12&lt;/A&gt;&lt;br /&gt;&lt;br /&gt;I learned sooooo much from these. The loss of these publications is just one of the reasons that VSM is just a shadow of VBPJ. Just for a walk through memory lane I read through some of them, seeing if any of them would apply to C# today. Most of the tips were not transferable, but a few could be.&lt;br /&gt;&lt;br /&gt;So, here is the first "New" C# TechTip: Originally by Karl E. Peterson&lt;br /&gt;&lt;br /&gt;How to add an AutoTab feature to textboxes that have a set MaxLength. Connect the textboxes' TextChanged Event to this function:&lt;br /&gt;&lt;br /&gt;&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;br /&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;br /&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff"&gt;void&lt;/span&gt; textBox_TextChanged(&lt;span style="color:#0000ff"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff"&gt;if&lt;/span&gt;((sender &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;TextBox&lt;/span&gt;).MaxLength == (sender &lt;span style="color:#0000ff"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af"&gt;TextBox&lt;/span&gt;).TextLength) &lt;span style="color:#2b91af"&gt;SendKeys&lt;/span&gt;.Send(&lt;span style="color:#a31515"&gt;&amp;quot;{TAB}&amp;quot;&lt;/span&gt;);&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Who knew that the Dot Net designers had included the SendKeys function!?!&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/_HrVS60GHN0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/4836419141005898769/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=4836419141005898769" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/4836419141005898769?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/4836419141005898769?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/_HrVS60GHN0/c-techtip-1-using-maxlength-as-autotab.html" title="C# TechTip #1 Using MaxLength as AutoTab" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/c-techtip-1-using-maxlength-as-autotab.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQEQX06cSp7ImA9WxBXEEk.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-2168318836612774724</id><published>2010-01-20T22:15:00.000-06:00</published><updated>2010-01-20T22:15:00.319-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-20T22:15:00.319-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="1and1" /><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Bye bye 1and1 - Hello GoDaddy!</title><content type="html">I'm done. I've put up with 1and1's broken ASP.Net implementation. GoDaddy is even cheaper! Well, as I go through this painful experience - I'll keep everyone updated!&lt;br /&gt;&lt;br /&gt;Now I can finally do all the things I've learned in ASP.Net 3.5. And, I'll be able to use 4.0 additions before I grow old!&lt;br /&gt;&lt;br /&gt;Thank you GoDaddy.&lt;br /&gt;&lt;br /&gt;And 1and1?  Dudes, it has been five years now and you still have not gotten a full implementation of ASP.Net 2.0 up and running?  Wow ...&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/ihDk9fnrVwE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/2168318836612774724/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=2168318836612774724" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2168318836612774724?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2168318836612774724?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/ihDk9fnrVwE/bye-bye-1and1-hello-godaddy.html" title="Bye bye 1and1 - Hello GoDaddy!" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/bye-bye-1and1-hello-godaddy.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAAQX08fyp7ImA9WxBQFkw.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-362648097493366758</id><published>2010-01-15T21:49:00.006-06:00</published><updated>2010-01-15T21:49:00.377-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-15T21:49:00.377-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Dynamically update Url Mappings in Web.Config</title><content type="html">One of the most useful yet underused additions to ASP.Net 2.0 was Url Mapping. This feature alone has caused a lot of noise in the blogsphere. Complaints range from the fact that you need an entry for every mapping to the fact that the mappings are not dynamic because they reside in the static web.config file.&lt;br /&gt;&lt;br /&gt;Well ... that is all true. It is also true that if you update web.config in code, the application object is restarted and users lose Session state.&lt;br /&gt;&lt;br /&gt;But, if Url Mappings is say, used for a standard blog webpage:&lt;br /&gt;&amp;nbsp;&amp;nbsp;A - How many entries are in a Blog? Even if we are talking a thousand or so entries eventually, will that few lines cause the ASP.Net engine problems? I wouldn't think so.&lt;br /&gt;&amp;nbsp;&amp;nbsp;B - How often would the webmaster be updating the Url Mappings? Once per posting. Even if the visitors loose Session - its not like it is happening every hour or so.&lt;br /&gt;&amp;nbsp;&amp;nbsp;C - What is a simple site doing with Session in the first place?&lt;br /&gt;&lt;br /&gt;Well, I'm adding Url Mapping to my personal website and I've got a page that when called will automatically update the Url Mappings in web.config from the database, but only when a new mapping is needed.&lt;br /&gt;&lt;br /&gt;And yes, I have session and viewstate shut off!&lt;br /&gt;&lt;div style="BORDER-BOTTOM: #000080 1px solid; BORDER-LEFT: #000080 1px solid; FONT-FAMILY: 'Courier New', Courier, Monospace; COLOR: #000; FONT-SIZE: 10pt; BORDER-TOP: #000080 1px solid; BORDER-RIGHT: #000080 1px solid"&gt;&lt;br /&gt;&lt;div style="PADDING-BOTTOM: 2px; PADDING-LEFT: 5px; PADDING-RIGHT: 5px; FONT-FAMILY: Verdana, Tahoma, Arial, sans-serif; BACKGROUND: #000080; COLOR: #fff; FONT-WEIGHT: bold; PADDING-TOP: 2px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="BACKGROUND: #ddd; MAX-HEIGHT: 300px; OVERFLOW: auto"&gt;&lt;br /&gt;&lt;ol style="PADDING-BOTTOM: 0px; MARGIN: 0px 0px 0px 2.5em; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; BACKGROUND: #ffffff; PADDING-TOP: 0px"&gt;&lt;br /&gt;&lt;li&gt;    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt; e)&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;    {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; config = &lt;span style="color:#2b91af;"&gt;WebConfigurationManager&lt;/span&gt;.OpenWebConfiguration(Request.ApplicationPath);&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;        &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; section = (&lt;span style="color:#2b91af;"&gt;UrlMappingsSection&lt;/span&gt;)config.GetSection(&lt;span style="color:#a31515;"&gt;"system.web/urlMappings"&lt;/span&gt;);&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;        &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; catArray = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ArrayList&lt;/span&gt;();&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; arcArray = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ArrayList&lt;/span&gt;();&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; AnyChanges = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; bd &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;BaseData&lt;/span&gt;.BlogDataList)&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;        {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; strCategory &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; bd.Categories)&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;            {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!catArray.Contains(strCategory) &amp;amp;&amp;amp; !section.UrlMappings.AllKeys.Contains(&lt;span style="color:#a31515;"&gt;"~/"&lt;/span&gt; + strCategory))&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;                {&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                    catArray.Add(strCategory);&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;                    section.UrlMappings.Add(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;UrlMapping&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;"~/"&lt;/span&gt; + strCategory, &lt;span style="color:#a31515;"&gt;"~/Default.aspx?Category="&lt;/span&gt; + strCategory));&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                    AnyChanges = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;                }                &lt;/li&gt;&lt;br /&gt;&lt;li&gt;            }&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; strEntryDate = bd.EntryDate.ToString(&lt;span style="color:#a31515;"&gt;"MMMM yyyy"&lt;/span&gt;);&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!arcArray.Contains(strEntryDate) &amp;amp;&amp;amp; !section.UrlMappings.AllKeys.Contains(&lt;span style="color:#a31515;"&gt;"~/"&lt;/span&gt; + strEntryDate))&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            {&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;                arcArray.Add(strEntryDate);&lt;/li&gt;&lt;br /&gt;&lt;li&gt;                section.UrlMappings.Add(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;UrlMapping&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;"~/"&lt;/span&gt; + strEntryDate, &lt;span style="color:#a31515;"&gt;"~/Default.aspx?Archives="&lt;/span&gt; + strEntryDate));&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;                AnyChanges = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;            }&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        }&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (AnyChanges) config.Save();&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;        Response.Redirect(&lt;span style="color:#a31515;"&gt;"~/Default.aspx"&lt;/span&gt;);&lt;/li&gt;&lt;br /&gt;&lt;li style="BACKGROUND: #f3f3f3"&gt;    }&lt;/li&gt;&lt;br /&gt;&lt;li&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/_R1aqJe1wFs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/362648097493366758/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=362648097493366758" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/362648097493366758?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/362648097493366758?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/_R1aqJe1wFs/dynamically-update-url-mappings-in.html" title="Dynamically update Url Mappings in Web.Config" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/dynamically-update-url-mappings-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QMQXk8eyp7ImA9WxBQEUs.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-2227016391334420085</id><published>2010-01-10T18:23:00.002-06:00</published><updated>2010-01-10T18:23:00.773-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-10T18:23:00.773-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><title>Nearly Free Dot Net Books at Amazon</title><content type="html">I eagerly await the time of arrival. Like a kid in a candy store, I make plans on what I want. &lt;br /&gt;&lt;br /&gt;No, I'm not talking about my Birthday or another Christmas so soon. No, I'm eagerly awaiting Visual Studio 2010 and the update to C# and the Dot Net Framework. But, not for the reasons you might think.&lt;br /&gt;&lt;br /&gt;Hard on the heals of a new Visual Studio release is a flood of new Dot Net Books that are updated for the new release. And with that, all the previous release versions are going to be marked down. If history is any indicator, marked almost to the point of being free.&lt;br /&gt;&lt;br /&gt;If you do not believe me, search for ... say .... ASP.Net 2.0 (i.e. Visual Studio 2005) and you will find hoards of books for less that a dollar (Plus 3.99 shipping).&lt;br /&gt;&lt;br /&gt;Soon after VS2005 arrived I purchased over $1,000 dollars of 1.1 books (Cover Price) for $107 dollars!&lt;br /&gt;&lt;br /&gt;But Wait! Why would you want OLD info? Well, new versions add to, but does not alter the Framework, and the framework is so vast that there are always parts that we wanted to learn but didn't want to fork over the $50+ per book to learn.&lt;br /&gt;&lt;br /&gt;So, if your like me and your on a budget and want to learn as much as you can, then after March 22nd hit Amazon and load up on VS2008 books!&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/bw3GCL7bBVg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/2227016391334420085/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=2227016391334420085" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2227016391334420085?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/2227016391334420085?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/bw3GCL7bBVg/nearly-free-dot-net-books-at-amazon.html" title="Nearly Free Dot Net Books at Amazon" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/nearly-free-dot-net-books-at-amazon.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkYNRHsyfip7ImA9WxBQEkk.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-8803635069260556085</id><published>2010-01-05T21:02:00.007-06:00</published><updated>2010-01-11T14:03:15.596-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-11T14:03:15.596-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="computer science" /><title>C# Yields a better StrTok Command</title><content type="html">Here is another use of the Yield command which allows us to create looping functions that return a value for each iteration.  That is actually a great description of the StrTok command in C/C++.&lt;br /&gt;&lt;br /&gt;The C/C++ StrTok command takes two parameters, an input string and a string of delimiting characters.  After the first call to StrTok, the C/C++ programmer passes a null for the input string and StrTok returns the next Token in the original input string.  Sounds like an attempt to create an Enumerable function.  Unfortunately standard C/C++ does not have enumerable functions.&lt;br /&gt;&lt;br /&gt;Here is a C# enumerable function that you allows you to iterate through the tokens found in the input string.  This C# version takes two parameters as well, the input string and an array of delimiting charaters.&lt;br /&gt;&lt;br /&gt;Then using built-in power from the .net framework we:&lt;br /&gt;&lt;br /&gt;We split the string into a string array using the delimiting characters and we yield return each element in the string array where the element in the string arrays length is greater than 0.      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border: #000080 1px solid; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;&lt;br /&gt;&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Code Snippet&lt;/div&gt;&lt;br /&gt;&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;&lt;br /&gt;&lt;ol style="background: #ffffff; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;&lt;br /&gt;&lt;li&gt;&lt;br /&gt;&lt;span style="color:#0000ff"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff"&gt;string&lt;/span&gt;&amp;gt; StrToken(&lt;span style="color:#0000ff"&gt;string&lt;/span&gt; TokenizableString, &lt;span style="color:#0000ff"&gt;char&lt;/span&gt;[] Delimiters)&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff"&gt;var&lt;/span&gt; Token &lt;span style="color:#0000ff"&gt;in&lt;/span&gt; TokenizableString.Split(Delimiters, &lt;span style="color:#2b91af"&gt;StringSplitOptions&lt;/span&gt;.RemoveEmptyEntries))&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;return&lt;/span&gt; Token;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&amp;nbsp;&lt;/li&gt;&lt;br /&gt;&lt;li style="background: #f3f3f3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff"&gt;break&lt;/span&gt;;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;}&lt;/li&gt;&lt;br /&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/VFzGWxvk6KE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/8803635069260556085/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=8803635069260556085" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/8803635069260556085?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/8803635069260556085?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/VFzGWxvk6KE/c-yields-better-strtok-command.html" title="C# Yields a better StrTok Command" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2010/01/c-yields-better-strtok-command.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkIDQXk_eip7ImA9WxBTGU4.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-6799067674501568542</id><published>2009-12-15T21:20:00.002-06:00</published><updated>2009-12-15T21:36:10.742-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-15T21:36:10.742-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><category scheme="http://www.blogger.com/atom/ns#" term="programming" /><category scheme="http://www.blogger.com/atom/ns#" term="LINQ" /><title>PLINQO adds 'wow' to LINQ 'cool'</title><content type="html">Ok, I am the first to admit that I am firmly entrenched in the "Not Built Here" camp. Not only for controls but tools as well. The only tool I've let into Visual Studio for the longest time is Resharper.&lt;br /&gt;&lt;br /&gt;I love the power of LINQ but the LINQ to SQL ORM tools have never really thrilled me.&lt;br /&gt;&lt;br /&gt;Well, I have changed that rule and I've added &lt;a href="http://plinqo.com"&gt;PLINQO&lt;/a&gt;. I've looked at other tools for ORM, even LINQ to SQL and EF. Thus far I've never liked how the code that these tools generated, but the code that PLINQO generates is the BOMB! PLINQO is like LINQ on steroids, without the roid rage!&lt;br /&gt;&lt;br /&gt;Individual files for each table, Generated code does not overwrite custom changes, custom names .... the list just goes on and on.&lt;br /&gt;&lt;br /&gt;I could go on and on, but there is a fantastic 70 minute video tutorial &lt;a href="http://www.codesmithtools.com/video/plinqo-ddnug.html"&gt;here&lt;/a&gt; and I guaranty that within the first 10 minutes you will want to pause the video and download PLINQO!&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/LYqFfDDa2m0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/6799067674501568542/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=6799067674501568542" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6799067674501568542?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/6799067674501568542?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/LYqFfDDa2m0/plinqo-adds-wow-to-linq-cool.html" title="PLINQO adds 'wow' to LINQ 'cool'" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2009/12/plinqo-adds-wow-to-linq-cool.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkAMQno9fSp7ImA9WhZREUw.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-3852467230733141176</id><published>2009-11-30T20:07:00.024-06:00</published><updated>2011-04-06T14:39:43.465-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-04-06T14:39:43.465-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term="XAML" /><category scheme="http://www.blogger.com/atom/ns#" term="graphics" /><title>How to create your own Silverlight Cube Control similar to Telerik's Cube</title><content type="html">Well, as part of our lastest project, I needed to figure a way how to spin a widget.&lt;br&gt;&lt;br&gt;So, how do you rotate &lt;a href="http://oldschooldotnet.blogspot.com/search/label/widgets"&gt;widgets&lt;/a&gt; in an Asp.Net application? Well that question is fairly simple to answer - Silverlight!&lt;br&gt;&lt;br&gt;The next question is much harder: Buy or Build?&lt;br&gt;&lt;br&gt;After some searches I found two controls for sale: The &lt;a href="http://demos.telerik.com/silverlight/#Cube/FirstLook"&gt;Telerik Cube&lt;/a&gt; control and the &lt;a href="http://demo.componentone.com/Silverlight/ControlExplorer/#C1Cube/See%20it%20in%20action!"&gt;ComponentOne C1Cube&lt;/a&gt; control.&lt;br&gt;&lt;br&gt;So, first stop, download each and put them through the paces. I found a deal breaker for each control.&lt;br&gt;&lt;br&gt;We need to be able to minimize our widgets but both controls had problems with that:&lt;br&gt;- The Telerik control would resize but would apply a transform to 'Squash' the widget and according to the Telerik website FAQ, this behaviour can not be overridden.&lt;br&gt;- The Component one control 'Must' be in the shape of a cube. Ok, I know that sounds like a 'duh' point, but like I said, we need to minimize our widgets. But when I altered the height of the control to just the height of the header, the cubes' width was also adjusted.&lt;br&gt;&lt;br&gt;So, that left build - but there did not seem to be any examples of how to rotate a cube from side to side, on demand. I did find an example of a &lt;a href="http://www.silverlightbuzz.com/2009/06/16/creating-a-3d-cube-with-images-in-silverlight-3/"&gt;continuously spinning cube&lt;/a&gt;. With this example to decompose, I slowly taught myself the parameters and transformations that were needed to create the appearance of a cube spinning from one face to another.&lt;br&gt;&lt;br&gt;So, here is my demo of a rotating six sided cube. If you do not need to rotate to the top and the bottom, you can have sides of any height, as long as all the sides are of the same height. Plus, my example is not limited to four or six sides. This example allows for an unlimited number of sides!&lt;br&gt;&lt;br&gt;Now, there a couple of things that the professional controls do that my demo cannot. My code cannot free rotate and it also does not twist as it rotates to properly show a side. If you need these properties, you may want to go with the professional controls.&lt;br&gt;&lt;br&gt;&lt;a href="http://www.leesaunders.net/Main/Examples/Rotation3D/Rotation3DCode.zip"&gt;Here&lt;/a&gt; is the Visual Studio 2008/Silverlight 3 project.&lt;br&gt;&lt;br&gt;&lt;iframe height="420" src="http://www.leesaunders.net/Main/Examples/Rotation3D/TestPage.html" frameborder="0" width="420" scrolling="no" align="left"&gt;&lt;/iframe&gt;  &lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/gPD1LI0KSng" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/3852467230733141176/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=3852467230733141176" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3852467230733141176?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/3852467230733141176?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/gPD1LI0KSng/how-to-create-your-own-silverlight-cube.html" title="How to create your own Silverlight Cube Control similar to Telerik&amp;#39;s Cube" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2009/11/how-to-create-your-own-silverlight-cube.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEIMQX4-eCp7ImA9WxNbEEU.&quot;"><id>tag:blogger.com,1999:blog-6672560504141734407.post-7967147042666596877</id><published>2009-11-12T21:27:00.002-06:00</published><updated>2009-11-12T22:29:40.050-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-12T22:29:40.050-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="dot net" /><category scheme="http://www.blogger.com/atom/ns#" term="Free Template" /><category scheme="http://www.blogger.com/atom/ns#" term="asp.net" /><title>Personal Site Launched!</title><content type="html">Well, it has taken awhile but I've finally rolled out a personal website.  &lt;a href="http://www.leesaunders.net"&gt;LeeSaunders.net&lt;/a&gt; is a place that I can post about all things that interest me ... except dot net programming, of course!&lt;br /&gt;&lt;br /&gt;There is not much content as of yet, but the reason I am posting about it here is that I've used the asp.net web template that I created in a previous post.  So if you want to see a live site, not just a live example, then head out to &lt;a href="http://www.leesaunders.net"&gt;LeeSaunders.net&lt;/a&gt;!&lt;img src="http://feeds.feedburner.com/~r/TakingDotNetoldSchool/~4/SyXawDkJYOQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://oldschooldotnet.blogspot.com/feeds/7967147042666596877/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=6672560504141734407&amp;postID=7967147042666596877" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/7967147042666596877?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/6672560504141734407/posts/default/7967147042666596877?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/TakingDotNetoldSchool/~3/SyXawDkJYOQ/personal-site-launched.html" title="Personal Site Launched!" /><author><name>Lee Saunders</name><uri>http://www.blogger.com/profile/02660551995265335503</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://oldschooldotnet.blogspot.com/2009/11/personal-site-launched.html</feedburner:origLink></entry></feed>
