<?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/"
	>

<channel>
	<title>Adam.Kahtava.com / AdamDotCom &#187; ADC Website</title>
	<atom:link href="http://adam.kahtava.com/journal/category/open-source/adc-website/feed/" rel="self" type="application/rss+xml" />
	<link>http://adam.kahtava.com/journal</link>
	<description>A software development blog</description>
	<pubDate>Thu, 15 Jul 2010 17:00:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Same Origin Policy: JSONP vs The document.domain Property</title>
		<link>http://adam.kahtava.com/journal/2010/03/18/the-same-origin-policy-jsonp-vs-the-documentdomain-property/</link>
		<comments>http://adam.kahtava.com/journal/2010/03/18/the-same-origin-policy-jsonp-vs-the-documentdomain-property/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 17:00:26 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[ADC Services]]></category>

		<category><![CDATA[ADC Website]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Services]]></category>

		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=2441</guid>
		<description><![CDATA[The Same Origin Policy ensures that the client-side code (JavaScript) running on a website originated from that website. This prevents website http://kahtava.com from accessing resources (via client-side code) on website http://malicious-password-sniffers.com or website http://adam.kahtava.com from executing resources from http://kahtava.com - note that the sub-domains differ, one being kahtava.com, the other being adam.kahtava.com 
In most cases [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Same_origin_policy">The Same Origin Policy</a> ensures that the client-side code (JavaScript) running on a website originated from <em>that</em> website. This prevents website <em>http://kahtava.com</em> from accessing resources (via client-side code) on website <em>http://malicious-password-sniffers.com</em> or website <em>http://adam.kahtava.com</em> from executing resources from <em>http://kahtava.com</em> - note that the sub-domains differ, one being kahtava.com, the other being <em>adam</em>.kahtava.com </p>
<p>In most cases The Same Origin Policy is desirable. It helps to prevent malicious code that could potentially reveal sensitive information from being run on arbitrary website. However, the same origin policy also makes it difficult to share resources within a common root domain, or run external widgets on your site (like displaying <a href="http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/">The Project Badge</a> within your site). There are a couple ways to circumvent The Same Origin Policy, but I focus on JSONP and the <code>document.domain</code> property in this post.</p>
<h3>Ways to circumvent the Same Origin Policy</h3>
<ol>
<li><a href="http://en.wikipedia.org/wiki/JSON#JSONP">JSONP</a></li>
<li>Modifying the <code><a href="https://developer.mozilla.org/en/DOM/document.domain">document.domain</a></code> property</li>
<li>Creating a <a href="http://developer.yahoo.com/javascript/howto-proxy.html">server side web proxy</a></li>
</ol>
<h4>JSONP (JSON with padding)</h4>
<p><strong>How it works:</strong> JSONP dynamically creates a script element in the head of your HTML document which then requests data from outside your domain. <em>JSONP exploits a loophole in the Same Origin Policy that allows JavaScript from an external sites to be run within your site (much like how web analytic tracking works).</em> The JSON response, when returned, is executed within your browser at which time the JavaScript can manipulate your HTML page / DOM.</p>
<p><strong>An Example Using JSONP with jQuery:</strong></p>
<div class="syntax_hilite">
<div id="javascript-3">
<div class="javascript"><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; $.<span style="color: #006600;">getJSON</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'http://adam.kahtava.com/services/open-source/projects.json?project-host:username=github:adamdotcom&amp;callback=?'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p>
<em>Note the <code>callback=?</code> at the end of the URI, in jQuery this indicates a JSONP call.</em></p>
<p><strong>Pros</strong></p>
<ul>
<li>Lets us make external calls to any endpoint that supports JSONP</li>
<li>Lets us make external calls from HTTP to HTTPS</li>
<li>Supported by all major browsers</li>
</ul>
<p><strong>Cons</strong></p>
<ul>
<li>A bit more complex upfront, but most server side technologies support JSONP, browsers are natively supporting JSON, and JavaScript libraries like jQuery continue to abstract away most of the complexity.</li>
</ul>
<h4>The <code>document.domain</code> property</h4>
<p><strong>How it works:</strong> the <code>document.domain</code> property contains the domain of the server from which the page was loaded. For example, the domain for <em>http://adam.kahtava.com/</em> would be <em>adam.kahtava.com</em> whereas the domain for <em>http://kahtava.com</em> would be <em>kahtava.com</em>. The Same Origin Policy restricts resource access from <em>kahtava.com</em> to <em>adam.kahtava.com</em> unless we set the <code>document.domain</code> property to the root domain (in this case I'd want it set to <em>kahtava.com</em> to share resources with <em>http://adam.kahtava.com</em>).</p>
<p><strong>An Example using the <code>document.domain</code> property:</strong></p>
<div class="syntax_hilite">
<div id="javascript-4">
<div class="javascript"><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />
&nbsp; document.<span style="color: #006600;">domain</span> = <span style="color: #3366CC;">'kahtava.com'</span>;<br />
&nbsp; $.<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'http://adam.kahtava.com/contact-me/'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span>data<span style="color: #66cc66;">&#41;</span>;<br />
&nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</div>
</div>
<p></p>
<p><strong>Pros</strong></p>
<ul>
<li>An easy way to access resources within our root domains</li>
<li>Supported by all major browsers</li>
</ul>
<p><strong>Cons</strong></p>
<ul>
<li>Prevents us from making external calls outside a root domain</li>
<li>Prevents us from switching between HTTP and HTTPS</li>
<li>Kind of a hack - technically, the document.domain property is supposed to be a read only property, but most browsers also provide set access</li>
</ul>
<p>JSONP vs <code>document.domain</code> isn't a cut and dry comparison. JSONP lets anyone consume and share data, whereas overriding the <code>document.domain</code> lets you share resources within a common root domain. In simple cases where your only concern is sharing data within a single domain (exclusively on HTTP or exclusively on HTTPS), then overriding the domain works well, but in cases where you want to share or consume external data that may be passed over HTTP or HTTPS you'd probably want to stick with JSONP.</p>
<p><a href="http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/">The Project Badge</a> makes use of JSONP so it can work on your website. Most of <a href="http://adam.kahtava.com/publicly-available-web-services/">my publicly available web services</a> also make use of JSONP through a WCF <a href="http://code.google.com/p/adamdotcom-services/source/browse/trunk/AdamDotCom.Common.Service/Source/Common/Infrastructure/JSONP/JSONPBehavior.cs">JSONPBehavior</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2010/03/18/the-same-origin-policy-jsonp-vs-the-documentdomain-property/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Project Badge: Show The World Your GitHub and Google Code Projects On Your Blog</title>
		<link>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/</link>
		<comments>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 17:00:10 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[ADC Services]]></category>

		<category><![CDATA[ADC Website]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[CSS]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Services]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=2298</guid>
		<description><![CDATA[ 
The Project Badge displays your GitHub and Google Code projects in a badge that can be displayed on your site. This widget was built on the data being returned from my Open Source Service. 
View this post outside your RSS reader to see it in action or view it here.
The source for the Project [...]]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://adam.kahtava.com/etcetera/open-source-project-badge/" style="border-width: 0px; width: 320px; height: 370px; margin-left: 15px; float: left;"> </iframe></p>
<p>The Project Badge displays your GitHub and Google Code projects in a badge that can be displayed on your site. This widget was built on the data being returned from my <a href="http://adam.kahtava.com/journal/2010/02/11/introducing-my-open-source-projects-service-grab-your-project-details-from-github-or-google-code/">Open Source Service</a>. </p>
<p><em>View this post outside your RSS reader to see it in action or view it <a href="http://adam.kahtava.com/etcetera/open-source-project-badge/">here</a>.</em></p>
<p>The source for the Project Badge can be found <a href="http://github.com/AdamDotCom/project-badge/">here</a> and the source for the accompanying service can be found <a href="http://code.google.com/p/adamdotcom-services/source/browse/trunk#trunk/AdamDotCom.OpenSource.Service/Source/Service">here</a>. A list of all my publicly available web services can be found <a href="http://adam.kahtava.com/publicly-available-web-services/">here</a>.</p>
<div style="clear:both;"></div>
<h3>Using The Project Badge On Your Website or Blog</h3>
<p><strong>1. Add The Asset References</strong></p>
<p>Add the following asset references, and a reference to jQuery (if you don't have one already).</p>
<div class="syntax_hilite">
<div id="html-8">
<div class="html"><span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/css"</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://github.com/AdamDotCom/project-badge/raw/master/project-badge.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
<span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">"http://github.com/AdamDotCom/project-badge/raw/master/projectBadge.js"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></div>
</div>
</div>
<p></p>
<p><strong>2. Configure Your Accounts</strong></p>
<p>Set your project accounts (it's OK if you only use one host) then optionally set the appropriate filters - in my case <a href="http://code.google.com/u/adam.kahtava.com/">my Google Code projects</a> were prefixed with <em>adamdotcom</em> and I had duplicate projects on both GitHub and Google Code. By specifying <em>remove:adamdotcom,remove:duplicate-items</em> in my filters I filter out the duplicates and removed <em>adamdotcom</em> from the project name.</p>
<div class="syntax_hilite">
<div id="javascript-9">
<div class="javascript">&lt;script type=<span style="color: #3366CC;">"text/javascript"</span>&gt;<br />
&nbsp; projectBadge.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span> <br />
&nbsp; &nbsp; &nbsp; gitHub: <span style="color: #3366CC;">'AdamDotCom'</span>, <br />
&nbsp; &nbsp; &nbsp; googleCode: <span style="color: #3366CC;">'adam.kahtava.com'</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span>,<span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; filters: <span style="color: #3366CC;">'remove:adamdotcom,duplicate-items,-,empty-items'</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<br />
&lt;/script&gt;</div>
</div>
</div>
<p></p>
<p><strong>3. Add The Widget Hook</strong><br />
Add an element to your site or blog with the id of <code>project-badge</code>.</p>
<div class="syntax_hilite">
<div id="html-10">
<div class="html"><span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"project-badge"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span><br />
&nbsp; Loading...<br />
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span></div>
</div>
</div>
<p></p>
<p><strong>That's it!</strong><br />
If you have any issues, use the <a href="http://adam.kahtava.com/etcetera/open-source-project-badge/">the working example</a> as a reference, or send me a message.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2010/02/24/the-project-badge-show-the-world-your-github-and-google-code-projects-on-your-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Site Update: New Resume, Contact, Reviews, and Reading Lists Sections</title>
		<link>http://adam.kahtava.com/journal/2009/11/08/site-update-new-resume-contact-reviews-and-reading-lists-sections/</link>
		<comments>http://adam.kahtava.com/journal/2009/11/08/site-update-new-resume-contact-reviews-and-reading-lists-sections/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 17:00:37 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ADC Services]]></category>

		<category><![CDATA[ADC Website]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[Amazon]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1974</guid>
		<description><![CDATA[This site now sports a Resume, Contact Me, Reviews, and Reading Lists section.
If you're reading this from an RSS feed, then the changes looks like this:

These new sections make use of the services I created earlier - my resume content is pulled directly from LinkedIn via my Resume service, the Reading Lists and Reviews are being pulled from Amazon [...]]]></description>
			<content:encoded><![CDATA[<p>This site now sports a <a href="http://adam.kahtava.com/resume/curriculum-vitae/software-developer/">Resume</a>, <a href="http://adam.kahtava.com/contact-me/">Contact Me</a>, <a href="http://adam.kahtava.com/book-reviews/">Reviews</a>, and <a href="http://adam.kahtava.com/reading-lists/recommended-and-wishlist/">Reading Lists</a> section.</p>
<p>If you're reading this from an RSS feed, then the changes looks like this:</p>
<p style="padding-left: 30px;"><img src="http://adam.kahtava.com/journal/images/blog/adamdotcom-navigation-update.png" alt="Navigation changes on my site" width="429" height="112" /></p>
<p>These new sections make use of the services I created earlier - my resume content is pulled directly from LinkedIn via my <a href="http://adam.kahtava.com/journal/2009/09/24/introducing-my-linkedin-resume-service-view-your-resume/">Resume service</a>, the Reading Lists and Reviews are being pulled from Amazon via my <a href="http://adam.kahtava.com/journal/2009/09/15/introducing-my-amazon-web-service-find-your-profile-view-your-wishlist-or-reviews/">Amazon service</a>, and I'm still working on a personalized greeting module which will make use of my <a href="http://adam.kahtava.com/journal/2009/09/30/introducing-my-whois-service-customize-your-site-content-based-on-referrals-location-and-more/">Whois service</a>.</p>
<p>Now, when I update my resume on LinkedIn, add a new item to my Amazon wishlist, or write a new Review on Amazon the content is updated within this site and indexed by the Google.</p>
<p>It took longer than expected to get these new pages up and running - mostly due to a couple false starts. You see, I'm running this site on Windows shared hosting which unfortunately doesn't give me many options - sure, sure, I could purchase another hosting account, but developers are like freak'n MAcGyver we like working within ridiculous constraints. It's all about the challenge! Anyways, I first tried using Ruby on Rails on shared hosting (fail), then tried using PHP on Trax (fail), and finally reverted to ASP.NET MVC. While ASP.NET MVC is heads and tails more fun than Web Forms / Classic ASP.NET, the impedance mismatch between strongly typed objects and web languages (JavaScript, CSS, XHTML) is still annoying. Thankfully the <a href="http://github.com/mvccontrib/MvcContrib">MVC Contrib</a> project solves some of these pains, however it can't solve them all.</p>
<p>My next steps with this site are to: finish the greeting module, update the layout (drop the WordPress theme), and finish a Github / Google Code repo widget (kind of like this <a href="http://drnicwilliams.com/2008/05/03/github-badge-for-your-blog/">one</a>) for the sidebar.</p>
<p>Contribute, view, or download the openly available source code <a href="http://code.google.com/p/adamdotcom-website/source/browse/trunk/#trunk/Source/Website">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/11/08/site-update-new-resume-contact-reviews-and-reading-lists-sections/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Big Changes In The Works: Update My RSS Feed URL</title>
		<link>http://adam.kahtava.com/journal/2009/05/18/big-changes-in-the-works-update-my-rss-feed-url/</link>
		<comments>http://adam.kahtava.com/journal/2009/05/18/big-changes-in-the-works-update-my-rss-feed-url/#comments</comments>
		<pubDate>Mon, 18 May 2009 21:52:37 +0000</pubDate>
		<dc:creator>Adam Kahtava</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[ADC Website]]></category>

		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://adam.kahtava.com/journal/?p=1437</guid>
		<description><![CDATA[Things have been quiet for the past couple weeks, but an undercurrent of change has been happening within. My hosting account expired this month - which also marks 3 years of yammering (err... blogging) - I switched accounts, changed blog engines, migrated the content, and tried to resolve all existing links to the new engine.
I've [...]]]></description>
			<content:encoded><![CDATA[<p>Things have been quiet for the past couple weeks, but an undercurrent of change has been happening within. My hosting account expired this month - which also marks 3 years of yammering (err... blogging) - I switched accounts, changed blog engines, migrated the content, and tried to resolve all existing links to the new engine.</p>
<p>I've joined the millions of a happy<a href="http://wordpress.org/"> WordPress </a>users. This site was running <a href="http://www.dasblog.info/">dasBlog</a> - now dasBlog was pretty swell 4 years ago, but so was <a href="http://phpnuke.org/">PHP-nuke</a>, <a href="http://www.dotnetnuke.com/">DotNetNuke</a>, <em>table-based-design</em>, ASP.NET Themes &amp; Skins, and ASP.NET AJAX. :) Web technology changes at an accelerated pace, and some software / technologies / frameworks need to run their inevitable natural evolutionary course (extinction). dasBlog did its job, but it's time to move on - not to mention I'll sleep easier knowing that <a href="http://www.bailingbucket.com/">Rhett</a> won't be taunting me about how my blog reminds him of SharePoint. <em>Adios</em> dasBlog! :)</p>
<p>The new digs:</p>
<ul>
<li>WordPress running on IIS 7 hosted by GoDaddy's shared hosting plan ($203 for 4 years!!)</li>
<li>Redirections by <a href="http://managedfusion.com/products/url-rewriter/">ManagedFusion Url Rewriter</a></li>
<li>WordPress plug-ins installed:
<ul>
<li>FeedBurner FeedSmith - uses feedburner feeds in place of the WP vanilla feeds</li>
<li>Google Analytics for WP</li>
<li>Google XML Sitemaps</li>
<li>WP More Feeds - generates feeds for categories like <a href="http://adam.kahtava.com/journal/category/musings/feed/">musings</a> (this feature was native to dasBlog, but not to WP)</li>
</ul>
</li>
</ul>
<p>Be sure to update this blog's RSS feed to: <a href="http://adam.kahtava.com/journal/feed/">http://adam.kahtava.com/journal/feed/</a>. Old feeds will continue to work, but you may experience some oddities.</p>
]]></content:encoded>
			<wfw:commentRss>http://adam.kahtava.com/journal/2009/05/18/big-changes-in-the-works-update-my-rss-feed-url/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
