<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Stuart's Blog</title>
	<atom:link href="http://iamsh.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://iamsh.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 26 Nov 2008 05:05:14 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='iamsh.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/6078172b7fa306a0601cef5584fb5f9e?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Stuart's Blog</title>
		<link>http://iamsh.wordpress.com</link>
	</image>
			<item>
		<title>WeatherWrapper C# Open Source Project</title>
		<link>http://iamsh.wordpress.com/2008/11/26/weatherwrapper-c-open-source-project/</link>
		<comments>http://iamsh.wordpress.com/2008/11/26/weatherwrapper-c-open-source-project/#comments</comments>
		<pubDate>Wed, 26 Nov 2008 05:05:14 +0000</pubDate>
		<dc:creator>stuart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://iamsh.wordpress.com/?p=10</guid>
		<description><![CDATA[I released a bit of code I&#8217;ve been working on to grab the NOAA&#8217;s weather forecasts.  It&#8217;s nothing earth-shattering, but hopefully it&#8217;ll save a bit of someone&#8217;s time.  From the description on Codeplex
The NOAA provides some great weather-related resources, but it takes a bit of work to tie them together. This project&#8217;s goal is to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamsh.wordpress.com&blog=5590183&post=10&subd=iamsh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I released a bit of code I&#8217;ve been working on to grab the NOAA&#8217;s weather forecasts.  It&#8217;s nothing earth-shattering, but hopefully it&#8217;ll save a bit of someone&#8217;s time.  From the description on Codeplex</p>
<blockquote><p><span>The NOAA provides some great weather-related resources, but it takes a bit of work to tie them together. This project&#8217;s goal is to provide a simple-to-use wrapper and parser for the <a class="externalLink" href="http://www.weather.gov/xml/#nonSOAP">NOAA weather service&#8217;s forecasts</a> and <a class="externalLink" href="http://www.weather.gov/xml/current_obs/">current weather conditions</a>.  It will fetch and parse a zip code&#8217;s forecast, find the nearest weather station, and then fetch and parse that feed</span></p>
<p>It&#8217;s also smart about updates. NOAA&#8217;s limit of 1 request / hour is automatically respected (forecasts remember when they were looked up and only refresh themselves when they&#8217;re stale)</p>
<p>On the downside, the unit tests are outdated where they even exist and the xml parsing is ugly (I was experimenting with LINQ for that). But hey, it&#8217;s open source, right? You could fix it</p>
<p>Note that there&#8217;s plenty of information in the NOAA&#8217;s feed that it doesn&#8217;t currently bother to parse.  <a class="externalLink" href="http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXML.htm">This page</a> enumerates most of the possibilities</p></blockquote>
<p><span><a href="http://www.codeplex.com/weatherwrapper">Here&#8217;s the link</a><br />
</span></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamsh.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamsh.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/iamsh.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/iamsh.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/iamsh.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/iamsh.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/iamsh.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/iamsh.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/iamsh.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/iamsh.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamsh.wordpress.com&blog=5590183&post=10&subd=iamsh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://iamsh.wordpress.com/2008/11/26/weatherwrapper-c-open-source-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01e3dc5dc25f967f99962de874a9267d?s=96&#38;d=identicon" medium="image">
			<media:title type="html">stuart</media:title>
		</media:content>
	</item>
		<item>
		<title>Safe Delete Links in ASP.NET MVC</title>
		<link>http://iamsh.wordpress.com/2008/11/20/safe-delete-links-in-aspnet-mvc/</link>
		<comments>http://iamsh.wordpress.com/2008/11/20/safe-delete-links-in-aspnet-mvc/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 23:04:01 +0000</pubDate>
		<dc:creator>stuart</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://iamsh.wordpress.com/?p=3</guid>
		<description><![CDATA[The problem, as explained by Jason Fried at 37Signals:
Google’s web accelerator seems like a good thing for the public web, but it can wreak havok on web-apps and other things with admin-links built into the UI. How’s that?
The accelerator scours a page and prefetches the content behind each link. This gives the illusion of pages [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamsh.wordpress.com&blog=5590183&post=3&subd=iamsh&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The problem, <a href="http://www.37signals.com/svn/archives2/google_web_accelerator_hey_not_so_fast.php">as explained by Jason Fried</a> at 37Signals:</p>
<blockquote><p><a href="http://webaccelerator.google.com/">Google’s web accelerator</a> seems like a good thing for the <strong>public web</strong>, but it can wreak havok on <strong>web-apps</strong> and other things with admin-links built into the UI. How’s that?</p>
<p>The accelerator scours a page and prefetches the content behind each link. This gives the illusion of pages loading faster (since they’ve already been pre-loaded behind the scenes). Here’s the problem: Google is essentially clicking every link on the page — including links like “delete this” or “cancel that.” And to make matters worse, Google ignores the Javascript confirmations. So, if you have a “Are you sure you want to delete this?” Javascript confirmation behind that “delete” link, Google ignores it and performs the action anyway</p></blockquote>
<p>The root of the problem is that links generate <a href="http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol#Request_methods">GET requests</a>, which <a href="http://en.wikipedia.org/wiki/HyperText_Transfer_Protocol#Safe_methods">should be &#8217;safe&#8217;,</a> so they&#8217;re not strictly appropriate for modifying actions like deletes.  However, it&#8217;s not always aesthetically viable to use a button inside a form</p>
<p>I&#8217;ve taken the approach taken used in Rails, which is to use javascript to inject a form when the link is clicked that will submit a POST request to the correct url.  Web accelerators and search engines will pass over the link harmlessly, but it will work within the browser as long as javascript is enabled</p>
<p>Two step implementation.  First, add a DeleteLink extension method</p>
<p>public static string DeleteLink&lt;TController&gt;(this HtmlHelper helper, Expression&lt;Action&lt;TController&gt;&gt; action, string text, string confirmation_text) where TController : Controller<br />
{<br />
var action_address = helper.BuildUrlFromExpression&lt;TController&gt;(action);</p>
<p>const string link_format = &#8220;&lt;a href=&#8217;#&#8217; onclick=\&#8221;if (confirm(&#8216;{1}&#8217;)) {{ var f = document.createElement(&#8216;form&#8217;); f.style.display = &#8216;none&#8217;; this.parentNode.appendChild(f); f.method = &#8216;POST&#8217;; f.action = &#8216;{0}&#8217;;f.submit(); }};return false;\&#8221;&gt;{2}&lt;/a&gt;&#8221;;</p>
<p>return string.Format(link_format, action_address, confirmation_text, text);<br />
}</p>
<p><em>Note: string.Format needs double curly braces to emit a single curly<br />
</em></p>
<p>That can be called in the view like</p>
<pre>&lt;%= Html.DeleteLink&lt;ListingsController&gt;(l =&gt; l.Delete(listing.id), "Delete listing", "Delete this listing?") %&gt;</pre>
<p><em>Postlink would be a more apt name since it&#8217;s not specific to deletes, but I&#8217;ve left mine as DeleteLink since that&#8217;s how I&#8217;m using it<br />
</em></p>
<p>Finally, decorate modifying actions such that they only accept the correct verbs to be safe</p>
<pre>[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Delete(int id)
{
...
}</pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/iamsh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/iamsh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/iamsh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/iamsh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/iamsh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/iamsh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/iamsh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/iamsh.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/iamsh.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/iamsh.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=iamsh.wordpress.com&blog=5590183&post=3&subd=iamsh&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://iamsh.wordpress.com/2008/11/20/safe-delete-links-in-aspnet-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/01e3dc5dc25f967f99962de874a9267d?s=96&#38;d=identicon" medium="image">
			<media:title type="html">stuart</media:title>
		</media:content>
	</item>
	</channel>
</rss>