<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Little Brain &#187; howto</title>
	<atom:link href="http://justalittlebrain.wordpress.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://justalittlebrain.wordpress.com</link>
	<description>just a little brain</description>
	<lastBuildDate>Fri, 27 Jan 2012 09:05:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='justalittlebrain.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Little Brain &#187; howto</title>
		<link>http://justalittlebrain.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://justalittlebrain.wordpress.com/osd.xml" title="Little Brain" />
	<atom:link rel='hub' href='http://justalittlebrain.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Installing PIL in virtualenv in Ubuntu</title>
		<link>http://justalittlebrain.wordpress.com/2011/08/21/installing-pil-in-virtualenv-in-ubuntu/</link>
		<comments>http://justalittlebrain.wordpress.com/2011/08/21/installing-pil-in-virtualenv-in-ubuntu/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 05:14:45 +0000</pubDate>
		<dc:creator>kriwil</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://littlebrain.org/?p=296</guid>
		<description><![CDATA[To install PIL in virtualenv in ubuntu, these are the steps: install the dependencies needed to build PIL sudo apt-get build-dep python-imaging then run these commands sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/ sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/ sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/ If you&#8217;re using 64bit system, switch i386-linux-gnu to x86_64-linux-gnu. If you don&#8217;t do it, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=296&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To install PIL in virtualenv in ubuntu, these are the steps:</p>
<ol>
<li>
<p>install the dependencies needed to build PIL</p>
<pre><code>sudo apt-get build-dep python-imaging</code></pre>
</li>
<li>
<p>then run these commands</p>
<pre><code>sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/</code></pre>
<p><em>If you&#8217;re using 64bit system, switch i386-linux-gnu to x86_64-linux-gnu.</em></p>
<p>If you don&#8217;t do it, you might see these messages when after building PIL, and you won&#8217;t have jpeg support.</p>
<pre><code>*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available</code></pre>
</li>
<li>
<p>Last command, install PIL</p>
<pre><code>pip install PIL</code></pre>
</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justalittlebrain.wordpress.com/296/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justalittlebrain.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justalittlebrain.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=296&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://justalittlebrain.wordpress.com/2011/08/21/installing-pil-in-virtualenv-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/17b185ab2d1b7dcad3f488040f76385c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kriwil</media:title>
		</media:content>
	</item>
		<item>
		<title>CodeIgniter and Ajax Using jQuery tutorial using JSON</title>
		<link>http://justalittlebrain.wordpress.com/2010/10/24/codeigniter-and-ajax-using-jquery-tutorial-using-json/</link>
		<comments>http://justalittlebrain.wordpress.com/2010/10/24/codeigniter-and-ajax-using-jquery-tutorial-using-json/#comments</comments>
		<pubDate>Sun, 24 Oct 2010 09:09:49 +0000</pubDate>
		<dc:creator>kriwil</dc:creator>
				<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://littlebrain.org/?p=243</guid>
		<description><![CDATA[This post is outdated, and might and might not work. Unfortunately I currently don&#8217;t have time to check and/or fix it. Sorry So now you have created CodeIgniter + AJAX jQuery, you&#8217;ll want to use JSON, javascript way to exchange data. Assuming you already understand how to do CI + AJAX jQuery, using JSON should [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=243&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>This post is outdated, and might and might not work. Unfortunately I currently don&#8217;t have time to check and/or fix it. Sorry <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </strong></p>
<p>So now you have created <a href="http://littlebrain.org/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/">CodeIgniter + AJAX jQuery</a>, you&#8217;ll want to use JSON, javascript way to exchange data.</p>
<p>Assuming you already understand how to do <a href="http://littlebrain.org/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/">CI + AJAX jQuery</a>, using JSON should be pretty easy. We&#8217;ll only need to extend couple things. First, we&#8217;ll be extending <code>Message::view</code> in <code>Message controller</code> from that tutorial. Then we&#8217;ll extend the view to fetch/process the data.</p>
<h4>Controller</h4>
<p>The previous method was like this:</p>
<pre>function view($type = NULL)
{
    // get data from database
    $data['messages'] = $this-&gt;Message_model-&gt;get();

    if ($type == "ajax") // load inline view for call from ajax
        $this-&gt;load-&gt;view('messages_list', $data);
    else // load the default view
        $this-&gt;load-&gt;view('default', $data);
}</pre>
<p>Since we already handled the view type we want to return, all we have to do is add more handler for json. We&#8217;ll just convert the array of objects we get from model using <a href="http://php.net/json_encode">json_encode</a> function. Here&#8217;s the code:</p>
<pre>function view($type = NULL)
{
    // get data from database
    $data['messages'] = $this-&gt;Message_model-&gt;get();

    if ($type == "ajax") // load inline view for call from ajax
        $this-&gt;load-&gt;view('messages_list', $data);

    else if ($type == 'json') // json, print the output directly
    {
        echo json_encode($data['messages']);
    }

    else // load the default view
        $this-&gt;load-&gt;view('default', $data);
}</pre>
<h4>View</h4>
<p>We&#8217;ll be adding a button to trigger the new &#8220;fetch json data&#8221; so the previous handling is still functional.</p>
<p>The previous view (<code>default.php</code>) was:</p>
<div id="form"></div>
<div id="content">load-&gt;view(&#8216;messages_list&#8217;) ?&gt;</div>
<p>Then we added second submit button:</p>
<div id="form"></div>
<div id="content">load-&gt;view(&#8216;messages_list&#8217;) ?&gt;</div>
<p>Now the javacript. The previous javascript/jquery code was:</p>
<pre>$(document).ready(function() {
    $('#submit').click(function() {

        var msg = $('#message').val();

        $.post("", {message: msg}, function() {
            $('#content').load("");
            $('#message').val('');
        });
    });
});</pre>
<p>Then we need to create handler to fetch the data (in json) and put it in correct html tag. Here&#8217;s the code after we added handler for second submit button:</p>
<pre>$(document).ready(function() {
    $('#submit').click(function() {

        var msg = $('#message').val();

        $.post("", {message: msg}, function() {
            $('#content').load("");
            $('#message').val('');
        });
    });

    $('#submit2').click(function() {
        var msg = $('#message').val();
        $('#message').val('');
        $.post("", {message: msg}, function() {
            $.getJSON("", function(data) {
                var contentHtml = "</pre>
<ol>&#8220;; $(data).each(function(index, item) { contentHtml += &#8220;</p>
<li>&#8220;; contentHtml += item.message; contentHtml += &#8220;</li>
<p>&#8220;; }); contentHtml += &#8220;</ol>
<pre>
";
                $('#content').html(contentHtml);
            });
        });
    });
});</pre>
<p>It&#8217;s done. <a href="http://sandbox.littlebrain.org/ci/index.php/message/view">Try yourself</a>, or <a href="http://dl.dropbox.com/u/112837/littlebrain.org/243/applications.zip">download the files</a> needed.</p>
<p>I know, it&#8217;s pretty basic. But I think it&#8217;s enough to get you started to use json in exchanging data. Why json instead of complete html? less data transfer.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justalittlebrain.wordpress.com/243/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justalittlebrain.wordpress.com/243/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justalittlebrain.wordpress.com/243/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=243&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://justalittlebrain.wordpress.com/2010/10/24/codeigniter-and-ajax-using-jquery-tutorial-using-json/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/17b185ab2d1b7dcad3f488040f76385c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kriwil</media:title>
		</media:content>
	</item>
		<item>
		<title>Banshee 1.0 Beta 2 in Ubuntu 8.04 Hardy Heron</title>
		<link>http://justalittlebrain.wordpress.com/2008/05/28/banshee-10-beta-2-in-ubuntu-804-hardy-heron/</link>
		<comments>http://justalittlebrain.wordpress.com/2008/05/28/banshee-10-beta-2-in-ubuntu-804-hardy-heron/#comments</comments>
		<pubDate>Wed, 28 May 2008 15:28:39 +0000</pubDate>
		<dc:creator>kriwil</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[banshee]]></category>
		<category><![CDATA[hardy heron]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[launchpad]]></category>

		<guid isPermaLink="false">http://littlebrain.org/?p=175</guid>
		<description><![CDATA[Now Banshee 1.0 Beta 2 is released. If you want to try the music player in your ubuntu hardy box, you could add sources.list entry from banshee PPA team. Open software sources (System &#62; Administration &#62; Software Sources). In Third-Party Software tab, click Add and paste the code below deb http://ppa.launchpad.net/banshee-team/ubuntu hardy main If you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=175&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Now <a href="http://banshee-project.org/Releases/0.99.2">Banshee 1.0 Beta 2</a> is <a href="http://gburt.blogspot.com/2008/05/banshee-10-beta-2-released.html">released</a>. If you want to try the music player in your ubuntu hardy box, you could add sources.list entry from<a href="https://edge.launchpad.net/~banshee-team/+archive"> banshee PPA team</a>.</p>
<p>Open software sources (System &gt; Administration &gt; Software Sources). In Third-Party Software tab, click Add and paste the code below</p>
<pre>
deb http://ppa.launchpad.net/banshee-team/ubuntu hardy main
</pre>
<p>If you need the source, you could repeat the Add proccess, and paste this</p>
<pre>
deb-src http://ppa.launchpad.net/banshee-team/ubuntu hardy main
</pre>
<p>Close the Software Sources. Wait for a few moment while the software update your package database. Then open the terminal, and type</p>
<pre>
sudo apt-get install banshee-1
</pre>
<p>Yes, use <code>banshee-1</code>. If you use <code>banshee</code>, you&#8217;ll get the old Banshee 0.13.2 from universe repository.</p>
<p>And, enjoy your new Banshee <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/justalittlebrain.wordpress.com/175/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/justalittlebrain.wordpress.com/175/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justalittlebrain.wordpress.com/175/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justalittlebrain.wordpress.com/175/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justalittlebrain.wordpress.com/175/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=175&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://justalittlebrain.wordpress.com/2008/05/28/banshee-10-beta-2-in-ubuntu-804-hardy-heron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/17b185ab2d1b7dcad3f488040f76385c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kriwil</media:title>
		</media:content>
	</item>
		<item>
		<title>CodeIgniter and Ajax Using JQuery Tutorial</title>
		<link>http://justalittlebrain.wordpress.com/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/</link>
		<comments>http://justalittlebrain.wordpress.com/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/#comments</comments>
		<pubDate>Tue, 27 May 2008 15:28:59 +0000</pubDate>
		<dc:creator>kriwil</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://littlebrain.org/?p=172</guid>
		<description><![CDATA[This post is outdated, and might and might not work. Unfortunately I currently don&#8217;t have time to check and/or fix it. Sorry I created this tutorial because I was having a hard time finding good simple CodeIgniter + JQuery tutorial for newbie like me. The one I found, created by MR Forbes, is hard to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=172&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>This post is outdated, and might and might not work. Unfortunately I currently don&#8217;t have time to check and/or fix it. Sorry <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </strong></p>
<p>I created this tutorial because I was having a hard time finding good simple <a href="http://codeigniter.com/">CodeIgniter</a> + <a href="http://jquery.com/">JQuery</a> tutorial for newbie like me. <a href="http://www.mrforbes.com/wordpress/2007/05/13/a-quick-code-igniter-and-jquery-ajax-tutorial/">The one I found</a>, created by MR Forbes, is hard to understand and apparently isn&#8217;t working. <a href="http://pr0digy.com/codeigniter/unobtrusive-ajax-with-codeigniter-and-mootools/">Another one</a>, pr0digy&#8217;s, is using Mootools for the AJAX framework.</p>
<p>So I decided to create my own CodeIgniter and JQuery tutorial based on pr0digy&#8217;s tutorial. I&#8217;m assuming you already know how to code using CodeIgniter. If you&#8217;re new to CodeIgniter, you need to find others tutorial first. <a href="http://codeigniter.com/tutorials/">The videos</a> given in CodeIgniter&#8217;s site is a good start.</p>
<p>This tutorial is about creating simple CodeIgniter + database + ajax system. User will be shown a form to post a message. Then after he/she press the submit button, the system will save the message using ajax and then show the message. You could see <a href="http://sandbox.littlebrain.org/ci/index.php/message/view">the result</a> first if you want.</p>
<h4>Database</h4>
<p>The first thing we need to do is creating a table to save the message. For this tutorial, We will use this:</p>
<pre>CREATE TABLE IF NOT EXISTS `messages` (
  `id` tinyint(4) NOT NULL auto_increment,
  `message` varchar(256) NOT NULL,
  PRIMARY KEY  (`id`)
)</pre>
<h4>Controller</h4>
<p>Then, we need to create a controller. My controller is named <code>message</code>. You could name your controller any name you like. After that, create 2 functions/methods, <strong>view</strong> and <strong>add</strong>.</p>
<p>view is used to get the default view and list of messages from the database. The codes are:</p>
<pre>function view($type = NULL)
{
    // get data from database
    $data['messages'] = $this-&gt;Message_model-&gt;get();

    if ($type == "ajax") // load inline view for call from ajax
        $this-&gt;load-&gt;view('messages_list', $data);
    else // load the default view
        $this-&gt;load-&gt;view('default', $data);
}</pre>
<p>We fetch messages from the database using <code>Message_model-&gt;get()</code> function. Then the data is passed to the view. Here, we have 2 views called. One for the default view, where we called the page using <code>message/view</code>, and the other is for calling from ajax.</p>
<p>add is a proccess used to insert the message to the database. The codes are:</p>
<pre>function add()
{
    // if HTTP POST is sent, add the data to database
    if($_POST &amp;&amp; $_POST['message'] != NULL) {
        $message['message'] = $this-&gt;input-&gt;xss_clean($_POST['message']);
        $this-&gt;Message_model-&gt;add($message);
    } else
        redirect('message/view');
}</pre>
<p>This function is accessed when we press the submit button from the form. This function will save the message using <code>Message_model-&gt;add()</code> function.</p>
<h4>Model</h4>
<p>The next thing we need to create is the model. I use <code>Message_model</code> for the name. Here we create two functions, <strong>add</strong> and <strong>get</strong>. add is a function to insert the data into the database. get is a function to retrieve data from database. I think the codes are pretty self-explainatory, but you could drop me a message if you need some explainations on the codes.</p>
<pre>function add($data)
{
    $this-&gt;db-&gt;insert('messages', $data);
}

function get($limit=5, $offset=0)
{
    $this-&gt;db-&gt;orderby('id', 'DESC');
    $this-&gt;db-&gt;limit($limit, $offset);

    return $this-&gt;db-&gt;get('messages')-&gt;result();
}</pre>
<h4>View</h4>
<p>I use 2 files for view section. <code>default.php</code> and <code>message_list.php</code>. The <code>message_list</code> is used for displaying the messages taken from the database.</p>
<div id="form"></div>
<div id="content">load-&gt;view(&#8216;messages_list&#8217;) ?&gt;</div>
<ol>
<li>message ?&gt;</li>
</ol>
<h4>Hey, Where&#8217;s the JQuery?</h4>
<p>Here we go. The last, and maybe the most important part of this tutorial. So, we the our controller, we had the model, and we had the views. I assume you already know how to include a jquery script to your view. The jquery codes are this:</p>
<pre>$(document).ready(function() {
    $('#submit').click(function() {

        var msg = $('#message').val();

        $.post("", {message: msg}, function() {
            $('#content').load("");
            $('#message').val('');
        });
    });
});</pre>
<p>So, when we click the submit button, the javascript will take the value of input textbox then send it to <code>message/add</code> using post method. When the action succeed, the script will call <code>message/view/ajax</code>. Note the <code>ajax</code> keyword. It will call the <code>message_list</code> view instead of the default one. Then the view will replace the content in <code>div#content</code> tag.</p>
<p>Well done. You could see <a href="http://sandbox.littlebrain.org/ci/index.php/message/view">the demo I made from the tutorial</a>.</p>
<p>You could download the whole files used in this tutorial in [download#1#size#nohits].</p>
<p>Or, if you prefer to get one by one,<br />
[download#2#size#nohits]<br />
[download#3#size#nohits]<br />
[download#4#size#nohits]<br />
[download#5#size#nohits]</p>
<p>I hope this tutorial helps newbie like me. If you have any question, just drop a comment below <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><em><strong>Update</strong>: Need how to do this using JSON? Check <a href="http://littlebrain.org/2010/10/24/codeigniter-and-ajax-using-jquery-tutorial-using-json/">CodeIgniter and Ajax Using jQuery tutorial using JSON</a>.</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/justalittlebrain.wordpress.com/172/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/justalittlebrain.wordpress.com/172/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justalittlebrain.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justalittlebrain.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justalittlebrain.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=172&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://justalittlebrain.wordpress.com/2008/05/27/codeigniter-and-ajax-using-jquery-tutorial/feed/</wfw:commentRss>
		<slash:comments>149</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/17b185ab2d1b7dcad3f488040f76385c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kriwil</media:title>
		</media:content>
	</item>
		<item>
		<title>How To Install Oracle XE in Ubuntu 64 Bit</title>
		<link>http://justalittlebrain.wordpress.com/2008/05/12/how-to-install-oracle-xe-in-ubuntu-64-bit/</link>
		<comments>http://justalittlebrain.wordpress.com/2008/05/12/how-to-install-oracle-xe-in-ubuntu-64-bit/#comments</comments>
		<pubDate>Mon, 12 May 2008 15:42:20 +0000</pubDate>
		<dc:creator>kriwil</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[oracle]]></category>

		<guid isPermaLink="false">http://littlebrain.org/?p=163</guid>
		<description><![CDATA[While you&#8217;re thinking by installing 64 bit linux you&#8217;re standing in the edge of new technology era, it sucks knowing our 64 bit system is less supported than the old 32 bit system. We have to install 32 bit flash since Adobe didn&#8217;t have the 64 bit one. We have to install 32 bit oracle [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=163&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While you&#8217;re thinking by installing 64 bit linux you&#8217;re standing in the edge of new technology era, it sucks knowing our 64 bit system is less supported than the old 32 bit system. We have to install 32 bit flash since Adobe didn&#8217;t have the 64 bit one. We have to install 32 bit oracle xe since Oracle also didn&#8217;t have 64 bit version.</p>
<p>And now I will try explain how to install oracle xe into the 64 bit system, ubuntu way. Of course we couldn&#8217;t follow the <a href="http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html">guide from oracle</a>, since apt-get will detect our system architecture and we won&#8217;t get the 32 bit packages list.</p>
<p>Before we start, make sure you have the 32 bit library installed. It&#8217;s in reposity, all you have to do is</p>
<p><code>sudo apt-get install libc6-i386</code></p>
<p>The next thing to do is download the files needed. It&#8217;s <a href="http://oss.oracle.com/debian/dists/unstable/main/binary-i386/libaio_0.3.104-1_i386.deb">libaio_0.3.104-1_i386.deb</a> and <a href="http://oss.oracle.com/debian/dists/unstable/non-free/binary-i386/oracle-xe-universal_10.2.0.1-1.1_i386.deb">oracle-xe-universal_10.2.0.1-1.1_i386.deb</a>. You could use wget for this</p>
<p><code>wget -c http://oss.oracle.com/debian/dists/unstable/main/binary-i386/libaio_0.3.104-1_i386.deb http://oss.oracle.com/debian/dists/unstable/non-free/binary-i386/oracle-xe-universal_10.2.0.1-1.1_i386.deb</code></p>
<p>After your downloads are finished, we continue to the main issue, forcing the package to be installed. You could try to install with usual dpkg -i first to make sure your system is really 64 bit.</p>
<p><code>sudo dpkg -i libaio_0.3.104-1_i386.deb</code></p>
<p>You&#8217;ll get error,</p>
<p><code>dpkg: error processing libaio_0.3.104-1_i386.deb (--install):<br />
package architecture (i386) does not match system (amd64)<br />
Errors were encountered while processing:<br />
libaio_0.3.104-1_i386.deb</code></p>
<p><em>Added guide from <strong>Venka A</strong></em></p>
<p><code>sudo apt-get install bc</code></p>
<p>To force the installation, do these</p>
<p><code>dpkg -i --force-architecture libaio_0.3.104-1_i386.deb</code><br />
<code>dpkg -i --force-architecture oracle-xe-universal_10.2.0.1-1.1_i386.deb</code></p>
<p>And after the installation is finished, you need to configure it</p>
<p><code>sudo /etc/init.d/oracle-xe configure</code></p>
<p>and edit your ~/.bashrc</p>
<p><code>ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server<br />
PATH=$PATH:$ORACLE_HOME/bin<br />
export ORACLE_HOME<br />
export ORACLE_SID=XE<br />
export PATH</code></p>
<p>And, voila, the oracle xe is ready. You could go to <a href="http://127.0.0.1:8080/apex">http://127.0.0.1:8080/apex</a> from your browser.</p>
<p>References:</p>
<ul>
<li><a href="http://dballester.blogspot.com/2007/04/oracle-xe-en-ubuntu-edgy-amd64-em64t.html">Oracle XE en Ubuntu Edgy amd64 / em64t ( x86-64 )</a></li>
<li><a href="https://help.ubuntu.com/community/Oracle10g#head-310ffbf270536395fae3c8f74c7817a60ef7c3f1">Oracle Express Edition / on Ubuntu Edgy 6.10</a></li>
<li><a href="http://www.oracle.com/technology/tech/linux/install/xe-on-kubuntu.html">Installing Oracle Database XE on Debian, Ubuntu, and Kubuntu</a></li>
</ul>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/justalittlebrain.wordpress.com/163/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/justalittlebrain.wordpress.com/163/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/justalittlebrain.wordpress.com/163/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/justalittlebrain.wordpress.com/163/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/justalittlebrain.wordpress.com/163/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=justalittlebrain.wordpress.com&amp;blog=31033593&amp;post=163&amp;subd=justalittlebrain&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://justalittlebrain.wordpress.com/2008/05/12/how-to-install-oracle-xe-in-ubuntu-64-bit/feed/</wfw:commentRss>
		<slash:comments>282</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/17b185ab2d1b7dcad3f488040f76385c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kriwil</media:title>
		</media:content>
	</item>
	</channel>
</rss>
