<?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>Spencer Uresk</title>
	<atom:link href="http://www.spenceruresk.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.spenceruresk.com</link>
	<description>Random stuff from a software developer</description>
	<lastBuildDate>Wed, 09 Nov 2011 02:00:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>HTTP DELETE requests that include a body</title>
		<link>http://www.spenceruresk.com/2011/11/http-delete-requests-that-include-a-body/</link>
		<comments>http://www.spenceruresk.com/2011/11/http-delete-requests-that-include-a-body/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 04:51:12 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[http]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=60</guid>
		<description><![CDATA[I&#8217;ve had an enjoyable time getting down into a lot of gritty details about HTTP over the past year or so as I&#8217;ve worked on some webservices and a HTTP client tool for OS X. Every month, it seems like, I learn a little more about it based on the way my users use my [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had an enjoyable time getting down into a lot of gritty details about HTTP over the past year or so as I&#8217;ve worked on some webservices and a <a href="http://www.uresk.net/httpclient/">HTTP client tool for OS X</a>. Every month, it seems like, I learn a little more about it based on the way my users use my app.</p>
<p>This past month, over the course of a few weeks, I got several tickets stating:</p>
<blockquote><p>DELETEs are broken &#8211; they show as a POST on my server.</p></blockquote>
<p>I was a little concerned when the first one came in &#8211; something as simple as sending the correct verb shouldn&#8217;t be broken, but if it were, that was pretty bad. A quick test showed that DELETEs were, in fact, working. After requesting a saved .httpreq file, I quickly pinpointed the problem &#8211; DELETEs normally worked, but when a request body was present, they were magically turned into POSTs.</p>
<p>Further investigation revealed the problem to be in the library I use to actually assemble and send the HTTP requests (this behavior is actually present in a number of HTTP libraries, it turns out).W hile fixing the problem (version 1.0.6 contains the fix and should be available on the app store soon), I wondered &#8211; <strong>Is it valid to include a body with a DELETE request</strong>?</p>
<p>I spent a bunch of time reading through the <a href="http://www.ietf.org/rfc/rfc2616.txt">HTTP specification</a>, and saw nothing that would indicate this situation was explicitly forbidden. In practice, however, a number of HTTP clients and servers seem to not approve &#8211; as I mentioned, a number of clients silently turn them into POSTs, and per this <a href="http://stackoverflow.com/questions/299628/is-an-entity-body-allowed-for-an-http-delete-request">Stack Overflow thread</a>, a number of servers silently discard the body of a DELETE request.</p>
<p>Regardless of whether it is allowed, or how it is implemented by popular clients and serveres, I think it is a <strong>bad idea</strong> in general. If you are consuming a service, you don&#8217;t really have a lot of choice in the matter, but if you are creating one, I think you shouldn&#8217;t create DELETE services that require bodies. This is due to how inconsistently it is implemented, and the fact that it doesn&#8217;t make a lot of sense to include a body with a delete in the first place &#8211; a body is supposed to represent the entity, but you are deleting it, so why do you need to send it?</p>
<p>There are a few reasons I think folks may try to develop services that rely on a body being sent with the DELETE request, and I think there are better ways to accomplish them:</p>
<p><strong>1. To identify WHAT is to be deleted.</strong></p>
<p>This should be specified by the URI itself.</p>
<p><strong>2. To specify metadata about the delete request itself &#8211; for example, who deleted it or a comment related to the action.</strong></p>
<p>In most cases, a header is much more appropriate for these metadata fields.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/11/http-delete-requests-that-include-a-body/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ad supported vs $.99 &#8211; My experience</title>
		<link>http://www.spenceruresk.com/2011/09/ad-supported-vs-99-my-experience/</link>
		<comments>http://www.spenceruresk.com/2011/09/ad-supported-vs-99-my-experience/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 01:31:44 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[marketing]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=57</guid>
		<description><![CDATA[I love football, and I can&#8217;t tell you how excited I am that it is back on this week. I love playing fantasy football even more, and have even made an iPhone app for fantasy football drafts the past few years. This isn&#8217;t my day job, and I know I&#8217;ll never get rich doing it. [...]]]></description>
			<content:encoded><![CDATA[<p>I love football, and I can&#8217;t tell you how excited I am that it is back on this week. I love playing fantasy football even more, and have even made an iPhone app for fantasy football drafts the past few years.</p>
<p>This isn&#8217;t my day job, and I know I&#8217;ll never get rich doing it. My main goals are to get some more experience developing for iOS, earn back my expenses, and help pay for NFL Sunday Ticket.</p>
<p>Last year, my app was sold for $.99, and I made a small, but reasonable amount of money (something between $400-$500). This year, I decided to see what the results would be like if I offered it for free, but monetized it using advertising. At the last minute, I decided to make another version that cost $.99, but was identical except for the fact that it lacked ads &#8211; ads are sometimes kind of annoying, and as a user I&#8217;ll often opt to pay $.99 rather than deal with them.</p>
<p>Now that the fantasy football draft season is over, I thought it would be kind of interesting to take a look at the results. The limited shelf-life of this app (drafting season is at most 2 months long, and the average user won&#8217;t use it more than a few hours per year) makes a less than ideal case study for ad-supported vs paid, but I think there is some interesting data anyway. So, here is some stuff I learned from this:</p>
<p><strong>1) Free apps get downloaded way, way more than even $.99 apps</strong></p>
<p>This is obvious, of course, but the magnitude of the difference is worth pointing out. The free version of my app was downloaded <strong>11,450</strong> times, whereas the $.99 version was downloaded only <strong>239</strong> times.</p>
<p>My takeaway from this is, if you&#8217;re going to try to sell an app that is going to have free competitors, you&#8217;re really going to have to work hard to differentiate yourself from the free versions. Free apps are simply going to eat up the lion&#8217;s share of the market.</p>
<p><strong>2) But they don&#8217;t make nearly as much, per-user</strong></p>
<p>Those 11,450 downloads translated into several hundred thousand ad views, resulting in total revenue of <strong>$111.25</strong> for me. This is very slightly less than $.01 per download. The paid version brought in <strong>$167.34</strong> from its 239 downloads &#8211; despite having roughly 1/50th of the downloads, it actually out-earned the ad-supported version by ~$55.</p>
<p>I almost certainly made a lot less money this year by offering a free version supported by ads &#8211; if even 2% of the users who downloaded my free version would have shelled out $.99 for the paid version had it been the only option, I would have come out ahead.</p>
<p>Had this app been something people would use year-round, it might have worked out a little better.</p>
<p><strong>Lessons for next time</strong></p>
<p>Despite this not being the ideal outcome, I learned a few lessons from this. Your app has to be immensely popular to make any sort of worthwhile revenue from advertising. I don&#8217;t think niche apps or apps with limited lifespans are good candidates for ad-supported versions. Also, I think there are probably better ways to utilize a free app than just throwing ads on it.</p>
<p>Probably the best use of an ad-supported app is to use it to promote additional, paid functionality. You could do this through In-App Purchase or by selling a different version of the app altogehter. The important thing is to differentiate the two beyond just advertising &#8211; the paid version should also offer more features. I would have done something like this, but I given the short life-span of these apps and my late decision to offer both versions, I didn&#8217;t have time.</p>
<p>Going this route gives you a chance to use your likely more popular free download as an opportunity to promote the paid functionality. Just be careful to offer enough functionality in the free version to make it worth downloading &#8211; free apps that are utterly useless platforms to promote paid functionality get (rightly) harsh reviews in the app store.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/09/ad-supported-vs-99-my-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTTP Message basics, and POSTing form data in Graphical HTTP Client</title>
		<link>http://www.spenceruresk.com/2011/09/http-message-basics-and-posting-form-data-in-graphical-http-client/</link>
		<comments>http://www.spenceruresk.com/2011/09/http-message-basics-and-posting-form-data-in-graphical-http-client/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 04:08:25 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[http client]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=55</guid>
		<description><![CDATA[&#8220;The POST body isn&#8217;t working correctly! I add in something like name=spencer&#038;age=29, but the server doesn&#8217;t get the parameters. Please fix your program!&#8221; After a few support requests and 1 one-star review related to this issue, I figured it was at the very least worth a deeper explanation. If you&#8217;ve googled this and are just [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;The POST body isn&#8217;t working correctly! I add in something like name=spencer&#038;age=29, but the server doesn&#8217;t get the parameters. Please fix your program!&#8221;</p>
<p>After a few support requests and 1 one-star review related to this issue, I figured it was at the very least worth a deeper explanation. If you&#8217;ve googled this and are just looking for the answer here it is:</p>
<p><strong>You need to set the Content-Type header to &#8216;application/x-www-form-urlencoded&#8217;.</strong></p>
<p>That said, I think it is worth spending a few minutes to learn about HTTP messages and why this is required. Removing levels of abstraction and learning more about what is going on underneath makes you a better developer and is usually a lot of fun, too. This is a big part of the reason I&#8217;m giving up my evenings and weekends to go back to school for a CS degree.</p>
<p>Anyway, here is a quick primer on HTTP messages and why you have to add the header above&#8230;</p>
<p><strong>The HTTP message</strong></p>
<p>When you make an HTTP request, you&#8217;re connecting to an HTTP server at a given IP on a certain port and sending it a message. It then processes that message and gives you some sort of response.</p>
<p>What does that message look like? It consists of 3 parts:</p>
<blockquote><p>
<em>Request Line.</em> This tells the server what resource you&#8217;re looking for and what HTTP method (ie, one of GET, POST, PUT, DELETE, etc..) you are using. It also specifies the version of the HTTP protocol to use.<br />
<em>Headers.</em> These give metadata about the message, such as the Content-Type, the Host, what type of content you&#8217;ll accept, and a whole bunch of other things.<br />
<em>[CRLF]</em><br />
<em>Optional message body.</em>
</p></blockquote>
<p>So, for example, if you came to the homepage of my blog, your browser sent a message to my server that looked something like this:</p>
<blockquote><p>
GET / HTTP/1.1<br />
Host: www.spenceruresk.com<br />
[CRLF]
</p></blockquote>
<p>Pretty simple, right? Let&#8217;s look at a slightly more complex example. Let&#8217;s say I was hosting a Twitter-like service that allowed you to post status updates with simple HTTP POSTs. A request you&#8217;d send might look something like this:</p>
<blockquote><p>
POST /twitterClone/updateStatus HTTP/1.1<br />
Host: www.spenceruresk.com<br />
Content-Type: text/plain<br />
[CRLF]<br />
Check out this crappy cellphone pic I took at a concert!
</p></blockquote>
<p>In this case, we&#8217;re POSTing some data and telling the server what kind of content it is &#8211; in this case, it is just plain text. Pretty simple, right?</p>
<p><strong>Content-Type and message bodies</strong></p>
<p>One header in particular &#8211; Content-Type &#8211; is relevant to the issue and is worth talking about. When you send a message body, it can represent any number of types of data. For example, it could be plain text, a GIF, form data, or a JSON document. In order for the server to properly decode the body, you have to tell it what it is you&#8217;re sending it. The Content-Type header is how you do this. For a list of common MIME types, this <a href="http://en.wikipedia.org/wiki/Mime_type">Wikipedia</a> article is useful.</p>
<p><strong>Submitting forms</strong></p>
<p>So, what HTTP message is generated and sent to the server when a user submits a form in their browser? The answer is that it depends. If the form is submitted via GET request, the message would look something like this:</p>
<blockquote><p>
GET /signupform?name=Spencer&#038;age=29 HTTP/1.1<br />
Host: www.spenceruresk.com<br />
[CRLF]
</p></blockquote>
<p>Your web framework will then take the key/value pairs in the query string and make them available as request parameters.</p>
<p>What if it is a POST?</p>
<blockquote><p>
POST /signupform HTTP/1.1<br />
Host: www.spenceruresk.com<br />
Content-Type: application/x-www-form-urlencoded<br />
[CRLF]<br />
name=Spencer&#038;age=29
</p></blockquote>
<p>The Content-Type line is critical &#8211; it tells the server &#8220;I&#8217;m sending you URL-encoded form data in the message body.&#8221; Most/All web frameworks see that, then decode the body and make each key/value pair available as request parameters.</p>
<p>If you don&#8217;t tell it that you are sending URL-encoded form data, it doesn&#8217;t decode the body and make the parameters available.</p>
<p><strong>Conclusion</strong></p>
<p>Hope that helps make it at least a little bit clearer. In the next version of the app, I&#8217;m thinking about adding some sort of Content-Type autodetection (that you can turn off) to help avoid people getting confused and frustrated in situations like this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/09/http-message-basics-and-posting-form-data-in-graphical-http-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphical HTTP Client 1.0.3 submitted to the App Store</title>
		<link>http://www.spenceruresk.com/2011/07/graphical-http-client-1-0-3-submitted-to-the-app-store/</link>
		<comments>http://www.spenceruresk.com/2011/07/graphical-http-client-1-0-3-submitted-to-the-app-store/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 04:29:03 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=49</guid>
		<description><![CDATA[Graphical HTTP Client has been in the app store for roughly 2 months now and has had a few updates, but I haven&#8217;t quite added as much as I&#8217;d original hoped to. I&#8217;ve been able to devote more time to it recently and have just submitted 1.0.3 to the App Store. If history is any [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.uresk.net/httpclient/">Graphical HTTP Client</a> has been in the app store for roughly 2 months now and has had a few updates, but I haven&#8217;t quite added as much as I&#8217;d original hoped to. I&#8217;ve been able to devote more time to it recently and have just submitted 1.0.3 to the App Store. If history is any indication, it should be available in roughly a week. I plan to submit 1.0.4 in the next few weeks and generally update the app more frequently over the next few months.</p>
<p>On a side note &#8211; I spent some time playing around with NoSQL technologies (Riak and MongoDB, specifically) over the weekend. One interesting thing about the current crop of NoSQL solutions is that many of them offer an HTTP interface. I found this tool to be quite handy when interacting with Riak and Mongo, and I&#8217;m now brainstorming ideas for making it even more useful for working with NoSQL solutions &#8211; I am kind of excited by some of the possibilities! If this interests you at all, please let me know what ideas you have.</p>
<h1>New Features in 1.0.3</h1>
<h2>1. Improved header entry</h2>
<p>Probably the worst thing about Graphical HTTP Client in its current state is the way you enter and update request headers. It works, but it is kind of clunky and some unexpected things can happen if you aren&#8217;t careful. It turns out, a table view isn&#8217;t the easiest thing to work with for this kind of data. In 1.0.3, I&#8217;ve modified it so that there is a new sheet for adding and updating headers. Clicking on the + button will bring up this sheet, which lets you pick from a list of header names. You can also enter your own if it is a non-standard header. To edit a header, just double-click on its entry in the table. It won&#8217;t let you save over another header, which was a problem with the old table (actually, it would sometimes lock up if you even tried).</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/07/header.png"><img src="http://www.spenceruresk.com/wp-content/uploads/2011/07/header.png" alt="" title="header" width="300" height="290" class="alignnone size-full wp-image-51" /></a></p>
<p>I think this is a much better interaction, and in future releases I&#8217;m going to make it even better. Here are some plans for this functionality for the next release:</p>
<p>- Documentation for standard headers, including example values.<br />
- Some form of auto-complete for values (for example, if you select &#8216;Accept&#8217; or &#8216;Content-Type&#8217;, we can give you a list of standard content types to choose from).</p>
<p>Also, double-clicking on a response header row will pop up a read-only sheet that shows the full header name and header value &#8211; this can be helpful if you are dealing with longer header values.</p>
<h2>2. New Options</h2>
<p>Above the &#8216;Request Headers&#8217; box, there is a new &#8216;Options&#8217; button. This will grow over time, but for now it has 4 options:</p>
<p>- Validate Certificates. True by default. This allows you to tell it to NOT validate SSL certificates, which can be handy if you are using self-signed or internal certificates for your sites/services.<br />
- Follow Redirects. True by default. Unchecking this will cause the tool to stop when it encounters a redirect.<br />
- Compress Request Body. False by default. If checked, this will compress the request body.<br />
- Allow Compressed Responses. False by default. If checked, this will allow the server to send GZIPped responses.</p>
<p>All of these options are scoped to the request and will be saved along with the request, so if you load it back up later, it will remember your options.</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/07/options.png"><img src="http://www.spenceruresk.com/wp-content/uploads/2011/07/options-300x106.png" alt="" title="options" width="300" height="106" class="alignnone size-medium wp-image-52" /></a></p>
<h2>3. Redirect Count</h2>
<p>This is a fairly trivial feature that shows you the number of times your request was redirected. In the future, I plan to record information (url and headers) about each redirect and provide a way for you to view that data, which could be helpful for diagnosing redirect issues.</p>
<h2>4. If the response is an image, it will show up instead of the text box</h2>
<p>If we can see that the response is an image (by looking at the content-type header), we&#8217;ll try to show it instead of the blank text view. Not a huge feature, but if you are ever loading images via the tool, it will save you from having to save the image and go to another program to view it.</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/07/images.png"><img src="http://www.spenceruresk.com/wp-content/uploads/2011/07/images-300x105.png" alt="" title="images" width="300" height="105" class="alignnone size-medium wp-image-53" /></a></p>
<h1>Bug Fixes</h1>
<p>1. Fixed an issue where the &#8216;Copy to Clipboard&#8217; functionality wouldn&#8217;t work properly in certain cases.<br />
2. Fixed an issue where sometimes old data hung around when you loaded a request from a file.</p>
<h1>What&#8217;s coming in 1.0.4</h1>
<p>1. The ability to upload binary data. This is something I badly wanted to get into this release, but it will for sure make it into the next one.<br />
2. More improvements to the header functionality, as mentioned above.<br />
3. Also as mentioned above, more information about redirects.<br />
4. The ability to set preferences for certain things.<br />
5. It will save your last X number of URLs, so you can re-use them easily.</p>
<h1>1.1 and beyond</h1>
<p>1. The #1 feature folks have requested is the ability to use OAuth integration. This is useful for working with services like Twitter.<br />
2. Better formatting for non-JSON responses.<br />
3. Color-coding for response bodies (ie, JSON and XML).<br />
4. The ability to paste in a CURL command and have it be parsed into the tool. This was suggested by someone on the <a href="http://support.uresk.net/">suggestion forum</a>, and once I went through the <a href="http://wiki.basho.com/The-Riak-Fast-Track.html">Riak tutorial</a>, I realized how handy it could be.</p>
<p>Thanks to everyone who uses this tool, has provided feedback, and left ratings/reviews on the app store. If you have feedback on how this tool could improve, don&#8217;t hesitate to let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/07/graphical-http-client-1-0-3-submitted-to-the-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nl2br example in ASP.NET MVC 3</title>
		<link>http://www.spenceruresk.com/2011/06/nl2br-example-in-asp-net-mvc-3/</link>
		<comments>http://www.spenceruresk.com/2011/06/nl2br-example-in-asp-net-mvc-3/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 22:59:03 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=48</guid>
		<description><![CDATA[I&#8217;ve been playing around with ASP.NET 3.5 this weekend, and am building my first real website with it. Much to my horror, as a long-time Java developer, I&#8217;m finding it to be incredibly delightful to work with. C# feels like a slightly-improved version of Java, the tooling is pretty good (even though I&#8217;m still not [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with ASP.NET 3.5 this weekend, and am building my first real website with it. Much to my horror, as a long-time Java developer, I&#8217;m finding it to be incredibly delightful to work with. </p>
<p>C# feels like a slightly-improved version of Java, the tooling is pretty good (even though I&#8217;m still not thrilled with the code editor in VS2010), the Razor syntax used in views is quite clean, and the whole thing is pretty easy to work with. It isn&#8217;t perfect, and I haven&#8217;t tried to go to production with my website yet, but all-in-all, it is a pretty good developer experience.</p>
<p>Working on my website this weekend, I ran into a problem that I &#8211; like probably every other web developer &#8211; have run into many times before: I needed to take some data that had line breaks in it and display it on a page, and somehow figure out how to convert those line endings into &lt;br&gt; tags. A lot of languages and frameworks have something built-in to handle this &#8211; PHP&#8217;s nl2br(), for example &#8211; but I couldn&#8217;t find anything in the documentation far ASP.NET MVC. This is a fairly trivial problem, but it is also a pretty common one and doing it wrong can lead to security problems, so I figured it was worth spending a few minutes figuring out the best way to do it and documenting it.</p>
<p>Doing some research, it seems like folks were recommending 2 main approaches to solving this:</p>
<p>1. Convert the line-endings to  &lt;br&gt;&#8217;s before saving the content to the database. I didn&#8217;t care for this because saving HTML into the database complicates Cross-Site Scripting (XSS) defense. It also makes it problematic if you later want to display that same content outside of HTML (for example, in a mobile phone app).</p>
<p>2. Call Replace(&#8220;\r\n&#8221;, &#8220;&lt;br&gt;&#8221;) on the string when displaying it. I don&#8217;t care for this either &#8211; it seems repetitive (I&#8217;m lazy &#8211; I hate having to do something once, much less 500 times), and even worse, since you have to use @Html.Raw() to display it, it can open you up to XSS attacks.</p>
<p>Thankfully, MVC&#8217;s Html Helpers and C#&#8217;s extension methods provide a way to come up with a relatively simple and robust solution. My requirements were:</p>
<p>1. It had to be easy to use.<br />
2. It had to protect against XSS attacks.<br />
3. It should probably try to take into account the fact that there are (naturally) a number of different ways to end a line: \r\n on Windows, \r on really old Macs, and \n just about everywhere else.</p>
<p>This is what it ended up looking like:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">static</span> Regex LineEnding <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Regex<span style="color: #008000;">&#40;</span><span style="color: #666666;">@&quot;(\r\n|\r|\n)+&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> MvcHtmlString Nl2br<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> HtmlHelper html, <span style="color: #6666cc; font-weight: bold;">string</span> text, <span style="color: #6666cc; font-weight: bold;">bool</span> isXhtml <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  var encodedText <span style="color: #008000;">=</span> HttpUtility<span style="color: #008000;">.</span><span style="color: #0000FF;">HtmlEncode</span><span style="color: #008000;">&#40;</span>text<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  var replacement <span style="color: #008000;">=</span> isXhtml <span style="color: #008000;">?</span> <span style="color: #666666;">&quot;&lt;br /&gt;&quot;</span> <span style="color: #008000;">:</span> <span style="color: #666666;">&quot;&lt;br&gt;&quot;</span><span style="color: #008000;">;</span>
  <span style="color: #0600FF; font-weight: bold;">return</span> MvcHtmlString<span style="color: #008000;">.</span><span style="color: #0000FF;">Create</span><span style="color: #008000;">&#40;</span>LineEnding<span style="color: #008000;">.</span><span style="color: #0000FF;">Replace</span><span style="color: #008000;">&#40;</span>encodedText, replacement<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>And here is how you&#8217;d use it:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">@Html<span style="color: #008000;">.</span><span style="color: #0000FF;">Nl2br</span><span style="color: #008000;">&#40;</span>@Model<span style="color: #008000;">.</span><span style="color: #0000FF;">Description</span><span style="color: #008000;">&#41;</span></pre></div></div>

<p>And here are a few tests for good measure:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&#91;</span>TestMethod<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> TestCRLF<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    var input <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>World!&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> result <span style="color: #008000;">=</span> MyHelpers<span style="color: #008000;">.</span><span style="color: #0000FF;">Nl2br</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, input<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToHtmlString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    var expected <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello&lt;br /&gt;World!&quot;</span><span style="color: #008000;">;</span>
    Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">AreEqual</span><span style="color: #008000;">&#40;</span>expected, result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#91;</span>TestMethod<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> TestLF<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    var input <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello<span style="color: #008080; font-weight: bold;">\n</span>World!&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> result <span style="color: #008000;">=</span> MyHelpers<span style="color: #008000;">.</span><span style="color: #0000FF;">Nl2br</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, input<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToHtmlString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    var expected <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello&lt;br /&gt;World!&quot;</span><span style="color: #008000;">;</span>
    Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">AreEqual</span><span style="color: #008000;">&#40;</span>expected, result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#91;</span>TestMethod<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> TestNonXhtmlOnOldMac<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    var input <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello<span style="color: #008080; font-weight: bold;">\r</span>World!&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> result <span style="color: #008000;">=</span> MyHelpers<span style="color: #008000;">.</span><span style="color: #0000FF;">Nl2br</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, input, <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToHtmlString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    var expected <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello&lt;br&gt;World!&quot;</span><span style="color: #008000;">;</span>
    Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">AreEqual</span><span style="color: #008000;">&#40;</span>expected, result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #008000;">&#91;</span>TestMethod<span style="color: #008000;">&#93;</span>
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> TestXSS<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    var input <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello<span style="color: #008080; font-weight: bold;">\n</span>World!<span style="color: #008080; font-weight: bold;">\r</span><span style="color: #008080; font-weight: bold;">\n</span>Special Message: &lt;script&gt;alert('pwned!');&lt;/script&gt;&quot;</span><span style="color: #008000;">;</span>
    <span style="color: #6666cc; font-weight: bold;">string</span> result <span style="color: #008000;">=</span> MyHelpers<span style="color: #008000;">.</span><span style="color: #0000FF;">Nl2br</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, input<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToHtmlString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    var expected <span style="color: #008000;">=</span> <span style="color: #666666;">&quot;Hello&lt;br /&gt;World!&lt;br /&gt;Special Message: &amp;lt;script&amp;gt;alert(&amp;#39;pwned!&amp;#39;);&amp;lt;/script&amp;gt;&quot;</span><span style="color: #008000;">;</span>
    Assert<span style="color: #008000;">.</span><span style="color: #0000FF;">AreEqual</span><span style="color: #008000;">&#40;</span>expected, result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>A few notes:</p>
<p>- You&#8217;ll note that we HtmlEncode the raw text first, then replace the line breaks with &lt;br&gt; tags. This is so that any potentially malicious user-supplied content gets escaped, but our HTML doesn&#8217;t.<br />
- If the page you are working with is XHTML, the &lt;br&gt; tags should be self-closing. I&#8217;ve made this the default in this case, but you could pass in false to denote that they shouldn&#8217;t be self-closing.<br />
- It is worth noting that you can&#8217;t pass dynamic parameters (such as ViewBag.Message) into an extension method, so you&#8217;ll have to explicitly cast them to a string.<br />
- I&#8217;m quite new to C# and the .NET platform, so any comments or criticisms about this approach are certainly welcome.</p>
<p>Anyway, extension methods make it pretty easy to create your own HTML helpers &#8211; I&#8217;ve already ended up making handful of them to save time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/06/nl2br-example-in-asp-net-mvc-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software Patent Insanity &#8211; When will it end?</title>
		<link>http://www.spenceruresk.com/2011/06/software-patent-insanity-when-will-it-end/</link>
		<comments>http://www.spenceruresk.com/2011/06/software-patent-insanity-when-will-it-end/#comments</comments>
		<pubDate>Thu, 02 Jun 2011 04:25:40 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=46</guid>
		<description><![CDATA[I&#8217;ve been sick today, and so I&#8217;ve been laying in bed watching TV and using my iPad for most of the day. As I sat there, I couldn&#8217;t help thinking &#8220;I&#8217;m so grateful for the brilliant insight and tireless effort of Dan Abelow, who has made it possible for me to take my railroad baron [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been sick today, and so I&#8217;ve been laying in bed watching TV and using my iPad for most of the day. As I sat there, I couldn&#8217;t help thinking &#8220;I&#8217;m so grateful for the brilliant insight and tireless effort of <a href="http://www.lodsys.com/the-inventor.html">Dan Abelow</a>, who has made it possible for me to take my railroad baron skills in Ticket to Ride to the European theater, by way of In App Purchase.&#8221;</p>
<p>Actually, though, I did read <a href="http://www.avc.com/a_vc/2011/06/enough-is-enough.html">Fred Wilson&#8217;s blog post</a> on how the current patent system, abused more and more by lowly patent trolls, is a threat to innovation.</p>
<p>This isn&#8217;t a new problem &#8211; I&#8217;ve had discussions about the problems with software (and business process) patents over a decade ago, and even then it probably wasn&#8217;t new. What is changing, however, is the willingness of patent trolls to go after smaller and smaller businesses, and the fact that technology is so much more a part of every day life for everyone today.</p>
<p>Before, patent suits were largely behind-the-scenes affairs between big companies that resulted in boring settlements or cross-licensing agreements. Or, as I&#8217;ve seen firsthand, the threat of patent lawsuits prevented small startups from receiving financing. Unfair and a huge impediment to innovation? Yes. Exciting and interesting to the average American citizen? Not really.</p>
<p>But as actions like the Lodsys suit against mobile apps that utilize in app purchasing become more common, the effects of a horribly-implemented patent system, abused by unscrupulous patent trolls like Lodsys, has the potential to affect the every-day lives of your average person &#8211; and perhaps shed some more light on the problem.</p>
<p><strong>The scope of the Problem</strong></p>
<p>The scope of the problem with software patents isn&#8217;t obvious at first, but it is an important part of realizing why they are such a threat to innovation and economic growth. Let&#8217;s go through a short little exercise -</p>
<p>Grab your smartphone or tablet if you have one. Scroll through the pages and pages of apps you&#8217;ve downloaded. Pop open your browser and look through the bookmarks and history items that contain all of your favorite websites. Look through the list of applications listed on your computer.</p>
<p>What do all of these have in common? The vast majority (if not all) of them violate one or more  patents. Indeed, any marginally non-trivial app, service, or website probably violates dozens of patents.</p>
<p>Who are these people who have been providing you with applications or services chock-full of patent violations? Are they hardened criminals, numb to the harm they cause others? Or, are they shameless copycats who copy whatever they can find? Or, perhaps, they are hackers who&#8217;ve used their computer skills to steal secret designs from competitors?</p>
<p>None of the above. Most patents (especially the ones used by patent trolls) don&#8217;t exist as an implemented product, a documented library one can buy, or anything of that nature. They exist solely as one of millions of software patents filed with the PTO, written in legalese so heavy you or I would have a hard time knowing what they are describing.</p>
<p>Figuring out which patents your technology violates is so expensive and time consuming that it is effectively impossible for any small or medium business.</p>
<p>Think about that for a minute. Every small business that creates a technology product or service is sitting on dozens of bombs, any one of which can kill it. How is that fair? How is that good policy for promoting innovation and economic growth?</p>
<p><strong>The worst kind of tax</strong></p>
<p>When it comes to talking about economic growth (or lack thereof), it is hard to get very far without talking about the economic impact of taxes. Patents are a form of a tax, but they are the very worst kind of tax &#8211; a tax that is unpublished, seemingly random, and can wipe out your business.</p>
<p>The worst part is that for many of the small victims of these patent trolls, there is very little that can be done to fight this government-enforced monopoly &#8211; the very act of defending themselves will at worst case leave them bankrupt, and at best case cost countless hours and tens of thousands (at the very least) of dollars merely to continue to be able to exist.</p>
<p>It isn&#8217;t a bad business model &#8211; document some basic and broad idea, wait for others to come up with and implement the same idea, then sue them for a percentage of the profits.</p>
<p><strong>Arguments for the patent system</strong></p>
<p>There are lots of arguments for some form of a patent system. The main one is that if I think someone is going to steal my idea (which presumably took a lot of work to come up with), then I won&#8217;t bother coming up with new stuff because it will be hard for me to make money off of my work.</p>
<p>As a society that very highly values competition, we are willing to effectively kill competition by granting a monopoly on an idea in exchange for the value of someone coming up with it. This requires 2 things to be true &#8211; 1) Your &#8216;idea&#8217; must be genuinely novel and take a lot of investment to come up with, and 2) The only way you were willing to invest in coming up with the idea was if you were granted a temporary monopoly on it.</p>
<p>A government-enforced monopoly is a pretty drastic &#8211; and potentially harmful &#8211; thing, so if we are going to buy into that concept we&#8217;d better be getting a lot out of it. As I&#8217;ll try to explain in the next few sections, I don&#8217;t think we are getting even close to enough out of the deal (at least with regards to software patents) to make it worth the cost.</p>
<p><strong>Necessity, the mother of invention</strong></p>
<p>Software development, as a profession, is largely about coming up with solutions to problems. For a given problem, there are generally only a handful of reasonable ways to solve it, and developers independently working on a similar problem will likely come up with generally similar solutions.</p>
<p>If you were to get 100 developers who were ignorant of the Lodsys patents (which, until Lodsys began firing off lawsuits, could have been pretty much any developer) and tell them you need to be able to sell expansions of your game to your users, and give them each an afternoon to come up with a rough solution, you&#8217;d likely get back ideas that could be grouped into half a dozen or so similar distinct ideas. Of those half-dozen distinct approaches, at least a few of them would probably violate the Lodsys patents.</p>
<p>The fact is that most of us solve similarly-difficult problems on a consistent basis &#8211; it is part of our job, and it is part of the reasons software developers are compensated somewhat more than average. The business side of the organization comes to us and says &#8220;We need to be able to do X.&#8221; So, we sit in front of a whiteboard for an hour or whatever, and then start implementing it.</p>
<p>Most of us don&#8217;t think &#8220;Hey, that&#8217;s a good idea! I should write my name on it and send it to the PTO so nobody else can do that without my blessing.&#8221; If we&#8217;re nice enough (and/or our egos are big enough), we&#8217;ll even write about it so others can use our idea.</p>
<p>Some people, however, feel like every idea they come up with is special and that nobody else should be able to do something like it unless they first pay for a license. Those people are assholes.</p>
<p><strong>The cost of an idea</strong></p>
<p>When I look at patents involved in some of these lawsuits, one thing almost always jumps out at me &#8211; once you get past all the lawyer-speak and understand what the patent is describing, it becomes clear that there wasn&#8217;t a lot of work involved in coming up with the idea. In fact, I wouldn&#8217;t be shocked to find that the effort to file the patent significantly outweighed the effort in coming up with the original idea.</p>
<p>If your patent is for a medication that your company spent years of effort and billions of dollars to research and produce, I can get behind patenting it. If your software patent describes something I wrote in High School using Perl, I&#8217;m going to have a hard time accepting your idea as a patentable one.</p>
<p><strong>Counterpoint: Open Source Software</strong></p>
<p>Open sourcing your software is pretty much the opposite of patenting it &#8211; rather than claim a monopoly on my idea, I&#8217;m going to go to great lengths to give it away to others so they can use it. It is a powerful counterpoint to the argument that patents foster innovation.</p>
<p>Go back to the original exercise I had you do earlier. Now consider this &#8211; all of those apps, services, and websites most likely rely heavily on open-source software (yes, even iOS uses plenty of open-source components). This simple blog relies heavily on open-source: The software used is WordPress &#8211; an open-source blogging platform, which is written in PHP &#8211; an open-source programming language. The content is stored in mySQL &#8211; an open-source database. All of it is running on Linux &#8211; an open-source operating system. To write this post, I&#8217;m using Chrome &#8211; an open-source web browser, which is running on Mac OS X &#8211; an operating system that relies heavily on open-source components.</p>
<p>Even you &#8211; one of my 3 or 4 readers &#8211; are almost certainly utilizing a wide array of open-source software to view this post.</p>
<p>The fact that open-source software plays such a pivotal role in everything we do is clear, convincing evidence to me that we can have invention and innovation on a breathtakingly large scale without the need to patent every idea we come up with.</p>
<p><strong>The &#8216;small inventor&#8217; myth</strong></p>
<p>The final defense patent supporters like to throw out is a hypothetical one &#8211; patents are needed to help the small inventor who has his ideas ripped off by a big, evil corporation. I have to ask &#8211; how many times has a small inventor &#8216;invented&#8217; some software and successfully used a patent to keep a big corporation from stealing it? We have a long history of patent trolls abusing software patents, but have we ever seen someone legitimately use one in this way? I haven&#8217;t.</p>
<p><strong>Conclusion</strong></p>
<p>So, to summarize &#8211; most software patents encapsulate something that an average developer could reasonably come up with on their own, are overly broad, and don&#8217;t typically represent a large amount of investment. The people at the PTO should hate themselves for approving them. Even worse &#8211; patents don&#8217;t even seem to be required to get people to innovate and invent new software. So why are we continuing to allow them?</p>
<p>A lot of people talk about half-measures that could be used to improve the patent system, while still allowing software patents &#8211; and a lot of the ideas are decent, but come with their own set of drawbacks.</p>
<p>The real thing that scares me, though, is the fact that much of the damage has already been done. Millions of incredibly simple, overly broad software patents already litter the landscape &#8211; much like how cluster bombs and land mines make an area unsafe even long after the conflict has been resolved. Even if we were to stop issuing software patents immediately, the ones already issued are broad enough to hinder innovation for the next decade.</p>
<p>How will we get out of this mess we&#8217;ve allowed to happen? I don&#8217;t know. But like Fred Wilson said, enough is enough. At some point, this madness has to end.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/06/software-patent-insanity-when-will-it-end/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Mac OS X app released &#8211; Graphical Http Client</title>
		<link>http://www.spenceruresk.com/2011/05/new-mac-os-x-app-released-graphical-http-client/</link>
		<comments>http://www.spenceruresk.com/2011/05/new-mac-os-x-app-released-graphical-http-client/#comments</comments>
		<pubDate>Sun, 01 May 2011 04:40:50 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=40</guid>
		<description><![CDATA[I&#8217;m a huge fan of the app store model that has sprung up over the past few years, and I Apple&#8217;s introduction of the iPhone App Store may have been more influential than the iPhone itself. Part of the reason I like it so much is that I think it is a good business model, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a huge fan of the app store model that has sprung up over the past few years, and I Apple&#8217;s introduction of the iPhone App Store may have been more influential than the iPhone itself. Part of the reason I like it so much is that I think it is a good business model, but it also brings back memories of my Dad and I making applications and sharing them via CompuServe and AOL message boards when I was in Jr High. It is pretty cool to build something that entertains or helps thousands of people across the world (and make a few bucks to fuel your computer habit in the process!)</p>
<p>Nostalgia aside &#8211; I&#8217;ve released a new Mac (desktop) app to the Mac App Store called &#8216;Graphical Http Client&#8217;. This is a developer tool aimed at helping developers test and interact with REST-based services. Typically, when experimenting with or testing these services, you&#8217;ll use a command-line tool (like curl), access it with your browser (if it is a really simple GET request), or write tests to work with these services. My software aims to make this interaction somewhat easier. Some features include:</p>
<p>- Perform any HTTP method (GET, POST, PUT, DELETE, etc..)<br />
- Ability to set request headers<br />
- Ability to set authentication (Basic or Digest)<br />
- When you perform the request, you&#8217;ll see the HTTP status code, how long the request took, the response headers, and the response body<br />
- Nice formatting for requests that return JSON<br />
- Ability to view HTML responses in a web view<br />
- You can save the response body as a file (useful for when it returns binary data like an image)<br />
- You can also save your requests and open them up later to save time<br />
- Plus a bunch of other stuff</p>
<p>You can view it on my website <a href="http://www.uresk.net/httpclient/">here</a>, or directly on the <a href="http://itunes.apple.com/us/app/graphicalhttpclient/id433095876?mt=12&amp;ls=1">Mac App Store</a>.</p>
<p>If you do download it, please leave feedback in the App Store and/or at my <a href="http://support.uresk.net/">User Voice</a> site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/05/new-mac-os-x-app-released-graphical-http-client/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>5 good books I&#8217;ve read this past year</title>
		<link>http://www.spenceruresk.com/2011/04/5-good-books-ive-read-this-past-year/</link>
		<comments>http://www.spenceruresk.com/2011/04/5-good-books-ive-read-this-past-year/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 08:40:31 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=38</guid>
		<description><![CDATA[I&#8217;m a huge fan of reading &#8211; especially science and history books &#8211; and I don&#8217;t even want to know how much money I&#8217;ve spent at Amazon.com and Barnes and Noble over the years. I&#8217;ve read (or, in some cases, re-read) a number of really good books over the past year or so, and wanted [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a huge fan of reading &#8211; especially science and history books &#8211; and I don&#8217;t even want to know how much money I&#8217;ve spent at Amazon.com and Barnes and Noble over the years. I&#8217;ve read (or, in some cases, re-read) a number of really good books over the past year or so, and wanted to share them along with some short notes about what liked or thought about them.</p>
<p><strong>1. <a href="http://www.amazon.com/gp/product/0307885151/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0307885151">A Short History of Nearly Everything</a> by Bill Bryson</strong></p>
<p>A Short History of Nearly Everything is a fun examination physics, chemistry, biology, and general science. The book is quite enjoyable to read and Bill Bryson is quickly becoming one of my favorite authors (<a href="http://www.amazon.com/gp/product/0767919394/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0767919394">Life at Home: A Short History of Private Life</a> is another book of his that I recently read and really enjoyed).</p>
<p>One major theme that stands out is just how tenuous our existence on Earth is. Consider this quote:</p>
<blockquote><p>&#8220;To appreciate just how narrow, you have only to look at Venus. Venus is only twenty-five million miles closer to the Sun than we are. The Sun&#8217;s warmth reaches it just two minutes before it touches us. In size and composition, Venus is very like Earth, but the small difference in orbital distance made all the difference to how it turned out. It appears that during the early years of the solar system Venus was only slightly warmer than Earth and probably had oceans. But those few degrees of extra warmth meant that Venus could not hold on to its surface water, with disastrous consequences for its climate.&#8221;</p></blockquote>
<p>The book is full of examples of how tiny changes to one of a number of variables result in us not being here &#8211; a truly humbling notion. If you are looking for a fun, easy to read introduction to a great deal of interesting science, this book is worth picking up &#8211; I got the illustrated version for my Dad for his birthday, and he&#8217;s been enjoying it as much as I did.</p>
<p><strong>2. <a href="ttp://www.amazon.com/gp/product/1416542108/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1416542108">1776</a> (Illustrated Edition) by David McCullough</strong></p>
<p>David McCullough has written a number of well-researched, interesting historical books. My interest in his work was kicked of by 1776, which examines the military side of the beginning of the founding of our country.</p>
<p>Calling this new version of 1776 &#8220;Illustrated&#8221; is selling it a bit short &#8211; there are indeed a lot of interesting illustrations, but it also includes a number of sealed pouches that contain maps, letters, and historical articles that help bring the most important year of our country to life. McCullough&#8217;s writing also has a way of bringing the main cast of characters in the revolution to life.</p>
<p>Much like Bryson shows us how fragile our very existence is, McCullough shows us how victory in our fight for independence was never assured and was often close to failing, only sustained by unlikely and lucky events &#8211; Washington&#8217;s crossing of the East River, aided by a fortuitous fog comes to mind.</p>
<p>1776 is a great read, and the documents that accompany the illustrated edition make it come alive even more.</p>
<p>Other books from David McCullough I&#8217;ve really enjoyed: <a href="http://www.amazon.com/gp/product/067145711X/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=067145711X">The Great Bridge</a> &#8211; a history of the Brooklyn Bridge and the men who built it. <a href="http://www.amazon.com/gp/product/0671869205/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0671869205">Truman</a> &#8211; A look at an unlikely president who oversaw a lot of important events in American history.</p>
<p><strong>3. <a href="http://www.amazon.com/gp/product/0375412026/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0375412026">American Prometheus: The Triumph and Tragedy of J. Robert Oppenheimer</a> by Kai Bird and Martin J. Sherwin</strong></p>
<p>I have a huge interest in World War II history, and I&#8217;m also interested in science and technology, so this book about Oppenheimer seemed like it would be a good read. I found the book to be an interesting look at Oppenheimer&#8217;s life, the development of the atomic bomb, and the terrible way in which he was treated after the war.</p>
<p>I find it somewhat disgraceful the way the western allies treated some of their scientists after the war &#8211; these were men who applied their genius to hasten the end of the war and undoubtedly save millions of lives. Oppenheimer and many of his fellow Manhattan project scientists became casualties of McCarthyism. Alan Turing, the British scientist instrumental in breaking German ciphers and an important figure in the history of computer science, was relentlessly persecuted for being a homosexual and eventually committed suicide in 1954 (Britain issued an official public apology for this in 2009).</p>
<p>Interestingly, Truman is portrayed somewhat less charitably in this book than in McCullough&#8217;s &#8220;Truman&#8221; &#8211; as Oppenheimer is dealing with feelings of guilt about developing the atomic bomb, Truman (who ultimately approved its use) grows impatient with him, perhaps dealing with his own feelings about it.</p>
<p><strong>4. <a href="http://www.amazon.com/gp/product/0743270754/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0743270754">Team of Rivals</a> by Doris Kearns Goodwin</strong></p>
<p>This year marks the 150th anniversary of the start of the Civil War, and perhaps no single individual is more central to this period of history than Abraham Lincoln. Team of Rivals concentrates on Lincoln&#8217;s relationships with important members of his cabinet &#8211; Seward, Bates, Chase, and Stanton &#8211; who were once his bitter political enemies. Unlike many political and business leaders who surround themselves with yes-men, Lincoln recognized the intelligence and usefulness of his political rivals (who, for the most part, had little respect for him at the time) and included them in his cabinet, knowing full-well they would challenge him.</p>
<p>Team of Rivals shows the intelligence and shrewdness of Lincoln, and how he eventually earned respect and friendship from his former enemies.</p>
<p><strong>5. <a href="http://www.amazon.com/gp/product/0767911792/ref=as_li_ss_tl?ie=UTF8&amp;tag=uresknetworks&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0767911792">Conspiracy of Fools</a> by Kurt Eichenwald</strong></p>
<p>Greed, corruption, and incompetence have been major components of corporate america and wall street for the last few decades, and I really enjoy books that go into the details of some of our biggest scandals. Conspiracy of Fools takes a look at one of the more infamous scandals &#8211; Enron.</p>
<p>Eichenwald tells a fascinating story about what went on at Enron, and how the company was ultimately ruined by greedy executives who did anything they could to make more money. The large amount of research that went into Conspiracy of Fools is evident, as is some of the bias in that research &#8211; Ken Lay is portrayed as almost completely oblivious to any wrongdoing going on, Jeff Skilling&#8217;s portrayal is likewise somewhat sympathetic, and others like Andy Fastow, Dick Causey, and David Duncan are portrayed quite negatively.</p>
<p>Ultimately, it is a fun and interesting inside look at one of the bigger business scandals in recent history.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/04/5-good-books-ive-read-this-past-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where do software bugs come from?</title>
		<link>http://www.spenceruresk.com/2011/01/where-do-software-bugs-come-from/</link>
		<comments>http://www.spenceruresk.com/2011/01/where-do-software-bugs-come-from/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 03:33:57 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[qa]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=37</guid>
		<description><![CDATA[Last night, I came across this question on StackOverflow, essentially asking how you can be a zero-bug programmer. Many of the responses can be boiled down to &#8220;Don&#8217;t write any code.&#8221;, which is pretty much how I&#8217;d respond to that question. If you continue to throw ever-increasing amounts of time and money at a software [...]]]></description>
			<content:encoded><![CDATA[<p>Last night, I came across <a href="http://programmers.stackexchange.com/questions/41248/how-to-be-a-zero-bug-programmer">this question</a> on StackOverflow, essentially asking how you can be a zero-bug programmer. Many of the responses can be boiled down to &#8220;Don&#8217;t write any code.&#8221;, which is pretty much how I&#8217;d respond to that question.</p>
<p>If you continue to throw ever-increasing amounts of time and money at a software project, you can certainly get closer and closer to feeling confident you have no problems in your code, but almost any non-trivial piece of software is likely to have some (albiet, probably rare and minor) bugs in it.</p>
<p>I don&#8217;t, however, think an appropriate response to this fact is to throw up our hands and say &#8220;oh well, what can you do?&#8221;. Bugs are a serious problem that pretty much every software developer faces &#8211; from those building small sites in PHP to engineers writing software to guide spacecraft. Bugs are embarrassing when they are your fault as the developer. They are costly for project teams to fix. They cause your users frustration, inconvenience them, cause them to lose money, and may even <a href="http://en.wikipedia.org/wiki/Therac-25">kill them</a>.</p>
<p>So, if it is impossible (or at least highly impractical) to create software that is guaranteed to have 0 bugs, how can we at least minimize the number of bugs (especially common and/or serious ones)?</p>
<p><strong><em>&#8220;We cannot solve our problems with the same thinking we used when we created them.&#8221; </em>- Albert Einstein</strong></p>
<p>Whenever talking about software quality (or lack thereof), the knee-jerk response is always &#8220;write more tests!&#8221; It always strikes me as a little amusing to think that developers who are capable of writing a piece of software with a bug in it are also capable of writing 100% comprehensive tests that are completely free of bugs themselves.</p>
<p>Tests are, of course, incredibly valuable and I don&#8217;t want to demean their value &#8211; indeed, they are useful beyond just testing for bugs, and I&#8217;ve found them helpful as supplemental documentation and as ways to improve my APIs. I do, however, think that blindly writing more tests as a solution to buggy software is misguided. To understand why that is, we must first understand how we get bugs in our software in the first place.</p>
<p><strong>Where do bugs come from?</strong></p>
<p>A lot of the time, we naively assume that a bug happened because a programmer did something wrong. Technically, this may be true, but it is neither useful nor interesting to think of it this simplistically. What are some more specific reasons?</p>
<ol>
<li>Programmer error. Perhaps, the programmer did indeed screw up. Maybe it was a typo, or perhaps they didn&#8217;t understand a particular API and misused it. Even within this category, there are a bunch of useful things to consider &#8211; is it because of lack of training? Not enough documentation of APIs a developer is using? Hiring inexperienced programmers?</li>
<li>Insufficient requirements. Often, specific pieces of functionality are incompletely and ambiguously defined. The code may be completely bug free for every situation the developer was told to think of, but there are holes in the requirements that don&#8217;t manifest themselves until later.</li>
<li>Seams in functionality. The Agile methodology has, on the whole, been hugely positive for the software development industry. One negative aspect to how some teams implement it, however, is that while each user story (piece of functionality) may be completely bug free, the seams between those pieces of functionality are often messy, poorly tested, and often buggy &#8211; partially owing to the fact that you may have had one developer and one qa resource working on one part, and a completely different pair working on the other part. In my own personal experience, a disproportionate number of bugs appear in the seams between functionality.</li>
<li>Third party libraries. Sometimes the code we have little or no control over contains bugs.</li>
<li>External resources. Sometimes resources outside of the control of our program contain bugs.</li>
</ol>
<p>I could go on, but hopefully I&#8217;ve given you the idea that a lot of factors cause or contribute to bugs in software products and that it is useful to try to think about these reasons.</p>
<p><strong>How do we avoid making bugs?</strong></p>
<p>So, knowing how we end up with bugs, how can we minimize them?</p>
<ol>
<li>Develop better. Whether this means more training, more code reviews, or just hiring better developers.</li>
<li>More, and better, tests.</li>
<li>Static analysis tools.</li>
<li>Better requirements.</li>
<li>More manual QA.</li>
<li>Many, many more ways&#8230;.</li>
</ol>
<p>Hopefully as you read through my causes of bugs above (and thought of your own), you realized why I think tests aren&#8217;t necessarily the best method for dealing with buggy software in all cases. If your problem is that specifications are poor and incomplete, it is impossible for more tests to help you. If your programmers are making a lot of mistakes, they don&#8217;t need to write more tests &#8211; they need to write fewer bugs. If most of your bugs manifest themselves in the seams of functionality, one functional test is probably going to be worth more than a thousand unit tests.</p>
<p><strong>You can&#8217;t improve what you can&#8217;t measure</strong></p>
<p>Back around 2000, I started a company to track the results of online advertising. Companies were spending ghastly amounts of advertising with little idea of which advertisements were making them a lot of sales and which ones were complete wastes. That company didn&#8217;t do incredibly well because I was 18, kind of an idiot, and had absolutely no money. I still, however, believe in the power of hard data and analytics to help us make better decisions and gauge our success. I also believe that these concepts can be applied to making better software. However, nobody &#8211; including myself &#8211; is bothering to track how bugs actually happen and how we can most effectively prevent them.</p>
<p>Indeed, I&#8217;ve used a number of high-quality open-source and commercial issue tracking tools. They are all really good at recording bugs, prioritizing them, tracking them as they get resolved, and helping us remember when we fixed them. But I&#8217;ve yet to see an issue tracking tool that actually tries to help you make better decisions about where to concentrate your future software quality efforts. This is unfortunate, because I think issue tracking tools are ideally situated to be the place where causes and possible solutions are recorded and measured.</p>
<p><strong>&#8220;<em>Half the money I spend on advertising is wasted; the trouble is I don&#8217;t know which half.</em>&#8221; &#8211; John Wanamaker</strong></p>
<p>Software projects spend a lot of money in an effort to ensure a quality product. Much like the problem John Wanamaker had with his advertising money, I think projects waste a lot of money trying to improve quality.</p>
<p>Consider a product that currently has 50% test code coverage and too many bugs. A manager may say &#8220;We need to raise our test coverage to 75%!&#8221;, and the developers dutifully go off and spend a few weeks writing tests to get test coverage up to an acceptable level. At the end of the exercise, they have 75% test coverage &#8211; a 50% increase!</p>
<p>Has the quality of their product gone up by 50%? My experience tells me &#8220;No&#8221;. The reason is usually  a combination of a few factors &#8211; lack of testing probably wasn&#8217;t the whole problem, and test coverage is raised by testing the easiest (and probably least-buggy) stuff first. All of that time spent increasing code coverage was probably a waste, or at least not as effective as other efforts could have been &#8211; perhaps the requirements could have been documented more precisely, or rather than trying to hit a test coverage target, problematic portions of the application could have been identified and tested more thoroughly.</p>
<p><strong>Conclusion</strong></p>
<p>I have no product to sell, nor do I have a comprehensive solution to software quality to propose. I do hope that this post maybe sparks some thought and discussion on how we can better analyze our past coding mistakes and figure out better, more efficient ways of preventing them in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/01/where-do-software-bugs-come-from/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 &#8211; A bunch of code completion/navigation features I miss from Eclipse</title>
		<link>http://www.spenceruresk.com/2011/01/visual-studio-2010-a-bunch-of-code-completionnavigation-features-i-miss-from-eclipse/</link>
		<comments>http://www.spenceruresk.com/2011/01/visual-studio-2010-a-bunch-of-code-completionnavigation-features-i-miss-from-eclipse/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 01:10:13 +0000</pubDate>
		<dc:creator>Spencer Uresk</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.spenceruresk.com/?p=25</guid>
		<description><![CDATA[For those of you who don&#8217;t know me, I&#8217;m a long-time Java developer (although I&#8217;ve spent plenty of time playing around with other languages and platforms). I&#8217;m also a big believer in developer tools &#8211; I create developer tools as part of my day job, and take advantage of tools as part of all the [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know me, I&#8217;m a long-time Java developer (although I&#8217;ve spent plenty of time playing around with other languages and platforms). I&#8217;m also a big believer in developer tools &#8211; I create developer tools as part of my day job, and take advantage of tools as part of all the programming I do. Finally, I&#8217;m incredibly lazy and I&#8217;d spend all day playing video games if I could, so saving time is important to me  - every millisecond I save typing code is a millisecond more I can play World of Warcraft or Gran Turismo 5.</p>
<p>This weekend, I spent a bunch of time playing around with C#, ASP.NET MVC 3, and Visual Studio 2010. There are a lot of compelling things for me about this platform &#8211; C# is incredibly close to Java (even looking at IL code, I was surprised at how similar it was to Java bytecode) but has some features we Java developers can only dream about, there is a lot of progress within the whole .NET ecosystem, and the deployment mode of ASP.NET websites has potential to solve some problems I have deploying Java applications.</p>
<p>Overall, my experience making a few small ASP.NET websites this weekend was pretty good. For the purpose of this post, however, I&#8217;m going to concentrate on my experiences with Visual Studio&#8217;s code editor &#8211; specifically, some things I really miss from the JDT in Eclipse. It is important to keep in mind that this isn&#8217;t meant to be a comparison of the two tools and a declaration of  which one is better &#8211; the scope of my wishes are pretty narrow, and frankly, I don&#8217;t care which one is better since they rarely directly compete. It also isn&#8217;t meant to be a rant on how much Visual Studio sucks, as I think it is generally a good tool that, like any other tool, has  some things that I wish worked a little differently.</p>
<p>Also, I freely admit that some of my complaints/wishes may be invalid &#8211; maybe there is a way to do what I want, maybe what I want to do is stupid, or maybe there is a good reason I can&#8217;t do what I want. Feel free to correct me in the comments <img src='http://www.spenceruresk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>With that rambling preamble out of the way, here are the things that I miss from Eclipse:</p>
<p><strong>1. Open Type</strong></p>
<p>It is really handy to be able to open a class by its name. <em>Open Type..</em> is a considerably more efficient way to navigate to an arbitrary class than finding it in the project tree and it has saved me countless hours. Here is what it looks like in Eclipse:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/OpenTypeEclipse1.png"><img class="size-full wp-image-27 alignnone" title="OpenTypeEclipse" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/OpenTypeEclipse1.png" alt="" width="603" height="509" /></a></p>
<p>A couple of things to note &#8211; 1) It can open any type in your workspace, whether it is a class you&#8217;ve written, one from a referenced library, or from the JDK. 2) It has pretty smart matching (ie, you can use * liberally or do something like NPE to have it find NullPointerException. 3) It is really fast.</p>
<p>I can&#8217;t tell you how much I use this every day. Visual Studio has similar capabilities, so let&#8217;s see what it looks like:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/NavigateToVS.png"><img class="alignnone size-full wp-image-28" title="NavigateToVS" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/NavigateToVS.png" alt="" width="653" height="457" /></a></p>
<p>Not bad, but there are a few differences:</p>
<ul>
<li>It doesn&#8217;t include referenced libraries. Actually, the scope of the navigation was a little tricky to figure out. It would occasionally return an external class, but only if I already had it open in another tab.</li>
<li>It also includes member variables and other items. I can see how this would sometimes be useful, but it can get noisy &#8211; it would be nice if there were an easy way to filter results.</li>
</ul>
<p><strong>2. Class Hierarchy</strong></p>
<p>Another handy thing is to be able to quickly view the class hierarchy for any given type. It can be really useful to instantly know stuff like &#8220;What are this class&#8217; super types?&#8221; or &#8220;What known implementations of this interface are there?&#8221;. Eclipse has a Type Hierarchy view that you can access by selecting any class name (it doesn&#8217;t have to be at the class declaration) and either right-clicking and selecting &#8216;Open Type Hierarchy&#8217; or simply hitting F4. This opens a nice view of the type hierarchy that looks like this:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/TypeHierarchyEclipse.png"><img class="alignnone size-full wp-image-29" title="TypeHierarchyEclipse" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/TypeHierarchyEclipse.png" alt="" width="298" height="313" /></a></p>
<p>Visual Studio does have a type hierarchy viewer, but I couldn&#8217;t figure out how to get it to show any arbitrary type &#8211; you have to use the tree view to find the particular type you are looking for.</p>
<p><strong>3. Code Complete</strong></p>
<p>Code completion is a lazy developer&#8217;s best friend, and I&#8217;d heard great things about IntelliSense. My experience was that while it worked in more contexts than in Eclipse, the code complete in C# code felt really sub-optimal. First, let&#8217;s compare aut0-completing a method on the string class in both languages. <strong>Note</strong>: I&#8217;ve butchered these a little bit to get them to fit correctly in my blog. In both cases, they look a little better in the actual IDE.</p>
<p>Eclipse:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete1Eclipse.png"><img class="alignnone size-full wp-image-30" title="AutoComplete1Eclipse" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete1Eclipse.png" alt="" width="561" height="209" /></a></p>
<p>A couple of things that I want to point out about what you see in the code-complete popup:</p>
<ul>
<li>It shows the full method signature, as well as other info. You see the return type (immediately after the method signature) and which class that method actually comes from (to the right of the return type). If there are overloaded methods, you see all of them.</li>
<li>If there are any JavaDocs associated with that method, you&#8217;ll see them on the right.</li>
<li>The symbol on the far left tells you what kind of method this is &#8211; public, protected, or private.</li>
</ul>
<p>Now, let&#8217;s take a look at what a similar situation looks like in Visual Studio:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete1VisualStudio.png"><img class="alignnone size-full wp-image-31" title="AutoComplete1VisualStudio" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete1VisualStudio.png" alt="" width="545" height="218" /></a></p>
<p>We get a roughly similar view, but the information is harder to process. Parameter information and the return type is instead located on the right-popout that you only see if you hover your mouse over the auto-complete candidate for a second. Worse, it is poorly formatted and the information doesn&#8217;t jump out at you like it does in the Eclipse scenario. Finally, if there are overloaded methods, you can&#8217;t see their signatures in this view.</p>
<p><strong>4. Code Complete, Part 2</strong></p>
<p>So, what happens once we hit &#8216;enter&#8217; on one of those items?</p>
<p>Eclipse:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete2Eclipse.png"><img class="alignnone size-full wp-image-32" title="AutoComplete2Eclipse" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete2Eclipse.png" alt="" width="251" height="110" /></a></p>
<p>You&#8217;ll note that it not only inserts the rest of the method name, but stubs out the entire call for me with placeholders. As I type in real values for each of the placeholders, I can hit &#8216;tab&#8217; to go to the next one. It also helpfully shows the parameter types in the tooltip above it. Really useful.</p>
<p>Visual Studio:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete2VisualStudio.png"><img class="alignnone size-full wp-image-33" title="AutoComplete2VisualStudio" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete2VisualStudio.png" alt="" width="277" height="90" /></a></p>
<p>This is what it looks like in Visual Studio immediately after hitting &#8216;enter&#8217;. This is not very helpful. Hitting control + space at this point does nothing.</p>
<p>I have to think there is a way to get VS to do something more useful here (let me know if there is!), but really, it shouldn&#8217;t take another key combination or other action to get it to do something close to what Eclipse does.</p>
<p><strong>5. Code Complete, Part 3</strong></p>
<p>The scope of IntelliSense seemed really limited, too. For example, I was trying to use the <em>DbContext </em>class from <em>System.Data.Entity</em>. So, I typed <em>DbC </em>and then hit ctl+space, and wasn&#8217;t presented with anything useful. In Eclipse, if you were to do something similar, you&#8217;d see something like this:</p>
<p><a href="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete3Eclipse.png"><img class="alignnone size-full wp-image-34" title="AutoComplete3Eclipse" src="http://www.spenceruresk.com/wp-content/uploads/2011/01/AutoComplete3Eclipse.png" alt="" width="425" height="193" /></a></p>
<p>Selecting one of those would cause Eclipse to automatically import the proper package.</p>
<p>Visual Studio clearly knows enough to do this &#8211; when I right-click on DbContext, it offers me the option of importing the correct namespace. Why couldn&#8217;t it do this as part of the IntelliSense functionality?</p>
<p><strong>6. Sundry</strong></p>
<p>There a ton of little things that annoyed me or felt sub-optimal, but didn&#8217;t warrant screenshots or their own section:</p>
<ul>
<li>Eclipse has a feature where you can tell it to automatically put semi-colons and braces at the end of the line when you type them. This saves you having to cursor over or hit &#8216;end&#8217; to do that (I told you I was lazy!).</li>
<li>Code Snippets are pretty cool &#8211; Eclipse has a similar feature. I have 2 problems with Visual Studio&#8217;s implementation: 1) They aren&#8217;t editable or createable through a simple interface in the IDE (that I can tell). 2) They show in the same IntelliSense popup as everything else, yet you hit &#8216;tab&#8217; instead of &#8216;enter&#8217; to activate them. Why?</li>
<li>It is kind of annoying to have to manually build the project to get certain things to happen. Why can&#8217;t it be continuously building like Eclipse Java projects? I realize this occasionally causes problems in Eclipse, but you can turn it off if you want.</li>
</ul>
<p><strong>Conclusion</strong></p>
<p>Admittedly, when you use a tool for 8 or so hours per day for a number of years, you develop a ton of muscle memory, and using anything else feels really weird. I think, though, that some of the things I&#8217;ve pointed out above aren&#8217;t just &#8216;different&#8217; in Eclipse, but are actually better, and it would be nice to see them in Visual Studio. I&#8217;m pretty open-minded, though, so if I&#8217;m somehow wrong, feel free to let me know via the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.spenceruresk.com/2011/01/visual-studio-2010-a-bunch-of-code-completionnavigation-features-i-miss-from-eclipse/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

