<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vince's Random, Tech-Related Thoughts</title>
	<atom:link href="http://vincebullinger.com/Blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://vincebullinger.com/Blog</link>
	<description>A Rarely Updated Technical Blog</description>
	<lastBuildDate>Sat, 14 Apr 2012 23:31:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>First 7-Digit Prime Palindrome in Pi?!?</title>
		<link>http://vincebullinger.com/Blog/?p=176</link>
		<comments>http://vincebullinger.com/Blog/?p=176#comments</comments>
		<pubDate>Sat, 14 Apr 2012 19:37:11 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Code Tips and Tricks]]></category>
		<category><![CDATA[Conferences]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=176</guid>
		<description><![CDATA[Today&#8217;s the first day of Twin Cities Code Camp 12. It&#8217;s been great so far, but I decided to make a separate blog post just for this one thing. While in line during registration, I noticed some people doing some recruiting. They wanted us to send an email to [The Answer to This Problem]@theirwebsite.com, basically. [...]]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s the first day of Twin Cities Code Camp 12. It&#8217;s been great so far, but I decided to make a separate blog post just for this one thing. While in line during registration, I noticed some people doing some recruiting. They wanted us to send an email to [The Answer to This Problem]@theirwebsite.com, basically. What was the problem?</p>
<p>What is the first seven-digit prime palindrome in pi? So, while looking at the digits of pi, what is the first sequence of seven of them that are both prime (not divisible by anything but one and itself) and a palindrome (the characters are the same both backwards and forwards).</p>
<p>Well, the way I am, I just wanted to solve it just to solve it. So I did (I think). Feel free to:</p>
<p>A) Tell me if I&#8217;m wrong and</p>
<p>B) Tell me if my code is suboptimal</p>
<p>My code takes about nine seconds to run on my machine. That sounds slow, but then again, it&#8217;s doing a LOT. But again: feel free to let me know if it&#8217;s not efficient. I&#8217;ll show blocks of code and explain them.</p>
<p>Here&#8217;s the beginning of the method that does all the work (it&#8217;s called on a button click. It fills in a text box with the answer):</p>
<p style="padding-left: 30px;">function GetEmailAddress()<br />
{</p>
<p style="padding-left: 60px;">var palindromes = [];<br />
var indexString;<br />
var reverseIndexString;<br />
var primePalindromes = [];<br />
var piIndices = [];<br />
var lowestIndex = 4294967295;<br />
var savedIndex = 0;</p>
<p>We&#8217;re going to have some palindromes, some prime palindromes, the indices of the locations of the prime palindromes within the digits of pi and a few placeholder variables along the way.</p>
<p style="padding-left: 30px;">// Make seven-digit palindromes instead of checking all seven-digit numbers<br />
// Get all three digit numbers, filter them, reverse them and plop one digit between the original and the reversed<br />
for (var index = 100; index &lt; 999; index++)<br />
{</p>
<p style="padding-left: 60px;">// If the FIRST digit is divisible by two, in a palindrome, obviously the LAST digit is, too, so skip it<br />
if(parseInt(index.toString()[0]) % 2 === 0)</p>
<p style="padding-left: 90px;">index += 100;</p>
<p style="padding-left: 60px;">indexString = index.toString();<br />
var reverseIndexString = indexString.split(&#8221;).reverse().join(&#8221;);<br />
for (var middleDigit = 0; middleDigit &lt; 10; middleDigit++)<br />
{</p>
<p style="padding-left: 90px;">palindromes.push(parseInt(indexString + middleDigit + reverseIndexString));</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 30px;">}</p>
<p>The point here is to find all the palindromes first instead of trying to find the prime numbers first. I think this filters it down from nine million numbers (seven digit numbers) to 5,000 (I didn&#8217;t check this). The way I do this is that I know we&#8217;re making seven-digit palindromes, right? So in reality, the first three digits are the same as the last three, just reversed. The middle digit doesn&#8217;t matter. So&#8230; just build three digit numbers, add any number and then reverse the original three numbers. While doing so, we can filter out anything that STARTS with an even number. Because, since it&#8217;s a palindrome, if it STARTS with an even number, it ENDS with an even number. No prime number does this. That&#8217;s why we jump from 200 to 300, from 400 to 500, etc. That brings us down to five hundred numbers (again, these are all guesses. I didn&#8217;t debug this code because it just worked right away). Multiply that by ten (one per middle digit, 0-9) and you get 5,000. Instead of testing 9,000,000 numbers for palindromes, we&#8217;re only testing 5,000. Next block of code:</p>
<p style="padding-left: 30px;">// Now we only have 5,000 numbers from a possible 9,000,000 if we just checked all seven-digit numbers<br />
// Find all the prime numbers<br />
for(var index = 0; index &lt; palindromes.length; index++)</p>
<p style="padding-left: 60px;">if(IsPrime(palindromes[index]))</p>
<p style="padding-left: 90px;">primePalindromes.push(palindromes[index]);</p>
<p>I run all of these through my IsPrime method (I&#8217;ll show it after this paragraph). I <em>tried</em> to cheat on this part, but every algorithm I found was extremely inefficient. So here&#8217;s mine, from scratch (all my code is):</p>
<p style="padding-left: 30px;">function IsPrime(number)<br />
{</p>
<p style="padding-left: 60px;">var middle = Math.floor(number / 2);<br />
// We can start from 3 because everything&#8217;s divisible by one and we know we don&#8217;t have any even numbers from previous filtering,<br />
// also allowing us to skip every other number<br />
for(var index = 3; index &lt;= middle; index += 2)</p>
<p style="padding-left: 90px;">if(number % index === 0)</p>
<p style="padding-left: 120px;">return false;</p>
<p style="padding-left: 60px;">return true;</p>
<p style="padding-left: 30px;">}</p>
<p>The algorithms I found were horrific. By comparison, most weren&#8217;t smart about where to start or stop evaluating. I started at three because everything&#8217;s divisible by one and I&#8217;ve done some filtering already to make sure I don&#8217;t have any even numbers like two. Also, I&#8217;m not doing a ++ in the third clause of my for loop. I&#8217;m doing += 2. I&#8217;m skipping the even numbers. The last bit of optimization is the immediate return of false if we find out it&#8217;s not a palindrome. For some weird reason, some algorithms just saved the value, <em>continued to check against all other possible multiples</em> and then returned the saved value.</p>
<p>The next bit of code was setting a pi variable&#8230; I&#8217;m not going to post it because it&#8217;s thousands and thousands of digits of pi. I put it in a string (don&#8217;t include &#8220;3.&#8221;) so I could do an indexOf on each of the prime numbers I found in the previous step within the pi string. So here&#8217;s the last block of code:</p>
<p style="padding-left: 30px;">// Find the first prime palindrome<br />
for(var index = 0; index &lt; primePalindromes.length; index++)<br />
{</p>
<p style="padding-left: 60px;">piIndices[index] = pi.indexOf(primePalindromes[index].toString());<br />
if(piIndices[index] &lt; lowestIndex &amp;&amp; piIndices[index] &gt; -1)<br />
{</p>
<p style="padding-left: 90px;">lowestIndex = piIndices[index];<br />
savedIndex = index;</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">document.getElementById(&#8216;emailAddress&#8217;).value = primePalindromes[savedIndex];</p>
<p>}</p>
<p>So here, we&#8217;re running through all the primePalindromes to find the index of each of them within the pi string. If it&#8217;s not -1 (meaning, it&#8217;s actually in the string), then I save its index if it&#8217;s lower than the last one I saved. After that, I populate the textbox with the value at this saved, lowest index. Here&#8217;s the little bit of HTML if you want to see this working for yourself (you&#8217;ll have to slap together all the bits of code &#8211; they&#8217;re just two Javascript methods, and you&#8217;ll need to set var pi = &#8216;[Many thousands of digits of pi]&#8216;;):</p>
<p style="padding-left: 30px;">&lt;input type=&#8217;text&#8217; id=&#8217;emailAddress&#8217; /&gt;<br />
&lt;input type=&#8217;button&#8217; onclick=&#8217;javascript:GetEmailAddress();&#8217; value=&#8217;Click me to get the answer&#8217; /&gt;</p>
<p>Again, let me know if I&#8217;m wrong or if you&#8217;ve got a way to optimize it. Mine took about nine seconds, consistently, on my machine.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D176&amp;title=First%207-Digit%20Prime%20Palindrome%20in%20Pi%3F%21%3F"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=176</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Twin Cities Code Camp 11 Wrap Up</title>
		<link>http://vincebullinger.com/Blog/?p=161</link>
		<comments>http://vincebullinger.com/Blog/?p=161#comments</comments>
		<pubDate>Mon, 10 Oct 2011 16:47:49 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Conferences]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=161</guid>
		<description><![CDATA[Conference season is really getting under way now. Two big events in a week and a half. This past weekend, I went to the eleventh installment of Twin Cities Code Camp. If you&#8217;ve never been to Code Camp, you really should consider going. They&#8217;re held twice a year: in April and October. They&#8217;re 100% free, [...]]]></description>
			<content:encoded><![CDATA[<p>Conference season is really getting under way now. Two big events in a week and a half. This past weekend, I went to the eleventh installment of <a title="Twin Cities Code Camp" href="http://www.twincitiescodecamp.com" target="_blank">Twin Cities Code Camp</a>. If you&#8217;ve never been to Code Camp, you really should consider going. They&#8217;re held twice a year: in April and October. They&#8217;re 100% free, and are held on the weekends, so you really don&#8217;t have an excuse not to go. I&#8217;ve gone to the Chippewa Valley Code Camp and the Iowa Code Camp, both decent drives, so it really doesn&#8217;t make a lot of sense to me when developers don&#8217;t put any effort into learning outside of what their boss forces them to learn.</p>
<p>The Twin Cities Code Camp is now a two-day conference! On the first day, I got things rolling by going to see <a title="Func-y?" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s39" target="_blank">Getting Func-y with C# and F#</a> with <a title="Keith Dahlby" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp32" target="_blank">Keith Dahlby</a>. Keith gives good, valuable talks, so I recommend going to sessions he gives. He started off by describing the basics of functional programming and then showed how we&#8217;re using a lot of functional concepts or ideas in C# anyway. LINQ was heavily discussed. Things kind of broke down at that point, with what was meant to be a short Q and A about the concepts turning into an actual debate about whether or not they&#8217;re even useful! There were two people actually arguing against LINQ! A small piece of me died. Their arguments were bad and amounted to &#8220;I don&#8217;t understand it, therefore it&#8217;s bad.&#8221; Or acting like changing or learning something new is a bad thing. After that finally washed over, Keith talked about why someone would then use F# instead of C#. He listed the following as reasons:</p>
<p>More sophisticated type inference<br />
Immutability by default<br />
Functional data structures<br />
Curried functions and partial application<br />
Computation expressions</p>
<p>The interesting part about that list is that I don&#8217;t see these as imperical facts as to how F# is better than C#. It seemed like Keith was just listing off some tenets of F#. Some of us actually don&#8217;t think immutability by default is a good thing, for example. I am known to use variables on occasion. Shocking, I know. I do recommend learning functional programming even if you never use it professionally. And Keith&#8217;s very knowledgeable on the subject, so this was a great talk to attend.</p>
<p>For the second talk, I went to <a title="HTML5 Graphics" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s37" target="_blank">HTML5 Graphics: Pretty Pictures for Practical Processes</a> by <a title="Jon Stonecash" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp31" target="_blank">Jon Stonecash</a>. I think Jon wrote a really nice library in C# for creating HTML5 graphics from scratch just for this talk! If he didn&#8217;t gank this from somewhere else, that&#8217;s really impressive. He went over how he was generating it all and it was very nicely done. He used it to show how you can write real, practical software for the &#8220;real world&#8221; instead of just making pretty pictures and crappy games, etc. His demo included what looked like tracking products through the order, packing, shipping process. Boxes of steps in the process had the number of items in their queue step, showed where they went, if they were rejected, etc. It certainly was a good example of how this can be used to visualize something in a meaningful manner. Jon&#8217;s delivery is interesting. He seems right at home at the University of Minnesota. He both sounds and looks like a college professor.</p>
<p>Next up, I went to <a title="Monads" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s27" target="_blank">Practical Monads in C#: Maybe&lt;T&gt;</a> by <a title="Jordan Terrell" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp23" target="_blank">Jordan Terrell</a>. I figured he&#8217;d start out by explaining <a title="Monads!" href="http://en.wikipedia.org/wiki/Monad_(functional_programming)" target="_blank">what a monad is</a>, but he actually did that late in his talk. Strange. Most of the talk was about his implementation of something called Maybe. It&#8217;s something used to represent zero or one value. It works with all .NET types, both value and reference, unlike the nullable types. I&#8217;m not going to describe it in detail, but if you&#8217;d like to learn more about it, you can do so <a title="Maybe?" href="http://wiki.jordanterrell.com/default.aspx?AspxAutoDetectCookieSupport=1" target="_blank">here</a>. It&#8217;s an interesting concept when being introduced to monads and kind of takes you further down the functional rabbit hole.</p>
<p>After that, I attended <a title="Metro" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s45" target="_blank">Building Metro-style applications for Windows 8</a> by <a title="Steve Peterson" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp38" target="_blank">Steve Peterson</a>. He&#8217;s a principal architect from Microsoft, so he had a lot of good content. He talked about a handful of interesting things. He mentioned that Visual Studio Designer is now going to share the core authoring UI with Expression Blend. He also brought up &#8220;Blend for HTML.&#8221; It&#8217;s built for Windows 8 applications, not web sites. I had to ask for clarification, if I had heard correctly. You really write HTML, JavaScript, etc. for Windows 8 applications. Very interesting. Other too-complex-to-discuss-here topics included: Client Hyper-V, WinRT asynchronous API design, GPU compute and C++ AMP. Also, <a title="async!" href="http://blogs.msdn.com/b/csharpfaq/archive/2010/10/28/async.aspx" target="_blank">the async keyword</a>!</p>
<p>For the last talk of the first day, I went to see <a title="Git!" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s38" target="_blank">Distributed Version Control: Attack of the Clones</a> by Keith Dahlby again. I wasn&#8217;t sure what to expect from this talk, but I knew it would be good as Keith was giving it. As he warned, it ended up being a bit of a rehash from a previous talk I had seen from him &#8211; git commands like rebase, cherry pick, stashes, reflog, bisect. Still valuable, but I didn&#8217;t learn a whole lot of new things to mention. He did bring up <a href="http://whygitisbetterthanx.com">whygitisbetterthanx.com</a>.</p>
<p>During the prize giveaway at the end of the first day, I won an XBox 360/Kinect package!</p>
<p>I started off the second day by going to see <a title="Kinect" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s7" target="_blank">Level-Up Your Win7 Kinect Apps</a> by <a title="Mike Hodnick" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp5" target="_blank">Mike Hodnick</a>. On the first day, there weren&#8217;t any real conflicts in which talks I wanted to see. Day two started off with a conflict. I also wanted to see Brian Gorman&#8217;s talk on design patterns. But I thought this would be too fun to let myself miss it. Mike has done a lot of Kinect development, making demo projects for Avtex, so he could really speak from experience. He discussed some of the major concerns into which he&#8217;s run. Background noise is a big issue in Kinect development. You have to figure out what to do with other people in the scene, for example. He also talked about how cursor control is easy but flawed. Cursor control is controlling a pointer or cursor with your hand. It&#8217;s more of an out-of-the-box solution, but it&#8217;s rough, says Mike. It behaves differently when you have an abnormal body size, it has cross-body problems and he just thinks it&#8217;s outdated. A better way, he suggested, would be to use voice commands. Another concern to consider is lighting. He said that an app that he wrote just did not work when they were outside. Pitch black poses no problems, though.</p>
<p>Mike&#8217;s talks are always fun, so I suggest checking them out when you can.</p>
<p>Why does everyone code on the fly? Don&#8217;t do it. You will always fail, no matter how awesome you are. Your code will fail and you will look dumb. I&#8217;ve said it before and I&#8217;ll say it again. Just don&#8217;t do it. Have all the code pre-written. We don&#8217;t want to watch you code anyway. This happened in several of the presentations that I attended.</p>
<p>After that, I went to see <a title="Knockout.JS" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s34" target="_blank">KnockoutJS: Web Development Bliss</a> with <a title="Judah Himango" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp29" target="_blank">Judah Himango</a>. Judah put <a title="Rage Comics" href="http://knowyourmeme.com/memes/rage-comics" target="_blank">rage comics</a> all over his slides. <a href="http://twitter.com/#!/vbullinger/status/123058551106187264" target="_blank">I had to let him know that this was ill-advised</a>. The <a title="All hail jQuery!" href="http://www.doxdesk.com/img/updates/20091116-so-large.gif" target="_blank">fake StackOverflow question</a> was funny, though.</p>
<p><a title="Highly recommended" href="http://knockoutjs.com/" target="_blank">Knockout.js</a>, Judah says, is basically data binding for your HTML. It can be used to employ MVVM for JavaScript. It seemed really slick. I had never looked into Knockout.js before (typed very sheepishly), but I was really enamored with a lot of the concepts. It follows the observable pattern and has functions that use observables, too.</p>
<p>I&#8217;m really sold on a lot of what Knockout brings to the table and will certainly be looking into it in the future.</p>
<p>Next, I went to <a title="HTML5 Canvas" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s25" target="_blank">Intro to HTML 5 Canvas</a> by <a title="Kevin Moot" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp21" target="_blank">Kevin Moot</a>. This was a really fun talk. Kevin had a nice looking presentation format (using HTML5, of course) and it was really entertaining. The canvas is a 2d surface for drawing shapes and bitmaps and a 3d surface for polygons and shaders. When talking about a canvas arc, he showed a picture to illustrate the concept. Above, it said &#8220;canvas arc.&#8221; Next to it was a picture of a woman in medieval battle gear. Above it, it said &#8220;Joan of Arc.&#8221;</p>
<p>Not funny, Kevin. Not funny.</p>
<p>He went through a ton of mini-demos showing how every little aspect of the HTML5 canvas worked. He showed a couple of cool things. He turned a jpg into a drawing on a canvas. He had a video playing and wired up a button to basically take a snapshot of the video and post it as an image to the canvas. Then, instead of taking a single snapshot, he had it take a snapshot every ten milliseconds. Well, that&#8217;s basically instant, so it looked like a video was playing on the canvas. The video had a green screen, so he washed away the green pixels and replaced it with an associated pixel from a different background image. It was actually really cool. He topped off the talk with an extremely silly demo of an old guy dancing in a video and being plastered like a wall paper onto the canvas with different effects applied to them, with a bouncing cat with what looked like a pop tart on its back, leaving a rainbow trail around him&#8230; yep, I described that accurately. His whole presentation is online. I suggest not using IE: <a href="http://moot-point.com/presentations/canvas-part1/index.html">http://moot-point.com/presentations/canvas-part1/index.html</a>. Use the left and right mouse buttons to navigate.</p>
<p>For the last presentation of Code Camp before my presentation, I went to <a href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Sessions.aspx#s35" target="_blank">Web Development with CoffeeScript and Sass</a> with <a title="Brian Hogan" href="http://www.twincitiescodecamp.com/TCCC/Fall2011/Speakers.aspx#sp12" target="_blank">Brian Hogan</a>. He&#8217;s literally <a href="http://pragprog.com/book/bhh5/html5-and-css3" target="_blank">written the book</a> on things like this, and I&#8217;d seen him present before, so I knew this would be a good talk. Now, I went into this talk expecting to hear a lot about what CoffeeScript was and learn a lot about it and this &#8220;Sass&#8221; thing was just a tiny add-in that really wasn&#8217;t going to be a big deal. Interestingly enough, while I liked CoffeeScript, the real take home for me was Sass! CoffeeScript is really simple to pick up and hit the ground running. There&#8217;s very little to learn. It&#8217;s more like an extension to JavaScript with some nice added bonuses. The &#8220;fat arrow,&#8221; for example, allows us to pass &#8220;this&#8221; around into different scopes. There are more streamlined ways to do iteration, as well.</p>
<p>Brian said &#8220;there is no reason not to use Sass.&#8221; That&#8217;s pretty bold. But it really does give CSS &#8220;everything programmers want.&#8221; Iteration, modularization, mixins (functions), etc. Sass is a way to create CSS in a more programmer-friendly manner. You can make variables in your CSS. That&#8217;s crazy! Think of all the time you have to write the same color or margin, etc., in a large stylesheet. Instead, you could store it in a variable and re-use it over and over again. If your marketing department decides to change the background of the selected tab from pink to salmon, you&#8217;ll only need to change it in one location and it will just work. That&#8217;s awesome.</p>
<p>For the last session of the day, I gave my talk on Silverlight 5. Silverlight 5 will be out later this year and I just demo&#8217;ed every new thing I could. I included browser in browser, with the webpage in the in-browser browser showing this image:</p>
<p><img class="alignnone" title="Yo, Dawg!" src="http://images.memegenerator.net/instances/400x/10499541.jpg" alt="" width="400" height="258" /></p>
<p>I also demo&#8217;ed the multiple windows concept. The cool part was that you could put whatever you want in the child operating system window. So I put in just a portion of my page. But that page also had the mechanism to open a window. So above the button to open the window I had this picture:</p>
<p><img class="alignnone" title="Inception" src="http://www.moviedeskback.com/wp-content/uploads/2010/07/Inception-Wallpapers-12.jpg" alt="" width="480" height="300" /></p>
<p>I also did a PivotViewer demo with all the people I follow on Twitter, amongst many others, but those were the fun ones.</p>
<p>One annoying note to add: an 18-year old raised his hand every five minutes (probably more frequently) to ask tangential questions. They weren&#8217;t adding or helping with the presentation and made me go over and skip going further into detail on some things. I hope I wasn&#8217;t critiqued too harshly for that and I hope that doesn&#8217;t happen when I give this talk again.</p>
<p>At the end of the day, I won a grab bag from Telerik. Not an XBox 360/Kinect, but it&#8217;s better than a poke in the eye with a sharp stick.</p>
<p>Again, I really can&#8217;t urge more strongly to take advantage of learning opportunities like this. It&#8217;s not a chore. It&#8217;s a treat. And I&#8217;m not talking about the free food that they had all day.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D161&amp;title=Twin%20Cities%20Code%20Camp%2011%20Wrap%20Up"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=161</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MDC 2011 Wrap Up</title>
		<link>http://vincebullinger.com/Blog/?p=151</link>
		<comments>http://vincebullinger.com/Blog/?p=151#comments</comments>
		<pubDate>Mon, 10 Oct 2011 16:03:23 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Conferences]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=151</guid>
		<description><![CDATA[On Thursday, September 29th, I went to the Minnesota Developers Conference (MDC) 2011. If you&#8217;ve never been there before, it&#8217;s certainly a recommended conference to attend. It&#8217;s a local conference that is relatively cheap. I don&#8217;t really recommend spending thousands of dollars to send developers across the country for a conference when everything will end [...]]]></description>
			<content:encoded><![CDATA[<p>On Thursday, September 29th, I went to the Minnesota Developers Conference (MDC) 2011. If you&#8217;ve never been there before, it&#8217;s certainly a recommended conference to attend. It&#8217;s a local conference that is relatively cheap. I don&#8217;t really recommend spending thousands of dollars to send developers across the country for a conference when everything will end up being posted online, but local conferences that cost $150? You should absolutely send a couple of developers out there.</p>
<p>Now I didn&#8217;t have to worry about my employer paying for me this year because I got in due to being a member of <a title="TechMasters" href="http://techmasters-tc.com/" target="_blank">TechMasters</a>. We gave a demo of a meeting as a presentation on speaking skills.</p>
<p>The conference began with a keynote by <a title="Cem Erdem" href="http://twitter.com/#!/cemerdem" target="_blank">Cem Erdem</a>. My response is not going to be very popular amongst other people that were there. While everyone else seemed to just love this, I just plain didn&#8217;t. The entire thing was how he moved here from Turkey and is now successful. Nothing about development, code, where technology is going, etc. Don&#8217;t get me wrong, it&#8217;s a nice story, but maybe it would be better suited to give to immigrant entrepreneurs rather than established computer programmers. Complimenting America a bunch isn&#8217;t going to win me over. Don&#8217;t mean to sound cold, but that&#8217;s how I felt.</p>
<p>The first session was when we gave our mini-demo of a TechMasters presentation. All of the people that attended the talk were very interested and asked a lot of questions. If you&#8217;re intersted in getting better at public speaking, I certainly suggest stopping by sometime. You can show up as a guest for free.</p>
<p>For the second session, I saw Improving Web Site Performance and Scalability While Saving Money with <a title="Robert Boedigheimer" href="http://mdc.ilmservice.com/Speaker#Robert Boedigheimer" target="_blank">Robert Boedigheimer</a>. I&#8217;ve been to Robert&#8217;s talks before and they&#8217;re really great. They&#8217;re different from a lot of other talks. He includes a lot of useful tidbits of information that he&#8217;s learned on the front lines. Word must have gotten out about Robert because there was a packed house for this talk!</p>
<p>In order to sell home the point of increasing web performance, Robert gave out an interesting factoid: for every 100ms of increased load time to your site, sales decrease by 1%. That should be enough to make sure everyone thinks of performance as incredibly important, no matter the industry. Topics discussed include <a title="Fiddler" href="http://www.fiddler2.com/fiddler2/" target="_blank">Fiddler</a>, IIS log files, HTTP compression, content expiration dates, etags, minification and consolidation, CSS sprites, image optimization, CDNs, multiple domains for static resources and pre-fetching. The ideas mainly focused around monitoring what&#8217;s happening so you know what&#8217;s costing you the most in terms of time and bandwidth. Then acting on what you learn. Are you sending over too much data? Compress, cache, minify, optimize, etc. Is something taking too long? Pre-fetch, use CDNs and multiple domains, that sort of thing. I definitely found it to be a very valuable talk and will hopefully use some of the things I&#8217;ve learned in the future. Most people were aware of/have used some of what Robert discussed, but some of us have never been involved in deploying large, enterprise projects and haven&#8217;t run into some of these issues.</p>
<p>For the third session, the original speaker canceled. The talk was to be about JavaScript and MVC, I believe. The replacement, <a title="Matt Milner" href="http://www.pluralsight-training.net/community/blogs/matt/" target="_blank">Matt Milner</a>, spoke about jQuery Templates and data-link. That actually seemed a little more interesting anyway. Matt started off by pointing out when Microsoft got involved with jQuery. Basically it was after the popularity of jQuery really dominated the ajax client library. Microsoft threw all their weight behind contributing to jQuery, thus pretty much killing the ajax client library.</p>
<p>jQuery Templates enable you to display and manipulate data in the browser. It&#8217;s a jQuery plugin that was included in the core library for version 1.5 of jQuery, which came out earlier this year. To use it, you make a script tag with a type of &#8220;text/x-jQuery-tmpl&#8221; to let the jQuery parser know that this is a template. Then, you use pretty intuitive tagging to format your template.</p>
<p>For example, if you have a var like this:</p>
<p>var myFoos = [{a: "b", b: "c"}, {a: "d", b: "e"}];</p>
<p>You could use a jQuery template like the following to format myFoos into a list of divs:</p>
<p>&lt;script id=&#8221;fooTemplate&#8221; type=&#8221;text/x-jQuery-tmpl&#8221;&gt;<br />
&lt;div&gt;<br />
&lt;h2&gt;${a}&lt;/h2&gt;<br />
&lt;br&gt;<br />
&lt;b&gt;&lt;i&gt;${b}&lt;/i&gt;&lt;/b&gt;<br />
&lt;/div&gt;<br />
&lt;/script&gt;</p>
<p>To actually enact this template, you simply pick a place for these items to exist like &lt;div id=&#8221;myFooDiv&#8221;&gt;&lt;/div&gt; and write the following line of jQuery code:</p>
<p>$(&#8220;#fooTemplate&#8221;).tmpl(myFoos).appendTo(&#8220;#myFooDiv&#8221;);</p>
<p>Pretty simple. There are other things to learn, but that&#8217;s the gist of it.</p>
<p>Data-link binds objects to other objects and uses change events to update targets. It&#8217;s another really cool concept that&#8217;s also extremely simple. Data link is a jQuery plugin with two methods: link and unlink. If you have two objects that you want to link together (the links are two-way by default), you say</p>
<p>var foo = {};<br />
$(&#8220;form&#8221;).link(foo);</p>
<p>Every time a named item in the form changes, an associated property in foo will either be modified or created. Links are, by default, two way.</p>
<p>Matt also spent time looking into the future of these technologies. He mentioned jsRender, jsView and jQuery Datagrid. jsRender and jsView are supposed to be updates to templates and linking. jQuery Datagrid will also update templates and binding.</p>
<p>For the last talk, I went to see Silverlight 5 by <a title="Jeff Brand" href="http://www.slickthought.net/" target="_blank">Jeff Brand</a>. I thought that was a good idea, seeing as how I would be giving a talk on the same topic for Code Camp on October 9th. I had already written out a rough draft outline for a short speech at TechMasters, so I knew what I would be discussing, even if I was nowhere near finished. Jeff talked about most of the stuff I wanted to talk about, sometimes going off on a few tangents or including more in-depth information. I ended up snagging a couple of things from his presentation. Mainly the performance metrics on printing, an image illustrating how much sharper the text looked and another image showing linked rich text boxes. It was certainly a good talk that helped me get ready for my talk.</p>
<p>Another great MDC in the books. I hope to see you all next year!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D151&amp;title=MDC%202011%20Wrap%20Up"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=151</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synchronous Web Calls In Silverlight?</title>
		<link>http://vincebullinger.com/Blog/?p=146</link>
		<comments>http://vincebullinger.com/Blog/?p=146#comments</comments>
		<pubDate>Fri, 07 Oct 2011 22:57:44 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Code Tips and Tricks]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=146</guid>
		<description><![CDATA[Extremely recently, I Tweeted: I don&#8217;t get it. True synchronous web calls in Silverlight are impossible. I&#8217;ve tried every suggestion out there. Not possible. Giving up Source: http://twitter.com/#!/vbullinger/status/122425689566748672 Well, I couldn&#8217;t let that stand and figured it out. Put this method in your Silverlight.js file: function SyncWebServiceCaller() { var client = null; if (window.XMLHttpRequest) client [...]]]></description>
			<content:encoded><![CDATA[<p>Extremely recently, I Tweeted:</p>
<p>I don&#8217;t get it. True synchronous web calls in Silverlight are impossible. I&#8217;ve tried every suggestion out there. Not possible. Giving up</p>
<p>Source: <a href="http://twitter.com/#!/vbullinger/status/122425689566748672">http://twitter.com/#!/vbullinger/status/122425689566748672</a></p>
<p>Well, I couldn&#8217;t let that stand and figured it out.</p>
<p>Put this method in your Silverlight.js file:</p>
<p>function SyncWebServiceCaller() {<br />
var client = null;</p>
<p>if (window.XMLHttpRequest)<br />
client = new XMLHttpRequest();<br />
else if (window.ActiveXObject)<br />
client = new ActiveXObject(&#8220;Microsoft.XMLHTTP&#8221;);<br />
client.open(&#8216;GET&#8217;, arguments[0], false);<br />
client.send();<br />
return client.responseText;<br />
}</p>
<p>Then, in your Silverlight code, where you want a synchronous call, just put this:</p>
<p>string webResponse = HtmlPage.Window.Invoke(&#8220;SyncWebServiceCaller&#8221;, &#8220;http://MyWebsite/MyService.asmx/MyMethod?parameter1=value1&amp;parameter2=value2&#8243;).ToString();</p>
<p>My example is for a web service, which is what I wanted. You can do whatever, but due to cross-site scripting, I&#8217;m pretty sure you&#8217;ll be sticking with services within your solution.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D146&amp;title=Synchronous%20Web%20Calls%20In%20Silverlight%3F"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=146</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chapter 1: Introduction to Central Banking</title>
		<link>http://vincebullinger.com/Blog/?p=136</link>
		<comments>http://vincebullinger.com/Blog/?p=136#comments</comments>
		<pubDate>Tue, 31 May 2011 04:01:47 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[TechMasters]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=136</guid>
		<description><![CDATA[Monetary policy and central banking are topics that are woefully misunderstood. Not only do people not understand them, they don&#8217;t even think about them. Almost nobody thinks that these are important topics about which anybody should be concerned. Not many people realize the power of these issues nor their effects. In this chapter, I&#8217;m going [...]]]></description>
			<content:encoded><![CDATA[<p>Monetary policy and central banking are topics that are woefully misunderstood. Not only do people not understand them, they don&#8217;t even think about them. Almost nobody thinks that these are important topics about which anybody should be concerned. Not many people realize the power of these issues nor their effects. In this chapter, I&#8217;m going to introduce you to monetary policy and central banking, early American monetary policy and our founding fathers&#8217; feelings about money.</p>
<p>I want you to closely read <a href="http://en.wikipedia.org/wiki/Monetary_policy">the Wikipedia definition of monetary policy</a> to see just how powerful a topic this really is:</p>
<p style="padding-left: 30px;">“Monetary policy is the process by which the government, central bank, or monetary authority of a country controls (i) the supply of money, (ii) availability of money, and (iii) cost of money or rate of interest.”</p>
<p>It doesn&#8217;t take a genius to figure out that having any level of control or influence on monetary policy can have a major effect on just about everything. And if the wrong people have any control over monetary policy, bad things always happen. Imagine if you had control over something that everyone wanted and no one could get enough of&#8230;</p>
<p><a href="http://en.wikipedia.org/wiki/Mayer_Amschel_Rothschild">Mayer Amschel Rothschild</a>, founder of <a href="http://en.wikipedia.org/wiki/Rothschild_family">the Rothschild family international banking dynasty</a>, and <a href="http://www.forbes.com/2005/07/21/rothschild-banking-international-cx_0721bizmanrothschild.html">listed in Forbes Magazine</a> as the seventh most influential businessman of all time, once stated: “Give me control of a nation&#8217;s money supply and I care not who makes its laws.”</p>
<p>With any level of control over a nation&#8217;s money, you can steer the economy in such a way that you will always come out ahead. You can then, over time – and many generations – buy up more and more power and influence in the government, which would then be used to gain more and more of that nation&#8217;s wealth. This story has repeated itself over and over again in many different incarnations for thousands and thousands of years.</p>
<p>When the United States were still British colonies, they used British money. As the population grew, the amount of physical money became scarce. Since the British government was so far away, it was hard for them to keep the money supply adequate. Add to the fact that they just didn&#8217;t care about us, and it&#8217;s easy to see why the colonies began to import other currencies and print their own money in order to continue with normal finances.</p>
<p>But a strange thing happened: the colonies then flourished. After a while, England realized that the colonies were not using British money and the King sent a decree along with many enforcers to make sure that the colonies used only British money. As soon as that happened, a wave of depression hit the colonies and this was definitely the most important factor to us revolting against England that has been swept under the rug of history.</p>
<p>The founding fathers realized that monetary policy was a very important issue when creating our country. They knew that they had to make sure that our currency would be in good hands. Obviously, handing it over to private interests like Mr. Rothschild would be a bad idea. Transparency and controls to hold currency stable and predictable would be paramount. As such, the founding fathers put into <a href="http://www.constitution.org/constit_.htm#con1.10.1.5">Article I, Section X, Clause V</a> of our Constitution that the only things that could be used as legal tender in this country are gold and silver. Gold and silver have relatively held their value very steadily for thousands of years, and their values would be very transparent to everyone inside and outside of the country.</p>
<p>The founding fathers knew the dangers of a loose or irresponsible monetary policy. <a href="http://www.britannica.com/presidents/article-9116907" target="_blank">Thomas Jefferson once said</a> “I sincerely believe that banking establishments are more dangerous than standing armies; and that the principle of spending money to be paid by posterity, under the name of funding, is but swindling futurity on a large scale.” With the birth of the Federal Reserve, Jefferson&#8217;s worst nightmare has come true. And his prophecy about what would happen as a result is rapidly coming true, ever since our central banking authority – the Federal Reserve – came into being in 1913. We&#8217;re massively in debt, whole states are going bankrupt and we never balance our budget unless we do so by printing up more monopoly money that is backed by nothing and must be repaid – with interest – to the Federal Reserve.</p>
<p>Central control over monetary policy is dangerous and invites corruption. Always has and always will. In fact, it would be easy to prove that the people that push for central banking are only doing so in order to capitalize on the corruption it invites. I hope this first chapter has opened up some eyes into a rarely discussed topic that truly can make or break politicians, economies and entire nations.</p>
<p><a title="The History of Monetary Policy in America, Introduction" href="http://vincebullinger.com/Blog/?p=134">Back to the Introduction to The History of Monetary Policy in America</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D136&amp;title=Chapter%201%3A%20Introduction%20to%20Central%20Banking"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=136</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The History of Monetary Policy in America, Introduction</title>
		<link>http://vincebullinger.com/Blog/?p=134</link>
		<comments>http://vincebullinger.com/Blog/?p=134#comments</comments>
		<pubDate>Mon, 30 May 2011 23:29:59 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[TechMasters]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=134</guid>
		<description><![CDATA[In late 2008, I joined an IT-based ToastMasters group called TechMasters. We usually talk about IT-oriented topics. Around half of us are computer programmers, so we frequently delve into development-related topics. Often times, however, we will talk about other passions we have. Though I&#8217;ve given speeches on development-oriented topics like Silverlight 4, Prism, Hungarian notation, [...]]]></description>
			<content:encoded><![CDATA[<p>In late 2008, I joined an IT-based ToastMasters group called <a href="http://www.techmasters-tc.com/" target="_blank">TechMasters</a>. We usually talk about IT-oriented topics. Around half of us are computer programmers, so we frequently delve into development-related topics. Often times, however, we will talk about other passions we have. Though I&#8217;ve given speeches on development-oriented topics like Silverlight 4, Prism, Hungarian notation, LINQ to Objects and the Razor view engine, I&#8217;ve also given speeches on non-IT topics such as jogging, navigating controversial debates, selling your house in a poor market and career moves.</p>
<p>One day, <a href="http://twitter.com/#!/scottkdavis" target="_blank">a fellow member</a> asked a Table Topics question concerning creating a new holiday, suggesting maybe we celebrate the anniversay of the creation of the Federal Reserve. As someone who is staunchly against the Federal Reserve and central banking in general, I used that question to launch into a series of speeches against central banking and profiling the history of monetary policy in the US.</p>
<p>The first speech of mine about monetary policy in America was given in July of 2009. Since then, the majority of my speeches have been on monetary policy and central banking. Last Tuesday, May 24th, I gave the last of my chronological speeches. I&#8217;m putting these speeches online, in order, as if they were chapters in a short book chronicling monetary policy in American history.</p>
<p>I slightly altered the speeches. The introductions and conclusions were altered a little bit to make them flow better. Since these were given weeks apart, I would give a refresher at the beginning and give a teaser at the end. These are not necessary when all the speeches are at your fingertips. Also, since a lot of the information would be seen as massive shifts in most peoples&#8217; paradigms, and I smash prevailing wisdom in the process of these speeches, I&#8217;ve given a lot of links to documents, articles and documentaries that back up my points and information.</p>
<p>The references are not in true bibliographic form, but they should certainly be adequate in beginning your research into the matters I bring up. Feel free to debate me in the comments, but rest assured: you will lose.</p>
<p><a title="Chapter 1: Introduction to Central Banking" href="http://vincebullinger.com/Blog/?p=136">Continue on to Chapter One</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D134&amp;title=The%20History%20of%20Monetary%20Policy%20in%20America%2C%20Introduction"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=134</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cleaning Up Your Domain Service Files in RIA Services</title>
		<link>http://vincebullinger.com/Blog/?p=128</link>
		<comments>http://vincebullinger.com/Blog/?p=128#comments</comments>
		<pubDate>Wed, 11 May 2011 16:19:30 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Code Tips and Tricks]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=128</guid>
		<description><![CDATA[If you&#8217;re like me, you really don&#8217;t like repetitive code. I very quickly catch repetitive code and work to clean it up. Even if it seems different enough to warrant not refactoring, I still try to see if I can. I was modifying a generated DomainService class file and noticed something: every InsertXXX method had [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, you really don&#8217;t like repetitive code. I very quickly catch repetitive code and work to clean it up. Even if it seems different enough to warrant not refactoring, I still try to see if I can. I was modifying a generated DomainService class file and noticed something: every InsertXXX method had almost the exact same code:</p>
<p><span style="color: #0000ff;">public void</span> InsertMyEntity(<span style="color: #2b91af;">MyEntity</span> entity)<br />
{<br />
<span style="color: #0000ff;">  if</span> ((entity.EntityState != <span style="color: #2b91af;">EntityState</span>.Detached))<br />
  {<br />
    ObjectContext.ObjectStateManager.ChangeObjectState(entity, <span style="color: #2b91af;">EntityState</span>.Added);<br />
  }<br />
<span style="color: #0000ff;">  else</span><br />
  {<br />
    ObjectContext.MyEntities.AddObject(entity);<br />
  }<br />
}</p>
<p>I also noticed that delete was the same way: each entity had the exact same format. What I decided to do was to refactor these methods into something like the following:</p>
<p><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">void</span> InsertEntity&lt;T&gt;(T entity, <span style="color: #2b91af;">IObjectSet</span>&lt;T&gt; entityCollection) <span style="color: #0000ff;">where</span> T : <span style="color: #2b91af;">EntityObject</span><br />
{<br />
<span style="color: #0000ff;">  if</span> ((entity.EntityState != <span style="color: #2b91af;">EntityState</span>.Detached))<br />
    ObjectContext.ObjectStateManager.ChangeObjectState(entity, <span style="color: #2b91af;">EntityState</span>.Added);<br />
<span style="color: #0000ff;">  else<br />
</span>    entityCollection.AddObject(entity);<br />
}</p>
<p>Then, in the InsertMyEntity methods, you just call the InsertEntity method like so: InsertEntity(entity, ObjectContext.MyEntities);</p>
<p>That, in and of itself, saves seven lines of code per entity. If you&#8217;ve got 50 entities, that&#8217;s 350 lines of code! And that&#8217;s just for the insert method. Throw in the delete (eight lines per) and you&#8217;ve saved another 400 lines of code! 750 lines less code?!? That&#8217;s a lot. Add in modifications from ReSharper (getting rid of unused using statements, all the &#8220;this.&#8221;s, the empty parentheses in the attributes (as in &#8220;EnabledClientAccess()&#8221;), etc. and you save a ton of code and everything looks just so much better.</p>
<p>Obviously, this is just another refactoring exercise, but I felt the need to mention it because RIA Services generates these methods for all of us so we can all use them. And we frequently have to modify the DomainService file anyway, and a lot of us don&#8217;t like looking at ugly code.</p>
<p>Happy refactoring!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D128&amp;title=Cleaning%20Up%20Your%20Domain%20Service%20Files%20in%20RIA%20Services"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=128</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twin Cities Code Camp X Wrap-Up</title>
		<link>http://vincebullinger.com/Blog/?p=114</link>
		<comments>http://vincebullinger.com/Blog/?p=114#comments</comments>
		<pubDate>Thu, 14 Apr 2011 02:31:43 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Conferences]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=114</guid>
		<description><![CDATA[If you didn&#8217;t know, the latest Twin Cities Code Camp was held this past weekend.  It was another two-day event like last time.  I&#8217;ve said it before, and I&#8217;ll say it again: if you&#8217;ve never been to a Code Camp, you should really start going to them.  The Twin Cities Code Camp is a two-day [...]]]></description>
			<content:encoded><![CDATA[<p>If you didn&#8217;t know, the latest Twin Cities Code Camp was held this past weekend.  It was another two-day event like last time.  I&#8217;ve said it before, and I&#8217;ll say it again: if you&#8217;ve never been to a Code Camp, you should really start going to them.  The Twin Cities Code Camp is a two-day event located at the University of Minnesota.  It&#8217;s 100% free.  They even provide drinks and snacks all day.  Though Microsoft technologies are well represented, many others are covered as well.  This time around, there were sessions on Ruby, Clojure, Grails, Scala, Git, Android development, freelance development, writing and many others.  Certainly not Microsoft-only.  Once again, I presented this year.  I presented on the Razor view engine for MVC3.  If you&#8217;d like to see the slides/code for my talk, <a title="Slides/code from my TCCC10 presentation" href="http://bit.ly/RazorViewEngine" target="_blank">click here</a>.  But I won&#8217;t be getting into that.  I&#8217;ll make a separate blog post in the next week or so.  I&#8217;ll be giving the same talk (slightly expanded) tomorrow at the Rochester .Net User Group and was approached by someone to possibly give the talk at the St. Cloud .Net User Group soon, as well, after my session at <a title="Twitter search for #TCCC10" href="http://twitter.com/#!/search/%23TCCC10" target="_blank">TCCC10</a>.  No word yet on the Twin Cities .Net User Group next month, but that&#8217;s a possibility.</p>
<p>The first session I attended was * Takes deep breath * <a title="Baskin's really long-titled session" href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss12" target="_blank">In-Depth Unit/Integration Testing Using VS2010, TFS-2010 and Other Platforms/Frameworks</a> by <a href="http://tapkan.com/" target="_blank">Baskin Tapkan</a>.  Baskin is a fellow <a title="TechMasters" href="http://techmasters-tc.com/" target="_blank">TechMaster</a>, by the way.  As such, Baskin&#8217;s presentation skills are fantastic.  His introduction was very fun.  He also peppered in interesting anecdotes like when the <a href="http://www.defenseindustrydaily.com/f22-squadron-shot-down-by-the-international-date-line-03087/" target="_blank">F-22 failed after crossing the international dateline</a>.  If I had to give a piece of criticism about the talk, outside of the name, it would be the immense amount of information being crammed into a 75-minute session.  He talked about TDD, BDD, unit testing, integration testing, acceptance testing, database unit testing, coded UI testing and a few other topics.  Really seemed like information overload.  Most of it was review for most of us, I&#8217;m sure, but I certainly learned a few things.  I&#8217;d never seen coded UI testing in action, for example, and <a title="Not Baskin, but it's the same concept" href="http://www.youtube.com/watch?v=KYyj5Dfp8iE#t=3m4s" target="_blank">it was nuts</a>.  It takes over your mouse and keyboard and clicks on things and fills out your forms as part of the testing.  You have to take your hands off the mouse and keyboard and let it do its thing.  A couple of things seemed a little 101-y, like when he discussed unit testing and talked about Visual Studio 2010.  Baskin also gave us a nice overview of <a href="http://www.jetbrains.com/teamcity/" target="_blank">TeamCity</a> and I came away with a nice quote on how meaningless deadlines are: &#8220;If it&#8217;s not ready, it&#8217;s not ready.&#8221;  Cue <a href="http://www.yogiberra.com/yogi-isms.html" target="_blank">Yogi Berra</a>.</p>
<p>For the second session on Saturday, I went to <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#it4" target="_blank">Introduction to Grails</a>, by <a href="http://bartling.blogspot.com/" target="_blank">Chris Bartling</a>.  I thought this was an excellent presentation.  The topic was interesting to me, as a .Net developer, and the content was great.  The presentation was well-paced, easy to follow and it had the perfect amount of information.  Chris was the first of a few people that had great presentations but could use a little work on their presentation skills.  A few trips to TechMasters and he&#8217;d be the talk of Code Camp.  <a title="I _love_ the tag line" href="http://grails.org/" target="_blank">Grails</a> is a web application framework that uses <a href="http://groovy.codehaus.org/" target="_blank">Groovy</a>.  Grails is similar to <a href="http://rubyonrails.org/" target="_blank">Ruby on Rails</a> and <a href="http://www.asp.net/mvc" target="_blank">ASP.Net MVC</a> as far as the frameworks&#8217; aims, but obviously different according to programming language.  For anybody familiar with Java (I&#8217;ve been out of the loop since college), this Grails talk would&#8217;ve been a little more manageable, but for me, it was another landslide of information.  Chris talked about Gant, GORM, SiteMesh and various other Groovy/Java-specific topics.  Though I had heard of the IntelliJ IDE, I had never seen it in use.  Chris says it&#8217;s better than Eclipse, which I found quite adequate for its day back in college.  The guys at JetBrains make a lot of good software, though, so that&#8217;s no shock.  I was glad to see Chris didn&#8217;t turn this into a huge anti-Microsoft talk, which I almost expected.  But, to be honest?  I&#8217;m not sure why I&#8217;d make the switch from .Net to Groovy, nor do I see why Grails is superior to MVC at the end of the day.  It does seem, though, that Microsoft might be stealing some ideas from the open-source community to throw into .Net, and this Grails talk definitely planted the seed of that thought into my head.  MVC- and LINQ-like ideas were all over the place.</p>
<p>Originally, <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss45" target="_blank">Git More Done</a> by <a href="http://solutionizing.net/" target="_blank">Keith Dahlby </a>was left off the schedule.  This saddened me.  Fortunately, a slot opened up and Keith&#8217;s talk was added back in, so I went to it.  Keith had a &#8220;this talk is/isn&#8217;t&#8221; slide like I did in my presentation.  It&#8217;s when you tell your audience your focus for the talk, lest they think you&#8217;ll be giving some background.  This wasn&#8217;t a 101.  I&#8217;d heard and read plenty about Git, been to a session or two about it, but I&#8217;m no expert.  I knew roughly zero of what Keith brought up.  For example, if you&#8217;ve just been tinkering with Git, and haven&#8217;t used it in a production setting, you wouldn&#8217;t know much about the git.config file, would you?  Using Subversion, however, I did have a decent understanding of the concepts, so it wasn&#8217;t too much of a stretch.  Git seems to be one of those things on which I&#8217;ve really been dragging my feet, and I should probably instead be getting them wet.  I&#8217;ll have to put that on the docket for things to get under my belt in the near future.  Other new topics discussed include git stash, git reset, git cherry-pick and git rebase.  One thing I noticed in Keith&#8217;s examples was that he talked a lot about rewriting history.  Seems like a bit of a devious use for Git, especially since most people won&#8217;t know Git at all.  Something that really stood out with Keith&#8217;s session was that he did a really good job explaining complex topics.  I didn&#8217;t feel like anything went over my head at all.  And I walked away with another memorable quote when Keith was talking about stashing: &#8220;OMG, drop everything and work on this problem!  That never, ever happens.  Ever.  Right?&#8221;</p>
<p>My talk was next.  So, onto the next talk.</p>
<p>To round off the end of day one, I attended <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#it8" target="_blank">Introduction to Scala</a> by <a href="http://twitter.com/#!/Dan_Chamberlain" target="_blank">Dan Chamberlain</a>.  Dan was another guy that would be a good candidate for TechMasters.  Otherwise, it was another really good presentation.  One of the first things I noticed was that he was using Eclipse.  I asked about what he thought about IntelliJ and he said that Eclipse was the better IDE for Scala.  I thought I&#8217;d check the interwebs and it seems like most people think that IntelliJ is better:</p>
<p><a href="http://theyougen.blogspot.com/2010/01/best-scala-ide-intellij-idea.html">http://theyougen.blogspot.com/2010/01/best-scala-ide-intellij-idea.html</a></p>
<p><a href="http://weblogs.java.net/blog/lifemichael/archive/2011/03/21/scala-intellij-plugin-0">http://weblogs.java.net/blog/lifemichael/archive/2011/03/21/scala-intellij-plugin-0</a></p>
<p>Dan assures me that Eclipse is getting better with regards to <a href="http://www.scala-lang.org/" target="_blank">Scala</a>.  As it was, the Eclipse editor was very buggy and interrupted his otherwise excellent presentation.  I was originally thinking that Scala was a functional programming language, but Dan showed me that it&#8217;s definitely a hybrid.  That&#8217;s pretty slick.  Apparently, the creator of Groovy likes Scala, too: &#8220;I can honestly say if someone had shown me the Programming in Scala book by Martin Odersky, Lex Spoon &amp; Bill Venners back in 2003 I&#8217;d probably have never created Groovy.&#8221;  Dan covered most of the bases: immutability, pattern matching, etc.  Most of the talk wasn&#8217;t ground breaking, and I understand all the concepts behind the paradigm.  I&#8217;m comfortable enough with functional programming that I feel like I could use Scala if I wanted to do so.</p>
<p>To kick off the second day, I went to <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss4" target="_blank">Heal Your Code with Rx</a> with <a href="http://judahgabriel.blogspot.com/" target="_blank">Judah Himango</a>.  Judah had, without a doubt, the prettiest presentation slides of the conference.  He had some clever graphics, too.  For example, since Rx not only means &#8220;<a href="http://msdn.microsoft.com/en-us/data/gg577609" target="_blank">reactive extensions</a>,&#8221; but also prescriptions, Judah used some pharmacy pictures in his PowerPoint.  When he was going to define Rx, he had a Google define prompt for an image.  Those were interesting, but his jokes were a little off.  Not sure if he&#8217;s spending too much time with Mike Hodnick (making him try to be funny when he&#8217;s not) or not enough (Mike&#8217;s humor hasn&#8217;t rubbed off on him yet).  Judah&#8217;s presentation skills were much better than his humor, however, and he had great volume and a good command of the room.  I did notice that he probably could have buttoned up just one more button on his shirt, however.  That or wear an undershirt.  Pretty sure that was intentional to leave that button undone, too.  While watching Judah&#8217;s presentation, I came to the embarassing conclusion that I&#8217;d never explicitly used an ObservableCollection before.  The whole talk was incredibly interesting.  I really like LINQ and just better ways of doing things in general, so I was really enthralled by the power of Rx.  He had some great demos, as well, to point out what Rx was doing, like the demo showing how events can create memory leaks and how Rx can be used to fix that.</p>
<p>I noticed that four out of the five talks that I attended on day two were in the same room.  So, I didn&#8217;t have to move to see <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss37" target="_blank">Dev for the XBox Kinect with .NET</a> by <a href="http://www.kindohm.com/" target="_blank">Mike Hodnick</a>.  Mike first let us know that his talk may be partially or completely obsolete, depending on the announcements at MIX.  He&#8217;s assuming that there&#8217;s going to be an announcement surrounding a Kinect API.  But he said it&#8217;d still be valuable to sit in as many of the concepts would more than likely carry over.  Mike got us all interested right away by showing us <a href="http://www.youtube.com/watch?v=tlLschoMhuE" target="_blank">the Minority Report video we&#8217;ve all seen</a>.  Obviously, this was a fun talk.  We got to see Mike wave a bunch and act silly for 75 minutes.  He went over a couple of Kinect libraries out there like OpenKinect, OpenNI and CodeLaboratories.  The demos he should included cursor control, push control, smoothing, swiping and skeleton tracking, as well as the display at the entrance to Avtex, where Mike works.  All that with a little smack talk for C++ developers made for a really fun presentation, as is usually the case with Mike.</p>
<p>The next session to which I went was <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss40" target="_blank">&#8220;I Didn&#8217;t Know You Could Do That&#8221; .NET Tips and Tricks</a> by <a href="http://twitter.com/#!/vongillern" target="_blank">Jon von Gillern</a>.  I wasn&#8217;t sure what the format of this talk would be, but it ended up being pretty awesome.  Basically, Jon went through a litany of things he&#8217;s learned over the years, and sometimes we&#8217;d chime in with little tangential tidbits.  Jon&#8217;s a geek after my own heart, let me tell you.  Though he basically just reinforced the majority of how I code from day-to-day, I still learned a lot.  He gave the advice of unplugging your mouse for a couple of days to retrain yourself to use the keyboard.  Well, I don&#8217;t need to do that because I do that all the time.  But if you find yourself doing things like clicking on the run button in Visual Studio, maybe you do need to try it.  You should know as many shortcuts as possible.  If one doesn&#8217;t exist, then Jon suggests creating your own.  I have to say, I&#8217;ve never made my own shortcuts.  I might end up doing that if I can think of things I typically do that don&#8217;t have shortcuts.  Little tidbits I ended up learning include:</p>
<ul>
<li>Hitting F9 while your cursor is on a part of a line, like a part of a for loop, will set the breakpoint in that individual part of the line.  If you were to click on the left-hand side of the line to set the breakpoint, it would always be set to the first clause of the line.</li>
<li>Alt+d in a browser will bring you to the address bar.  Go ahead.  Try it.  I&#8217;ll wait.</li>
<li>Control+dragging the mouse will allow you to copy parts of multiple lines in Visual Studio.</li>
</ul>
<p>I also learned that I&#8217;m a &#8220;ReSharper traitor.&#8221;  Jon seems to prefer CodeRush.  Jon&#8217;s one of <em>those</em> people that thinks that the singular form of parentheses is parenthese instead of parenthesis.  I also could&#8217;ve done without the &#8220;VinceSucks&#8221; part of one of his demos, but the part where he wrote throw new Exception(&#8220;ha ha ha, Jason isn&#8217;t here&#8221;); was pretty funny (<a href="http://jasonbock.net/JB/Default.aspx" target="_blank">Jason Bock</a> is very much against <em>ever</em> throwing a generic exception).</p>
<p>The only session I attended not in that same room was <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss27" target="_blank">Build an N-Tier App with Entity Framework, WCF Data Services, and ASP.NET MVC</a> by <a href="http://stienessen.net/author/admin" target="_blank">Dave Stienessen</a>.  Dave should stop by TechMasters, too.  I&#8217;ve worked with projects that have dealt with some or all of these technologies, so not a whole lot of this was new to me, but I did get some nuggets out of it.  I hadn&#8217;t dealt with the ADO.NET Mocking Context Generator, for example, as well as the SetEntitySetAccessRule method, WCF Service URI filters, ChangeInterceptors and QueryInterceptors.  I thought this was a solid presentation on a pretty important set of technologies for the near future, but you never want to say this while presenting: &#8220;The version that&#8217;s on my blog works.&#8221;  That was pretty funny.</p>
<p>The last session I attended was <a href="http://www.twincitiescodecamp.com/TCCC/Spring2011/Sessions.aspx#ss17" target="_blank">Secure Coding Practices for .NET</a> with <a href="http://geekswithblogs.net/SoftwareSecurity/Default.aspx" target="_blank">Glenn Leifheit</a>.  Another fellow TechMaster, Glenn definitely gave a great presentation.  It&#8217;s really amazing to see how much he&#8217;s grown since he joined TechMasters.  He had a good command of the room and kept everyone interested the whole time.  The gist of the talk was how we, as developers, focus on frameworks and algorithms and don&#8217;t put enough focus on security.  A memorable quote that Glenn gave out was: &#8220;Hackers only need to find one weakness.  Developers need to protect everything.&#8221;  Interesting facts Glenn mentioned include:</p>
<ul>
<li>13% of websites are compromised on front page</li>
<li>49% of websites contain critical or high risk vulnerabilities</li>
<li>99% of apps do not meet PCI requirements</li>
</ul>
<p>Glenn had a lot of good anecdotes and I think this was a real slap in the face to a lot of us.  The presentation was engaging and thought-provoking.  He gave us a lot of tips involving auditing and logging, exception handling, session and state management, input validation and encryption, among other things.  After dumping a lot of information on us that undoubtedly went in one ear and out the other, Glenn finished up by offering a couple of book recommendations so we could actually take all of this in.</p>
<p>I didn&#8217;t get as lucky as I did last time, and I didn&#8217;t come away with an <a href="http://www.amazon.com/Silverlight-4-Action-Pete-Brown/dp/1935182374" target="_blank">awesome book</a> like last time.  I did, however win <em>a </em>book.  Which one?  <a href="http://www.androidcentral.com/android-books-worth-checking-out-droids-made-simple-and-android-fully-loaded" target="_blank">A glorified user manual for Android phones</a>&#8230;</p>
<p>No worries, however, since I got to spend a whole weekend learning a ton of great stuff.  These kinds of chances to get a lot of free training, great networking and a possibility to present yourself should really be taken by any developer within a hundred miles of the Twin Cities.  It&#8217;s a great way to improve yourself and is really a lot of fun.  Hope to see you at the next Twin Cities Code Camp in October!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D114&amp;title=Twin%20Cities%20Code%20Camp%20X%20Wrap-Up"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=114</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Decision: Part Trois</title>
		<link>http://vincebullinger.com/Blog/?p=112</link>
		<comments>http://vincebullinger.com/Blog/?p=112#comments</comments>
		<pubDate>Sat, 15 Jan 2011 07:07:28 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=112</guid>
		<description><![CDATA[To make a long story short, I recently decided to look for a new direction in my career.  If you know me, you know I&#8217;m passionate about a few things, development-wise: keeping up to date, learning and fun technologies.  I feel like the employer to whom I just gave my two weeks&#8217; notice just had [...]]]></description>
			<content:encoded><![CDATA[<p>To make a long story short, I recently decided to look for a new direction in my career.  If you know me, you know I&#8217;m passionate about a few things, development-wise: keeping up to date, learning and fun technologies.  I feel like the employer to whom I just gave my two weeks&#8217; notice just had a different philosophy when it comes to what gigs they were looking to get.  It may work for a business, but it didn&#8217;t align with my career goals.</p>
<p>If you didn&#8217;t know, the market&#8217;s crazy right now.  I&#8217;ve frequently made the analogy of holding a beach ball underwater.  You can try as hard as you want to keep down your costs in a down economy by not embarking on new, technological endeavors, but you will soon face the facts: keep up or get plowed over.  You can&#8217;t cut certain costs, no matter the economy.  So, when the economy seemingly bottomed out (for the time being), companies opened up the dams and let the projects fly.  At least, that&#8217;s my estimation as to what&#8217;s been happening lately.</p>
<p>As such, the market is very good right now.  I poked my head juuuuuust over the fence, and was just slammed with recruiters calling, emailing, etc.  I&#8217;m sure you know the drill.  With the market the way it is, I decided I might try my hand at independent consulting.  Either I&#8217;d be able to keep doing it long-term, or I&#8217;d find a place where I&#8217;d like to stay permanently in my travels.  I could also just give a list of things that would describe the perfect place for me and do the independent consulting thing until a recruiter brought the perfect permanent position to my feet.</p>
<p>So that was the plan: try independent consulting until a perfect opportunity came my way.  My list, for those who would want to know, included:</p>
<ul>
<li>A place where I&#8217;d always use the latest technologies</li>
<li>A place that encouraged &#8211; not just allowed &#8211; extra curricular activities like user groups</li>
<li>A role that was using really fun stuff.  I listed off Silverlight, WPF, MVC, jQuery and HTML 5 as current, fun stuff</li>
<li>A place that was close to where I lived or allowed me to work from home sometimes</li>
<li>A role that looked for input from me, where I wasn&#8217;t just a cog in the wheel</li>
</ul>
<p>All of that might seem a little arrogant or asking a little too much, but I was prepared to wait and work a few gigs while waiting for the right opportunity to present itself.</p>
<p>I had a good handful of ok consulting gigs tossed my way that I considered, but most were trash.  Let me tell you, people: Wells Fargo is hiring!  Just about every single recruiter tried to jam a contract with them down my throat.  I&#8217;d rather be unemployed.  There were two pretty nice sounding consulting gigs I was really looking at, however.  One was extremely close to where I live and was going to be with a very strong team of developers, mostly independent consultants.  The technologies were great and I would&#8217;ve learned a lot and built a lot of good skills.  The other one was more on the fun side and paid extremely well.</p>
<p>But I was given an opportunity that meet all of my criteria.  Right now.  So I took it.  I get to use Silverlight, WPF and MVC right now.  I&#8217;m not a cog in the wheel.  I can work from home if I so choose, but the commute is great anyway.  I met with the CTO and he&#8217;s more in tune with the latest and greatest things than I am.  He was a developer for a long time and moved into his current role after working with them as an independent consultant.  He didn&#8217;t want to leave.</p>
<p>About this blog post&#8217;s title.  In case you didn&#8217;t know, LeBron James is kind of full of himself.  This past offseason, the best basketball player alive was a free agent.  When he decided where he was going to go, he had a brilliant idea: instead of just telling everyone with whom he&#8217;d be signing, he&#8217;d make a <a title="I bet you thought I was kidding" href="http://sports.espn.go.com/nba/news/story?id=5359255" target="_blank">one hour special on ESPN</a> that would have us all worshipping him.  He called his special &#8220;The Decision.&#8221;  Hence the name of the blog post.</p>
<p>But, wait, Vince, trois means &#8220;three,&#8221; not &#8220;two.&#8221;  What gives?</p>
<p>I would have called this post &#8220;The Decision: Part Deux,&#8221; but <a href="http://www.youtube.com/watch?v=fvL5KRoXC00" target="_blank">Anthony Tolliver beat me to it</a>.</p>
<p>So, what was my decision?  I decided to take my talents to Hastings and work for Anytime Fitness.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D112&amp;title=The%20Decision%3A%20Part%20Trois"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=112</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>XmlSerialization Made Easy</title>
		<link>http://vincebullinger.com/Blog/?p=99</link>
		<comments>http://vincebullinger.com/Blog/?p=99#comments</comments>
		<pubDate>Thu, 02 Dec 2010 18:47:12 +0000</pubDate>
		<dc:creator>Vince</dc:creator>
				<category><![CDATA[Code Tips and Tricks]]></category>

		<guid isPermaLink="false">http://vincebullinger.com/Blog/?p=99</guid>
		<description><![CDATA[I was doing some serialization recently, and I was reminded of just how clunky it is. Typically, it will look like this: public String SerializeMe(MyClass myInstance) { StringBuilder myInstanceStringBuilder = new StringBuilder(); new XmlSerializer(typeof(MyClass)).Serialize(new StringWriter(myInstanceStringBuilder), myInstance); return myInstanceStringBuilder.ToString(); } That&#8217;s awfully clunky. I thought I&#8217;d make an extension method, but then I realized that, in [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing some serialization recently, and I was reminded of just how clunky it is.  Typically, it will look like this:</p>
<p>        public String SerializeMe(MyClass myInstance)<br />
        {<br />
            StringBuilder myInstanceStringBuilder = new StringBuilder();<br />
            new XmlSerializer(typeof(MyClass)).Serialize(new StringWriter(myInstanceStringBuilder), myInstance);<br />
            return myInstanceStringBuilder.ToString();<br />
        }</p>
<p>That&#8217;s awfully clunky.  I thought I&#8217;d make an extension method, but then I realized that, in order to do so, I&#8217;d have to have an instance of XmlSerializer first to use an extension method.  Well, there are no parameterless constructors for XmlSerializer, and you&#8217;d negate the benefit of creating the extension method in the first place if you used any of the ones with parameters.</p>
<p>So, I decided to extend the XmlSerializer class.  Here&#8217;s the result:</p>
<p>    public class QuickSerializer : XmlSerializer<br />
    {<br />
        public static String Serialize(object instance)<br />
        {<br />
            StringBuilder instanceSB = new StringBuilder();<br />
            new XmlSerializer(instance.GetType()).Serialize(new StringWriter(instanceSB), instance);<br />
            return instanceSB.ToString();<br />
        }<br />
    }</p>
<p>Now, anything can be serialized (if it&#8217;s serializable) by just this little snippet:</p>
<p>QuickSerializer.Serialize(myInstance);</p>
<p>Much quicker and much easier.  This is the way it should be.  Happy serializing!</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fvincebullinger.com%2FBlog%2F%3Fp%3D99&amp;title=XmlSerialization%20Made%20Easy"><img src="http://vincebullinger.com/Blog/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://vincebullinger.com/Blog/?feed=rss2&#038;p=99</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

