<?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>The CodeUnit of Craig</title>
	<atom:link href="http://www.codeunit.co.za/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codeunit.co.za</link>
	<description>Software, Code, Technology and Tutorials</description>
	<lastBuildDate>Tue, 31 Aug 2010 05:00:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<atom:link rel='hub' href='http://www.codeunit.co.za/?pushpress=hub'/>
		<item>
		<title>How Ubuntu&#8217;s Version Numbering Works</title>
		<link>http://www.codeunit.co.za/2010/08/31/how-ubuntus-version-numbering-works/</link>
		<comments>http://www.codeunit.co.za/2010/08/31/how-ubuntus-version-numbering-works/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 05:00:57 +0000</pubDate>
		<dc:creator>Craig Lotter</dc:creator>
				<category><![CDATA[Software & Websites]]></category>
		<category><![CDATA[lucid lynx]]></category>
		<category><![CDATA[maverick meerkat]]></category>
		<category><![CDATA[naming]]></category>
		<category><![CDATA[natty narwhal]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.codeunit.co.za/?p=2551</guid>
		<description><![CDATA[So the latest codename for next year's first planned Ubuntu release has been revealed as being Natty Narwhal, not perhaps the most awe-inspiring of codenames but one I guess which will work. <a href="http://www.codeunit.co.za/2010/08/31/how-ubuntus-version-numbering-works/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F31%2Fhow-ubuntus-version-numbering-works%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F31%2Fhow-ubuntus-version-numbering-works%2F&amp;source=craiglotter&amp;style=normal&amp;service=bit.ly&amp;space=1" height="61" width="50" /><br />
			</a>
		</div>
<p>So the latest codename for next year&#8217;s first planned Ubuntu release has been revealed as being <a href="http://www.markshuttleworth.com/archives/478">Natty Narwhal</a>, not perhaps the most awe-inspiring of codenames but one I guess which will work.</p>
<p>Still, I kind of like the fact that the next one coming up is nicknamed &#8220;Maverick Meerkat&#8221; &#8211; just the word Meerkat makes me feel all proudly South African for some strange reason.</p>
<p>Anyway, the point of this quickfire post is to explain the version numbering which Canonical employs for its Ubuntu releases.</p>
<p>As we all know by now, Ubuntu is released on a time-based six-month release cycle. So that&#8217;s two versions a year, which typically arrive in April and October respectively.</p>
<p>The codename for each new release is based on an advancing alphabetically ordered sequence, and consists of an animal name preceded by an adjective that starts with the same letter. This then explains why we&#8217;ve had things like Intrepid Ibis, Jaunty Jackalope, Karmic Koala and Lucid Lynx, and getting things like Maverick Meerkat and Natty Narwhal. An entertaining system for sure, but one which will have to be adjusted once they hit Z I&#8217;m sure! :)</p>
<p>The actual version number is based on the year and approximate month of the planned release date. Hence Ubuntu 10.04 refers to the April 2010 release.</p>
<p>And that&#8217;s pretty much that. Sure, sometimes they go and throw on little extra like LTS after the version number, but all that this means is that the OS release qualifies for Long Term Support, which basic means Canonical will support it for at least three years.</p>
<p>Simple, and if you didn&#8217;t before, now you know! ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeunit.co.za/2010/08/31/how-ubuntus-version-numbering-works/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install Webmin on Ubuntu 10.04 Lucid Lynx Server</title>
		<link>http://www.codeunit.co.za/2010/08/30/how-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server/</link>
		<comments>http://www.codeunit.co.za/2010/08/30/how-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 05:00:42 +0000</pubDate>
		<dc:creator>Craig Lotter</dc:creator>
				<category><![CDATA[Software & Websites]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[lucid lynx]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[webmin]]></category>

		<guid isPermaLink="false">http://www.codeunit.co.za/?p=2549</guid>
		<description><![CDATA[Installing Webmin in Ubuntu is not exactly a quick win thanks to Webmin's reliance on a deprecated PERL package (an MD5 wrapper to be exact) that Ubuntu and the like just don't want to include any more, but never fear, following these steps one by one will have you up and running in absolutely no time! <a href="http://www.codeunit.co.za/2010/08/30/how-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F30%2Fhow-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F30%2Fhow-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server%2F&amp;source=craiglotter&amp;style=normal&amp;service=bit.ly&amp;space=1" height="61" width="50" /><br />
			</a>
		</div>
<p>Installing Webmin in Ubuntu is not exactly a quick win thanks to Webmin&#8217;s reliance on a deprecated PERL package (an MD5 wrapper to be exact) that Ubuntu and the like just don&#8217;t want to include any more, but never fear, following these steps one by one will have you up and running in absolutely no time!</p>
<p>Install the dependencies:</p>
<blockquote><p>sudo aptitude -y install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl apt-show-versions libapt-pkg-perl</p></blockquote>
<p>While most of the packages above will all successfully install, you should get an error message that reads something like this:</p>
<blockquote><p>Couldn&#8217;t find any package whose name or description matched &#8220;libmd5-perl&#8221;</p></blockquote>
<p>The next step is then obviously to manually grab it and install it.</p>
<p>Run the following:</p>
<blockquote><p>wget http://ftp.debian.org/pool/main/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb</p></blockquote>
<p>followed by</p>
<blockquote><p>sudo dpkg -i libmd5-perl_2.03-1_all.deb</p></blockquote>
<p>All right, all set. Go to webmin&#8217;s home page and grab the download link to the latest version. In my case, this was thrown up:</p>
<blockquote><p>wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=cdnetworks-us-1</p></blockquote>
<p>Download it and once done, run the final install:</p>
<blockquote><p>sudo dpkg -i webmin_1.510-2_all.deb</p></blockquote>
<p>All done. You should now be able to run the webmin web manager from another PC by hitting http://10.0.0.6:10000/ (using your server&#8217;s IP address of course!)</p>
<p>Nifty.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeunit.co.za/2010/08/30/how-to-install-webmin-on-ubuntu-10-04-lucid-lynx-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A Quick Guide to Bash Shell Scripting</title>
		<link>http://www.codeunit.co.za/2010/08/23/a-quick-guide-to-bash-shell-scripting/</link>
		<comments>http://www.codeunit.co.za/2010/08/23/a-quick-guide-to-bash-shell-scripting/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 19:29:29 +0000</pubDate>
		<dc:creator>Craig Lotter</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.codeunit.co.za/?p=2545</guid>
		<description><![CDATA[I stumbled across this gem of a quick guide to Bash shell scripting over at some or other forum and so as not to lose this valuable resource for my later use, I've decided to duplicate it here and thus save it for prosperity. <a href="http://www.codeunit.co.za/2010/08/23/a-quick-guide-to-bash-shell-scripting/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F23%2Fa-quick-guide-to-bash-shell-scripting%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F23%2Fa-quick-guide-to-bash-shell-scripting%2F&amp;source=craiglotter&amp;style=normal&amp;service=bit.ly&amp;space=1" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.codeunit.co.za/wp-content/uploads/2010/03/javascript-blue-ninja.jpg"><img class="alignright size-full wp-image-2143" title="javascript-blue-ninja" src="http://www.codeunit.co.za/wp-content/uploads/2010/03/javascript-blue-ninja.jpg" alt="" width="126" height="180" /></a>I stumbled across this gem of a quick guide to Bash shell scripting over at some or other forum and so as not to lose this valuable resource for my later use, I&#8217;ve decided to duplicate it here and thus save it for prosperity.</p>
<p><strong>Common environment variables</strong></p>
<p>PATH &#8211; Sets the search path for any executable command. Similar to the PATH variable in MSDOS.</p>
<p>HOME &#8211; Home directory of the user.</p>
<p>MAIL &#8211; Contains the path to the location where mail addressed to the user is stored.</p>
<p>IFS &#8211; Contains a string of characters which are used as word seperators in the command line. The string normally consists of the space, tab and the newline characters. To see them you will have to do an octal dump as follows:</p>
<p>$ echo $IFS | od -bc</p>
<p>PS1 and PS2 &#8211; Primary and secondary prompts in bash. PS1 is set to $ by default and PS2 is set to &#8216;&gt;&#8217; . To see the secondary prompt, just run the command :</p>
<p>$ ls |</p>
<p>&#8230; and press enter.</p>
<p>USER &#8211; User login name.</p>
<p>TERM &#8211; indicates the terminal type being used. This should be set correctly for editors like Vim to work correctly.</p>
<p>SHELL &#8211; Determines the type of shell that the user sees on logging in.</p>
<p>Note: To see what are the values held by the above environment variables, just do an echo of the name of the variable preceeded with a $. For example, if I do the following:</p>
<p>$ echo $USER<br />
ravi</p>
<p>&#8230; I get the value stored in the environment variable USER.</p>
<p><span id="more-2545"></span></p>
<p>Some bash shell scripting rules</p>
<p>* The first line in your script must be #!/bin/bash<br />
&#8230; that is a # (Hash) followed by a ! (bang) followed by the path of the shell. This line lets the environment know the file is a shell script and the location of the shell.<br />
* Before executing your script, you should make the script executable. You do it by using the following command:</p>
<p>$ chmod ugo+x your_shell_script.sh</p>
<p>* The name of your shell script must end with a .sh . This lets the user know that the file is a shell script. This is not compulsary but is the norm.</p>
<p><strong>Conditional statements</strong><br />
&#8216;if&#8217; Statement<br />
The &#8216;if&#8217; statement evaluates a condition which accompanies its command line.<br />
syntax:</p>
<p>if condition_is_true<br />
then<br />
execute commands<br />
else<br />
execute commands<br />
fi</p>
<p>&#8216;if&#8217; condition also permits multiway branching. That is you can evaluate more conditions if the previous condition fails.</p>
<p>if condition_is_true<br />
then<br />
execute commands<br />
elif another_condition_is_true<br />
then<br />
execute commands<br />
else<br />
execute commands<br />
fi</p>
<p>Example :</p>
<p>if grep &#8220;linuxhelp&#8221; thisfile.html<br />
then<br />
echo &#8220;Found the word in the file&#8221;<br />
else<br />
echo &#8220;Sorry no luck!&#8221;<br />
fi</p>
<p>if&#8217;s companion &#8211; test<br />
test is an internal feature of the shell. &#8216;test&#8217; evaluates the condition placed on its right, and returns either a true or false exit status. For this purpose, &#8216;test&#8217; uses certain operators to evaluate the condition. They are as follows:</p>
<p><strong>Relational Operators</strong></p>
<p>* -eq &#8211; Equal to<br />
* -lt &#8211; Less than<br />
* -gt &#8211; Greater than<br />
* -ge &#8211; Greater than or Equal to<br />
* -le &#8211; Less than or Equal to</p>
<p><strong>File related tests</strong></p>
<p>* -f file &#8211; True if file exists and is a regular file.<br />
* -r file &#8211; True if file exists and is readable.<br />
* -w file &#8211; True if file exists and is writable.<br />
* -x file &#8211; True if file exists and is executable.<br />
* -d file &#8211; True if file exists and is a directory.<br />
* -s file &#8211; True if file exists and has a size greater than zero.</p>
<p><strong>String tests</strong></p>
<p>* -n str &#8211; True if string str is not a null string.<br />
* -z str &#8211; True if string str is a null string.<br />
* str1 == str2 &#8211; True if both strings are equal.<br />
* str &#8211; True if string str is assigned a value and is not null.<br />
* str1 != str2 &#8211; True if both strings are unequal.<br />
* -s file &#8211; True if file exists and has a size greater than zero.</p>
<p>Test also permits the checking of more than one expression in the same line.</p>
<p>* -a  &#8211; Performs the AND function<br />
* -o  &#8211; Performs the OR function</p>
<p>A few Example snippets of using test</p>
<p>test $d -eq 25 &amp;&amp; echo $d</p>
<p>&#8230; which means, if the value in the variable d is equal to 25, print the value. Otherwise don&#8217;t print anything.</p>
<p>test $s -lt 50 &amp;&amp; do_something</p>
<p>if [ $d -eq 25 ]<br />
then<br />
echo $d<br />
fi</p>
<p>In the above example, I have used square brackets instead of the keyword test &#8211; which is another way of doing the same thing.</p>
<p>if [ $str1 == $str2 ]<br />
then<br />
do something<br />
fi</p>
<p>if [ -n "$str1" -a -n "$str2" ]<br />
then<br />
echo &#8216;Both $str1 and $str2 are not null&#8217;<br />
fi</p>
<p>&#8230; above, I have checked if both strings are not null then execute the echo command.</p>
<p>Things to remember while using test</p>
<p>1. If you are using square brackets [] instead of test, then care should be taken to insert a space after the [ and before the ].<br />
2. test is confined to integer values only. Decimal values are simply truncated.<br />
3. Do not use wildcards for testing string equality &#8211; they are expanded by the shell to match the files in your directory rather than the string.</p>
<p><strong>Case statement</strong><br />
Case statement is the second conditional offered by the shell.<br />
Syntax:</p>
<p>case expression in<br />
pattern1) execute commands ;;<br />
pattern2) execute commands ;;<br />
&#8230;<br />
esac</p>
<p>The keywords here are in, case and esac. The &#8216;;;&#8217; is used as option terminators. The construct also uses &#8216;)&#8217; to delimit the pattern from the action.</p>
<p>Example:</p>
<p>&#8230;<br />
echo &#8220;Enter your option : &#8221;<br />
read i;</p>
<p>case $i in<br />
1) ls -l ;;<br />
2) ps -aux ;;<br />
3) date ;;<br />
4) who ;;<br />
5) exit<br />
esac</p>
<p>Note: The last case option need not have ;; but you can provide them if you want.</p>
<p>Here is another example:</p>
<p>case `date |cut -d&#8221; &#8221; -f1` in<br />
Mon) commands ;;<br />
Tue) commands ;;<br />
Wed) commands ;;<br />
&#8230;<br />
esac</p>
<p>Case can also match more than one pattern with each option.You can also use shell wild-cards for matching patterns.</p>
<p>&#8230;<br />
echo &#8220;Do you wish to continue? (y/n)&#8221;<br />
read ans</p>
<p>case $ans in<br />
Y|y) ;;<br />
[Yy][Ee][Ss]) ;;<br />
N|n) exit ;;<br />
[Nn][Oo]) exit ;;<br />
*) echo &#8220;Invalid command&#8221;<br />
esac</p>
<p>In the above case, if you enter YeS, YES,yEs and any of its combinations, it will be matched.</p>
<p>This brings us to the end of conditional statements.<br />
Looping Statements<br />
while loop<br />
Syntax :</p>
<p>while condition_is_true<br />
do<br />
execute commands<br />
done</p>
<p>Example:</p>
<p>while [ $num -gt 100 ]<br />
do<br />
sleep 5<br />
done</p>
<p>while :<br />
do<br />
execute some commands<br />
done</p>
<p>The above code implements a infinite loop. You could also write &#8216;while true&#8217; instead of &#8216;while :&#8217; .<br />
Here I would like to introduce two keywords with respect to looping conditionals. They are break and continue.<br />
break &#8211; This keyword causes control to break out of the loop.<br />
continue &#8211; This keyword will suspend the execution of all statements following it and switches control to the top of the loop for the next iteration.</p>
<p>until loop<br />
Until complements while construct in the sense that the loop body here is executed repeatedly as long as the condition remains false.<br />
Syntax:</p>
<p>until false<br />
do<br />
execute commands<br />
done</p>
<p>Example:</p>
<p>&#8230;<br />
until [ -r myfile ]<br />
do<br />
sleep 5<br />
done</p>
<p>The above code is executed repeatedly until the file myfile can be read.</p>
<p>for loop<br />
Syntax :</p>
<p>for variable in list<br />
do<br />
execute commands<br />
done</p>
<p>Example:</p>
<p>&#8230;<br />
for x in 1 2 3 4 5<br />
do<br />
echo &#8220;The value of x is $x&#8221;;<br />
done</p>
<p>Here the list contains 5 numbers 1 to 5. Here is another example:</p>
<p>for var in $PATH $MAIL $HOME<br />
do<br />
echo $var<br />
done</p>
<p>Suppose you have a directory full of java files and you want to compile those. You can write a script like this:</p>
<p>&#8230;<br />
for file in *.java<br />
do<br />
javac $file<br />
done</p>
<p>Note: You can use wildcard expressions in your scripts.</p>
<p>Special symbols used in BASH scripting</p>
<p>* $* &#8211; This denotes all the parameters passed to the script at the time of its execution. Which includes $1, $2 and so on.<br />
* $0 &#8211; Name of the shell script being executed.<br />
* $# &#8211; Number of arguments specified in the command line.<br />
* $? &#8211; Exit status of the last command.</p>
<p>The above symbols are known as positional parameters. Let me explain the positional parameters with the aid of an example. Suppose I have a shell script called my_script.sh . Now I execute this script in the command line as follows :</p>
<p>$ ./my_script.sh linux is a robust OS</p>
<p>&#8230; as you can see above, I have passed 5 parameters to the script. In this scenario, the values of the positional parameters are as follows:</p>
<p>* $* &#8211; will contain the values &#8216;linux&#8217;,'is&#8217;,'a&#8217;,'robust&#8217;,'OS&#8217;.<br />
* $0 &#8211; will contain the value my_script.sh &#8211; the name of the script being executed.<br />
* $# &#8211; contains the value 5 &#8211; the total number of parameters.<br />
* $$ &#8211; contains the process ID of the current shell. You can use this parameter while giving unique names to any temporary files that you create at the time of execution of the shell.<br />
* $1 &#8211; contains the value &#8216;linux&#8217;<br />
* $2 &#8211; contains the value &#8216;is&#8217;</p>
<p>&#8230; and so on.</p>
<p>The set and shift statements<br />
set &#8211; Lets you associate values with these positional parameters .<br />
For example, try this:</p>
<p>$ set `date`<br />
$ echo $1<br />
$ echo $*<br />
$ echo $#<br />
$ echo $2</p>
<p>shift &#8211; transfers the contents of a positional parameter to its immediate lower numbered one. This goes on as many times it is called.</p>
<p>Example :</p>
<p>$ set `date`<br />
$ echo $1 $2 $3<br />
$ shift<br />
$ echo $1 $2 $3<br />
$ shift<br />
$ echo $1 $2 $3</p>
<p>To see the process Id of the current shell, try this:</p>
<p>$ echo $$<br />
2667</p>
<p>Validate that it is the same value by executing the following command:</p>
<p>$ ps -f |grep bash</p>
<p>Make your BASH shell script interactive<br />
read statement<br />
Make your shell script interactive. read will let the user enter values while the script is being executed. When a program encounters the read statement, the program pauses at that point. Input entered through the keyboard id read into the variables following read, and the program execution continues.<br />
Eg:</p>
<p>#!/bin/sh<br />
echo &#8220;Enter your name : &#8221;<br />
read name<br />
echo &#8220;Hello $name , Have a nice day.&#8221;</p>
<p>Exit status of the last command<br />
Every command returns a value after execution. This value is called the exit status or return value of the command. A command is said to be true if it executes successfully, and false if it fails. This can be checked in the script using the $? positional parameter.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeunit.co.za/2010/08/23/a-quick-guide-to-bash-shell-scripting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery: Invert a Selection of Checked Checkboxes</title>
		<link>http://www.codeunit.co.za/2010/08/20/jquery-invert-a-selection-of-checked-checkboxes/</link>
		<comments>http://www.codeunit.co.za/2010/08/20/jquery-invert-a-selection-of-checked-checkboxes/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 05:00:25 +0000</pubDate>
		<dc:creator>Craig Lotter</dc:creator>
				<category><![CDATA[Technology & Code]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[checked]]></category>
		<category><![CDATA[invert]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[ticked]]></category>

		<guid isPermaLink="false">http://www.codeunit.co.za/?p=2542</guid>
		<description><![CDATA[If you have a group of checkboxes on a page, sometimes it is quite nice to give the user some quickfire controls that allows him to select all or select none at a click of a button. Similarly, it is pretty cool to give him the option of inverting his current selection, in other words checking all of those checkboxes currently unchecked, while unchecking all the currently ticked checkboxes. <a href="http://www.codeunit.co.za/2010/08/20/jquery-invert-a-selection-of-checked-checkboxes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F20%2Fjquery-invert-a-selection-of-checked-checkboxes%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F20%2Fjquery-invert-a-selection-of-checked-checkboxes%2F&amp;source=craiglotter&amp;style=normal&amp;service=bit.ly&amp;space=1" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.codeunit.co.za/wp-content/uploads/2010/06/jquery-girl-black-stretch-top.jpg"><img src="http://www.codeunit.co.za/wp-content/uploads/2010/06/jquery-girl-black-stretch-top.jpg" alt="" title="jquery-girl-black-stretch-top" width="127" height="190" class="alignright size-full wp-image-2381" /></a>If you have a group of checkboxes on a page, sometimes it is quite nice to give the user some quickfire controls that allows him to select all or select none at a click of a button. Similarly, it is pretty cool to give him the option of inverting his current selection, in other words checking all of those checkboxes currently unchecked, while unchecking all the currently ticked checkboxes.</p>
<p>To do this is fairly simple.</p>
<p>First, we built up a jQuery object containing all checked checkboxes. Then we repeat this for all unchecked checkboxes. Next, using the incredibly useful .each() function, we iterate over both collections and either set or unset the checked attribute accordingly.</p>
<p>In code, your invert function would look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#createrightstoggle'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> checked <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.createrightcheckbox'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;:checked&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> unchecked <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'.createrightcheckbox'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">filter</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;:not(:checked)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    checked.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'checked'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    unchecked.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'checked'</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    createrightscounterupdate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Nifty.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeunit.co.za/2010/08/20/jquery-invert-a-selection-of-checked-checkboxes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joomla 1.5: Remove Copyright Info from the Bottom of the Page Footer</title>
		<link>http://www.codeunit.co.za/2010/08/19/joomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer/</link>
		<comments>http://www.codeunit.co.za/2010/08/19/joomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 05:00:55 +0000</pubDate>
		<dc:creator>Craig Lotter</dc:creator>
				<category><![CDATA[Software & Websites]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[footer]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[joomla 1.5]]></category>
		<category><![CDATA[powered by]]></category>
		<category><![CDATA[remove]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://www.codeunit.co.za/?p=2537</guid>
		<description><![CDATA[Most Joomla sites, with or without snazzy templates applied, all carry a pretty standard Powered by Joomla! footer text. Now while most people should be in favour of keeping this in, there are a lot of us out there who simply don't want it spoiling our tight site design, and so digging around the web revealed the two simplest ways of removing this line of text from your website. <a href="http://www.codeunit.co.za/2010/08/19/joomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F19%2Fjoomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codeunit.co.za%2F2010%2F08%2F19%2Fjoomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer%2F&amp;source=craiglotter&amp;style=normal&amp;service=bit.ly&amp;space=1" height="61" width="50" /><br />
			</a>
		</div>
<p><a href="http://www.codeunit.co.za/wp-content/uploads/2010/01/joomla-logo.png"><img src="http://www.codeunit.co.za/wp-content/uploads/2010/01/joomla-logo.png" alt="" title="joomla-logo" width="125" height="180" class="alignright size-full wp-image-1903" /></a>Most Joomla sites, with or without snazzy templates applied, all carry a pretty standard Powered by Joomla! footer text.</p>
<p>Now while most people should be in favour of keeping this in, there are a lot of us out there who simply don&#8217;t want it spoiling our tight site design, and so digging around the web revealed the two simplest ways of removing this line of text from your website.</p>
<p>First, you could actually edit the core files of your Joomla 1.5 installation directly. To do this, go to the core files, navigating through core files &gt;&gt; Languages &gt;&gt; en-GB.mod_footer.ini.</p>
<p>Opening this file you will see the lines:</p>
<blockquote><p>FOOTER=Footer</p>
<p>FOOTER_LINE1=Copyright © %date% %sitename%. All Rights Reserved.</p>
<p>FOOTER_LINE2=Joomla! is Free Software released under the GNU/GPL License.</p>
<p>MOD_FOOTER=mod_footer</p>
<p>THIS MODULE SHOWS THE JOOMLA! COPYRIGHT INFORMATION=This Module shows the Joomla! Copyright information</p></blockquote>
<p>Simply change the data to what you would like to display and voila &#8211; you are done! :)</p>
<p>A second way is to modify your template file located at yourtemplate/index.php &#8211; scroll to the bottom, locate the lines below and change accordingly:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;"> &lt;a href=&quot;http://www.joomla.org&quot;&gt;Joomla!&lt;/a&gt; &lt;a href=&quot;http://validator.w3.org/check/referer&quot;&gt;XHTML&lt;/a&gt;  &lt;a href=&quot;http://jigsaw.w3.org/css-validator/check/referer&quot;&gt;CSS&lt;/a&gt;</pre></div></div>

<p>And that is literally that. Nifty.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codeunit.co.za/2010/08/19/joomla-1-5-remove-copyright-info-from-the-bottom-of-the-page-footer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
