<?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>Kit Menke&#039;s Blog &#187; Links</title>
	<atom:link href="http://kitmenke.com/blog/tag/links/feed/" rel="self" type="application/rss+xml" />
	<link>http://kitmenke.com/blog</link>
	<description>Experiences with SharePoint, web development, and programming</description>
	<lastBuildDate>Fri, 20 Aug 2010 14:19:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using undefined in JavaScript</title>
		<link>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/</link>
		<comments>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 17:37:52 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=269</guid>
		<description><![CDATA[Working with JavaScript can definitely be painful, but I always love stumbling across interesting and strange features of the language. I just found wtfjs.com which led me to these two answers on stackoverflow. The first answer made me realize that undefined is not a keyword in JavaScript; it actually is a type that also happens [...]]]></description>
			<content:encoded><![CDATA[<p>Working with JavaScript can definitely be painful, but I always love stumbling across interesting and strange features of the language. I just found <a href="http://wtfjs.com/">wtfjs.com</a> which led me to these <a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2008728#2008728">two</a> <a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2010740#2010740">answers</a> on stackoverflow.</p>
<p><span id="more-269"></span></p>
<p><a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2008728#2008728">The first answer</a> made me realize that <code class="codecolorer text default"><span class="text">undefined</span></code> is not a keyword in JavaScript; it actually is a <strong>type</strong> that also happens to have a global variable with the same name. This means that you can change the value of <code class="codecolorer text default"><span class="text">undefined</span></code> (the global variable) to be something else.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> undefined <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">true</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> undefined <span style="color: #339933;">=</span> <span style="color: #CC0000;">42</span><br />
<span style="color: #CC0000;">42</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> undefined <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">false</span></div></div>
<p>And, like shown above, the correct way to check if a variable is <code class="codecolorer text default"><span class="text">undefined</span></code> is by using <code class="codecolorer text default"><span class="text">typeof</span></code>.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #003366; font-weight: bold;">var</span> myVariable<span style="color: #339933;">;</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> myVariable<br />
<span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> myVariable <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #CC0000;">1</span><br />
<span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> myVariable<br />
<span style="color: #3366CC;">&quot;number&quot;</span></div></div>
<p><a href="http://stackoverflow.com/questions/1995113/strangest-language-feature/2010740#2010740">The second feature</a>, is something that I often used but had no idea why it actually worked: <code class="codecolorer text default"><span class="text">void(0)</span></code>.</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:void(0)&quot;</span>&gt;</span>do nothing<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;</span></div></div>
<p>According to Breton&#8217;s excellent explanation, <code class="codecolorer text default"><span class="text">void</span></code> is actually a prefix operator. When you prefix any expression with <code class="codecolorer text default"><span class="text">void</span></code>, the result evaluates to <code class="codecolorer text default"><span class="text">undefined</span></code>. So, using our <em>correct</em> method for checking <code class="codecolorer text default"><span class="text">undefined</span></code> above you get this in the console:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&gt;&gt;&gt;</span> <span style="color: #000066; font-weight: bold;">typeof</span> <span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><br />
<span style="color: #003366; font-weight: bold;">true</span></div></div>
<p>Awesome!</p>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=269&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2010/08/10/using-undefined-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AllowUnsafeUpdates and ValidateFormDigest</title>
		<link>http://kitmenke.com/blog/2009/12/23/allowunsafeupdates-and-validateformdigest/</link>
		<comments>http://kitmenke.com/blog/2009/12/23/allowunsafeupdates-and-validateformdigest/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:34:41 +0000</pubDate>
		<dc:creator>Kit</dc:creator>
				<category><![CDATA[SharePoint 2007]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://kitmenke.com/blog/?p=175</guid>
		<description><![CDATA[Add this to the list of things every SharePoint developer should know (up there with disposing SPWebs and SPSites). In general&#8230; Don&#8217;t update SharePoint objects on a GET request Call SPUtility.ValidateFormDigest() before anything on a POST request Here are the two links to read: What you need to know about AllowUnsafeUpdates (Part 1) What you need [...]]]></description>
			<content:encoded><![CDATA[<p>Add this to the list of things every SharePoint developer should know (up there with disposing SPWebs and SPSites).</p>
<p>In general&#8230;</p>
<ol>
<li>Don&#8217;t update SharePoint objects on a GET request</li>
<li>Call SPUtility.ValidateFormDigest() before anything on a POST request</li>
</ol>
<p>Here are the two links to read:</p>
<ul>
<li><a rel="bookmark" href="http://hristopavlov.wordpress.com/2008/05/16/what-you-need-to-know-about-allowunsafeupdates/">What you need to know about AllowUnsafeUpdates (Part 1)</a></li>
<li><a rel="bookmark" href="http://hristopavlov.wordpress.com/2008/05/21/what-you-need-to-know-about-allowunsafeupdates-part-2/">What you need to know about AllowUnsafeUpdates (Part 2)</a></li>
</ul>
<img src="http://kitmenke.com/blog/?ak_action=api_record_view&id=175&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kitmenke.com/blog/2009/12/23/allowunsafeupdates-and-validateformdigest/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
