<?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>Kalkran.COM &#187; Web development</title>
	<atom:link href="http://kalkran.com/category/tutorials/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://kalkran.com</link>
	<description>Design&#38;Coding</description>
	<lastBuildDate>Fri, 26 Feb 2010 15:48:50 +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 MySQL to select data from multiple tables (Using JOIN)</title>
		<link>http://kalkran.com/tutorials/web-development/using-mysql-to-select-data-from-multiple-tables-using-join/</link>
		<comments>http://kalkran.com/tutorials/web-development/using-mysql-to-select-data-from-multiple-tables-using-join/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:53:39 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=144</guid>
		<description><![CDATA[I got on the idea of writing a little post about this a while ago, but forgot about it. And just today I uncovered the note I had written to myself, to keep my promise to all of you, so here goes. My situation was as follows: Imagine a store. Every product has a unique [...]]]></description>
			<content:encoded><![CDATA[<p>I got on the idea of writing a little post about this a while ago, but forgot about it. And just today I uncovered the note I had written to myself,  to keep my promise to all of you, so here goes.</p>
<p>My situation was as follows: Imagine a store. Every product has a unique identification code (NASA-number), a product description and a price, to keep it very basic. Then, every product has a stock number (The amount of items currently in stock). We're keeping these values apart from eachother because keeping the amount of items in stock isn't enough. We also need to keep a log of everything that happens to the product (how many do we sell per day, how many are delivered to us, how much do we throw out).</p>
<p>So basically, we have two tables. One contains all product information, and the second keeps daily logs of what happens to each and every product. Let's give you a basic table layout:</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> `nasa` <span style="color: #66cc66;">&#40;</span>
`nasa` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`name` <span style="color: #aa9933; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`price` <span style="color: #aa9933; font-weight: bold;">FLOAT</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`content` <span style="color: #aa9933; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
<span style="color: #aa3399; font-weight: bold;">UNIQUE</span> KEY `nasa` <span style="color: #66cc66;">&#40;</span>`nasa`<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span>;</pre>
<p>This is the listing of the products, every single item has a unique NASA-number, names can overlap providing the content is different (think a litre of whole milk vs. a gallon of whole milk), than we have the log:</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">CREATE TABLE</span> `history` <span style="color: #66cc66;">&#40;</span>
`<span style="color: #993333; font-weight: bold;">DAY</span>` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`nasa` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`stock` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`received` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`sold` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>,
`counted` <span style="color: #aa9933; font-weight: bold;">INT</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">16</span><span style="color: #66cc66;">&#41;</span> <span style="color: #aa3399; font-weight: bold;">NOT NULL</span>
<span style="color: #66cc66;">&#41;</span>;</pre>
<p>So this one has a daily log. But if you want to display the data of these tables on your screen, you might be tempted to run two queries, one to fetch the name (for legibility, people aren't very likely to remember numbers), maybe the content and one to fetch the current stock (are we out? did we receive anything?). This would go as follows</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">SELECT</span> name,content <span style="color: #993333; font-weight: bold;">FROM</span> nasa <span style="color: #993333; font-weight: bold;">WHERE</span> nasa=<span style="color: #cc66cc;">62334</span></pre>
<p>and then</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">SELECT</span> stock <span style="color: #993333; font-weight: bold;">FROM</span> history <span style="color: #993333; font-weight: bold;">WHERE</span> nasa=<span style="color: #cc66cc;">62334</span></pre>
<p>What if you combined these two into a single query? First write down which things you need: name, content, sales and current stock. Then, lo and behold the power of the JOIN-statement.</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">SELECT</span> name,content,stock,sold <span style="color: #993333; font-weight: bold;">FROM</span> nasa <span style="color: #993333; font-weight: bold;">JOIN</span> history <span style="color: #993333; font-weight: bold;">ON</span> nasa.nasa =
  history.nasa <span style="color: #993333; font-weight: bold;">WHERE</span> history.nasa = <span style="color: #cc66cc;">62334</span> <span style="color: #993333; font-weight: bold;">AND</span> history.<span style="color: #993333; font-weight: bold;">DAY</span> = today</pre>
<p>See that? You can just select the four columns you need. MySQL will retrieve any row where the history.nasa matches the nasa.nasa so be sure to specify which row you want to retrieve. In this case you could also order descending by the date and limit the rows retrieved to 1:</p>
<pre class="mysql"><span style="color: #993333; font-weight: bold;">SELECT</span> name,content,stock,sold <span style="color: #993333; font-weight: bold;">FROM</span> nasa <span style="color: #993333; font-weight: bold;">JOIN</span> history <span style="color: #993333; font-weight: bold;">ON</span> nasa.nasa =
  history.nasa <span style="color: #993333; font-weight: bold;">WHERE</span> history.nasa = <span style="color: #cc66cc;">62334</span> <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> history.<span style="color: #993333; font-weight: bold;">DAY</span> DESC <span style="color: #993333; font-weight: bold;">LIMIT</span> <span style="color: #cc66cc;">1</span></pre>
<p>Thanks for reading, hope it makes any sense :))</p>
<p>P.S. In case you were wondering, 62334 is an actual NASA number used in Albert Heijn. It's the code for fresh cod filet.</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=144&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/tutorials/web-development/using-mysql-to-select-data-from-multiple-tables-using-join/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Theme Generator</title>
		<link>http://kalkran.com/misc/wordpress-theme-generator/</link>
		<comments>http://kalkran.com/misc/wordpress-theme-generator/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 19:02:39 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[creator]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=129</guid>
		<description><![CDATA[You'll never guess what I've made now! :). A theme generator, which takes in regular templates (all HTML), and turns them into a 'basic' template, with a widget-ready sidebar, archive support, comments, and what not! Click Please let me know what you think in the comments section. And, please; Do note that this is a [...]]]></description>
			<content:encoded><![CDATA[<p>You'll never guess what I've made now! :).</p>
<p>A theme generator, which takes in regular templates (all HTML), and turns them into a 'basic' template, with a widget-ready sidebar, archive support, comments, and what not!</p>
<p><a title="Theme Creator" href="http://kalkran.com/theme-creator/">Click</a></p>
<p>Please let me know what you think in the comments section. And, please; Do note that this is a beta version, hmm let's make up a number. Let's call it version Oh-point-six ?</p>
<p>Thanks for reading.</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=129&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/misc/wordpress-theme-generator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS Hyperlink Tooltips</title>
		<link>http://kalkran.com/tutorials/web-development/css-hyperlink-tooltips/</link>
		<comments>http://kalkran.com/tutorials/web-development/css-hyperlink-tooltips/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 13:05:03 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=123</guid>
		<description><![CDATA[Ever wanted nicely styled CSS tooltips? Here's a quick explanation: &#160; &#60;a href=&#34;#&#34;&#62;Link text&#60;span&#62;Your tooltip&#60;/span&#62;&#60;/a&#62; Use that HTML. Then add the following to your stylesheet: &#160; a &#123; position: relative; outline: none; &#125; a span &#123; display: none; &#125; a:hover span &#123; display: block; font-size: 8pt; position: absolute; top:-25px; left: -45px; border:1px solid #383a47; background-color:#5cbbe3; [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted nicely styled CSS tooltips?</p>
<p>Here's a quick explanation:</p>
<pre>&nbsp;
&lt;a href=&quot;#&quot;&gt;Link text&lt;span&gt;Your tooltip&lt;/span&gt;&lt;/a&gt;</pre>
<p>Use that HTML. Then add the following to your stylesheet:</p>
<pre class="css">&nbsp;
a <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">relative</span>; <span style="color: #000000; font-weight: bold;">outline</span>: <span style="color: #993333;">none</span>; <span style="color: #66cc66;">&#125;</span>
a span <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">none</span>; <span style="color: #66cc66;">&#125;</span>
a<span style="color: #3333ff;">:hover</span> span <span style="color: #66cc66;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span>: <span style="color: #993333;">block</span>;
<span style="color: #000000; font-weight: bold;">font-size</span>: <span style="color: #933;">8pt</span>;
<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">absolute</span>;
top<span style="color: #3333ff;">:-<span style="color: #933;">25px</span></span>; <span style="color: #000000; font-weight: bold;">left</span>: -<span style="color: #933;">45px</span>;
border<span style="color: #3333ff;">:<span style="color: #933;">1px</span></span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#383a47</span>;
<span style="color: #000000; font-weight: bold;">background-color</span>:<span style="color: #cc00cc;">#5cbbe3</span>;
<span style="color: #000000; font-weight: bold;">color</span>: <span style="color: #cc00cc;">#383a47</span>;
<span style="color: #000000; font-weight: bold;">text-align</span>: <span style="color: #993333;">center</span>;
<span style="color: #000000; font-weight: bold;">padding</span>: <span style="color: #933;">1px</span> <span style="color: #933;">5px</span>;
<span style="color: #000000; font-weight: bold;">width</span>: <span style="color: #933;">130px</span>; <span style="color: #66cc66;">&#125;</span></pre>
<p>This code hides the span tag when you're not hovering over it. (a span { display: none; }) and positions it nicely when you DO hover over it.<br />
Read on for an example (just a single hyperlink, but it's not valid xhtml so I put it on a different page)<br />
<span id="more-123"></span></p>
<style type="text/css">a.example { position: relative; outline: none; } 
a.example span { display: none; }
a.example:hover span { display: block; font-size: 8pt; position: absolute; top:-25px; left: 0px; border:1px solid #000; background-color:#5cbbe3; color: #383a47; text-align: center; padding: 1px 5px; width: 130px; font-weight: none; text-decoration: none; font-weight:  normal; }</style>
<p><a href="#" class="example">Hover over me!<span>Wow, a tooltip!</span></a></p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=123&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/tutorials/web-development/css-hyperlink-tooltips/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using clear in CSS</title>
		<link>http://kalkran.com/tutorials/web-development/using-clear-in-css/</link>
		<comments>http://kalkran.com/tutorials/web-development/using-clear-in-css/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 22:36:20 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=107</guid>
		<description><![CDATA[If you ever use floats, and then tried to add content to a container that's not floated, you may have experienced the same issues that many have. The solution is far simpler than expected &#160; .clear &#123; clear: both; &#125; This forces any item with a class of clear to be clear of floats on [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever use floats, and then tried to add content to a container that's not floated, you may have experienced the same issues that many have. The solution is far simpler than expected</p>
<pre class="css">&nbsp;
<span style="color: #6666ff;">.clear</span> <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">clear</span>: <span style="color: #993333;">both</span>; <span style="color: #66cc66;">&#125;</span></pre>
<p>This forces any item with a class of <em>clear</em> to be clear of floats on the left and right, which are - by chance - the other two options to <em>clear</em>; left and right. So after floating elements left and right, you should add a <span class="clear"></span> to force content below.</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=107&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/tutorials/web-development/using-clear-in-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegEx to find URLs and turn them into hyperlinks</title>
		<link>http://kalkran.com/tutorials/php/regex-to-find-urls-and-turn-them-into-hyperlinks/</link>
		<comments>http://kalkran.com/tutorials/php/regex-to-find-urls-and-turn-them-into-hyperlinks/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 10:11:12 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regular expressions]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=102</guid>
		<description><![CDATA[&#160; $string = preg_replace&#40;&#34;/(http:\/\/)?([a-zA-Z0-9\-.]+\.[a-zA-Z0-9\-]+([\/]([a-zA-Z0-9_\/\-.?&#38;%=+])*)*)/&#34;, '&#60;a href=&#34;http://$2&#34;&#62;$2&#60;/a&#62;', $string&#41;; That little gem right there'll take any length of text and turn the urls in it into hyperlinks. Cool or what? :-)]]></description>
			<content:encoded><![CDATA[<pre class="php">&nbsp;
<span style="color: #0000ff;">$string</span> = <a href="http://www.php.net/preg_replace"><span style="color: #000066;">preg_replace</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;/(http:<span style="color: #000099; font-weight: bold;">\/</span><span style="color: #000099; font-weight: bold;">\/</span>)?([a-zA-Z0-9<span style="color: #000099; font-weight: bold;">\-</span>.]+<span style="color: #000099; font-weight: bold;">\.</span>[a-zA-Z0-9<span style="color: #000099; font-weight: bold;">\-</span>]+([<span style="color: #000099; font-weight: bold;">\/</span>]([a-zA-Z0-9_<span style="color: #000099; font-weight: bold;">\/</span><span style="color: #000099; font-weight: bold;">\-</span>.?&amp;%=+])*)*)/&quot;</span>, <span style="color: #ff0000;">'&lt;a href=&quot;http://$2&quot;&gt;$2&lt;/a&gt;'</span>, <span style="color: #0000ff;">$string</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>That little gem right there'll take any length of text and turn the urls in it into hyperlinks. Cool or what? :-)</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=102&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/tutorials/php/regex-to-find-urls-and-turn-them-into-hyperlinks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX: Introduction</title>
		<link>http://kalkran.com/tutorials/ajax-introduction/</link>
		<comments>http://kalkran.com/tutorials/ajax-introduction/#comments</comments>
		<pubDate>Sat, 24 May 2008 20:00:57 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=94</guid>
		<description><![CDATA[Hey, You've probably heard of AJAX. It's an acronym for "Asynchronous Javascript And XML". It basically means you could use Javascript for updating a page, submitting info without refreshing and so forth. I've only just found out the basics of AJAX myself. It's not hard, but it requires (very) basic understanding of Javascript and HTML. [...]]]></description>
			<content:encoded><![CDATA[<p>Hey,</p>
<p>You've probably heard of AJAX. It's an acronym for "Asynchronous Javascript And XML". It basically means you could use Javascript for updating a page, submitting info without refreshing and so forth. I've only just found out the basics of AJAX myself. It's not hard, but it requires (very) basic understanding of Javascript and HTML.</p>
<p>The biggest part about using AJAX is understanding the <strong>XMLHttpRequest()</strong> object. This object has a wide range of properties, functions and what not. But for basic AJAX you'll only need a couple.</p>
<h2>Initializing the XMLHttpRequest object</h2>
<pre class="javascript">&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> GetXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
<span style="color: #003366; font-weight: bold;">var</span> xmlHttp;
<span style="color: #000066; font-weight: bold;">try</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #009900; font-style: italic;">// Firefox, Opera 8.0+, Safari</span>
xmlHttp=<span style="color: #003366; font-weight: bold;">new</span> XMLHttpRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #009900; font-style: italic;">// Internet Explorer</span>
<span style="color: #000066; font-weight: bold;">try</span>
<span style="color: #66cc66;">&#123;</span>
xmlHttp=<span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Msxml2.XMLHTTP&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000066; font-weight: bold;">try</span>
<span style="color: #66cc66;">&#123;</span>
xmlHttp=<span style="color: #003366; font-weight: bold;">new</span> ActiveXObject<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Microsoft.XMLHTTP&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066; font-weight: bold;">catch</span> <span style="color: #66cc66;">&#40;</span>e<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Your browser does not support AJAX!&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000066; font-weight: bold;">return</span> xmlHttp;
<span style="color: #66cc66;">&#125;</span></pre>
<p>That is the function I'm using to get the object. Usually you could just use the XMLHttpRequest(), but since the (oh-so-loved) Internet Explorer doesn't support it. You need to make a complete function and have it return the object.</p>
<p>You can now use:</p>
<pre class="javascript">&nbsp;
ajax = getXML<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>to get the object instantiated.</p>
<p><span id="more-94"></span></p>
<h2>Sending information</h2>
<p>Okay, having this object is all nice and dandy, but we might want to use it and send info to other pages and retrieve the information. This is done as follows:</p>
<pre class="javascript">&nbsp;
ajax.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span>STRING method, STRING url, BOOL asynchronous<span style="color: #66cc66;">&#41;</span>;</pre>
<p>So if we (e.g.) wanted to submit a star-rating for a specific id, we would want to pass on the id and the actual rating:</p>
<pre class="javascript">&nbsp;
ajax.<span style="color: #000066;">open</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;GET&quot;</span>, <span style="color: #3366CC;">&quot;save_rating.php?id=WUT&amp;rating=&quot;</span>+rating,<span style="color: #003366; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span></pre>
<p>Now Ajax has cached our request, ready to be sent:</p>
<pre class="javascript">&nbsp;
ajax.<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
<p>Ajax is now sending the request and receiving some information for itself and we might want to do something with the information we received.</p>
<h2>Receiving information</h2>
<p>Sending and receiving sound like a logical order here, but while using AJAX you might want to declare your ajax handler, and then immediately setup a function to handle the incoming traffic. Since AJAX uses functions to receive it:</p>
<pre class="javascript">&nbsp;
ajax.<span style="color: #006600;">onreadystatechange</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>
<span style="color: #009900; font-style: italic;">// On ready state change (Loading, Finished Loading.. etc)</span>
<span style="color: #009900; font-style: italic;">//0    The request is not initialized</span>
<span style="color: #009900; font-style: italic;">//1    The request has been set up</span>
<span style="color: #009900; font-style: italic;">//2    The request has been sent</span>
<span style="color: #009900; font-style: italic;">//3    The request is in process</span>
<span style="color: #009900; font-style: italic;">//4    The request is complete</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #66cc66;">&#40;</span>ajax.<span style="color: #006600;">readyState</span>==<span style="color: #CC0000;">4</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
<span style="color: #009900; font-style: italic;">// Received information.</span>
document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'rating'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">innerHTML</span>=ajax.<span style="color: #006600;">responseText</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>Woot. The only vital part here is ajax.responseText. And noticing you're passing a function to the ajax.onreadystatechange.</p>
<p>That's all for now, I'll write a tutorial about the star-rating system I've coded probably monday since I've got work tomorrow :(.</p>
<p>Thanks for reading!</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=94&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/tutorials/ajax-introduction/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>www. is deprecated</title>
		<link>http://kalkran.com/misc/www-is-deprecated/</link>
		<comments>http://kalkran.com/misc/www-is-deprecated/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 18:12:03 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=89</guid>
		<description><![CDATA[You may have noticed that www.kalkran.com redirects to kalkran.com, I did this out of a silent protest against the uselessness of www. But I found out I'm not the only one.. And I got a tag for it! :-) Just wanted to share ;)]]></description>
			<content:encoded><![CDATA[<p>You may have noticed that www.kalkran.com redirects to kalkran.com, I did this out of a silent protest against the uselessness of <strong>www</strong>. But I found out I'm not the only one.. And I got a tag for it! :-)</p>
<p><a href="http://no-www.org"><img src="http://no-www.org/images/type1/class-b.png" alt="Class B" border="0"></a></p>
<p>Just wanted to share ;)</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=89&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/misc/www-is-deprecated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The fifteen sins of web design</title>
		<link>http://kalkran.com/misc/the-fifteen-sins-of-web-design/</link>
		<comments>http://kalkran.com/misc/the-fifteen-sins-of-web-design/#comments</comments>
		<pubDate>Thu, 17 Apr 2008 11:43:38 +0000</pubDate>
		<dc:creator>Kalkran</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://kalkran.com/?p=88</guid>
		<description><![CDATA[Today, on Kalkran.COM: The fifteen (+one!) sins to designing a webpage. Animated GIFs Animated GIFs are soo 1990's. I remember using them on my geocities website! And that, my dear reader, is almost prehistorical. Slow download times Nothing makes me stop browsing a website as slow load times. Waiting for the server to respond, takes [...]]]></description>
			<content:encoded><![CDATA[<p>Today, on Kalkran.COM: The fifteen (+one!) sins to designing a webpage.</p>
<ul>
<li><strong>Animated GIFs</strong><br />
Animated GIFs are soo 1990's. I remember using them on my geocities website! And that, my dear reader, is almost prehistorical.</li>
<li><strong>Slow download times</strong><br />
Nothing makes me stop browsing a website as slow load times. Waiting for the server to respond, takes up valuable time of your reader. Nobody likes waiting.</li>
</ul>
<p><span id="more-88"></span>
<ul>
<li><strong>Unreadable text</strong><br />
Like.. Low contrast with the background: <span style="color: #ccc;">this</span>, impossible colour combinations or a background that distracts too much from the content</li>
<li><strong>Blink &amp; Marquee<br />
</strong>BLINK is <em>EVIL</em>. And Marquee is outdated. And they're annoying. Your turn.</li>
<li><strong>Looonngg pages<br />
</strong>Ever been on a site that loads for ages? And you just watch your little scrollbar getting smaller by the second. And when it finally finishes loading, you pick up your microscope and find that all that is left of your scrollbar are five nanometers. Lots of content is good, just organise it well, make pages.</li>
<li><strong>Under Construction<br />
</strong>If it's under construction, why do <a href="http://www.tomik.nl/">you</a> even have a website? If it's not ready, don't list it. Simple as that.</li>
<li><strong>Background Sound<br />
</strong>I once was in the U.S.A, in a museum, and they had computers you could use for browsing the internet. I opened up a page, and to my horror, the volume was set to max and everyone in the museum heard it. It was really lousy music, too. That is just one reason not to use background music</li>
<li><strong>Designed for a specific browser / resolution / colour setting<br />
</strong>With such a variety of browsers around, why would you design your site to only work in (e.g) Internet Explorer. (bad example). This is killing your visits.</li>
<li><strong>Spelling/grammar mistakes<br />
</strong>Nothing looks as unprofessional as having spelling and/or grammar mistakes all over your website. Personally, as soon as the spelling/grammar looks really bad, I'm out - There's plenty more websites on the internet.</li>
<li><strong>Tables for layout<br />
</strong>Again: Sooo 1990's. DIVs styled with CSS are the norm now!</li>
<li><strong>Status bar text<br />
</strong>Ancient. Annoying.</li>
<li><strong>Too much images<br />
</strong>Lowering your loading speed, having a lot of gaps all over your website while it's loading. Not my favorite.</li>
<li><strong>Bad content<br />
</strong>Content is what the people come to your site for. Bad content and they're off again to google or wikipedia. Another visit lost.</li>
<li><strong>Hard to navigate<br />
</strong>If I can't find how to get to your (e.g) tutorials section, why would I stick around and look for it? If you cant even design your site with the user in mind, I might as well find someone who can do that. And probably write better tutorials too!</li>
<li><strong>Frames<br />
</strong>Frames can be good, but only if you know <a href="http://www.phpmyadmin.net/">how to use them</a></li>
</ul>
<p>And lastly, if you're writing a personal blog. Nobody cares, really. If you're just writing about yourself and nothing else, you're bound to lose visitors. Unless you have a strong sense of humour and are a good writer.</p>
<img src="http://kalkran.com/?ak_action=api_record_view&id=88&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://kalkran.com/misc/the-fifteen-sins-of-web-design/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

