<?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>2Paths &#187; javascript</title>
	<atom:link href="http://www.2paths.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.2paths.com</link>
	<description>Custom Software Technical Architecture, Design and Development in Vancouver, BC, Canada</description>
	<lastBuildDate>Mon, 27 Sep 2010 01:15:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>jQuery Tidbits</title>
		<link>http://www.2paths.com/2009/06/23/jquery-tidbits/</link>
		<comments>http://www.2paths.com/2009/06/23/jquery-tidbits/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 21:12:29 +0000</pubDate>
		<dc:creator>Garrett</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[dynamic web]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[javascript library]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[web application]]></category>

		<guid isPermaLink="false">http://www.2paths.com/?p=1032</guid>
		<description><![CDATA[My experience with JavaScript has lead me to using Ajax frameworks and libraries such as Mootools, ExtJs, and now jQuery. The jQuery library has been around long enough to become stable, fast, and lightweight for dealing with those annoying problems all web application developers have to handle.
The core competency of jQuery is it&#8217;s ability to [...]]]></description>
			<content:encoded><![CDATA[<p>My experience with JavaScript has lead me to using Ajax frameworks and libraries such as <a title="Mootools" href="http://mootools.net/" target="_blank">Mootools</a>, <a title="ExtJs" href="http://extjs.com/" target="_blank">ExtJs</a>, and now <a title="jQuery" href="http://jquery.com" target="_blank">jQuery</a>. The jQuery library has been around long enough to become stable, fast, and lightweight for dealing with those annoying problems all web application developers have to handle.</p>
<p>The core competency of jQuery is it&#8217;s ability to manage and manipulate the HTML <a title="DOM" href="http://www.w3.org/DOM/" target="_blank">DOM</a>. This portion of the library alone makes the small 20kb library fully worth the download. Targeting an element for assignment while manipulating anything within a document is as easy as:</p>
<pre>var element = $('#idOfTheElement')</pre>
<p><a style="font-size: smaller;" href="http://docs.jquery.com/Selectors/id#id" target="_blank">(API for selectors)</a></p>
<p>More than just HTML document manipulation, jQuery has a very simple and clean way to implement event triggers and handlers.</p>
<pre>// trigger
$("#idOfElement").click(function () {
   $("#idOfElementThatIsListening").<strong class="selflink">trigger</strong>('click');
});
// handler
$("#idOfElementThatIsListening").<strong class="selflink">bind</strong>("click", function(e){
   alert("click event happened")
});</pre>
<p>(<a style="font-size: smaller;" href="http://docs.jquery.com/Events" target="_blank">API for events</a>)</p>
<p>This is just  a taste of what jQuery can do for your web application development. I recommend giving it a test drive if you haven&#8217;t already. The online <a href="http://docs.jquery.com/Main_Page" target="_blank">API and documentation</a> is thorough and well constructed. The user community is chock-full of enthusiasts with useful plug-ins.</p>
<p>This will be my go-to JavaScript library for most applications for the foreseeable future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2paths.com/2009/06/23/jquery-tidbits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualizing Semantic Data using Javascript and the HTML Canvas Element</title>
		<link>http://www.2paths.com/2009/06/22/visualizing-semantic-data-using-javascript-and-the-html-canvas-element/</link>
		<comments>http://www.2paths.com/2009/06/22/visualizing-semantic-data-using-javascript-and-the-html-canvas-element/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:45:37 +0000</pubDate>
		<dc:creator>gord</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[rdf]]></category>
		<category><![CDATA[semantic]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://www.2paths.com/?p=1014</guid>
		<description><![CDATA[A work in progress visualization of freedb (RDF version of wikipedia).]]></description>
			<content:encoded><![CDATA[<p>So after trying a few existing javascript/canvas graph visualization libraries, I decided to try my hand at writing my own. We were doing a lot of stuff with RDF in the office at the time, so I decided that my visualization would be a graph of rdf data and relationships. Since I&#8217;d never done anything with the HTML canvas element before, I thought I&#8217;d give that a shot too.</p>
<p><strong>Graph Layout</strong></p>
<p>After looking at various existing graph layout algorithms, I decided to reinvent the wheel and developed my own approach. Each node has a mass based on its size, and I simply used gravity calculations to determine the (inverse, so they repel each other) force each node apples to each other node. You can see this in action when you mouse over a node, it gets bigger and other nodes retreat from it as its mass increases.</p>
<p>This allows each node to position itself in a way so it is visible. It&#8217;s not perfect, but it works okay and makes the graph feel responsive to the user.</p>
<p><strong>How to use it</strong></p>
<p>Double click on a node to load its relationships and related nodes. A node must be an rdf node to load properly, I haven&#8217;t implemented any way to handle normal web links yet. Basically, only click on links that look like <strong>h</strong><strong>ttp://dbpedia.org/resource/<em>something</em><span style="font-weight: normal;">, or that you know are rdf.</span></strong></p>
<div id="attachment_1016" class="wp-caption alignnone" style="width: 521px"><a href="http://staging.2paths.com:8080/deepsnow/" target="_self"><img class="size-full wp-image-1016" src="http://www.2paths.com/wp-content/uploads/2009/06/deepsnow1.png" alt="image of visualization in action, click for demo" width="511" height="300" /></a><p class="wp-caption-text">click for demo of the wikipedia article for baseball</p></div>
<p>If you&#8217;re just interested in the pretty pictures, stop here, if you want more technical information read on.</p>
<p><strong>Implementation</strong></p>
<p>I just used javascript and followed the <a href="http://www.whatwg.org/specs/web-apps/current-work/#canvasrenderingcontext2d" target="_blank">HTML5 docs for using the canvas element</a>. One thing I ran into was the fact that Firefox doesn&#8217;t yet have a full canvas implementation, specifically it doesn&#8217;t yet render text on the canvas. I tried doing some voodoo with absolute positioning divs containing text over the canvas, and after a brief descent into insanity, I found the excellent <a href="http://typeface.neocracy.org/">typeface.js</a> library which emulates the missing canvas calls for text.</p>
<p>As for the javascript code itself, I implemented a simple object graph that can contain vertices or edges, then a render loop just advances the object graph by a given amount of time and renders the scene to the canvas.</p>
<p>The back end serving up rdf was done quickly in grails using the <a href="http://jena.sourceforge.net/" target="_blank">Jena</a> framework to do all the heavy lifting. There is some minimal inference going on using the RDF data to determine if something is an image.</p>
<p><strong><strong>Disclaimer</strong></strong></p>
<p><strong><span style="font-weight: normal;">Keep in mind that this is a work of progress that I have not spent much time with. It has bugs, and it&#8217;s nowhere near usable for anything useful, but it serves its purpose as a proof of concept. I&#8217;m not sure if it will even run under IE, but it should run on any browser that has a decent javascript + canvas implementation.</span></strong></p>
<p><strong> </strong></p>
<p><strong>Conclusions</strong></p>
<p><strong><span style="font-weight: normal;">The canvas element is cool, and works well.</span></strong></p>
<p>Basically I hope you like it. Please leave any suggestions or feedback as comments. I realize it&#8217;s probably full of bugs, but that&#8217;s the nature of the beast.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2paths.com/2009/06/22/visualizing-semantic-data-using-javascript-and-the-html-canvas-element/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

