<?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 &#187; howto</title>
	<atom:link href="http://huuah.com/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://huuah.com</link>
	<description>webdevelopment, cms, php, javascript etc</description>
	<lastBuildDate>Sun, 20 Nov 2011 20:30:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to make tabs bookmarkable with jQuery</title>
		<link>http://huuah.com/how-to-make-tabs-bookmarkable-with-jquery/</link>
		<comments>http://huuah.com/how-to-make-tabs-bookmarkable-with-jquery/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 20:20:41 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=787</guid>
		<description><![CDATA[<p>There it was. A web layout with tabs. Everything is loaded when on first page load or when needed. This is great for the user experience and it minimizes the page load time. Super.</p>
<a name="Tabs+are+not+good+for+bookmarking"></a>Tabs are not good for bookmarking
<p>HOWEVER &#8211; the content is not than userfriendly is&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>There it was. A web layout with tabs. Everything is loaded when on first page load or when needed. This is great for the user experience and it minimizes the page load time. Super.</p>
<a name="Tabs+are+not+good+for+bookmarking"></a><h1>Tabs are not good for bookmarking</h1>
<p>HOWEVER &#8211; the content is not than userfriendly is you would like the users to bookmark the page. When a page is bookmarked you would expect the bookmark would lead you to the same content as when it was bookmarked. So what to do, when a tab is loaded on the fly or if is just a div or something else, being changed from hidden to visible?</p>
<p>Layout:</p>
<div class="tablayout">
<div class="tabs">
<div class="tab1">Tab 1</div>
<div class="tab2">Tab 2</div>
<div class="tab3">Tab 3</div>
</p></div>
<div class="tabcontent">
<div class="tab1">Tab content 1</div>
<div class="tab2">Tab content 2</div>
<div class="tab3">Tab content 3</div>
</p></div>
</div>
<p>HTML code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;tablayout&quot;&gt;
  &lt;div class=&quot;tabs&quot;&gt;
    &lt;div class=&quot;tab1&quot;&gt;Tab 1&lt;/div&gt;
    &lt;div class=&quot;tab2&quot;&gt;Tab 2&lt;/div&gt;
    &lt;div class=&quot;tab3&quot;&gt;Tab 3&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;tabcontent&quot;&gt;
    &lt;div class=&quot;tab1&quot;&gt;Tab content 1&lt;/div&gt;
    &lt;div class=&quot;tab2&quot;&gt;Tab content 2&lt;/div&gt;
    &lt;div class=&quot;tab3&quot;&gt;Tab content 3&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>jQuery tab code:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {

    $(&quot;.tab1&quot;).click( function() {
        $(&quot;.tabs div&quot;).removeClass(&quot;selectedtab&quot;);
        $(this).addClass(&quot;selectedtab&quot;);
        $(&quot;.tabcontent div&quot;).hide();
        $(&quot;.tabcontent .tab1&quot;).show();
        $(&quot;.tabcontent .tab1&quot;).addClass(&quot;selectedtab&quot;);
    });
    $(&quot;.tab2&quot;).click( function() {
        $(&quot;.tabs div&quot;).removeClass(&quot;selectedtab&quot;);
        $(this).addClass(&quot;selectedtab&quot;);
        $(&quot;.tabcontent div&quot;).hide();
        $(&quot;.tabcontent .tab2&quot;).show();
        $(&quot;.tabcontent .tab2&quot;).addClass(&quot;selectedtab&quot;);
    });
    $(&quot;.tab3&quot;).click( function() {
        $(&quot;.tabs div&quot;).removeClass(&quot;selectedtab&quot;);
        $(this).addClass(&quot;selectedtab&quot;);
        $(&quot;.tabcontent div&quot;).hide();
        $(&quot;.tabcontent .tab3&quot;).show();
        $(&quot;.tabcontent .tab3&quot;).addClass(&quot;selectedtab&quot;);
    });

    $(&quot;.tabs .tab1&quot;).click();
});
</pre>
<p>I know the layout is ugly. I know the tab function can be done better and smarter. This is not what this post is about.</p>
<p>The example shows one way of making a tab function and this is all nice and great. But it does not allow the user to bookmark the page and expect the page to show to correct tab when returning at a later time.</p>
<a name="Tabs+that+are+cool+and+ready+for+the+archive"></a><h1>Tabs that are cool and ready for the archive</h1>
<p>This is where we can use the BBQ plugin by Ben Alman (URL: <a href="http://benalman.com/projects/jquery-bbq-plugin/">http://benalman.com/projects/jquery-bbq-plugin/</a>).<br />
Download it and include it on your page and you are ready to got. Well. Almost.</p>
<p>Bookmarkable tabs with jQuery and the nice and juicy BBQ plugin:</p>
<div class="tablayoutbbq">
<div class="tabs">
<div class="tab1"><a href="#tab1">Tab 1</a></div>
<div class="tab2"><a href="#tab2">Tab 2</a></div>
<div class="tab3"><a href="#tab3">Tab 3</a></div>
</p></div>
<div class="tabcontent">
<div class="tab1">Tab content 1</div>
<div class="tab2">Tab content 2</div>
<div class="tab3">Tab content 3</div>
</p></div>
</div>
<p>HTML Code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div class=&quot;tablayoutbbq&quot;&gt;
  &lt;div class=&quot;tabs&quot;&gt;
    &lt;div class=&quot;tab1&quot;&gt;&lt;a href=&quot;#tab1&quot;&gt;Tab 1&lt;/a&gt;&lt;/div&gt;
    &lt;div class=&quot;tab2&quot;&gt;&lt;a href=&quot;#tab2&quot;&gt;Tab 2&lt;/a&gt;&lt;/div&gt;
    &lt;div class=&quot;tab3&quot;&gt;&lt;a href=&quot;#tab3&quot;&gt;Tab 3&lt;/a&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;tabcontent&quot;&gt;
    &lt;div class=&quot;tab1&quot;&gt;Tab content 1&lt;/div&gt;
    &lt;div class=&quot;tab2&quot;&gt;Tab content 2&lt;/div&gt;
    &lt;div class=&quot;tab3&quot;&gt;Tab content 3&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>As you can see the HTML code is almost the same. Only thing changed is that there is added a link to the tabs. This links add the hash-value to the URL and this is the value we can use. When a user bookmarks the page with a hash-value in the url, all we have to do is read the value and &#8220;click&#8221; the matching tab.</p>
<p>jQuery code</p>
<pre class="brush: jscript; title: ; notranslate">
    $(window).bind( 'hashchange', function(e) {
        var url = $.param.fragment();
        $(&quot;.tablayoutbbq .tabs .&quot;+url).click();
    });

    $(window).trigger( 'hashchange' );
</pre>
<a name="The+end"></a><h1>The end</h1>
<p>There you go. Tabs that can be bookmarked.</p>
<p>Over and out. Comment if you like.</p>
<p>Thanks to <a href="http://benalman.com/">Ben Alman</a> for the great BBQ-plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/how-to-make-tabs-bookmarkable-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Choose which google to use in Firefox and Internet Explorer</title>
		<link>http://huuah.com/choose-which-google-to-use-in-firefox-and-internet-explorer/</link>
		<comments>http://huuah.com/choose-which-google-to-use-in-firefox-and-internet-explorer/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 21:36:09 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=743</guid>
		<description><![CDATA[<a name="3+Step+guide+into+installing+a+new+Google+search+engine+in+your+Firefox+or+Internet+Explorer+browser."></a>3 Step guide into installing a new Google search engine in your Firefox or Internet Explorer browser.
<p>I am using Firefox as my primary browser for many different reasons. I think it is doing a good job and I like the way it is possible to extent its features&#8230;</p>]]></description>
			<content:encoded><![CDATA[<a name="3+Step+guide+into+installing+a+new+Google+search+engine+in+your+Firefox+or+Internet+Explorer+browser."></a><h1>3 Step guide into installing a new Google search engine in your Firefox or Internet Explorer browser.</h1>
<p>I am using Firefox as my primary browser for many different reasons. I think it is doing a good job and I like the way it is possible to extent its features by installing new plugins.</p>
<p>However &#8211; there is one thing, that has bothered me for a long time now. There is no simple way (as far as I have found) to change which country the internal google search uses. The default is google.com and there is no obvious way of changing this.</p>
<p>The only way I have found to do this, is either by editing some xml configuration files, but this does not seem like &#8220;the right way&#8221; to do this.</p>
<p>So I decided to make my own search engine thingy and have afterwards made this small tool below for easier updating.</p>
<p>There is 3 steps into installing a new google search engine.<br />
<strong><br />
Step 1 &#8211; Choose which google engine to install<br />
Step 2 &#8211; Install the new search engine in the top search field<br />
Step 3 &#8211; Select the new search engine<br />
</strong></p>
<a name="Step+1%3A"></a><h1>Step 1:</h1>
<p>If you would like to define your own search parameters sent to google, simply copy/paste your search url below:</p>
<input class="userdefinedgoogle" type="text" value="http://www.google.com/#sclient=psy&amp;hl=en&amp;q=huuah&amp;aq=f&amp;aqi=g1g-o1&amp;aql=&amp;oq=&amp;gs_rfai=&amp;pbx=1" />
<button class="saveuserdefined">Update search options</button></p>
<a name="Step+2%3A"></a><h1>Step 2:</h1>
<p>Go to the google toolbar in your browser (this is tested with Firefox and Internet Explorer) and there will be an option, where it is possible to install the new search engine:<br />
<img src="/images/step2google.png" alt="step 2 google search engine" /><br />
I&#8217;m currently browsing from a Firefox with Danish localization, but it will of course say &#8220;Add&#8221; or something similiar in the language you are running.</p>
<p>Click the install section and we are ready to go.</p>
<a name="Step+3%3A"></a><h1>Step 3:</h1>
<p>The final step is to select the newly installed search engine.<br />
<img src="/images/step3google.png" alt="step 3 google search engine" /></p>
<a name="That%26%238217%3Bs+it"></a><h1>That&#8217;s it</h1>
<p>I hope this small tool is usefull to you. Please post a comment below.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/choose-which-google-to-use-in-firefox-and-internet-explorer/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; title: ; notranslate">
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; title: ; notranslate">
#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; title: ; notranslate">
/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; title: ; notranslate">
# vim /etc/auto.nfs
</pre>
<p>Enter one or more shares like this:</p>
<pre class="brush: plain; title: ; notranslate">
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; title: ; notranslate">
# 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; title: ; notranslate">
# 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; title: ; notranslate">
# 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; title: ; notranslate">
# 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; title: ; notranslate">
/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; title: ; notranslate">
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; title: ; notranslate">
#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; title: ; notranslate">
# 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; title: ; notranslate">
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; title: ; notranslate">
...
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; title: ; notranslate">
#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; title: ; notranslate">
# 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; title: ; notranslate">
/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; title: ; notranslate">
# 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; title: ; notranslate">
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; title: ; notranslate">
# 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[howto]]></category>
		<category><![CDATA[Misc]]></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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
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; title: ; notranslate">
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>2</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; title: ; notranslate">
&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; title: ; notranslate">
#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; title: ; notranslate">
&lt;div class=&quot;mydiv&quot;&gt;some content here&lt;/div&gt;
</pre>
<p>And</p>
<pre class="brush: css; title: ; notranslate">
.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; title: ; notranslate">
&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; title: ; notranslate">
.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; title: ; notranslate">
.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; title: ; notranslate">
.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; title: ; notranslate">
.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; title: ; notranslate">
&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; title: ; notranslate">
.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>Beginning SQL commands</title>
		<link>http://huuah.com/beginning-sql-commands/</link>
		<comments>http://huuah.com/beginning-sql-commands/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 15:14:24 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=503</guid>
		<description><![CDATA[<p>The first step to get an application (program, website etc.) to work against a database is knowing the 5 basic SQL commands. The following examples is based on MySQL, but should apply to every SQL-server. When mastering these 5 commands, you are off to a good start on SQL programming.&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The first step to get an application (program, website etc.) to work against a database is knowing the 5 basic SQL commands. The following examples is based on MySQL, but should apply to every SQL-server. When mastering these 5 commands, you are off to a good start on SQL programming.</p>
<a name="Create+a+tabel"></a><h1>Create a tabel</h1>
<p>First we have to create a new database called &#8216;articles&#8217; and it will contain 2 fields &#8211; a numeric article id and text field for the article content. This is done with the <code>CREATE TABLE</code>-command:</p>
<pre class="brush: sql; title: ; notranslate">
CREATE TABLE `articles` (
`article_id` INT NOT NULL ,
`article_content` TEXT NOT NULL
)
</pre>
<p>Running the above code will create a database called <code>articles</code> with two fields <code>article_id</code> and <code>article_content</code>.</p>
<p>The database table is now ready for use.</p>
<a name="Inserting+into+a+table"></a><h1>Inserting into a table</h1>
<p>To insert data into to newly created database is done with the <code>INSERT</code>-command. When using the <code>INSERT</code>-command, you must specify which table the content should be inserted to and which fields to insert it into.</p>
<p>The <code>INSERT</code>-command is used with this syntax:</p>
<pre class="brush: sql; title: ; notranslate">INSERT INTO `table` (fields) VALUES (values);</pre>
<p><em>table</em>, <em>fields</em> and <em>values</em> must be replaced with the appropriate names, like this:</p>
<pre class="brush: sql; title: ; notranslate">INSERT INTO `articles` (`article_id`, `article_content`) VALUES ('1', 'First article...');</pre>
<p>This will insert an article to the <code>articles</code>-table, with an article id value of &#8217;1&#8242; and a content &#8216;First articles&#8230;&#8217;.</p>
<p>Let insert a couple more articles:</p>
<pre class="brush: sql; title: ; notranslate">INSERT INTO `articles` (`article_id`, `article_content`) VALUES ('2', 'Second article...');
INSERT INTO `articles` (`article_id`, `article_content`) VALUES ('3', 'Third article...');</pre>
<a name="Selecting+from+a+table"></a><h1>Selecting from a table</h1>
<p>The <code>articles</code>-table is now holding 3 articles with id 1, 2 and 3. To retrieve article information from the table, we have to use the <code>SELECT</code>-command. </p>
<p>Selecting content from the database is done by using this syntax:</p>
<pre class="brush: sql; title: ; notranslate">SELECT `field` FROM `table` WHERE search;</pre>
<p>Now &#8211; let select the article content for article no. 2:</p>
<pre class="brush: sql; title: ; notranslate">SELECT `article_content` FROM `articles` WHERE article_id='2';</pre>
<p>This will return a result set with the article content from article no 2.</p>
<p>Selecting from table can of course be must more advanced than this, but this will be covered in a later blog entry.</p>
<a name="Updating+a+table"></a><h1>Updating a table</h1>
<p>Now we know how to insert and select data in the database. At some point it&#8217;s often necessary to change the content of the tables. Changing values is done with the <code>UPDATE</code>-command.</p>
<pre class="brush: sql; title: ; notranslate">UPDATE `table` SET `field`=`value` WHERE search;</pre>
<p>So, to change the content of article no 3 from &#8216;Third article&#8217; to &#8216;yet another article&#8217; use a command like this:</p>
<pre class="brush: sql; title: ; notranslate">UPDATE `articles` SET `article_content`='yet another article' WHERE `article_id`='3'</pre>
<p>This will update the <code>article_content</code>-field to &#8216;yet another article&#8217; if the <code>article_id</code> is equal &#8217;3&#8242;.</p>
<a name="Delete+from+table"></a><h1>Delete from table</h1>
<p>The last command for now is the <code>DELETE</code>-command. This is used, when content in the database should be deleted and is used like this:</p>
<pre class="brush: sql; title: ; notranslate">DELETE FROM `table` WHERE search;</pre>
<p>The article no 1 is now going to be deleted and this is done with the following line:</p>
<pre class="brush: sql; title: ; notranslate">DELETE FROM `articles` WHERE `article_id`='1';</pre>
<p>That&#8217;s it. Article deleted.</p>
<a name="Ending"></a><h1>Ending</h1>
<p>The 5 basic SQL command has now been explained and I hope this will be useful when starting using databases. Every command can be expanded to be much more advanced than what I have shown here.</p>
<p>For further reading on how to create a basic <a href="http://huuah.com/a-simple-login-script-with-php-and-mysql/">login script with PHP and MySQL-database</a> &#8211; <a href="http://huuah.com/a-simple-login-script-with-php-and-mysql/">go here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/beginning-sql-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting position from jQuery UI sortable</title>
		<link>http://huuah.com/getting-position-from-jquery-ui-sortable/</link>
		<comments>http://huuah.com/getting-position-from-jquery-ui-sortable/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 11:07:43 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=461</guid>
		<description><![CDATA[<p>The jQuery UI sortable widget offers a great interface for listing and moving element around. </p>
<p>I have been working on a small project of mine and figured that the sortable widget could be a great feature. I then started to output the list and the element that should be&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The jQuery UI sortable widget offers a great interface for listing and moving element around. </p>
<p>I have been working on a small project of mine and figured that the sortable widget could be a great feature. I then started to output the list and the element that should be draggable like this:</p>
<p>My HTML list</p>
<pre class="brush: xml; title: ; notranslate">
&lt;ul id=&quot;sort1&quot;&gt;
  &lt;li&gt;
    &lt;div&gt;box no 1&lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;div&gt;box no 2&lt;/div&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;div&gt;box no 3&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</pre>
<p>My jQuery code to enable the sortable widget and for getting a serialized result when an element has been dragged around:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready(function() {
    $(&quot;#sort1&quot;).sortable({
        opacity: 0.6,
        update: function(event, ui) {
            var info = $(this).sortable(&quot;serialize&quot;);
            $(&quot;#sort1output&quot;).html(info);
        }

    });
});
</pre>
<p>Example (try dragging a box up or down):</p>
<ul id="sort1">
<li>
<div>box no 1</div>
</li>
<li>
<div>box no 2</div>
</li>
<li>
<div>box no 3</div>
</li>
</ul>
<p>Serialized output (updated when a box is dragged):<span id="sort1output"><strong>Output will be shown here</strong></span></p>
<p>So. Nothing. No output what so ever.</p>
<p>I have spend several hour researching this problem, because the documentation on jqueryui.com lists that the serialize and toArray events should return output.</p>
<p>And then. Finaly. I stumpled upon a note regarding the id name of the element that gets dragged. I have seen no documentation about this and was quite puzzled. I digged some more into this id-hint and realized that the element that gets moved around, has to have a unique id tag ending with a number like this: &#8220;element_2&#8243;.</p>
<p>The working code will then be:</p>
<pre class="brush: xml; highlight: [2,5,8]; title: ; notranslate">
&lt;ul id=&quot;sort2&quot;&gt;
  &lt;li id=&quot;element_1&quot;&gt;
    &lt;div&gt;box no 1&lt;/div&gt;
  &lt;/li&gt;
  &lt;li id=&quot;element_2&quot;&gt;
    &lt;div&gt;box no 2&lt;/div&gt;
  &lt;/li&gt;
  &lt;li id=&quot;element_3&quot;&gt;
    &lt;div&gt;box no 3&lt;/div&gt;
  &lt;/li&gt;
&lt;/ul&gt;
</pre>
<ul id="sort2">
<li id="element_1">
<div>box no 1</div>
</li>
<li id="element_2">
<div>box no 2</div>
</li>
<li id="element_3">
<div>box no 3</div>
</li>
</ul>
<p>Serialized output (updated when a box is dragged):<span id="sort2output" style="font-weight: bold"><strong>Output will be shown here</strong></span></p>
<p>I hope this tip is helpfull.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/getting-position-from-jquery-ui-sortable/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>jQuery and dropdown / select boxes</title>
		<link>http://huuah.com/jquery-and-dropdown-select-boxes/</link>
		<comments>http://huuah.com/jquery-and-dropdown-select-boxes/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 10:54:39 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=434</guid>
		<description><![CDATA[<p>With jQuery it is quick and easy to access and modify elements in a select dropdown box. There are of course several ways of doing thing and I will try to cover most of them here.</p>
<p>Quicklinks:<br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#testsetup">The test setup</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#getthevalue">Get the selected value from the select /</a>&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>With jQuery it is quick and easy to access and modify elements in a select dropdown box. There are of course several ways of doing thing and I will try to cover most of them here.</p>
<p>Quicklinks:<br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#testsetup">The test setup</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#getthevalue">Get the selected value from the select / dropdown box</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#setthevalue">Set the selected value</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#insertvalue">Insert new options and values in the dropdown box</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#removevalue">Removing an entry from the select box</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#enabledisable">Disable and enable options</a><br />
<a href="http://huuah.com/jquery-and-dropdown-select-boxes/#thecode">The code</a></p>
<p><a name="testsetup"></a></p>
<a name="The+test+setup."></a><h1>The test setup.</h1>
<p>For the following examples I will use a dropdown / select box like this:</p>
<select id="dropdowntestsetup">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p>The HTML-code for the dropdown is where basic:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;select id=&quot;dropdown&quot;&gt;
&lt;option value=&quot;apples&quot;&gt;10 Apples&lt;/option&gt;
&lt;option value=&quot;oranges&quot;&gt;5 Oranges&lt;/option&gt;
&lt;option value=&quot;bananas&quot;&gt;12 Bananes&lt;/option&gt;
&lt;/select&gt;
</pre>
<p><a name="getthevalue"></a></p>
<a name="Get+the+selected+value+from+the+select+%2F+dropdown+box."></a><h1>Get the selected value from the select / dropdown box.</h1>
<p>When a value is selected, it could be nice to use the value for something and the first step to doing this, is to receive the value. This is actually very simple to do:<br />
<strong>dropdown1</strong>:<br />
<select id="dropdown1">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p><strong>button1</strong>: <button id="button1">Fetch value from dropdown</button></p>
<p>Code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button1&quot;).click( function() {
        alert(&quot;The selected value is: &quot; + $(&quot;#dropdown1&quot;).val() );
    });
</pre>
<p>Here I have used the val()-function on the dropdown box the receive the value for the selected element and it will output the content of the &#8220;value&#8221;-parameter on the select-box.</p>
<p>If you would rather have the visible text (ie. 10 Apples or 5 Oranges) outputted, you will have to use the html()-function instead. It&#8217;s a bit more tricky, as you should only get the content of the selected value and not the entire select-box.<br />
To do this, we have to do a combination like this:<br />
<strong>button2</strong>: <button id="button2">Fetch content from dropdown</button></p>
<p>Code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button2&quot;).click( function() {
        var selectedvalue = $(&quot;#dropdown1&quot;).val();
        alert(&quot;The selected value is: &quot; + $(&quot;#dropdown1 option[value=&quot;+selectedvalue+&quot;]&quot;).html() );
    });
</pre>
<p>Another and more simple way of getting the text from the selected element could be:</p>
<pre class="brush: jscript; title: ; notranslate">
    $('#dropdown1 :selected').text();
</pre>
<p><a name="setthevalue"></a></p>
<a name="Set+the+selected+value."></a><h1>Set the selected value.</h1>
<p>Setting the selected value is very easy. All you have to do, is use the val()-function:<br />
<strong>dropdown2</strong>:<br />
<select id="dropdown2">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p><strong>button3</strong>: <button id="button3">Select &#8216;oranges&#8217;</button><br />
<strong>button4</strong>: <button id="button4">Select &#8216;bananas&#8217;</button></p>
<p>code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button3&quot;).click( function() {
        $(&quot;#dropdown2&quot;).val(&quot;oranges&quot;);
    });
    $(&quot;#button4&quot;).click( function() {
        $(&quot;#dropdown2&quot;).val(&quot;bananas&quot;);
    });
</pre>
<p><a name="insertvalue"></a></p>
<a name="Insert+new+options+and+values+in+the+dropdown+box."></a><h1>Insert new options and values in the dropdown box.</h1>
<p>If the content of the dropdown are depending on other fields, it is often necessary to change or insert new values to a dropdown box.<br />
This can be done by appending new &lt;option&gt;-tags to the &lt;select&gt;-box:<br />
<strong>dropdown3</strong>:<br />
<select id="dropdown3">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p><strong>button5</strong>: <button id="button5">Append a new field named &#8217;20 Grapes&#8217;</button><br />
<strong>button6</strong>: <button id="button6">Prepend a new field named &#8217;20 Melons&#8217;</button></p>
<p>Code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button5&quot;).click( function() {
        // insert new option at the bottom of the dropdown box
        $(&quot;#dropdown3&quot;).append('&lt;option selected=selected value=&quot;grapes&quot;&gt;20 Grapes&lt;/option&gt;');
    });
    $(&quot;#button6&quot;).click( function() {
        // insert new option at the top of the dropdown box
        $(&quot;#dropdown3&quot;).prepend('&lt;option selected=selected value=&quot;melons&quot;&gt;20 Melons&lt;/option&gt;');
    });
</pre>
<p><a name="removevalue"></a></p>
<a name="Removing+an+entry+from+the+select+box."></a><h1>Removing an entry from the select box.</h1>
<p>Remove options is very easy. All you need is knowing which values to remove:<br />
<strong>dropdown4</strong>:<br />
<select id="dropdown4">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p><strong>button7</strong>: <button id="button7">Remove the &#8220;10 Apples&#8221; option</button></p>
<p>Code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button7&quot;).click( function() {
        $(&quot;#dropdown4 option[value='apples']&quot;).remove();
    });
</pre>
<p><a name="enabledisable"></a></p>
<a name="Disable+and+enable+options."></a><h1>Disable and enable options.</h1>
<p>If some of the options in the dropdown is depending on other values, it is sometimes nice to enable and disable entries on the fly.<br />
<strong>dropdown5</strong>:<br />
<select id="dropdown5">
<option value="apples">10 Apples</option>
<option value="oranges">5 Oranges</option>
<option value="bananas">12 Bananes</option>
</select>
<p><strong>button8</strong>: <button id="button8">Disable the&#8221;5 Oranges&#8221; option</button><br />
<strong>button9</strong>: <button id="button9">Enable the &#8220;5 Oranges&#8221; option</button></p>
<p>Code:</p>
<pre class="brush: jscript; title: ; notranslate">
    $(&quot;#button8&quot;).click( function() {
        $(&quot;#dropdown5 option[value='oranges']&quot;).attr(&quot;disabled&quot;, &quot;disabled&quot;);
    });

    $(&quot;#button9&quot;).click( function() {
        $(&quot;#dropdown5 option[value='oranges']&quot;).removeAttr(&quot;disabled&quot;);
    });
</pre>
<p><a name="thecode"></a></p>
<a name="The+code."></a><h1>The code.</h1>
<p>The complete jQuery code with the above examples, can be <a href="/js/dropdown.js">downloaded here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/jquery-and-dropdown-select-boxes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

