<?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>cometton</title>
	<atom:link href="http://www.cometton.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cometton.com</link>
	<description></description>
	<lastBuildDate>Sat, 26 Feb 2011 20:02:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Google Tweaks Algorithm to Push Down Low-Quality Sites</title>
		<link>http://www.cometton.com/snippets/google-tweaks-algorithm-to-push-down-low-quality-sites</link>
		<comments>http://www.cometton.com/snippets/google-tweaks-algorithm-to-push-down-low-quality-sites#comments</comments>
		<pubDate>Sat, 26 Feb 2011 20:02:14 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[Company News]]></category>
		<category><![CDATA[content farms]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Internet]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=767</guid>
		<description><![CDATA[Google said late Thursday that it had made a major change to its algorithm in an effort to improve the rankings of high-quality Web sites in its search results — and to reduce the visibility of low-quality sites. While the company did not say so explicitly, the change appears to be directed in part at [...]]]></description>
			<content:encoded><![CDATA[<p>Google said late Thursday that it had made a major change to its algorithm in an effort to improve the rankings of high-quality Web sites in its search results — and to reduce the visibility of low-quality sites. While the company did not say so explicitly, the change appears to be directed in part at so-called content farms like eHow and Answerbag, which generate articles <a href="http://www.nytimes.com/2011/02/11/business/media/11search.html">based on popular search queries</a> so they will rise to the top of the rankings and attract clicks.</p>
<p>Google has been facing criticism from some users for allowing articles that aren’t useful to appear prominently in search results. That has now changed, according to the company</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/snippets/google-tweaks-algorithm-to-push-down-low-quality-sites/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Worst Pink Floyd Cover Ever</title>
		<link>http://www.cometton.com/bookmark/worst-pink-floyd-cover</link>
		<comments>http://www.cometton.com/bookmark/worst-pink-floyd-cover#comments</comments>
		<pubDate>Fri, 03 Dec 2010 04:43:35 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=756</guid>
		<description><![CDATA[Comfortably numb performed out of tune and out of sync. Even the guitarist is relieved to finish playing even before the song has finished.
]]></description>
			<content:encoded><![CDATA[<p>Comfortably numb performed out of tune and out of sync. Even the guitarist is relieved to finish playing even before the song has finished.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/worst-pink-floyd-cover/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Future of Screen Technology</title>
		<link>http://www.cometton.com/bookmark/the-future-of-screen-technology</link>
		<comments>http://www.cometton.com/bookmark/the-future-of-screen-technology#comments</comments>
		<pubDate>Fri, 03 Dec 2010 03:15:08 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=753</guid>
		<description><![CDATA[The Astonishing Tribe visualizes the power of smart-phones in the year 2014. Wishful thinking?
]]></description>
			<content:encoded><![CDATA[<p>The Astonishing Tribe visualizes the power of smart-phones in the year 2014. Wishful thinking?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/the-future-of-screen-technology/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microbes Redefine Life</title>
		<link>http://www.cometton.com/bookmark/microbes-redefine-life</link>
		<comments>http://www.cometton.com/bookmark/microbes-redefine-life#comments</comments>
		<pubDate>Fri, 03 Dec 2010 03:07:41 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=749</guid>
		<description><![CDATA[NASA astrobiologists discover microbes that have replaced phosphorus atoms &#8211; one of six elements necessary in life &#8211; with arsenic atoms.
It’s like if you or I morphed into fully functioning cyborgs after being thrown into a room of electronic scrap with nothing to eat.
]]></description>
			<content:encoded><![CDATA[<p>NASA astrobiologists discover microbes that have replaced phosphorus atoms &#8211; one of six elements necessary in life &#8211; with arsenic atoms.</p>
<blockquote><p>It’s like if you or I morphed into fully functioning cyborgs after being thrown into a room of electronic scrap with nothing to eat.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/microbes-redefine-life/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating XML Using MySQL &amp; PHP</title>
		<link>http://www.cometton.com/snippets/creating-xml-using-mysql-php</link>
		<comments>http://www.cometton.com/snippets/creating-xml-using-mysql-php#comments</comments>
		<pubDate>Thu, 02 Dec 2010 13:24:01 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=668</guid>
		<description><![CDATA[It&#8217;s no surprise to me when developers decide to publish data, often times, it&#8217;s formatted in XML. It allows for content to be published once and viewed on many different platforms. The widespread adoption and ease of use allow XML to be the de facto standard when it comes to content syndication.
If you aren&#8217;t already [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s no surprise to me when developers decide to publish data, often times, it&#8217;s formatted in <a href="http://www.w3schools.com/php/php_xml_dom.asp">XML</a>. It allows for content to be published once and viewed on many different platforms. The widespread adoption and ease of use allow XML to be the de facto standard when it comes to content syndication.</p>
<p>If you aren&#8217;t already familiar with XML, the example below illustrates how easily the document can be interpreted by humans and machines.</p>
<pre>&lt;?xml version="1.0"?&gt;
&lt;music&gt;
	&lt;song&gt;
		&lt;title&gt;Hooch&lt;/title&gt;
		&lt;artist&gt;Melvins&lt;/artist&gt;
		&lt;album&gt;Houdini&lt;/album&gt;
	&lt;/song&gt;
	&lt;song&gt;
		&lt;title&gt;Sixtyniner&lt;/title&gt;
		&lt;artist&gt;Boards Of Canada&lt;/artist&gt;
		&lt;album&gt;Twoism&lt;/album&gt;
	&lt;/song&gt;
&lt;/music&gt;</pre>
<h2>PHP DOM Extension</h2>
<p>Built in support for DOM parsing in PHP makes retrieving data and inserting it into an XML document fairly simple. The DOM functions available in PHP are much similar to those in Javascript. If you are already comfortable navigating the DOM in Javascript then this should be quite easy to pick up.</p>
<pre>require('configure.php');
$table = 'demo_xml';
$query = "SELECT * FROM $table";
$result = mysql_query($query);</pre>
<p>To begin, establish a database connection and retrieve all values within the specified database table.</p>
<pre>$xmlDoc = new DomDocument('1.0');</pre>
<p>With our data readily available, we can begin creating our XML document using version 1.0.</p>
<pre>$root = $xmlDoc-&gt;createElement('music');</pre>
<p>All XML documents require a root element and in this case, we are calling it &#8220;music&#8221;.</p>
<pre>$root = $xmlDoc-&gt;appendChild($root);</pre>
<p>Using the <code>appendChild</code>function, our new element will be written to the XML document.</p>
<pre>while($row = mysql_fetch_assoc($result)) {</pre>
<p>The while statement retrieves each row as an associative array with &#8220;name=value&#8221; pairs to make things easier later when looping through the data.</p>
<pre>$rowContainer = $xmlDoc-&gt;createElement('song');
$rowContainer = $root-&gt;appendChild($rowContainer);</pre>
<p>For each data pair, create a new row labeled &#8220;song&#8221; and write them to the XML document.</p>
<pre>foreach ($row as $fieldName =&gt; $fieldValue) {
	$child = $xmlDoc-&gt;createElement($fieldName);
	$child = $rowContainer-&gt;appendChild($child);
	$value = $xmlDoc-&gt;createTextNode($fieldValue);
	$value = $child-&gt;appendChild($value);
}</pre>
<p>For every row available, insert each field name and its value.</p>
<pre>$xmlString = $xmlDoc-&gt;saveXML();
echo $xmlString;
$xmlDoc-&gt;save("songs.xml")</pre>
<p>Completing the script, the XML document is saved as a string and when viewed in a browser the values will be displayed. Finally, save the the XML file as &#8220;songs.xml&#8221;.</p>
<p>In its entirety, the script below handles the complete output of the XML document.</p>
<pre>&lt;?php 

require('configure.php');
$table = 'demo_xml';
$query = "SELECT * FROM $table";
$result = mysql_query($query);

$xmlDoc = new DomDocument('1.0');
$root = $xmlDoc-&gt;createElement('music');
$root = $xmlDoc-&gt;appendChild($root);

while($row = mysql_fetch_assoc($result)) {
	$rowContainer = $xmlDoc-&gt;createElement('song');
  	$rowContainer = $root-&gt;appendChild($xmlDoc);

	foreach ($row as $fieldName =&gt; $fieldValue) {
		$child = $xmlDoc-&gt;createElement($fieldName);
		$child = $rowContainer-&gt;appendChild($child);
		$value = $xmlDoc-&gt;createTextNode($fieldValue);
	        $value = $child-&gt;appendChild($value);
	}
}

$xmlString = $xmlDoc-&gt;saveXML();
echo $xmlString;
$xmlDoc-&gt;save("songs.xml")

?&gt;</pre>
<h2>Resources</h2>
<ul>
<li><a href="http://www.php.net/manual/en/intro.dom.php">PHP DOM Extension</a></li>
<li><a href="http://www.xml.com/axml/testaxml.htm">W3C XML Specifications &amp; Recommendations</a></li>
<li><a href="http://www.ibm.com/developerworks/library/x-tengoodxmlhabits.html">XML Usage</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/snippets/creating-xml-using-mysql-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chaos Theory – Splinter Cell 3 Soundtrack</title>
		<link>http://www.cometton.com/snippets/chaos-theory-splinter-cell-3-soundtrack</link>
		<comments>http://www.cometton.com/snippets/chaos-theory-splinter-cell-3-soundtrack#comments</comments>
		<pubDate>Sun, 28 Nov 2010 23:29:36 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=670</guid>
		<description><![CDATA[
Released by Amon Tobin in 2005, this is the trip hop artist&#8217;s fifth album. It is a collection of songs taken from Tom Clancy&#8217;s Splinter Cell: Chaos Theory video game. I was never a fan of the video game series, but the production quality of the video deserves my respect.
The unique aspect of this album [...]]]></description>
			<content:encoded><![CDATA[<p><a style="border-bottom: none;" href="http://www.amazon.com/gp/product/B001B1VZ24?ie=UTF8&amp;tag=theonlmusofco-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B001B1VZ24"><img class="post-image" src="http://upload.wikimedia.org/wikipedia/en/8/8d/AmonTobinSplinterCell.jpg" alt="Chaos Theory – Splinter Cell 3 Soundtrack" width="500" height="500" /></a></p>
<p>Released by <a href="http://www.amontobin.com/">Amon Tobin</a> in 2005, this is the trip hop artist&#8217;s fifth album. It is a collection of songs taken from <em>Tom Clancy&#8217;s Splinter Cell: Chaos Theory</em> video game. I was never a fan of the video game series, but the production quality of the video deserves my respect.</p>
<p>The unique aspect of this album is that it is not a true soundtrack by definition. None of the songs off the album would be heard in the game, except in small fragments. Individual segments of each song are layered throughout the game that correspond to the actions of the player.</p>
<p>I must recommend this for fans of hip hop, electronica and house music.</p>
	<div class="audio-playlist player-playlist">
		<div id="jquery_jplayer"></div> 
<div class="jp-playlist-player"> 
	<div class="jp-interface"> 
		<div id="now-playing"></div>
		<ul class="jp-controls"> 
			<li><a id="jplayer_previous" class="jp-previous" tabindex="1"></a></li> 
			<li><a id="jplayer_play" class="jp-play" tabindex="1"></a></li> 
			<li><a id="jplayer_pause" class="jp-pause" tabindex="1"></a></li> 
			<li><a id="jplayer_next" class="jp-next" tabindex="1"></a></li>
		</ul> 
		<div class="jp-progress"> 
			<div id="jplayer_load_bar" class="jp-load-bar"> 
				<div id="jplayer_play_bar" class="jp-play-bar"><span></span></div> 
			</div> 
		</div> 
		<div class="jp-play-time-all">
			<div id="jplayer_play_time">0:00</div> / 
			<div id="jplayer_total_time">0:00</div>
		</div> 
	</div> 
</div> 	
	<div class="haudio">
   	<span class="fn">Ruthless</span> 
	<span class="contributor">
		<span class="vcard">
			<span class="fn org">Amon Tobin</span>
		</span>
	</span>
	<span class="album">Chaos theory – Splinter Cell 3 Soundtrack</span>
		<abbr class="duration" title="PT5M16S">5 minutes, 16 seconds</abbr>	
	<a rel="enclosure" href="L3dwY21zLXRjb250ZS93cC1jb250ZW50L3VwbG9hZHMvMjAxMC8xMS8wMi4tUnV0aGxlc3MubXAz">"Ruthless"</a></div>
	</div>

]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/snippets/chaos-theory-splinter-cell-3-soundtrack/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slide Screen for Android</title>
		<link>http://www.cometton.com/bookmark/slide-screen-for-android</link>
		<comments>http://www.cometton.com/bookmark/slide-screen-for-android#comments</comments>
		<pubDate>Sun, 28 Nov 2010 02:49:48 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=664</guid>
		<description><![CDATA[Enhance the Android UI with this nifty app. It replaces the default home screen with something more palpable for those with information overload problems.
]]></description>
			<content:encoded><![CDATA[<p>Enhance the Android UI with this nifty app. It replaces the default home screen with something more palpable for those with information overload problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/slide-screen-for-android/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quantitative Easing Explained</title>
		<link>http://www.cometton.com/bookmark/quantitative-easing-explained</link>
		<comments>http://www.cometton.com/bookmark/quantitative-easing-explained#comments</comments>
		<pubDate>Sun, 28 Nov 2010 02:42:48 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=662</guid>
		<description><![CDATA[Microsoft Sam voices and animated bears help teach lessons about the Fed&#8217;s move to purchase more Treasury Bonds as a method known as &#8220;Quantitative Easing&#8221;.
]]></description>
			<content:encoded><![CDATA[<p>Microsoft Sam voices and animated bears help teach lessons about the Fed&#8217;s move to purchase more Treasury Bonds as a method known as &#8220;Quantitative Easing&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/quantitative-easing-explained/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX Form Validation</title>
		<link>http://www.cometton.com/snippets/ajax-form-validation</link>
		<comments>http://www.cometton.com/snippets/ajax-form-validation#comments</comments>
		<pubDate>Fri, 26 Nov 2010 06:10:34 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=629</guid>
		<description><![CDATA[A web form is a prime example of an application that AJAX can enhance its responsiveness and usability. At a bare minimum, a form should do the following:

Check for empty fields
Check for valid characters
Check for duplicates

If everything is &#8216;ok&#8217;, submit the form.
Faced with a multi-field form, it would be great if our inputs were validated on [...]]]></description>
			<content:encoded><![CDATA[<p>A web form is a prime example of an application that AJAX can enhance its responsiveness and usability. At a bare minimum, a form should do the following:</p>
<ul>
<li>Check for empty fields</li>
<li>Check for valid characters</li>
<li>Check for duplicates</li>
</ul>
<p>If everything is &#8216;ok&#8217;, submit the form.</p>
<p>Faced with a multi-field form, it would be great if our inputs were validated on the fly. That way, you could correct any errors before the form is submitted.</p>
<h2>XMLHttpRequest object = AJAX</h2>
<p>All data is stored in XMLHttpRequest object which is transferred between the browser and server. Before any data can be handled we need to create an instance of this object.</p>
<pre>function ajaxInit() {
	// XMLHttpRequest object
	var ajaxRequest = false;

	try {
		// Supports IE7+, Firefox, Chrome, Opera, Safari
		ajaxRequest = new XMLHttpRequest();

	} catch (e) {

		try {
			// Supports IE6, IE5
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

		} catch (e) {
			// Browser doesn't support XMLHttpRequest objects
			ajaxRequest = false;
			alert("Your browser does not support the AJAX methods!");
		}
	}
        return ajaxRequest
}</pre>
<p>This function checks your browser for XMLHttpRequest support. If the browser doesn&#8217;t support the object, the function returns false and throws up an error message rendering AJAX capabilities useless.</p>
<h2>Get Form Values</h2>
<p>To pass data to our server, we will have to construct a function that creates the query sent to the server.</p>
<pre>// Get form values
function checkFields(){
	document.getElementById('user-form').onkeyup = function(){
		var params = '';
		var username = document.getElementById("name");
		var action = "action=checkUsername";

		params += username.name;
		params += '=';
		params += username.value;
		params += "&amp;";
		params += action;

		return sendData(params);
	}
}</pre>
<p>The <code>onkeyup</code> event triggers the function and when complete, the variable <code>params</code> holds a string of names and values taken from the form. This data will then be passed to the <code>sendData</code> function.</p>
<h2>Passing Data to the Server</h2>
<p>Three critical components involved in this process include:</p>
<ul>
<li>onreadystatechange</li>
<li>open</li>
<li>send</li>
</ul>
<p>Without those components functioning, no data could be passed to the server.</p>
<pre>// Send form values to the server
function sendData(params){
	var request = ajaxInit();
	if(request){
		request.onreadystatechange = function(){
			handleData(request);
		}
		request.open("POST", "register.php", true);
		request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		request.send(params);
		return true;
	} else {
		return false;
	}
}</pre>
<p>After our <code>onreadystatechange </code>function fires and sends a request to the server, we have to deal with handling the server&#8217;s response.</p>
<h2>Processing the Server&#8217;s Response</h2>
<p>The <code>eval</code>statement executes the JSON formatted data sent from the server. All JSON values are now accessible as properties of the variable <code>resp</code>.</p>
<pre>function handleData(request){
	if(request.readyState == 4 &amp;&amp; request.status == 200){
		var resp = eval('('+request.responseText+')');
		var result = resp.ok;
		var msg = resp.msg;
		var placeholder = document.getElementById("validation");

		if(!result){
			placeholder.innerHTML = msg;
		} else {
			placeholder.innerHTML = msg;
		}

		return true
	} else {
		return false;
	}
}</pre>
<p>The <code>innerHTML</code>property then updates the HTML element with the data stored in the variable.</p>
<h2>Load The Script</h2>
<p>Finally, to extract the user&#8217;s input from the form field, the <code>checkFields</code>function needs to be loaded into the document when requested from the server.</p>
<pre>window.onload = checkFields();</pre>
<h2>Resources</h2>
<p>Check out the <a title="View this demo." href="http://www.cometton.com/demo/ajax-form-validation/">demo</a> to see this script in action or <a href="http://www.cometton.com/demo/ajax-form-validation/ajax-form-validation-scripts.zip" onClick="javascript: pageTracker._trackPageview('/download/ajax-form-validation'); ">download</a> the files to use for yourself.</p>
<ul>
<li><a href="https://developer.mozilla.org/en/ajax">Mozilla Development Center: AJAX</a></li>
<li><a href="http://www.w3schools.com/Ajax/Default.Asp">W3Schools AJAX Tutorial</a></li>
<li><a href="http://www.amazon.com/gp/product/0321472667?ie=UTF8&amp;tag=theonlmusofco-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321472667">Bulletproof AJAX by Jeremy Keith</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/snippets/ajax-form-validation/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So You Need A Typeface?</title>
		<link>http://www.cometton.com/bookmark/so-you-need-a-typeface</link>
		<comments>http://www.cometton.com/bookmark/so-you-need-a-typeface#comments</comments>
		<pubDate>Wed, 17 Nov 2010 03:29:21 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Bookmark]]></category>

		<guid isPermaLink="false">http://www.cometton.com/?p=626</guid>
		<description><![CDATA[Yes, I do need a typeface. Tell me more.
]]></description>
			<content:encoded><![CDATA[<p>Yes, I do need a typeface. Tell me more.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cometton.com/bookmark/so-you-need-a-typeface/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

