<?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; Misc</title>
	<atom:link href="http://huuah.com/category/misc/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.3.2</generator>
		<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>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; title: ; notranslate">
&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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
&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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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; title: ; notranslate">
$ 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>Beginning Android by Mark L. Murphy</title>
		<link>http://huuah.com/beginning-android-by-mark-l-murphy/</link>
		<comments>http://huuah.com/beginning-android-by-mark-l-murphy/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 22:21:45 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=520</guid>
		<description><![CDATA[<p>I just started reading the <a href="http://www.amazon.co.uk/gp/product/1430224193?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430224193">Beginning Android by Mark L. Murphy</a> and it seems like a very easy to read book.</p>
<p>The Android platform is very new to me, so I wanted to read about some of the basics before starting to develop Android software. I know the Internet contains &#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>I just started reading the <a href="http://www.amazon.co.uk/gp/product/1430224193?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430224193">Beginning Android by Mark L. Murphy</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=1430224193" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> and it seems like a very easy to read book.</p>
<p>The Android platform is very new to me, so I wanted to read about some of the basics before starting to develop Android software. I know the Internet contains all the same information, but sometimes it is nice to have the reading material as a good old fashion paper book.</p>
<p>When reading through the <a href="http://www.amazon.co.uk/gp/product/1430224193?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430224193">book</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=1430224193" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> I will try out the example codes on my HTC Hero telephone with the Android 1.5 original rom.</p>
<p>I will, with out doubt, end up in situations where nothing want to work the way I thought it would and when this happens, I will be making blog post about this. The Android platform is very exciting and the HTC Hero is doing a nice job running it. I know there is different opinions about the Hero phone and some might prefer the droid instead and this is all fine by me. I happen to have the HTC Hero.</p>
<p>More blog post about the Android platform will follow very soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/beginning-android-by-mark-l-murphy/feed/</wfw:commentRss>
		<slash:comments>2</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 draggable &#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>A simple login script with PHP and MySQL</title>
		<link>http://huuah.com/a-simple-login-script-with-php-and-mysql/</link>
		<comments>http://huuah.com/a-simple-login-script-with-php-and-mysql/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 17:45:29 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=417</guid>
		<description><![CDATA[<p>With this guide I will try to go through the very basic techniques of making a simple php script that can handle login authorization of website users.</p>
<p>The guide will be based on common Linux installations of both MySQL and PHP.</p>
<a name="Step+1+%26%238211%3B+the+database"></a>Step 1 &#8211; the database
<p>Create a table in &#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>With this guide I will try to go through the very basic techniques of making a simple php script that can handle login authorization of website users.</p>
<p>The guide will be based on common Linux installations of both MySQL and PHP.</p>
<a name="Step+1+%26%238211%3B+the+database"></a><h1>Step 1 &#8211; the database</h1>
<p>Create a table in your MySQL database with 2 fields, <code>username</code> and <code>password</code>. This could be done by running the following code in your MySQL shell or from phpMyAdmin or another interface:</p>
<pre class="brush: plain; title: ; notranslate">
CREATE TABLE `login` (
`username` TEXT NOT NULL ,
`password` TEXT NOT NULL
)
</pre>
<p>The database table called <code>login</code> is now created with 2 field named <code>username</code> and <code>password</code>.</p>
<a name="Step+2+%26%238211%3B+The+HTML+form"></a><h1>Step 2 &#8211; The HTML form</h1>
<p>First we have to create the web formula to show the login function:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;login.php&quot; method=&quot;post&quot;&gt;
  &lt;input type=&quot;text&quot; name=&quot;username&quot;&gt;
  &lt;input type=&quot;password&quot; name=&quot;password&quot;&gt;
  &lt;input type=&quot;submit&quot; value=&quot;Login&quot;&gt;
&lt;/form&gt;
</pre>
<p>This will output 3 field like this:</p>
<form action="#" method="post" onsubmit="return false;">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login">
</form>
<p>When submitting the form, either by hitting enter or by clicking the Login button, the formula will send the username and password to the login.php file.</p>
<a name="Step+3+%26%238211%3B+Getting+the+information+from+the+website."></a><h1>Step 3 &#8211; Getting the information from the website.</h1>
<p>The login information has now been sent to the login.php and we have to receive these value before checking them against the MySQL database.</p>
<p>Login.php:</p>
<pre class="brush: php; title: ; notranslate">
  &lt;?php
  ...
  // receiveing the login information
  $username = $_GET[&quot;username&quot;];
  $password = $_GET[&quot;password&quot;];
  ?&gt;
</pre>
<a name="Step+4+%26%238211%3B+Connecting+to+the+database"></a><h1>Step 4 &#8211; Connecting to the database</h1>
<p>Before checking the login data against the database, we have to open a new connection.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
  ...
  //login information to the MySQL database
  $dbuser = &quot;myUsername&quot;; // change myUsername to your own username
  $dbpass = &quot;myPassword&quot;; //change myPassword to your own password
  $dbhost = &quot;localhost&quot;; // this should work in most cases. Otherwise contact your webhost
  $db = &quot;myDatabase&quot;; // change myDatabase to your the database assigned to your login

  // perform user authentication
  mysql_connect($server, $dbuser, $dbpass);
  // selecting database
  mysql_select_db($db;

  ...
?&gt;
</pre>
<a name="Step+5+%26%238211%3B+Comparing+the+username+and+password+against+the+database"></a><h1>Step 5 &#8211; Comparing the username and password against the database</h1>
<p>We have the login information from the formula and we have opened a connection to the database. Great. All we have to do, is the actually user validation.</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
  ..
  // check the content of our $username and $password variable against the login table
  $sql = &quot;SELECT username FROM login WHERE username='$username' AND password='$password'&quot;;
  // perform the query
  $query = mysql_query($sql);
  // check if the request returned 1 or 0 rows from the database
  if (mysql_num_rows($query)) {
    // 1 or more rows matched our request, which means the username and password combo are valid
  } else {
    // 0 rows matched our request. Login is not valid then.
  }
  ..
?&gt;
</pre>
<a name="Step+6+%26%238211%3B+All+done%2C+final+pointer"></a><h1>Step 6 &#8211; All done, final pointer</h1>
<p>This is a very basic type of php login script. There are a lot of other things to have in mind when making database queries, that I have not convert in the above examples:</p>
<ul>
<li>Perhaps the login table should hold more information, like a user id for easier validation later on the the script.</li>
<li>Double checking and validating user input to prevent SQL Injection. This could be done be PHP Magic Quotes or by manually applying addslashes() and stripslashs().</li>
<li>..</li>
</ul>
<p>But then again. Very simple demonstration.</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/a-simple-login-script-with-php-and-mysql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery and iframe manipulation</title>
		<link>http://huuah.com/jquery-and-iframe-manipulation/</link>
		<comments>http://huuah.com/jquery-and-iframe-manipulation/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 10:52:48 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[iframe]]></category>

		<guid isPermaLink="false">http://huuah.com/?p=248</guid>
		<description><![CDATA[<p>I&#8217;ve been experimenting with some iframe-manipulation with jQuery, but this was not as easy as I have hoped for. There is not much help on jquery.com and a Google search just found others with the same kind of problem.</p>
<p>My setup is very basic. An iframe loading a page like &#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with some iframe-manipulation with jQuery, but this was not as easy as I have hoped for. There is not much help on jquery.com and a Google search just found others with the same kind of problem.</p>
<p>My setup is very basic. An iframe loading a page like this </p>
<pre class="brush: xml; title: ; notranslate">&lt;iframe name=&quot;framename&quot; id=&quot;myframe&quot; src=&quot;mypage.html&quot;&gt;&lt;/iframe&gt;</pre>
<p>In the page where this iframe is being loaded, I have included the jquery.min.js and an extra .js-file for my code.</p>
<div class="bt">
<script type="text/javascript"><!--
amazon_ad_tag="huuah-21"; 
amazon_ad_width="468"; 
amazon_ad_height="60"; 
amazon_color_background="F5F5F5"; 
amazon_color_border="337696"; 
amazon_color_logo="FFFFFF"; 
amazon_color_link="0088CC"; 
amazon_ad_logo="hide"; 
amazon_ad_link_target="new"; 
amazon_ad_title="jQuery Book"; //--></script><br />
<script type="text/javascript" src="http://www.assoc-amazon.co.uk/s/asw.js"></script>
</div>
<p><strong>First attempt</strong> was to try the examples found on Google. For testing purposes I wanted to set a red background color on every &lt;div&gt; inside the iframe.</p>
<pre class="brush: jscript; title: ; notranslate">var frame = $(&quot;#myframe&quot;)[0].contentDocument;
$(&quot;div&quot;, frame).css(&quot;background-color&quot;, &quot;red&quot;);</pre>
<p>Nothing happens.</p>
<p>When testing new things I often use alert-boxes for test-output, so I tried inserting an alert-box:</p>
<pre class="brush: jscript; highlight: [1]; title: ; notranslate">alert(&quot;trying a red color&quot;);
var frame = $(&quot;#myframe&quot;)[0].contentDocument;
$(&quot;div&quot;, frame).css(&quot;background-color&quot;, &quot;red&quot;);</pre>
<p>And hey! When pushing the alert-box, the divs inside the iframe gets a red background-color. Or at least they do in Firefox 3.0.11 (still a no-go in IE8). Strange.</p>
<p><strong>Test 2</strong>:</p>
<pre class="brush: jscript; title: ; notranslate">$(&quot;#myframe&quot;).contents().find(&quot;div&quot;).css(&quot;background-color&quot;, &quot;red&quot;);</pre>
<p>Nothing! Blank!</p>
<p>Oh well. Why not try the alert-box again:</p>
<pre class="brush: jscript; highlight: [1]; title: ; notranslate">alert(&quot;trying a red color&quot;);
$(&quot;#myframe&quot;).contents().find(&quot;div&quot;).css(&quot;background-color&quot;, &quot;red&quot;);</pre>
<p>Hmm.. this seems to work in both Firefox 3.0.11 and Internet Explorer 8 <strong>IF</strong> you <strong>don&#8217;t</strong> push the alert-box until the iframe is finished loading.</p>
<p>So perhaps it&#8217;s all about not accessing the iframe before the contents has been loaded. So I tried wrapping the whole thing in a ready-function like this:</p>
<pre class="brush: jscript; title: ; notranslate">$(&quot;#myframe&quot;).ready(function () {
...
}</pre>
<p>That did <strong>not</strong> help at all. </p>
<p>Well. Google google google. And bingo. There&#8217;s a plugin for jQuery called <a href="http://ideamill.synaptrixgroup.com/wp-trackback.php?p=6">frameReady</a> and this does the trick.</p>
<div class="ww">
<div class="am">
<a href="http://www.amazon.co.uk/gp/product/1430230541?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1430230541"><img border="0" src="/512a8p3m4KL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=1430230541" 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/0596101694?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596101694"><img border="0" src="/415wDIPoM8L._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0596101694" 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/0240813286?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0240813286"><img border="0" src="/515T2pj0xRL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0240813286" 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/1935182323?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1935182323"><img border="0" src="/51Mz3glo-7L._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=1935182323" 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/0596101996?ie=UTF8&#038;tag=huuah-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596101996"><img border="0" src="/51IJ8LZqxmL._SL110_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=huuah-21&#038;l=as2&#038;o=2&#038;a=0596101996" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</div>
</div>
<p><strong>Third and final test</strong>:<br />
Include the jQuery.frameReady.js in the main page and enter this code:</p>
<pre class="brush: jscript; title: ; notranslate">$.frameReady( function() {
    $(&quot;div&quot;).css(&quot;background&quot;, &quot;red&quot;);
  },
  &quot;framename&quot;
);</pre>
<p>This loads the iframe and sets a red background color on every div inside the iframe. Tested in IE8 and Firefox 3.0.11.</p>
<p><strong>Conclusion</strong>:<br />
Use the <a href="http://ideamill.synaptrixgroup.com/wp-trackback.php?p=6">frameReady</a> plugin for jQuery when manipulating with iframes.</p>
<p>Update: If you&#8217;re having trouble getting this to work, please check the source code for frameReady and verify that the hardcoded path for /js/jQuery.js matches your site configuration!</p>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/jquery-and-iframe-manipulation/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Going down&#8230;</title>
		<link>http://huuah.com/going-down/</link>
		<comments>http://huuah.com/going-down/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 21:49:20 +0000</pubDate>
		<dc:creator>js - huuah</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[photo]]></category>

		<guid isPermaLink="false">http://wp.itpower.dk/?p=24</guid>
		<description><![CDATA[<p>Just browsing through some old photos from a visit to Randers Rainforrest. The trails inside the domes are actually pretty fine, but the exit for one of them are apparantly so steep, that they have posted a warning sign for wheel chair users:<a rel="attachment wp-att-45" href="http://huuah.com/going-down/wheelchairwarning/"></a></p>
<p><a rel="attachment wp-att-45" href="http://huuah.com/going-down/wheelchairwarning/"></a></p>
<div class="mceTemp">
<dl id="attachment_45" class="wp-caption alignnone" style="width: 610px;">
<dd class="wp-caption-dd">Warning sign from Randers Rainforrest</dd>
</dl>
&#8230;</div>]]></description>
			<content:encoded><![CDATA[<p>Just browsing through some old photos from a visit to Randers Rainforrest. The trails inside the domes are actually pretty fine, but the exit for one of them are apparantly so steep, that they have posted a warning sign for wheel chair users:<a rel="attachment wp-att-45" href="http://huuah.com/going-down/wheelchairwarning/"></a></p>
<p><a rel="attachment wp-att-45" href="http://huuah.com/going-down/wheelchairwarning/"><img class="size-full wp-image-45" title="wheelchairwarning" src="http://wp.itpower.dk/wp-content/uploads/2009/06/wheelchairwarning.jpg" alt="Warning sign from Randers Rainforrest" width="600" height="450" /></a></p>
<div class="mceTemp">
<dl id="attachment_45" class="wp-caption alignnone" style="width: 610px;">
<dd class="wp-caption-dd">Warning sign from Randers Rainforrest</dd>
</dl>
</div>
]]></content:encoded>
			<wfw:commentRss>http://huuah.com/going-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

