<?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>reZo Labs</title>
	<atom:link href="http://rezolabs.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://rezolabs.com</link>
	<description>Yet another nerd blog about GNU/Linux and Web Development!</description>
	<lastBuildDate>Fri, 20 Feb 2009 00:33:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Internet Blackout</title>
		<link>http://rezolabs.com/activism/internet-blackout/</link>
		<comments>http://rezolabs.com/activism/internet-blackout/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 00:33:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Activism]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=119</guid>
		<description><![CDATA[Join The New Zealand Internet Blackout to protest against the Guilt Upon Accusation law 'Section 92A' that calls for internet disconnection based on accusations of copyright infringement without a trial and without any evidence held up to court scrutiny. This is due to come into effect on February 28th unless immediate action is taken by the National Party.]]></description>
			<content:encoded><![CDATA[<p>Join The New Zealand Internet Blackout to protest against the Guilt Upon Accusation law &#8216;Section 92A&#8217; that calls for internet disconnection based on accusations of copyright infringement without a trial and without any evidence held up to court scrutiny. This is due to come into effect on February 28th unless immediate action is taken by the National Party.</p>
<p>Do you really think it&#8217;s fair to have your Internet disconnected due to accusation? No, I don&#8217;t think so. Join the rest of New Zealand in the fight against &#8216;Section 92A&#8217;.</p>
<p>To join the fight, you can sign the petition at http://creativefreedom.org.nz/blackout.html, blackout avatars, place banners on your website and a lot more. Anything it takes to help bring down &#8216;Section 92A&#8217;.</p>
<p>I&#8217;ve changed my MSN display picture, Bebo and Facebook pictures to support the blackout already. So, whats the wait?</p>
<p>You can read more about the Internet Blackout at http://www.stuff.co.nz/4851675a28.html, http://www.geekzone.co.nz/juha/6247 and http://blog.greens.org.nz/2009/02/17/internet-blackout-gathers-steam/.</p>
<p><a href="http://creativefreedom.org.nz/blackout.html"><img src="http://creativefreedom.org.nz/library/not-in-my-name-logo/guilt-upon-accusation/guilt-upon-accusation-x300.gif" alt="Internet Blackout" /></a></p>
<p><a href="http://creativefreedom.org.nz/blackout.html"><img src="http://www.geekzone.co.nz/images/blog/antis92abanner-300x250.gif" alt="Internet Blackout" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/activism/internet-blackout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian GNU/Linux Lenny Released</title>
		<link>http://rezolabs.com/gnu-linux/debian-gnulinux-lenny-released/</link>
		<comments>http://rezolabs.com/gnu-linux/debian-gnulinux-lenny-released/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 20:35:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[5.0]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[GNU]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[Lenny]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[new distribution]]></category>
		<category><![CDATA[Released]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=111</guid>
		<description><![CDATA[After 22 months of constant development, Debian Lenny stable is finally released! Debian Lenny is the latest from the Debian project, which is a GNU/Linux distribution. Debian Lenny supports a total of twelve processor architectures and includes the KDE, GNOME, Xfce, and LXDE desktop environments.

Debian GNU/Linux runs on computers ranging from palmtops and handheld systems to supercomputers, and on nearly everything in between. A total of twelve architectures are supported: Sun SPARC (sparc), HP Alpha (alpha), Motorola/IBM PowerPC (powerpc), Intel IA-32 (i386), IA-64 (ia64), HP PA-RISC (hppa), MIPS (mips, mipsel), ARM (arm, armel), IBM S/390 (s390), and AMD64 and Intel EM64T (amd64).]]></description>
			<content:encoded><![CDATA[<p>After 22 months of constant development, Debian Lenny stable is finally released! Debian Lenny is the latest from the Debian project, which is a GNU/Linux distribution. Debian Lenny supports a total of twelve processor architectures and includes the KDE, GNOME, Xfce, and LXDE desktop environments.</p>
<p>Debian GNU/Linux runs on computers ranging from palmtops and handheld systems to supercomputers, and on nearly everything in between. A total of twelve architectures are supported: Sun SPARC (sparc), HP Alpha (alpha), Motorola/IBM PowerPC (powerpc), Intel IA-32 (i386), IA-64 (ia64), HP PA-RISC (hppa), MIPS (mips, mipsel), ARM (arm, armel), IBM S/390 (s390), and AMD64 and Intel EM64T (amd64).</p>
<p>To upgrade to Lenny, you&#8217;ll need to update your /etc/apt/source.list file, which contains information about which repository you download your update packages from. My source.list file being New Zealand based, it&#8217;s a good idea to change it to your country, for faster downloads. Note, # is a commented out line.</p>
<pre>
deb http://ftp.nz.debian.org/debian/ lenny main
deb-src http://ftp.nz.debian.org/debian/ lenny main
deb http://security.debian.org/ lenny/updates main contrib
deb http://ftp.us.debian.org/debian lenny main

# non-free priority software
#deb http://ftp.nz.debian.org/debian/ lenny main non-free contrib
</pre>
<p>From there, depending on what you use, you&#8217;ll need to `apt-get update; apt-get dist-upgrade; apt-get upgrade`, or if your using aptitude instead, `aptitude update; aptitude full-upgrade`.</p>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/gnu-linux/debian-gnulinux-lenny-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>INI Parser</title>
		<link>http://rezolabs.com/gnu-linux/ini-parser/</link>
		<comments>http://rezolabs.com/gnu-linux/ini-parser/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 13:34:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[ini]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[settings]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=102</guid>
		<description><![CDATA[As a current project, I'm developing a small game in C++ using the SDL API, the project is going well, so I thought I'd share some code. The following is a small parser to parse the game settings file. Target syntax for the INI file is within the header comment.]]></description>
			<content:encoded><![CDATA[<p>As a current project, I&#8217;m developing a small game in C++ using the SDL API, the project is going well, so I thought I&#8217;d share some code. The following is a small parser to parse the game settings file. Target syntax for the INI file is within the header comment.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * Parse and replace (set) settings within settings.ini
 * Syntax of settings.ini, command = value, ; comment
 *
 * @author  reZo &lt;reZo@rezolabs.com&gt;
 * @license GNU GPL (latest version)
 */</span>
&nbsp;
class Settings <span style="color: #009900;">&#123;</span>
&nbsp;
   private<span style="color: #339933;">:</span>
      <span style="color: #666666; font-style: italic;">// settings map to store command / value</span>
      std<span style="color: #339933;">::</span><span style="color: #202020;">map</span><span style="color: #339933;">&lt;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span><span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #202020;">string</span><span style="color: #339933;">&gt;</span> settings<span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// input file descriptor</span>
      std<span style="color: #339933;">::</span><span style="color: #202020;">ifstream</span> iSettings<span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// output file descriptor</span>
      std<span style="color: #339933;">::</span><span style="color: #202020;">ofstream</span> oSettings<span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// filename</span>
      std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> filename<span style="color: #339933;">;</span>
      <span style="color: #993333;">void</span> parse <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   public<span style="color: #339933;">:</span>
      <span style="color: #993333;">void</span> load <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> file<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #993333;">void</span> set <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> command<span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> get <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> command<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> Settings<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Open file for parsing
 *
 * @param std::string file filename to open
 */</span>
&nbsp;
<span style="color: #993333;">void</span> Settings<span style="color: #339933;">::</span><span style="color: #202020;">load</span> <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> file<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> line<span style="color: #339933;">;</span>
   filename <span style="color: #339933;">=</span> file<span style="color: #339933;">;</span>
&nbsp;
   iSettings.<span style="color: #202020;">open</span> <span style="color: #009900;">&#40;</span>filename.<span style="color: #202020;">data</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #202020;">ios</span><span style="color: #339933;">::</span><span style="color: #202020;">in</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>iSettings.<span style="color: #202020;">is_open</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>iSettings.<span style="color: #202020;">eof</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      getline <span style="color: #009900;">&#40;</span>iSettings<span style="color: #339933;">,</span> line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      parse <span style="color: #009900;">&#40;</span>line<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   iSettings.<span style="color: #202020;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Get value from settings map&lt;std::string, std::string&gt;
 *
 * @param  std::string commmand name of command of which value to return
 * @return std::string value
 */</span>
&nbsp;
std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> Settings<span style="color: #339933;">::</span><span style="color: #202020;">get</span> <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> command<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">return</span> settings<span style="color: #009900;">&#91;</span>command<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Use iterator object from map object to compare command index std::string
 *
 * @param std::string command holds command to change value of
 * @param std::string value   value command will be replaced with
 */</span>
&nbsp;
<span style="color: #993333;">void</span> Settings<span style="color: #339933;">::</span><span style="color: #202020;">set</span> <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> command<span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   oSettings.<span style="color: #202020;">open</span> <span style="color: #009900;">&#40;</span>filename.<span style="color: #202020;">data</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #202020;">ios</span><span style="color: #339933;">::</span><span style="color: #202020;">out</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   std<span style="color: #339933;">::</span><span style="color: #202020;">map</span><span style="color: #339933;">&lt;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span><span style="color: #339933;">,</span> std<span style="color: #339933;">::</span><span style="color: #202020;">string</span><span style="color: #339933;">&gt;::</span><span style="color: #202020;">iterator</span> line<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>line <span style="color: #339933;">=</span> settings.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> line <span style="color: #339933;">!=</span> settings.<span style="color: #202020;">end</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> line<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>line<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">first</span><span style="color: #009900;">&#41;</span>.<span style="color: #202020;">compare</span><span style="color: #009900;">&#40;</span>command<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
         oSettings <span style="color: #339933;">&lt;&lt;</span> command  <span style="color: #339933;">&lt;&lt;</span> <span style="color: #ff0000;">&quot; = &quot;</span> <span style="color: #339933;">&lt;&lt;</span> value<span style="color: #339933;">;</span>
      <span style="color: #b1b100;">else</span>
         oSettings <span style="color: #339933;">&lt;&lt;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>line<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">first</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #ff0000;">&quot; = &quot;</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>line<span style="color: #009900;">&#41;</span>.<span style="color: #202020;">second</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   settings<span style="color: #009900;">&#91;</span>command<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
&nbsp;
   oSettings.<span style="color: #202020;">close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Parse command and value from @param std::string line into settings map&lt;std::string,
 * std::string&gt;
 *
 * @param std::string line the line to parse
 *
 * Uses ; for comment
 */</span>
&nbsp;
<span style="color: #993333;">void</span> Settings<span style="color: #339933;">::</span><span style="color: #202020;">parse</span> <span style="color: #009900;">&#40;</span>std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> line<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>line.<span style="color: #202020;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>.<span style="color: #202020;">compare</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">||</span> line.<span style="color: #202020;">compare</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
   std<span style="color: #339933;">::</span><span style="color: #993333;">string</span> command<span style="color: #339933;">,</span> value<span style="color: #339933;">;</span>
   std<span style="color: #339933;">::</span><span style="color: #993333;">string</span><span style="color: #339933;">::</span><span style="color: #202020;">size_type</span> location<span style="color: #339933;">;</span>
&nbsp;
   location <span style="color: #339933;">=</span> line.<span style="color: #202020;">find</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot; = &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>location <span style="color: #339933;">!=</span> std<span style="color: #339933;">::</span><span style="color: #993333;">string</span><span style="color: #339933;">::</span><span style="color: #202020;">npos</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      command <span style="color: #339933;">=</span> line.<span style="color: #202020;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #339933;">,</span> location<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      value <span style="color: #339933;">=</span> line.<span style="color: #202020;">substr</span><span style="color: #009900;">&#40;</span>location <span style="color: #339933;">+</span> <span style="color: #0000dd;">3</span><span style="color: #339933;">,</span> line.<span style="color: #202020;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   settings<span style="color: #009900;">&#91;</span>command<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> value<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/gnu-linux/ini-parser/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VIM Run Command (~/.vimrc)</title>
		<link>http://rezolabs.com/gnu-linux/vim-run-command-vimrc/</link>
		<comments>http://rezolabs.com/gnu-linux/vim-run-command-vimrc/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 09:13:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[run command]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[syntax highlighting]]></category>
		<category><![CDATA[tips and tricks]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[~/.vimrc]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=88</guid>
		<description><![CDATA[Yes, yet another VIM Run Command file (~/.vimrc). Enough said, read the comments for information on the commands if needed. Use it as you please, feel free to change anything to suit your needs.

Also, a nice resource for tips and tricks for better and easier VIM usage is http://vim.wikia.com/wiki/Main_Page.]]></description>
			<content:encoded><![CDATA[<p>Yes, yet another VIM Run Command file (~/.vimrc). Enough said, read the comments for information on the commands if needed. Use it as you please, feel free to change anything to suit your needs.</p>
<p>Also, a nice resource for tips and tricks for better and easier VIM usage is <a href="http://vim.wikia.com/wiki/Main_Page">http://vim.wikia.com/wiki/Main_Page</a>.</p>
<pre>" turn line numbers on
set number

" syntax on in terminals which can display color
if has('syntax') &amp;&amp; (&amp;t_Co &gt; 2)
syntax on
endif

" set buffer history (i like large ints)
set history=500

" enable mnouse all the time (excluding tty's of cause)
set mouse=a

" no wrapping or hiphopping
set nowrap

" use indents of 3 spaces, and have them copied down lines:
set shiftwidth=3
set shiftround
set expandtab
set autoindent
set tabstop=3

set formatoptions-=t
set textwidth=79

filetype on

autocmd FileType c,cpp,slang set cindent

set et
set sw=3
set smarttab

set ch=2

" indent blank lines!
imap &lt;CR&gt; &lt;CR&gt; &lt;BS&gt;

" firefox like tabbing
" nmap &lt;C-w&gt; :wq&lt;CR&gt;
" nmap &lt;C-x&gt; :q&lt;CR&gt;
nmap &lt;C-n&gt; :tabn&lt;CR&gt;
nmap &lt;C-p&gt; :tabp&lt;CR&gt;
nmap &lt;C-t&gt; :tabnew&lt;CR&gt;

" imap &lt;C-w&gt; &lt;ESC&gt;:wq&lt;CR&gt;
imap &lt;C-n&gt; &lt;ESC&gt;:tabn&lt;CR&gt;
imap &lt;C-p&gt; &lt;ESC&gt;:tabp&lt;CR&gt;
imap &lt;C-t&gt; &lt;ESC&gt;:tabnew&lt;CR&gt;

" control + o for save
imap &lt;C-o&gt; &lt;ESC&gt;:w&lt;CR&gt;i&lt;right&gt;
map &lt;C-o&gt; :w&lt;CR&gt;i

" easy undo

imap &lt;C-u&gt; &lt;ESC&gt;:u&lt;CR&gt;
map &lt;C-u&gt; :u&lt;CR&gt;

set nocompatible
filetype on
filetype plugin on</pre>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/gnu-linux/vim-run-command-vimrc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fbsetbg Wallpaper Rotation</title>
		<link>http://rezolabs.com/gnu-linux/fbsetbg-wallpaper-rotation-2/</link>
		<comments>http://rezolabs.com/gnu-linux/fbsetbg-wallpaper-rotation-2/#comments</comments>
		<pubDate>Mon, 16 Feb 2009 00:10:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[fbsetbg]]></category>
		<category><![CDATA[fluxbox]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[wallpaper]]></category>
		<category><![CDATA[wallpaper changer]]></category>
		<category><![CDATA[xfce]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=71</guid>
		<description><![CDATA[Bash wallpaper rotation is a simple wallpaper changer for GNU/Linux. It doesn't work in every environment, but one's which use fbsetbg to set the wallpaper. The usage of the script is fairly basic, you can set the delay timer in which wallpapers are changed, as well as demonizing the script or not.]]></description>
			<content:encoded><![CDATA[<p>Bash wallpaper rotation is a simple wallpaper changer for GNU/Linux. It doesn&#8217;t work in every environment, but one&#8217;s which use fbsetbg to set the wallpaper. The usage of the script is fairly basic, you can set the delay timer in which wallpapers are changed, as well as demonizing the script or not.</p>
<pre lang="c" lines="0">#/bin/bash

if [ -z "$1" ]
then
        echo "usage: $0 (sleep timer) (d|-d|--daemon)"
        exit 1
fi

daemon="no"

for i in "$@"
do
        if [ "$i" == "d" ] || [ "$i" == "-d" ] || [ "$i" == "--daemon" ]
        then
                daemon="yes"
        else
                time=$i
        fi
done

if [ "$daemon" == "yes" ]
then
        $0 $time &#038;> /dev/null &#038;
        exit 0
fi

while [ 1 == 1 ]
do
        for i in `ls | grep -v ${0:2:${#0}}`
        do
                fbsetbg $i
                sleep $time
        done
done</pre>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/gnu-linux/fbsetbg-wallpaper-rotation-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CLI Argument Parser</title>
		<link>http://rezolabs.com/code/cli-argument-parse/</link>
		<comments>http://rezolabs.com/code/cli-argument-parse/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 06:00:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[argument parser]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[dev-c++]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=61</guid>
		<description><![CDATA[CLI Argument Parser has been written in C, and simple parses command line arguments. I've used it for a few applications, and will continue to do so. Well, enough said really. Feel free to post comments, bug fixes, patches, suggestions, complaints etc.

I may recode this in C++ when I have the time, but for now, it's in C. Enjoy.]]></description>
			<content:encoded><![CDATA[<p>CLI Argument Parser has been written in C, and simple parses command line arguments. I&#8217;ve used it for a few applications, and will continue to do so. Well, enough said really. Feel free to post comments, bug fixes, patches, suggestions, complaints etc.</p>
<p>I may recode this in C++ when I have the time, but for now, it&#8217;s in C. Enjoy.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
 * CLI Argument Parser
 *
 * @author  reZo &lt;reZo@rezolabs.com&gt;
 * @license GNU General Public License
 * @version 14th April 2008
 *
 * @bug -k=v &amp;&amp; --key=value accepts x{1,} = chars
 */</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Prototype's
 */</span>
&nbsp;
<span style="color: #339933;">#ifdef win32</span>
<span style="color: #339933;">#define snprintf sprintf_s</span>
<span style="color: #339933;">#define strtok strtok_s</span>
<span style="color: #339933;">#endif</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">extern</span> <span style="color: #993333;">struct</span> configuration configuration<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #993333;">void</span> argumentShort <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">void</span> argumentLong <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#ifdef WIN32</span>
<span style="color: #993333;">void</span> argumentWin32 <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#endif</span>
<span style="color: #993333;">void</span> argumentUsageAndHelp <span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>programName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argumentGetKey <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argumentGetValue <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #993333;">int</span> arguments <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Send argv[i] &amp;&amp; argv[i+1] off to there correct parser's
 */</span>
&nbsp;
<span style="color: #993333;">int</span> arguments <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span> argc<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">==</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span>
      argumentUsageAndHelp<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #993333;">int</span> i<span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">=</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> argc<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>current <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> strlen<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      snprintf<span style="color: #009900;">&#40;</span>current<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%s&quot;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>current<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'-'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>current<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'-'</span><span style="color: #009900;">&#41;</span>
         argumentLong<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>current<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'-'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>current<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #ff0000;">'-'</span><span style="color: #009900;">&#41;</span>
         argumentShort<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#ifdef WIN32</span>
      <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span><span style="color: #009900;">&#40;</span>current<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'/'</span><span style="color: #009900;">&#41;</span>
         argumentWin32<span style="color: #009900;">&#40;</span>argv<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#endif</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * CLI usage and help
 */</span>
&nbsp;
<span style="color: #993333;">void</span> argumentUsageAndHelp <span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>programName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;usage: %s (options)<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> programName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#ifdef WIN32</span>
   fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Windows help<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#else</span>
   fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Non Windows help<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#endif</span>
   fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Report bugs to &lt;reZo@rezolabs.com&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   exit<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">#ifdef WIN32</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Parse windows style CLI argument's
 */</span>
&nbsp;
<span style="color: #993333;">void</span> argumentWin32 <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Invalid CLI argument length (win32).<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      exit<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Settings that do not require usage of value argument
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;/?&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">2</span> <span style="color: #339933;">&amp;&amp;</span> value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s argument with no value, setting to default<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
      <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Settings that require usage of value argument
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;/example&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">5</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">8</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #339933;">,</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #339933;">#endif</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Parse short unix style CLI argument's
 *
 * @accept -k
 *         -k value
 *         -k=value
 */</span>
&nbsp;
<span style="color: #993333;">void</span> argumentShort <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Invalid CLI argument length (short).<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      exit<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Settings that do not require usage of value argument
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;-e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">2</span> <span style="color: #339933;">&amp;&amp;</span> value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s argument with no value, setting to default<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Check if we're dealing with -k=value if value is NULL
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strchr<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">'='</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         value <span style="color: #339933;">=</span> argumentGetValue<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         key <span style="color: #339933;">=</span> argumentGetKey<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;-e&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #339933;">,</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Parse long unix style CLI argument's
 *
 * @accept --key
 *         --key value
 *         --key=value
 */</span>
&nbsp;
<span style="color: #993333;">void</span> argumentLong <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #339933;">,</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #0000dd;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      fprintf<span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Invalid CLI argument length (long)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      exit<span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Settings that do not require usage of value argument
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;--example&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">9</span> <span style="color: #339933;">&amp;&amp;</span> value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s with no value, setting to default<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #808080; font-style: italic;">/**
    * Check if we're dealing with --key=value if value is NULL
    */</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>value <span style="color: #339933;">==</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strchr<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">'='</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> NULL<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         value <span style="color: #339933;">=</span> argumentGetValue<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
         key <span style="color: #339933;">=</span> argumentGetKey<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #b1b100;">else</span>
         <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>strncmp<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;--example&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">6</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&amp;&amp;</span> strlen<span style="color: #009900;">&#40;</span>key<span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000dd;">6</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000066;">printf</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s %s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> key<span style="color: #339933;">,</span> value<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Extract key from -k=value or --key=value syntax
 */</span>
&nbsp;
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argumentGetKey <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #b1b100;">return</span> strtok<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/**
 * Extract value from -k=value or --key=value syntax
 */</span>
&nbsp;
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argumentGetValue <span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span> <span style="color: #339933;">*</span>key<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
   <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>value<span style="color: #339933;">;</span>
&nbsp;
   value <span style="color: #339933;">=</span> strtok<span style="color: #009900;">&#40;</span>key<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   value <span style="color: #339933;">=</span> strtok<span style="color: #009900;">&#40;</span>NULL<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #b1b100;">return</span> value<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/code/cli-argument-parse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Commit</title>
		<link>http://rezolabs.com/gnu-linux/svn-commit/</link>
		<comments>http://rezolabs.com/gnu-linux/svn-commit/#comments</comments>
		<pubDate>Sun, 15 Feb 2009 05:04:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[pysvn]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=50</guid>
		<description><![CDATA[The main purpose of SVN Commit is to save you time commiting any file(s) to the target SVN repository. What SVNc does, it parses files within an SVN checkout for a "commit comment". Once this comment is found, it does certian checks to see if the file has changed, if so, it then commits the file back to it's SVN repository, otherwise, moves to the next.

It's a good program to use alone with a task scheduler (Windows) or a Cron job (GNU/Linux).]]></description>
			<content:encoded><![CDATA[<p>The main purpose of SVN Commit is to save you time commiting any file(s) to the target SVN repository. What SVNc does, it parses files within an SVN checkout for a &#8220;commit comment&#8221;. Once this comment is found, it does certian checks to see if the file has changed, if so, it then commits the file back to it&#8217;s SVN repository, otherwise, moves to the next.</p>
<p>It&#8217;s a good program to use alone with a task scheduler (Windows) or a Cron job (GNU/Linux).</p>
<p>Programmed in Python, currently in alpha stages. It&#8217;s a small bit buggy, and new releases will be posted soon, maybe even a GUI. Feel free to make any suggestions, complaints, bug fixes, patches and what not.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">optparse</span> <span style="color: #ff7700;font-weight:bold;">import</span> OptionParser
<span style="color: #ff7700;font-weight:bold;">from</span> hashlib <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">md5</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>, <span style="color: #dc143c;">glob</span>, <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">re</span>, MySQLdb, pysvn
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> svnc:
&nbsp;
   <span style="color: #483d8b;">&quot;&quot;&quot;
   set default arguments for CLI variables
   &quot;&quot;&quot;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span> <span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
      <span style="color: #008000;">self</span>.<span style="color: black;">options</span> = <span style="color: #008000;">False</span>
      <span style="color: #008000;">self</span>.<span style="color: #008000;">list</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
      <span style="color: #008000;">self</span>.<span style="color: black;">parseCLI</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      <span style="color: #008000;">self</span>.<span style="color: black;">db</span> = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;"># TODO get connection information from self.parseCLI() CLI args</span>
      db = MySQLdb.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>host   = <span style="color: #483d8b;">'localhost'</span>,
                           <span style="color: #dc143c;">user</span>   = <span style="color: #483d8b;">'svnc'</span>,
                           passwd = <span style="color: #483d8b;">'svnc'</span>,
                           db     = <span style="color: #483d8b;">'svnc'</span><span style="color: black;">&#41;</span>
&nbsp;
      <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span> = db.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
   <span style="color: #483d8b;">&quot;&quot;&quot;
   parse CLI arguments
   # FIXME looping multiple times
   &quot;&quot;&quot;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> parseCLI <span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
      <span style="color: #dc143c;">parser</span> = OptionParser<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option_version</span> = <span style="color: #483d8b;">'pre-alpha'</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-d'</span>, <span style="color: #483d8b;">'--daemon'</span>, dest=<span style="color: #483d8b;">'daemon'</span>, default=<span style="color: #008000;">False</span>, metavar=<span style="color: #483d8b;">'(yes|no)'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'run as daemon'</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-c'</span>, <span style="color: #483d8b;">'--checkout'</span>, dest=<span style="color: #483d8b;">'checkout'</span>, metavar=<span style="color: #483d8b;">'/path/to/checkout/'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'path to repository checkout'</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-e'</span>, <span style="color: #483d8b;">'--extensions'</span>, dest=<span style="color: #483d8b;">'extensions'</span>, metavar=<span style="color: #483d8b;">'ext,ext,...'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'extensions to check'</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-u'</span>, <span style="color: #483d8b;">'--username'</span>, dest=<span style="color: #483d8b;">'username'</span>, metavar=<span style="color: #483d8b;">'username'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'username for svn repository login'</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-p'</span>, <span style="color: #483d8b;">'--password'</span>, dest=<span style="color: #483d8b;">'password'</span>, metavar=<span style="color: #483d8b;">'password'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'password for svn repository login'</span><span style="color: black;">&#41;</span>
      <span style="color: #dc143c;">parser</span>.<span style="color: black;">add_option</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'-q'</span>, <span style="color: #483d8b;">'--quiet'</span>, dest=<span style="color: #483d8b;">'quiet'</span>, metavar=<span style="color: #483d8b;">'quiet'</span>, <span style="color: #008000;">help</span>=<span style="color: #483d8b;">'display nothing to stdout'</span><span style="color: black;">&#41;</span>
      <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">options</span>, args<span style="color: black;">&#41;</span> = <span style="color: #dc143c;">parser</span>.<span style="color: black;">parse_args</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">try</span>:
         <span style="color: #008000;">self</span>.<span style="color: black;">options</span>.<span style="color: black;">extensions</span> = <span style="color: #008000;">self</span>.<span style="color: black;">options</span>.<span style="color: black;">extensions</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">AttributeError</span>:
         <span style="color: #dc143c;">parser</span>.<span style="color: black;">print_help</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
         <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
   <span style="color: #483d8b;">&quot;&quot;&quot;
   get value parsed from CLI
   &quot;&quot;&quot;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> get <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, key<span style="color: black;">&#41;</span>:
      <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">eval</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;self.options.%s&quot;</span> <span style="color: #66cc66;">%</span> key<span style="color: black;">&#41;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> scan <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, path<span style="color: black;">&#41;</span>:
      files = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
      <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">listdir</span><span style="color: black;">&#40;</span>path<span style="color: black;">&#41;</span>:
         name = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>path, i<span style="color: black;">&#41;</span>
         <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isfile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s'</span> <span style="color: #66cc66;">%</span> name<span style="color: black;">&#41;</span>:
            <span style="color: #808080; font-style: italic;"># check for extensions</span>
            <span style="color: #ff7700;font-weight:bold;">for</span> extension <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">options</span>.<span style="color: black;">extensions</span>:
               <span style="color: #ff7700;font-weight:bold;">if</span>  name<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">2</span>:<span style="color: black;">&#93;</span> == extension:
                  files.<span style="color: black;">append</span><span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>
         <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">isdir</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%s'</span> <span style="color: #66cc66;">%</span> name<span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">for</span> j <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">scan</span><span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>:
               files.<span style="color: black;">append</span><span style="color: black;">&#40;</span>j<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">return</span> files
&nbsp;
   <span style="color: #483d8b;">&quot;&quot;&quot;
   extract @commit comment from filename
   &quot;&quot;&quot;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> extract <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, filename<span style="color: black;">&#41;</span>:
      contents = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      <span style="color: #808080; font-style: italic;"># regex @commit till and excluding n (raw for r)</span>
      match = <span style="color: #dc143c;">re</span>.<span style="color: black;">search</span><span style="color: black;">&#40;</span>r<span style="color: #483d8b;">&quot;@commit(.*)&quot;</span>, contents<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> match:
         <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#123;</span> <span style="color: #483d8b;">'comment'</span> : match.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">'filename'</span> : filename, <span style="color: #483d8b;">'hash'</span> : <span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span>contents<span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> <span style="color: black;">&#125;</span>
&nbsp;
   <span style="color: #483d8b;">&quot;&quot;&quot;
   checks for legit changes within self.list
   removes any non-legit files
   &quot;&quot;&quot;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">def</span> check <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, current<span style="color: black;">&#41;</span>:
&nbsp;
      <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span>.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SELECT hash, comment FROM svnc WHERE filename = &quot;%s&quot;'</span> <span style="color: #66cc66;">%</span> current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
      client = pysvn.<span style="color: black;">Client</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      row = <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span>.<span style="color: black;">fetchone</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
      <span style="color: #808080; font-style: italic;"># add file to database</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span>.<span style="color: black;">rowcount</span> == <span style="color: #ff4500;">0</span> <span style="color: #ff7700;font-weight:bold;">or</span> row == <span style="color: #008000;">None</span>:
         <span style="color: #ff7700;font-weight:bold;">print</span> current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;not currently in database, adding.&quot;</span>
         <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span>.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'INSERT INTO svnc (filename, hash, comment) VALUES (&quot;%s&quot;, &quot;%s&quot;, &quot;%s&quot;)'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'hash'</span><span style="color: black;">&#93;</span>, current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
         <span style="color: #808080; font-style: italic;"># TODO before adding to svn repository, check if it already belongs to one</span>
         <span style="color: #808080; font-style: italic;">#entry = client.info(current['filename'].rsplit(&quot;/&quot;, 1)[0])</span>
         <span style="color: #ff7700;font-weight:bold;">if</span> client.<span style="color: black;">add</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> == pysvn._pysvn_2_5.<span style="color: black;">ClientError</span>:
            <span style="color: #ff7700;font-weight:bold;">print</span> current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;does not belong to a SVN checkout.&quot;</span>
            <span style="color: #ff7700;font-weight:bold;">return</span>
         <span style="color: #ff7700;font-weight:bold;">return</span>
&nbsp;
      <span style="color: #808080; font-style: italic;"># return if there has been no comment changes</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> row<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> == current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#93;</span>:
         <span style="color: #ff7700;font-weight:bold;">return</span>
&nbsp;
      <span style="color: #808080; font-style: italic;"># replace new comment with old</span>
      <span style="color: #808080; font-style: italic;"># check md5 checksum</span>
      replacedChecksum = <span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">re</span>.<span style="color: black;">sub</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'@commit %s'</span> <span style="color: #66cc66;">%</span> current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'@commit %s'</span> <span style="color: #66cc66;">%</span> row<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>, <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
      currentChecksum = <span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span><span style="color: #008000;">open</span><span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
      <span style="color: #ff7700;font-weight:bold;">if</span> replacedChecksum <span style="color: #66cc66;">!</span>= currentChecksum:
         <span style="color: #ff7700;font-weight:bold;">print</span> current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;has changed, commiting changes to SVN repository.&quot;</span>
         <span style="color: #008000;">self</span>.<span style="color: black;">cursor</span>.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'UPDATE svnc SET comment = &quot;%s&quot;, hash = &quot;%s&quot; WHERE filename = &quot;%s&quot;'</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#93;</span>, replacedChecksum, current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
         client.<span style="color: black;">checkin</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'filename'</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>, current<span style="color: black;">&#91;</span><span style="color: #483d8b;">'comment'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Let's run it!</span>
sc = svnc
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> sc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">scan</span><span style="color: black;">&#40;</span>sc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;checkout&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
   <span style="color: #ff7700;font-weight:bold;">if</span> sc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">extract</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span> <span style="color: #66cc66;">!</span>= <span style="color: #008000;">None</span>:
      sc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">check</span><span style="color: black;">&#40;</span>sc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">extract</span><span style="color: black;">&#40;</span>i<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/gnu-linux/svn-commit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Armageddon 2008</title>
		<link>http://rezolabs.com/geek-events/armageddon-2008/</link>
		<comments>http://rezolabs.com/geek-events/armageddon-2008/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 22:50:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Geek Events]]></category>
		<category><![CDATA[aotea center]]></category>
		<category><![CDATA[Armageddon 2008]]></category>
		<category><![CDATA[auckland]]></category>
		<category><![CDATA[david hewlett]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[michael shanks]]></category>
		<category><![CDATA[tealc]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=43</guid>
		<description><![CDATA[If you have not heard about Armagedon, it's a place for geeks and nerds to come together for a social gathering, meeting science fiction TV show stars, comic book creators, play games on LAN and more.

As always, this year's Armageddon was held at Aotea Center over labour weekend. I only managed to go on the Monday, out of three days however.]]></description>
			<content:encoded><![CDATA[<p>If you have not heard about Armagedon, it&#8217;s a place for geeks and nerds to come together for a social gathering, meeting science fiction TV show stars, comic book creators, play games on LAN and more.</p>
<p>As always, this year&#8217;s Armageddon was held at Aotea Center over labour weekend. I only managed to go on the Monday, out of three days however.</p>
<p>The day started off with finding the way around the center, and glancing over all the different stalls selling products and such. First floor was advertising courses for geeks and nerds alike, which included 3D Animation courses and more. As well as this, the first floor also had a mini arcade, with some DDR and racing car machines. There was also a nice Gothic store which sold posters, goblets and Egyptian ceramics. I ended up purchasing a Egyptian ceramic from this store, as shown below.</p>
<p>In total there were three levels in the center, the second floor had all the video games on it. Some of the games company&#8217;s such as EA where showing off included Spore and Need for Speed. There was also a nice Call of Duty 5 beta preview, and a few people playing World of Warcraft. Other games which were either on PC or XBox 360 included Warhammer Online, and a music band game, which seemed to be very popular.</p>
<p>Last but not least, was the third floor, this floor had photo shootings, and signature signings for science fiction stars, such as David Hewlett, Kevin Marks and many more. This level also had a few DVD shops, and comic book stands.</p>
<p>The comic book signing was the worst, I had a mate standing in line to get Jim Lee&#8217;s signature for at least 3 hours. In that time, I got my photo and signature from David Hewlett, which you can see below.</p>
<p>Overall, it was an excellent day, and I&#8217;ll be going back next year. I must say, this was probably one of the best years so far, as I have been for the last 3 years.</p>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/geek-events/armageddon-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Combining Web 2.0 with 1.0</title>
		<link>http://rezolabs.com/web-development/combining-web-20-with-10/</link>
		<comments>http://rezolabs.com/web-development/combining-web-20-with-10/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 08:05:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[combining]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[web 1.0]]></category>
		<category><![CDATA[web 2.0]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=14</guid>
		<description><![CDATA[It's all very nice and dandy to have a website built within 2.0 standards. However, what if the website hasn't been built for non-JavaScript browsers, or for people with JavaScript disabled?

Since all web 2.0 website's require JavaScript, whether we are talking about Flash or AJAX. A nice way to resolve this issue is to return true, or false from a function being called via a JavaScript event. This can determine if the client is using a web 2.0 or 1.0 web browser.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s all very nice and dandy to have a website built within 2.0 standards. However, what if the website hasn&#8217;t been built for non-JavaScript browsers, or for people with JavaScript disabled?</p>
<p>Since all web 2.0 website&#8217;s require JavaScript, whether we are talking about Flash or AJAX. A nice way to resolve this issue is to return true, or false from a function being called via a JavaScript event. This can determine if the client is using a web 2.0 or 1.0 web browser.</p>
<p>An example of this is:</p>
<p>index.html</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;test.js&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return test();&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/&quot;</span>&gt;</span>a simple test<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;update&quot;</span>&gt;</span>will be updated<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>

<p>test.js</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> test <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'update'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'updated...'</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>What we have here, is the onclick JavaScript event checking the return type of the test function.</p>
<p>In this case, we are returning false, therefore, we will not follow the hyperlink, but update the content dynamically using JavaScript.</p>
<p>This is very useful when using AJAX, if something goes wrong, we can return true so the browser knows to follow the hyperlink (web 1.0 style). If all goes well, we can return false (web 2.0 style) and update the content dynamically. Then of cause, if JavaScript is disabled, it will follow the hyperlink automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/web-development/combining-web-20-with-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gedit Plugins</title>
		<link>http://rezolabs.com/web-development/gedit-plugins/</link>
		<comments>http://rezolabs.com/web-development/gedit-plugins/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 08:04:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[GNU/Linux]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[gedit]]></category>
		<category><![CDATA[gnu/linux]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://rezolabs.com/?p=12</guid>
		<description><![CDATA[Software Freedom Day was held on Saturday 20th September. It was a chance to raise more awareness of GNU/Linux and free software. I got involved with the day, and setup an awareness stand with my friend Jake. We burnt off about 25 copies of Ubuntu, 10 copies of Open Disc (containing OpenOffice, Firefox and more free software), and about 5 copies of Open Education disc, which contained free educational software for students.

The day went from 10am till 4pm. Software Freedom Day for our team consided of a few lengthy discussions based on GNU/Linux, showing off the Compiz-Fusion project, demonstrating a few features of OpenOffice, and of course, teaching some newcomers what GNU/Linux is about.]]></description>
			<content:encoded><![CDATA[<p>The text editor gedit is part of the GNOME desktop environment, which I happen to use currently. One really nice feature about this GUI text editor, is the fact it supports Python and C plugins.</p>
<p>So, I thought I&#8217;d take my time to share some useful plugins which I&#8217;ve been using. Also, below the list, you can find out how to install a plugin.</p>
<p>Embeded Terminal</p>
<p>This is a nice plugin, it gives you a small terminal within gedit. Of cause you could just tab into your terminal, within another window. But it&#8217;s nice to have one built in.</p>
<p>External Tools</p>
<p>Very useful plugin, allows you to create a shortcut to an external tool. For instance, if you want to run make, or execute the current source code file, you can do so using the external tools plugin. Simple to setup, and has a few pre-made examples which you can use.</p>
<p><a href="http://live.gnome.org/Gedit/Plugins?action=AttachFile&amp;do=view&amp;target=fullscreen-2006-07-13.tar.bz2">Fullscreen</a></p>
<p>Have you ever wanted gedit to be fullscreen, or generally code in fullscreen mode. This plugin will be handy for you. You still have all the features of the text editor, but it&#8217;s fullscreen and without the window decoration.</p>
<p>Indent Lines</p>
<p>A standard plugin, which comes with gedit itself.</p>
<p><a href="http://vaem.googlecode.com/files/gedit2_regex_replace_plugin.tar.gz">Regex Search and Replace</a></p>
<p>Very useful, and is an essential for every text editor. Use regular expressions for searching and substitution of text.</p>
<p>Snippets</p>
<p>Another standard plugin, yet one I can&#8217;t live without. Makes life so much easier. Snippets allows you to make little auto-complete code snippets. Where, say you type &#8220;inc&#8221;, it could translate to &#8220;#include &lt;$0&gt;&#8221; when tab-completed.</p>
<p>Installing a Plugin</p>
<p>Once you have downloaded the plugin you want, extract it. For instance:</p>
<p>tar zxvf plugin-name.tar.gz</p>
<p>Then, `cp` the extracted contents to ~/.gnome2/gedit/plugins/. For me, this directory location didn&#8217;t exist, so create it if it doesn&#8217;t exist.</p>
<p>Reload gedit, go to Edit -&gt; Preferences, and enable your plugins within the plugin tab.</p>
<p>Extra Plugins</p>
<p>Also, you can get extra official gedit plugins from the Debian / Ubuntu repository.</p>
<p>apt-get install gedit-plugins</p>
<p>Note</p>
<p>External links are only for those plugins which were created by 3rd party.</p>
<p>Happy hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://rezolabs.com/web-development/gedit-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
