<?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>Webdevelopment at huuah.com</title>
	<atom:link href="http://huuah.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://huuah.com</link>
	<description>webdevelopment, cms, php, javascript etc</description>
	<lastBuildDate>Tue, 24 Aug 2010 21:46:17 +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>itsplanned.com just launched</title>
		<link>http://huuah.com/itsplanned-com-just-launched/</link>
		<comments>http://huuah.com/itsplanned-com-just-launched/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 21:28:51 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[itsplanned.com]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=711</guid>
		<description><![CDATA[<p>The new project management tool itsplanned.com has been launched today.</p>
<a name="Itsplanned.com"></a>Itsplanned.com
<p><a href="http://itsplanned.com">Itsplanned.com is created as an alternative</a> to the more advanced project management tools that already exists. It is built based on the goal that it should be very easy to use, with a simple set of functions that&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The new project management tool itsplanned.com has been launched today.</p>
<a name="Itsplanned.com"></a><h1>Itsplanned.com</h1>
<p><a href="http://itsplanned.com">Itsplanned.com is created as an alternative</a> to the more advanced project management tools that already exists. It is built based on the goal that it should be very easy to use, with a simple set of functions that quickly gives the user a clear and clean view of the tasks that are planned.</p>
<a name="Own+tasks"></a><h1>Own tasks</h1>
<p><a href="http://itsplanned.com">Itsplanned.com gives the use a set of tool</a>, where the users can create there own tasks or project, that they need to track. When the tasks are created, the user can sort and change priority of the tasks, simply by drag&#8217;n'drop the tasks up and down in the task overview.</p>
<a name="Groups+and+moves"></a><h1>Groups and moves</h1>
<p>Tasks can also be moved into another task, where it will be a subtask. <a href="http://itsplanned.com">Itsplanned.com opens for the possibility</a>, where every single tasks easily is movable among the other tasks.</p>
<a name="Overview+and+userability"></a><h1>Overview and userability</h1>
<p>The overview can quickly be changed from listing a task summary to be listing a more detailed output. The overview can both display or hide closed and finished tasks, by selecting a checkbox.</p>
<p>Task descriptions are changed with the user friendly built-in HTML (WYSIWYG) editor.</p>
<p>When the first real-world tests have been completed, the source-code will be released to download.</p>
<p>More details and screenshots can be found at <a href="http://itsplanned.com">itsplanned.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/itsplanned-com-just-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autofs and NFS on Ubuntu 10.04</title>
		<link>http://huuah.com/autofs-and-nfs-on-ubuntu-10-04/</link>
		<comments>http://huuah.com/autofs-and-nfs-on-ubuntu-10-04/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 19:38:27 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[autofs]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nfs]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=703</guid>
		<description><![CDATA[<p>I&#8217;ve been messing around with some weird behavior on the Ubuntu 10.04 while setting up Autofs to auto mount some NFS shares from a remote server.</p>
<a name="My+setup"></a>My setup
<p>Server:<br />
Debian Lenny (IP 192.168.1.123)<br />
Standard NFS-server<br />
A simple export setup (1 share) /mnt/storage</p>
<p>Client:<br />
Ubuntu 10.04<br />
Autofs&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been messing around with some weird behavior on the Ubuntu 10.04 while setting up Autofs to auto mount some NFS shares from a remote server.</p>
<a name="My+setup"></a><h1>My setup</h1>
<p>Server:<br />
Debian Lenny (IP 192.168.1.123)<br />
Standard NFS-server<br />
A simple export setup (1 share) /mnt/storage</p>
<p>Client:<br />
Ubuntu 10.04<br />
Autofs 5.0.4-3.1ubuntu5<br />
Autofs5 5.0.4-3.1ubuntu5</p>
<a name="Autofs+configuration"></a><h1>Autofs configuration</h1>
<p>The first problem is this:</p>
<pre class="brush: plain;">
syntax error in nsswitch config near [ syntax error ]
</pre>
<p>This error message appears in my message log file on my client after installing Autofs. No configuration has yet been changed. So this is by default not working.<br />
There are, as far as I have tested, two workarounds:<br />
1: outcomment the line with &#8216;+auto.master&#8217; at the bottom of the /etc/auto.master<br />
2: insert a line with &#8216;automount:files&#8217; in the /etc/nsswitch.conf</p>
<p>Now &#8211; restart autofs and verify that the error message is gone:</p>
<pre class="brush: plain;">
#sudo service autofs restart
</pre>
<a name="The+Autofs+setup+step+1"></a><h1>The Autofs setup step 1</h1>
<p>Edit /etc/auto.master and add a line like this:</p>
<pre class="brush: plain;">
/media/nfsshares /etc/auto.nfs
</pre>
<p>This will tell autofs to create a folder named nfsshares inside the /media/ folder and that there are further configuration entries in the file /etc/auto.nfs</p>
<a name="The+Autofs+setup+step+2"></a><h1>The Autofs setup step 2</h1>
<p>Create a file called auto.nfs in the /etc/ folder and edit it with your favorite editor:</p>
<pre class="brush: plain;">
# vim /etc/auto.nfs
</pre>
<p>Enter one or more shares like this:</p>
<pre class="brush: plain;">
myservershare 192.168.1.123:/mnt/storage
</pre>
<p>Save the file and we are done.</p>
<a name="Starting+and+testing+Autofs"></a><h1>Starting and testing Autofs</h1>
<p>All options are now created, so lets (re)start Autofs and move on:</p>
<pre class="brush: plain;">
# service autofs restart
</pre>
<p>The Autofs is now running and we should see a newly created folder inside your /media directory:</p>
<pre class="brush: plain;">
# cd /media

# ls -al
...
drwxr-xr-x  3 root root     0 2010-07-15 21:22 nfsshares
...
</pre>
<p>Try to change directory to the nfsshares folder:</p>
<pre class="brush: plain;">
# cd nfsshares

# ls -al
</pre>
<p>What the &#8230;. It&#8217;s empty. Where is the myservershare folder? Don&#8217;t worry, just try and cd&#8217;e into the folder:</p>
<pre class="brush: plain;">
# cd myservershare
</pre>
<p>Well well well. The directory is now accessible and visible.</p>
<p>If you would like the directory structure to be visible at all times &#8211; even at first entry &#8211; add the ghost parameter to the auto.master like this:</p>
<pre class="brush: plain;">
/media/nfsshares /etc/auto.nfs --ghost
</pre>
<p>The Autofs is now up and running.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/autofs-and-nfs-on-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Restore Debian / (root) from backup and boot it.</title>
		<link>http://huuah.com/restore-debian-root-from-backup-and-boot-it/</link>
		<comments>http://huuah.com/restore-debian-root-from-backup-and-boot-it/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 14:33:49 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=691</guid>
		<description><![CDATA[<p>A failing hard drive is something everybody fears. Are all data lost forever or can they be restored from a backup? Hopefully the latter.</p>
<p>I have a setup, where I with the dump/restore utilities on my Debian box are running a set of scheduled backup jobs. To make it short,&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>A failing hard drive is something everybody fears. Are all data lost forever or can they be restored from a backup? Hopefully the latter.</p>
<p>I have a setup, where I with the dump/restore utilities on my Debian box are running a set of scheduled backup jobs. To make it short, I use the dump utility to backup the different mount points on my system. </p>
<a name="How+to+backup+with+dump"></a><h1>How to backup with dump</h1>
<p>To backup the root (/) partition I run a command like this:</p>
<pre class="brush: plain;">
dump -0 -u -f - / | gzip &gt; /mnt/backup/root-gziped.gz
</pre>
<p>This runs the dump utility with a set of options (please referrer to the man page for further options). -0 means a level 0 backup, -u updated a log file with the date of the last update and -f outputs everything to standard output. Afterwards the gzip command will pack the dump data and store it in a file.<br />
This is the way <em><strong>I</strong> do it</em>. Feel free to use other options.</p>
<div class="ww">
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0596102461?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596102461"><img border="0" src="/512JK9LIecL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0596102461" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0131480049?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0131480049"><img border="0" src="/51VdpnUFGGL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0131480049" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0470485051?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0470485051"><img border="0" src="/51VGcZojAOL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0470485051" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/2212125054?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=2212125054"><img border="0" src="/51Xyt7CY3pL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=2212125054" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/2212124430?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=2212124430"><img border="0" src="/51TKbXg8ojL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=2212124430" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
</div>
<a name="How+to+restore+a+backup+made+with+dump"></a><h1>How to restore a backup made with dump</h1>
<p>If your hard drive is failing or perhaps running low on disk space and you need to upgrade it, one way is to do it by restoring from a backup.</p>
<p>What you need, is some kind of running Unix system where you can access the new hard drive and you also need access to the backup file. I have plugged my new drive in another Unix machine as a secondary drive. In this case I am using an Ubuntu 10.4 workstation, where I have installed the dump utility.</p>
<a name="Partitioning+the+new+hard+drive"></a><h2>Partitioning the new hard drive</h2>
<p>To get access to the new drive we need to partition it first. I am using the GParted program in my Ubuntu and have created a partition layout like this:<br />
<img src="/images/gparted.png" alt="GParted" /><br />
NB. This screenshot shows disk usage, because the screenshot it taken after a successful restore.</p>
<a name="Mounting+the+new+layout"></a><h2>Mounting the new layout</h2>
<p>Before we can start the restore, we need to mount the new partition. This is done from the console (terminal) like this:</p>
<pre class="brush: plain;">
#mkdir /media/root

#mount /dev/sdb1 /media/root
</pre>
<p>NB. Please note that I am using sdb (and not sda like the screenshot above shows). This is because the hard drive is not the system drive yet.</p>
<p>The hard drive is now mounted in the /media/root directory and we can begin the restore.</p>
<a name="Restoring+data"></a><h2>Restoring data</h2>
<p>I am using the restore command with the interactive shell to select the files and directories that I need to restore.</p>
<pre class="brush: plain;">
# gunzip root-gziped.tar.gz  | restore -ivf -
Verify tape and initialize maps
Input is from a local file/pipe
Input block size is 32
Dump   date: Thu Jul  8 21:35:37 2010
Dumped from: the epoch
Level 0 dump of / on myserver.mynetwork.com:/dev/sda1
Label: none
Extract directories from tape
Initialize symbol table.
restore &gt;
</pre>
<p>At the prompt it is possible to browse the media with the normally used &#8216;cd&#8217; and &#8216;ls&#8217; commands. When we have found what we need we can go ahead a add it to the queue. To help the restore utility getting the folder permissions correct I usually runs the command setmodes as the first thing.</p>
<pre class="brush: plain;">
restore &gt; setmodes
Set directory mode, owner, and times.
restore &gt; add boot
restore &gt; add bin
...
...
restore &gt; extract
</pre>
<p>The &#8216;add&#8217; command adds folders or files to the queue and the extract command will start the restoring process. </p>
<p>When this is finished you will be asked if you want to set folder permissions on &#8216;.&#8217;. Answer Yes here.</p>
<pre class="brush: plain;">
...
Add links
Set directory mode, owner, and times.
set owner/mode for '.'? [yn] y
restore &gt;
</pre>
<p>This is it. The files are now restored and the hard drive is almost ready to begin its new life.</p>
<div class="ww">
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/2212124430?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=2212124430"><img border="0" src="/51TKbXg8ojL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=2212124430" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0131480049?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0131480049"><img border="0" src="/51VdpnUFGGL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0131480049" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0596102461?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596102461"><img border="0" src="/512JK9LIecL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0596102461" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/2212125054?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=2212125054"><img border="0" src="/51Xyt7CY3pL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=2212125054" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0470485051?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0470485051"><img border="0" src="/51VGcZojAOL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0470485051" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
</div>
<a name="Installing+grub+boot+loader"></a><h2>Installing grub boot loader</h2>
<p>Before the disk can boot up and start the operating system, it needs to have a boot manager. My previously system was using Grub, so I will just reinstall this on the new drive. For this job, we can use an Ubuntu Live cd-rom and boot this. </p>
<p>When this is done and the Ubuntu Live version has booted we need to get access to the new drive (now known as /dev/sda).</p>
<p>Open up a terminal window and enter:</p>
<pre class="brush: plain;">
#mkdir /mnt/root

#sudo mount /dev/sda1 /mnt/root

#sudo chroot /mnt/root /bin/bash

#grub-install /dev/sda
</pre>
<p>These commands will create a mount point, mount the new drive, get root access to the new content and install a grub boot loader on the new.</p>
<p>Power off the machine, pull out the hard drive and install it in the old server again.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/restore-debian-root-from-backup-and-boot-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian NFS server &#8211; Ubuntu NFS client</title>
		<link>http://huuah.com/debian-nfs-server-ubuntu-nfs-client/</link>
		<comments>http://huuah.com/debian-nfs-server-ubuntu-nfs-client/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 18:50:18 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=681</guid>
		<description><![CDATA[<p>NFS is a great way to share and get access to files across a network. The NFS system gives the option to mount a NFS from an external system and a local mount point on your locale system.</p>
<p>To get this working, you need two systems &#8211; a server and&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>NFS is a great way to share and get access to files across a network. The NFS system gives the option to mount a NFS from an external system and a local mount point on your locale system.</p>
<p>To get this working, you need two systems &#8211; a server and a client.</p>
<a name="Installing+the+NFS+Server"></a><h1>Installing the NFS Server</h1>
<p>I have en Debian server running, where I would like easy access to some of the folders from my workstation. To do this, I will install the nfs-kernel-server and the portmap packages like this:</p>
<pre class="brush: plain;">
# aptitute install nfs-kernel-server portmap
</pre>
<p>The NFS server and the portmap service is now installed and up and running.</p>
<a name="Which+folders+to+share"></a><h1>Which folders to share</h1>
<p>To defined which folder we want to share and to which client, we have to take a look at the /etc/exports file. So open /etc/exports in you favorite editor and insert a line like this:</p>
<pre class="brush: plain;">
/home/js 192.168.1.2(rw)
</pre>
<p>This tells the NFS service, that I want to share my home folder /home/js to the client at IP 192.168.1.2 with read-write (rw) access.</p>
<p>To reload the defined exports I have to run the exportfs command like this:</p>
<pre class="brush: plain;">
# exportfs -a
</pre>
<p>That&#8217;s it &#8211; we done here</p>
<div class="ww">
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/1565925106?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1565925106"><img border="0" src="/51YZES9223L._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=1565925106" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0672331098?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0672331098"><img border="0" src="/51tgFc%2BW30L._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0672331098" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/274604076X?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=274604076X"><img border="0" src="/51NDdOyGPJL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=274604076X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0137081308?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0137081308"><img border="0" src="/51yNUUHx3wL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0137081308" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/0470431318?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0470431318"><img border="0" src="/51pm4lubOjL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0470431318" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
</div>
<a name="Access+the+NFS+share+from+an+Ubuntu+Client"></a><h1>Access the NFS share from an Ubuntu Client</h1>
<p>I am using Ubuntu 10.4 as my primary workstation, so I would like to access my home folder on my server. To do this, I have to install the nfs-common package, so I will select my System menu, goto Administration and click on Synaptic Package Manager. Here I will find the nfs-common package and install it as shown here:<br />
<img src="/images/nfsclient.png" alt="nfs-common in synaptic package manager" /></p>
<p>All that&#8217;s left is to mount the share. I will just enter the share to my fstab file and it will then be ready to mount (and automatically mounted on the startup). Again &#8211; use your favorite editor to add a line to the /etc/fstab:</p>
<pre class="brush: plain;">
192.168.1.1:/home/js /media/serverhome   nfs rw 0 0
</pre>
<p>This will let the system mount the /home/js share located on the server with the IP 192.168.1.1, into the local folder /media/serverhome with read-write (rw) access.</p>
<p>When this is done, we must create the folder /media/serverhome on the locale machine and then, either reboot the system or manually mount the share like this:</p>
<pre class="brush: plain;">
# mount /media/serverhome
</pre>
<p>And we are done.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/debian-nfs-server-ubuntu-nfs-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing OpenQRM on Debian 5.0</title>
		<link>http://huuah.com/installing-openqrm-on-debian-5-0/</link>
		<comments>http://huuah.com/installing-openqrm-on-debian-5-0/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 09:37:09 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[openqrm]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=668</guid>
		<description><![CDATA[<p>The OpenQRM installation is quite difficult if you ask me. I have tried installing on both Debian and Ubuntu with the precompiled .deb packages and directly from the Debian and Ubuntu repository. Everything seems to fail in one way or the other. But I finally got it working and here&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The OpenQRM installation is quite difficult if you ask me. I have tried installing on both Debian and Ubuntu with the precompiled .deb packages and directly from the Debian and Ubuntu repository. Everything seems to fail in one way or the other. But I finally got it working and here is how I did it.</p>
<a name="Installing+a+fresh+Debian+5.0"></a><h1>Installing a fresh Debian 5.0</h1>
<p>I am using Virtual Box on my Ubuntu Workstation. This gives me the option to install the OpenQRM in a closed internal network, without having access to new hardware.</p>
<p>To start with I am doing a fresh installation of Debian 5.05 without any additions. No server software, no desktop software, nothing. Just like this:<br />
<img src="/images/openqrm1.png" alt="Debian Installation" /> </p>
<a name="Installing+the+basic+packages+for+building+the+OpenQRM+source"></a><h1>Installing the basic packages for building the OpenQRM source</h1>
<p>Now I have the most basic Debian installation. The OpenQRM will be installed from the svn repository, so I have to install the subversion and make programs. I will also install the mysql-server-5.0 and postfix manually before starting, as it seems something gets messed up if the OpenQRM installation handles these two:</p>
<pre class="brush: plain;">
root@openqrm:~# aptitude install subversion make postfix mysql-server-5.0
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be installed:
  bsd-mailx{a} ca-certificates{a} file{a} libapr1{a} libaprutil1{a} libdb4.5{a} libdbd-mysql-perl{a} libdbi-perl{a}
  libexpat1{a} libhtml-template-perl{a} libldap-2.4-2{a} liblockfile1{a} libmagic1{a} libmysqlclient15off{a}
  libneon27-gnutls{a} libnet-daemon-perl{a} libplrpc-perl{a} libpq5{a} libserf-0-0{a} libsqlite3-0{a} libsvn1{a}
  libterm-readkey-perl{a} libxml2{a} mailx{a} make mime-support{a} mysql-client-5.0{a} mysql-common{a}
  mysql-server-5.0 openssl{a} openssl-blacklist{a} perl{a} perl-modules{a} postfix psmisc{a} python{a}
  python-minimal{a} python2.5{a} python2.5-minimal{a} sgml-base{a} ssl-cert{a} subversion xml-core{a}
0 packages upgraded, 43 newly installed, 0 to remove and 0 not upgraded.
Need to get 64,1MB of archives. After unpacking 189MB will be used.
Do you want to continue? [Y/n/?] Y
</pre>
<p>During the installation of mysql-server-5.0 you will be asked to type in a MySQL root user password. I am entering &#8216;openqrm&#8217; &#8211; you can choose whatever you like, as long as you can remember it later on.<br />
The postfix packages will ask how to deliver mail from the system. This depends on your setup, but I will select the &#8220;Internet Site&#8221; option, so that the server can delivery mail directly on the internet.</p>
<a name="Download+OpenQRM+from+the+svn+repository"></a><h1>Download OpenQRM from the svn repository</h1>
<p>When this is done, the next step is the fetch the newest version from the svn repository:</p>
<pre class="brush: plain;">
root@openqrm:~# svn co https://openqrm.svn.sourceforge.net/svnroot/openqrm openqrm
...
Checked out revision 1998.
</pre>
<p>This can take a few minutes and it finishes by displaying which revision I have checked out.</p>
<a name="Compiling+the+OpenQRM+source"></a><h1>Compiling the OpenQRM source</h1>
<p>Next step is to change to the src-folder and start the code compiling by running the &#8216;make&#8217; command:</p>
<pre class="brush: plain;">
openqrm:~# cd openqrm/trunk/src/
openqrm:~/openqrm/trunk/src# make
...
...
</pre>
<p>This will download and install all the needed Debian packages by itself.</p>
<a name="Installing+the+OpenQRM+source"></a><h1>Installing the OpenQRM source</h1>
<p>To install the OpenQRM software run the &#8216;make install&#8217; command, when the previously &#8216;make&#8217; command has finished:</p>
<pre class="brush: plain;">
openqrm:~/openqrm/trunk/src# make install
</pre>
<p>This will copy all files to the correct positions on the system.</p>
<a name="OpenQRM+system+scripts"></a><h1>OpenQRM system scripts</h1>
<p>The final installation step is to run the &#8216;start&#8217; command, which activates all startup scripts and installs the last required system software:</p>
<pre class="brush: plain;">
openqrm:~/openqrm/trunk/src# make start
...
</pre>
<a name="Accessing+the+Web+interface"></a><h1>Accessing the Web interface</h1>
<p>All software has now been installed and the final step is to prepare the MySQL-database.</p>
<p>This is done by accessing the OpenQRM website. My server has the IP address 192.168.1.26, so I will point my browser at http://192.168.1.26/openqrm/ and type in &#8216;openqrm&#8217; in the username and password prompt.</p>
<a name="Step+1"></a><h2>Step 1</h2>
<p>I am clicking &#8216;next&#8217;:<br />
<img src="/images/openqrm2.png" alt="OpenQRM Step 1" /> </p>
<a name="Step+2"></a><h2>Step 2</h2>
<p>I am selecting the MySQL option:<br />
<img src="/images/openqrm3.png" alt="OpenQRM Step 2" /></p>
<a name="Step+3"></a><h2>Step 3</h2>
<p>Now enter the password for the MySQL root user and click &#8216;Initialyze&#8217;<br />
<img src="/images/openqrm4.png" alt="OpenQRM Step 3" /></p>
<a name="All+done"></a><h2>All done</h2>
<p>The OpenQRM should now be installed without any errors:<br />
<img src="/images/openqrm5.png" alt="OpenQRM Step 4" /></p>
<p>The browser will now redirect to the main screen and we are ready to go.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/installing-openqrm-on-debian-5-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The basics of Android intents and activities</title>
		<link>http://huuah.com/the-basics-of-android-intents-and-activities/</link>
		<comments>http://huuah.com/the-basics-of-android-intents-and-activities/#comments</comments>
		<pubDate>Sun, 30 May 2010 12:58:10 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[activity]]></category>
		<category><![CDATA[intent]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=665</guid>
		<description><![CDATA[<p>Intents can among many things be used to start op a new user interface in your Android App. If you are using a MVC technique, you would like the view part to the separated into classes for itself.  To do this, there is three basic steps to make:</p>
<p>- Create&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Intents can among many things be used to start op a new user interface in your Android App. If you are using a MVC technique, you would like the view part to the separated into classes for itself.  To do this, there is three basic steps to make:</p>
<p>- Create a new class for the activity<br />
- Add the class to the Android Manifest<br />
- Start the activity</p>
<a name="Create+a+class+for+the+user+interface"></a><h1>Create a class for the user interface</h1>
<p>Lets call this file UI:</p>
<pre class="brush: java;">
import android.app.Activity;

public class UI extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // type your magic code here
    }

}
</pre>
<p>That it basically it. A class extending the Activity &#8211; the onCreate is called when the activity is started.<br />
NB: the super.onCreate is very important &#8211; without it the code will fail to run!</p>
<a name="Editing+the+AndroidManifest.xml"></a><h1>Editing the AndroidManifest.xml</h1>
<p>The register the intent in the application, we have to edit the AndroidManifest.xml file like this:</p>
<pre class="brush: xml;">
...
&lt;application...&gt;
        ...
        &lt;activity android:name=&quot;.UI&quot; android:label=&quot;@string/app_name&quot;&gt;
        &lt;/activity&gt;
        ...
&lt;/application&gt;
</pre>
<p>This enables us to access the UI intent created earlier.</p>
<a name="Starting+the+activity"></a><h1>Starting the activity</h1>
<p>All we have to do now, is to start the new intent. This can be done with the startActivity()-function like this:</p>
<pre class="brush: java;">
...
startActivity(new Intent(this, UI.class));
...
</pre>
<p>I hope this small guide is helpful to you. If you would like an example with more details, please let me know</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/the-basics-of-android-intents-and-activities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Git version control.</title>
		<link>http://huuah.com/how-to-use-git-version-control/</link>
		<comments>http://huuah.com/how-to-use-git-version-control/#comments</comments>
		<pubDate>Sun, 16 May 2010 21:25:38 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=652</guid>
		<description><![CDATA[<p>How do you keep track of your code changes? What do you do, if you want to go back to how your code was yesterday? What if you by mistake has deleted a file from your code. Well, I though it would be a great time to get some control&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>How do you keep track of your code changes? What do you do, if you want to go back to how your code was yesterday? What if you by mistake has deleted a file from your code. Well, I though it would be a great time to get some control over my project and the code behind them.</p>
<p>I asked around a bit and everyone said I should take a look at &#8216;git&#8217;, so that I did and I will here summarize what I found so far.</p>
<a name="What+is+Git%3F"></a><h1>What is Git?</h1>
<p>The git version control is a decentralized system that runs along side your code projects. This means that your are not depended on a shared/central server to manage your requests. This have many advantages compared to say cvs and subversion (svn), but I will not go into details with this.</p>
<a name="Basic+file+handling"></a><h1>Basic file handling</h1>
<p>I have writing a small Hello World sample i php, which looks like this:</p>
<pre class="brush: php;">
&lt;?
  print &quot;Hello world!&quot;;
?&gt;
</pre>
<p>Nothing fancy &#8211; just a starting point.</p>
<a name="Initializing+a+project"></a><h1>Initializing a project</h1>
<p>To start up a new project, you have to use the init-option. Standing in the root folder of your project run this:</p>
<pre class="brush: plain;">
$ git init
Initialized empty Git repository in /home/js/helloworld/.git/
</pre>
<p>This creates a .git-folder in the root of the project folder and your project is ready to go.</p>
<a name="Adding+files+to+the+git+repo"></a><h1>Adding files to the git repo</h1>
<p>To add the newly created helloworld.php file to the git repository, you have to use the add option like this:</p>
<pre class="brush: plain;">
$ git add helloworld.php
</pre>
<p>The helloworld.php is now queued for adding to the project.</p>
<a name="Committing+changes"></a><h1>Committing changes</h1>
<p>When files are marked to be added to the project, you have to commit the changes to the repo. This is done with the commit option</p>
<pre class="brush: plain;">
$ git commit
</pre>
<p>This opens up your default editor, where you can type in a comment for your update. When this is done and the content is saved, just quit your editor and the file should now be committed.</p>
<pre class="brush: plain;">
$ git commit
[master (root-commit) 22aff8e] Initial commit
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 helloworld.php
</pre>
<a name="Showing+a+log%2Fhistory+of+the+project"></a><h1>Showing a log/history of the project</h1>
<p>To see what has happen to the project, you can always run the log option like this:</p>
<pre class="brush: plain;">
$ git log
commit 22aff8e5f227c6284307363d036fbe06806ad4a5
Author: js &lt;js@w(none)&gt;
Date:   Sun May 16 22:54:13 2010 +0200

    Initial commit
</pre>
<p>Here we can see, that I have submitted a change, which I have commented &#8220;Initial commit&#8221;.</p>
<a name="Updating+existing+files"></a><h1>Updating existing files</h1>
<p>So lets make some changes to the helloworld.php file:</p>
<pre class="brush: php;">
&lt;?
  print &quot;Hello world... Hello world!&quot;;
?&gt;
</pre>
<p>I have here added some text to the print command.</p>
<p>When using the diff option we can see which changed has been entered:</p>
<pre class="brush: plain;">
$ git diff
diff --git a/helloworld.php b/helloworld.php
index 4450c89..50f9c46 100644
--- a/helloworld.php
+++ b/helloworld.php
@@ -1,3 +1,3 @@
 &lt;?
-  print &quot;Hello world&quot;;
+  print &quot;Hello world... Hello world!&quot;;
 ?&gt;
</pre>
<p>Here we can see, that there is a difference in the helloworld.php file.</p>
<p>To save these changes in the repo, just commit them like shown above:</p>
<pre class="brush: plain;">
$ git commit -a
[master d6bcc84] Added more text
 1 files changed, 1 insertions(+), 1 deletions(-)
</pre>
<a name="Reverting+back+to+previous+versions"></a><h1>Reverting back to previous versions</h1>
<p>Doh!, this is all wrong. It should only print out &#8220;Hello world&#8221; and nothing else. Well, then we just have to fetch the previous version of the helloworld.php file.</p>
<p>Lets use the log function to see which change we have to get back to:</p>
<pre class="brush: plain;">
$ git log
commit d6bcc84950f5968e8c5d3fc0522e55cfb3cc8dab
Author: js &lt;js@w(none)&gt;
Date:   Sun May 16 23:04:17 2010 +0200

    Added more text

commit 22aff8e5f227c6284307363d036fbe06806ad4a5
Author: js &lt;js@w(none)&gt;
Date:   Sun May 16 22:54:13 2010 +0200

    Initial commit
</pre>
<p>We then want to go back to the initial commit by using the hash value stated on the commit line:</p>
<pre class="brush: plain;">
$ git checkout 22aff8e5f227c6284307363d036fbe06806ad4a5
Note: moving to '22aff8e5f227c6284307363d036fbe06806ad4a5' which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b &lt;new_branch_name&gt;
HEAD is now at 22aff8e... Initial commit
</pre>
<p>Listing the content of the helloworld.php will now verify that we have gone back to the original version.</p>
<p>But as you can see, we now have to work with branches. I will not cover branches in this article, so just save a branch and move it to the master like this:</p>
<pre class="brush: plain;">
$ git checkout -b test
Switched to a new branch 'test'
$ git branch -M master
</pre>
<p>There you go &#8211; a previous update was found and we can continue our coding from here.</p>
<p>I will cover branches and much more later on.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/how-to-use-git-version-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SQLite from your Android App</title>
		<link>http://huuah.com/using-sqlite-from-your-android-app/</link>
		<comments>http://huuah.com/using-sqlite-from-your-android-app/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 12:46:27 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=641</guid>
		<description><![CDATA[<p>So, how do you use the SQLite database from your Android App? Go google! &#8211; well, been there done that. It took me many hours getting it to work &#8211; perhaps because I made some mistakes &#8211; so I will try and give a crash course in how to connect&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>So, how do you use the SQLite database from your Android App? Go google! &#8211; well, been there done that. It took me many hours getting it to work &#8211; perhaps because I made some mistakes &#8211; so I will try and give a crash course in how to connect to a SQLite database from an Android Application.</p>
<a name="The+basic+databaseHandler"></a><h1>The basic databaseHandler</h1>
<p>There are properly tons of ways to make a databaseHandler and I will not discuss why and when to use what. Use my examples as you want or if you want to.</p>
<p>The databaseHandler is the class that handles the connection from the application to the database.</p>
<p>This is the most basic database handle class:</p>
<pre class="brush: java;">

package huuah.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.SQLException;

public class databaseHelper extends SQLiteOpenHelper {

  private static final String DBNAME = &quot;myfancydatabase&quot;;
  private databaseHelper myDBHelper;
  private SQLiteDatabase myDB; 

  private final Context myContext;

  public databaseHelper(Context context) {
    super(context, DBNAME, null, 2);
    this.myContext = context;
  }

  @Override
  public void onCreate(SQLiteDatabase db) {
  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  }

  public databaseHelper open() throws SQLException {
     myDBHelper = new databaseHelper(myContext);
     myDB = myDBHelper.getWritableDatabase();
     return this;
  }
}
</pre>
<p>When the open() function is called, it will activate the constructor and a new database (in this case named &#8216;myfancydatabase&#8217;) will be created inside the database path for your app.</p>
<p>The database path is located in /data/data/YOURPACKAGENAME/databases/.</p>
<p>To run the code add something like this to your application:</p>
<pre class="brush: java;">
...
import huuah.db.databaseHelper;
...
databaseHelper dbCon = new databaseHelper(this);
dbCon.open();
...
</pre>
<p>Use the DDMS in Eclipse or the ADB tool to check if the database is created correctly.</p>
<a name="Copying+from+assets+to+database+path"></a><h1>Copying from assets to database path</h1>
<p>What if we would like to distribute the application with a default database? Almost as simple as creating a new. Copy your SQLite database to the assets folder of your project. From here we will copy it to the correct database folder on the phone.</p>
<pre class="brush: java;">
...
  public void createDatabase() throws IOException {

    InputStream assetsDB = myContext.getAssets().open(&quot;localdb&quot;);
    OutputStream dbOut = new FileOutputStream(&quot;/data/data/huuah.db/database/myfancydatabase&quot;);

    byte[] buffer = new byte[1024];
    int length;
    while ((length = assetsDB.read(buffer))&gt;0){
      dbOut.write(buffer, 0, length);
    }

    dbOut.flush();
    dbOut.close();
    assetsDB.close();
}
...
</pre>
<p>This will copy the database &#8216;localdb&#8217; found in the assets folder and copy it to the database folder of my huuah.db package and naming it myfancydatabase. All done.</p>
<a name="Using+DDMS+or+the+ADB+tool"></a><h1>Using DDMS or the ADB tool</h1>
<p>Sometimes it is a good idea to check if your files and databases are created properly. This can be done with the DDMS in the Eclipse IDE or with the ADB tool.</p>
<a name="Eclipse+DDMS"></a><h2>Eclipse DDMS</h2>
<p>Go to the Window-menu, select Open Perspective and click the &#8220;Other&#8221; option. Select the DDMS option and click OK. This will open up a File Explorer and some other windows. The File Explorer can be used to view, delete and copy to and from the emulator by pulling or pushing files.</p>
<a name="ADB+tool"></a><h2>ADB tool</h2>
<p>The adb-tool can, among many things, be used for file exploring. Open a adb shell and list the content of the database folder like this:</p>
<pre class="brush: plain;">
$ adb shell
# cd data/data/huuah.db/databases
# ls
myfancydatabase
#
</pre>
<a name="Creating+a+SQLite+database+with+a+Firefox+plugin"></a><h1>Creating a SQLite database with a Firefox plugin</h1>
<p>If your are using Firefox, there is a great simple plugin that lets your create and edit SQLite database. <a href="https://addons.mozilla.org/addon/5817">It can be found here</a>. When downloaded and installed, goto the tools menu in Firefox and select the SQLite manager and your are ready. </p>
<p>There is only one thing you must remember, when creating the databases from scratch like this, is to manually create the android structure. This is done by running these to SQL commands:</p>
<pre class="brush: sql;">
CREATE TABLE &quot;android_metadata&quot; (&quot;locale&quot; TEXT DEFAULT 'en_US');
INSERT INTO &quot;android_metadata&quot; VALUES ('en_US');
</pre>
<p>Close and save the database, and copy the file to your assets folder.</p>
<a name="Where+I+got+stuck"></a><h1>Where I got stuck</h1>
<p>I ran into quite a few obstacles when making the database connection for the very first time. I did find some answers as well:</p>
<a name="Problem%3A+public+type+databaseHelper+must+be+definded"></a><h2>Problem: public type databaseHelper must be definded</h2>
<p>Solution: Well, I wasn&#8217;t thinking when creating my databaseHelper, so I just wrote it in the same file as my main function. Don&#8217;t do this. Bad idea. New classes must be placed in its own .java file.</p>
<a name="Problem%3A+I+was+getting+loads+of+%26%238220%3Bdatabase+failure+14%26%238243%3B"></a><h2>Problem: I was getting loads of &#8220;database failure 14&#8243;</h2>
<p>Solution: Don&#8217;t manually create the /data/data/PACKAGENAME/databases directory. User rights on the databases folder will be wrong and your are not allowed to write to the directory from your Android App. Remove the directory and let the Android software create it for you.</p>
<a name="The+end"></a><h1>The end</h1>
<p>I hope your found my post useful. Please post any comments you may have.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/using-sqlite-from-your-android-app/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Howto float your CSS</title>
		<link>http://huuah.com/howto-float-your-css/</link>
		<comments>http://huuah.com/howto-float-your-css/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 19:41:13 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=611</guid>
		<description><![CDATA[<p>Float left. Float right. What to do and why? Well read on &#8230;</p>
<a name="How+to+float+it"></a>How to float it
<p>Well &#8211; it can sometimes be quite difficult to understand how the float universe works. I will try to give some basic pointers and examples on the float left and float right&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Float left. Float right. What to do and why? Well read on &#8230;</p>
<a name="How+to+float+it"></a><h1>How to float it</h1>
<p>Well &#8211; it can sometimes be quite difficult to understand how the float universe works. I will try to give some basic pointers and examples on the float left and float right technique and how it reacts in the layout.</p>
<p><SCRIPT charset="utf-8" type="text/javascript" src="http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&#038;MarketPlace=GB&#038;ID=V20070822/GB/huuah-21/8006/871a18af-2ef7-40ff-b192-f5732c864791"> </SCRIPT> <NOSCRIPT><A HREF="http://ws.amazon.co.uk/widgets/q?ServiceVersion=20070822&#038;MarketPlace=GB&#038;ID=V20070822%2FGB%2Fhuuah-21%2F8006%2F871a18af-2ef7-40ff-b192-f5732c864791&#038;Operation=NoScript">Amazon.co.uk Widgets</A></NOSCRIPT></p>
<a name="The+basic+of+id+and+classes"></a><h1>The basic of id and classes</h1>
<p>There are two ways to access HTML elements from CSS. You can either use id&#8217;s or class&#8217;es. Almost every HTML tag, if not all, allows the assignment of an id or class name. When element has an id or class, it can be accessed from CSS by using . or #.</p>
<p>ID are accessed with # (hash). Lets say we have a &lt;div&gt;-tag with the id set to mydiv:</p>
<pre class="brush: xml;">
&lt;div id=&quot;mydiv&quot;&gt;some content here&lt;/div&gt;
</pre>
<p>The mydiv can then be access like this from CSS</p>
<pre class="brush: css;">
#mydiv {
  width: 100px;
  height: 100px;
}
</pre>
<p>If we are using a class instead of an id, the code would lookup like this:</p>
<pre class="brush: xml;">
&lt;div class=&quot;mydiv&quot;&gt;some content here&lt;/div&gt;
</pre>
<p>And</p>
<pre class="brush: css;">
.mydiv {
  width: 100px;
  height: 100px;
}
</pre>
<p>id&#8217;s and class&#8217;es will not be covered in more details here.</p>
<a name="Starting+point"></a><h1>Starting point</h1>
<p>This article will use the following HTML as a starting point. It holds a simple div-&#8221;container&#8221; with contains another 3 divs.</p>
<pre class="brush: xml;">
&lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;class1&quot;&gt;This is the first class&lt;/div&gt;
  &lt;div class=&quot;class2&quot;&gt;This is the second class&lt;/div&gt;
  &lt;div class=&quot;class3&quot;&gt;This is the third class&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>Without any CSS it would look like this:</p>
<div class="container">
<div class="class1">This is the first class</div>
<div class="class2">This is the second class</div>
<div class="class3">This is the third class</div>
</div>
<p>Not really that pretty and nice as we would like it to be, right?</p>
<a name="Basic+styling"></a><h1>Basic styling</h1>
<p>Lets do some basic styling of the above code, to better see what&#8217;s going on.</p>
<pre class="brush: css;">
.class1 {
  width: 200px;
  background-color: light-grey;
}
.class2 {
  width: 300px;
  background-color: white;
}
.class3 {
  width: 500px;
  background-color: grey;
}
</pre>
<p>This outputs:</p>
<div class="container1">
<div class="class1">This is the first class</div>
<div class="class2">This is the second class</div>
<div class="class3">This is the third class</div>
</div>
<p>Okay &#8211; now we can better see the difference between the 3 divs.</p>
<a name="Lets+float+it"></a><h1>Lets float it</h1>
<p>When floating left, the selected element will be placed along the left side of the next element.<br />
When floating right, the selected element will be placed along the right side of the next element.</p>
<p>Left floating the first class:</p>
<pre class="brush: css;">
.class1 {
  width: 200px;
  background-color: light-grey;
  float: left;
}
</pre>
<div class="container2">
<div class="class1">This is the first class</div>
<div class="class2">This is the second class</div>
<div class="class3">This is the third class</div>
</div>
<p>Okay, that went kinda like expected. Although &#8211; the class2 has a width set to 300px, so why does it wrap like that, when it should have enough space &#8211; the class1 is 200px and the class3 is 500px, so class1 and class2 should will up the exact same space as class3 below. </p>
<p>This is one of those questions I used to ask a friend of mine over at <a href="http://www.spiced2.com">spiced2.com</a> and he always answered &#8220;when in doubt, float left&#8221;. Ok then. Lets float class2 left as well:</p>
<div class="container3">
<div class="class1">This is the first class</div>
<div class="class2">This is the second class</div>
<div class="class3">This is the third class</div>
</div>
<pre class="brush: css;">
.class1 {
          width: 200px;
          background-color: #DEDEDE;
          float: left;
}
.class2 {
          width: 300px;
          background-color: #006699;
          float: left;
}
.class3 {
          width: 500px;
          background-color: #009900;
}
</pre>
<p>Now it&#8217;s a lot better, but what will happen if we try to float right?</p>
<div class="container4">
<div class="class1">This is the first class</div>
<div class="class2">This is the second class</div>
<div class="class3">This is the third class</div>
</div>
<p>The first class is now floating right, and is therefor aligned to the right side of class2:</p>
<pre class="brush: css;">
.class1 {
          width: 200px;
          background-color: #DEDEDE;
          float: right;
}
.class2 {
          width: 300px;
          background-color: #006699;
}
class3 {
          width: 500px;
          background-color: #009900;
}
</pre>
<a name="The+next+step"></a><h1>The next step</h1>
<p>Lets try a bit more advanced setup, where we will wrap some text around another element. To do this we have to place one element inside another like this:</p>
<pre class="brush: xml;">
&lt;div class=&quot;container&quot;&gt;
  &lt;div class=&quot;class1&quot;&gt; &lt;span class=&quot;class2&quot;&gt;This is the second class&lt;/span&gt;This is the first class This is the first class This is the first class This is the first class This is the first class This is the first class &lt;/div&gt;
  &lt;div class=&quot;class3&quot;&gt;This is the third class&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>To get the text in class wrapped around the class2 element, we have to set a float right on the class2. This makes it right aligned, and the text in class1 will then wrapped around it. </p>
<p>The CSS looks as follows:</p>
<pre class="brush: css;">
.class1 {
          width: 500px;
          background-color: #DEDEDE;
          float: left;
}
.class2 {
          width: 200px;
          background-color: #006699;
          float: right;
}
.class3 {
          width: 500px;
          background-color: #009900;
}
</pre>
<div class="container5">
<div class="class1"> <span class="class2">This is the second class</span>This is the first class This is the first class This is the first class This is the first class This is the first class This is the first class </div>
<div class="class3">This is the third class</div>
</div>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2002298237929711";
/* 468x15, oprettet 19-04-10 */
google_ad_slot = "2384876595";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script><br />
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
<a name="Last+words"></a><h1>Last words</h1>
<p>That it. A very small and basic intro tutorial on the mysterious left and right floating. Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/howto-float-your-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android Progress Bar and Thread updating</title>
		<link>http://huuah.com/android-progress-bar-and-thread-updating/</link>
		<comments>http://huuah.com/android-progress-bar-and-thread-updating/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 11:43:38 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=606</guid>
		<description><![CDATA[<p>The progress bar is useful for telling users that your Android Application is working on a task that might take a little longer than the usual tasks.</p>
<p>A progress bar is quit easy to make, which I have described here is the <a href="/dialog-boxes-in-android/">Dialog Boxes post here</a> and I will&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The progress bar is useful for telling users that your Android Application is working on a task that might take a little longer than the usual tasks.</p>
<p>A progress bar is quit easy to make, which I have described here is the <a href="/dialog-boxes-in-android/">Dialog Boxes post here</a> and I will therefor not go into details with this.</p>
<a name="Simple+test+layout"></a><h1>Simple test layout</h1>
<p>I have created a simple test layout like this:<br />
<img src="/images/progress1.png" alt="Progress Bar Test Layout" /></p>
<p>XML layout:</p>
<pre class="brush: xml;">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;LinearLayout xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
    android:orientation=&quot;vertical&quot;
    android:layout_width=&quot;fill_parent&quot;
    android:layout_height=&quot;fill_parent&quot;
    &gt;

&lt;TextView android:id=&quot;@+id/TextView02&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;Maximum value&quot;&gt;&lt;/TextView&gt;

&lt;EditText android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;100&quot; android:id=&quot;@+id/maximum&quot;&gt;&lt;/EditText&gt;

&lt;TextView android:id=&quot;@+id/TextView01&quot; android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;Increment by&quot;&gt;&lt;/TextView&gt;

&lt;EditText android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;5&quot; android:id=&quot;@+id/increment&quot;&gt;&lt;/EditText&gt;

&lt;Button android:layout_width=&quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:text=&quot;Start&quot; android:id=&quot;@+id/startbtn&quot;&gt;&lt;/Button&gt;

&lt;/LinearLayout&gt;
</pre>
<p>There are two text fields. One to set the maximum value of the progress bar and one to set the increment value. When pushing the Start button a progress bar is displayed and in this example it will just update the progress bar every half a second (500ms) to demonstrate the result.</p>
<a name="Updating+the+progress+bar"></a><h1>Updating the progress bar</h1>
<p>To update the progress bar in the background, while something else is running the application has to use threads. I will be setting up a thread when the Start button is clicked. The thread will then execute some code, in this case just a simple handler that will update the progress bar, and when finished the thread will terminate itself.</p>
<p>When the Start button is activated the application will display a progress bar &#8211; I have set a maximum value of 200 and a increment value of 14:<br />
<img src="/images/progress2.png" alt="Progress Bar Updating" /></p>
<a name="Complete+Java+code"></a><h1>Complete Java code</h1>
<p>The complete java code looks like this. I have added comments in the code, so it should be self explanatory &#8211; if not just post a comment last on this page.</p>
<pre class="brush: java;">
package huuah.progressthread;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.app.ProgressDialog;

public class progressthread extends Activity implements OnClickListener {
    ProgressDialog dialog;
    int increment;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Button startbtn = (Button) findViewById(R.id.startbtn);
        startbtn.setOnClickListener(this);
    }

    public void onClick(View view) { 

        // get the increment value from the text box
        EditText et = (EditText) findViewById(R.id.increment);
        // convert the text value to a integer
        increment = Integer.parseInt(et.getText().toString());

        dialog = new ProgressDialog(this);
        dialog.setCancelable(true);
        dialog.setMessage(&quot;Loading...&quot;);
        // set the progress to be horizontal
        dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
        // reset the bar to the default value of 0
        dialog.setProgress(0);

        // get the maximum value
        EditText max = (EditText) findViewById(R.id.maximum);
        // convert the text value to a integer
        int maximum = Integer.parseInt(max.getText().toString());
        // set the maximum value
        dialog.setMax(maximum);
        // display the progressbar
        dialog.show();

        // create a thread for updating the progress bar
        Thread background = new Thread (new Runnable() {
           public void run() {
               try {
                   // enter the code to be run while displaying the progressbar.
                   //
                   // This example is just going to increment the progress bar:
                   // So keep running until the progress value reaches maximum value
                   while (dialog.getProgress()&lt;= dialog.getMax()) {
                       // wait 500ms between each update
                       Thread.sleep(500);

                       // active the update handler
                       progressHandler.sendMessage(progressHandler.obtainMessage());
                   }
               } catch (java.lang.InterruptedException e) {
                   // if something fails do something smart
               }
           }
        });

        // start the background thread
        background.start();

    }

    // handler for the background updating
    Handler progressHandler = new Handler() {
        public void handleMessage(Message msg) {
            dialog.incrementProgressBy(increment);
        }
    };
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/android-progress-bar-and-thread-updating/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
