<?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>MafiaGeek</title>
	<atom:link href="http://www.mafiageek.com/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mafiageek.com</link>
	<description>Building Worlds</description>
	<lastBuildDate>Thu, 27 May 2010 22:21:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>DHClient</title>
		<link>http://www.mafiageek.com/index.php/archives/226</link>
		<comments>http://www.mafiageek.com/index.php/archives/226#comments</comments>
		<pubDate>Tue, 11 May 2010 06:18:29 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[misc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=226</guid>
		<description><![CDATA[I&#8217;m running  Ubuntu Linux on a server the /etc/network/interfaces follows auto eth0 iface eth0 inet dhcp But on boot up dhclient is never called.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m running  Ubuntu Linux on a server the /etc/network/interfaces follows</p>
<p>auto eth0</p>
<p>iface eth0 inet dhcp</p>
<p>But on boot up dhclient is never called.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/226/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Validating Nominal Numbers</title>
		<link>http://www.mafiageek.com/index.php/archives/223</link>
		<comments>http://www.mafiageek.com/index.php/archives/223#comments</comments>
		<pubDate>Mon, 10 May 2010 19:33:19 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=223</guid>
		<description><![CDATA[Currently I&#8217;m working on a on how to validate nominal number like Cd Keys are validated by a installer, any idea intranets?]]></description>
			<content:encoded><![CDATA[<p>Currently I&#8217;m working on a on how to validate nominal number like Cd Keys are validated by a installer, any idea intranets?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/223/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Removing blank lines with a regular expression.</title>
		<link>http://www.mafiageek.com/index.php/archives/206</link>
		<comments>http://www.mafiageek.com/index.php/archives/206#comments</comments>
		<pubDate>Mon, 23 Nov 2009 10:29:46 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Regular expression]]></category>
		<category><![CDATA[remove blank lines]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=206</guid>
		<description><![CDATA[Today i was trying to write a regular expression to remove blank lines using the PHP method preg_replace. After googling it i found this solution being posted online. PHP: $s = preg_replace("/(^[\r\n]*&#124;[\r\n]+)[\s\t]*[\r\n]+/","",$s); Perl: $s =~ s/(^[\r\n]*&#124;[\r\n]+)[\s\t]*[\r\n]//g; Input: ----------------------- hello ----------------------- Output: ----------------------- hello----------------------- Not very nice. Seems that this expression removes newline characters from cases [...]]]></description>
			<content:encoded><![CDATA[<p>Today i was trying to write a regular expression to remove blank lines using the PHP method preg_replace.<br />
After googling it i found this solution being posted online.</p>
<pre>PHP: $s = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/","",$s);
Perl: $s =~ s/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]//g;</pre>
<p>Input:</p>
<pre>-----------------------

hello

-----------------------</pre>
<p>Output:</p>
<pre>-----------------------
hello-----------------------</pre>
<p>Not very nice. Seems that this expression removes newline characters from cases like &#8220;string\n\n&#8221;.</p>
<p>What it should look like.</p>
<pre>-----------------------
hello
-----------------------</pre>
<p>My solution:</p>
<pre>PHP: $s = preg_replace("/^\n+|^[\t\s]*\n+/m", "", $s);
Perl: $s =~ s/^\n+|^[\t\s]*\n+//mg; #we need to use the g modifier to replace all occurrences preg_replace does this by default.</pre>
<p>Output:</p>
<pre>-----------------------
hello
-----------------------
</pre>
<p>Much better. <img src='http://www.mafiageek.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/206/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding programming section</title>
		<link>http://www.mafiageek.com/index.php/archives/204</link>
		<comments>http://www.mafiageek.com/index.php/archives/204#comments</comments>
		<pubDate>Fri, 30 Oct 2009 23:57:47 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=204</guid>
		<description><![CDATA[I&#8217;m adding a programming section containing algorithms and other programming related topics.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m adding a programming section containing algorithms and other programming related topics.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/204/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objects in C</title>
		<link>http://www.mafiageek.com/index.php/archives/167</link>
		<comments>http://www.mafiageek.com/index.php/archives/167#comments</comments>
		<pubDate>Sun, 25 Oct 2009 10:01:29 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[objects]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=167</guid>
		<description><![CDATA[I was playing around with c and creating pseudo type objects. Objects.c ?Download object.c1 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 [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with c and creating pseudo type objects.</p>
<h3>Objects.c</h3>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.mafiageek.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=167&amp;download=object.c">object.c</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1672"><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
</pre></td><td class="code" id="p167code2"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#include &lt;stdio.h&gt;</span>
<span style="color: #339933;">#include &lt;string.h&gt;</span>
<span style="color: #339933;">#include &lt;stdlib.h&gt;</span>
&nbsp;
<span style="color: #339933;">#define NAMESIZ 32 /*size of name array */</span>
&nbsp;
&nbsp;
<span style="color: #993333;">typedef</span> <span style="color: #993333;">struct</span> object
<span style="color: #009900;">&#123;</span>
	<span style="color: #993333;">char</span> name<span style="color: #009900;">&#91;</span>NAMESIZ<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #993333;">int</span> number<span style="color: #339933;">;</span>
	<span style="color: #993333;">void</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>print<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> object<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/*function pointer declarations*/</span>
	<span style="color: #993333;">int</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>getNumber<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #993333;">struct</span> object<span style="color: #339933;">*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> Object<span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #993333;">void</span> object_print<span style="color: #009900;">&#40;</span>Object<span style="color: #339933;">*</span> this<span style="color: #009900;">&#41;</span> <span style="color: #808080; font-style: italic;">/* functions which do operations on the Object structure */</span>
<span style="color: #009900;">&#123;</span>
	<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> this<span style="color: #339933;">-&gt;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> object_getNumber<span style="color: #009900;">&#40;</span>Object <span style="color: #339933;">*</span>this<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> this<span style="color: #339933;">-&gt;</span>number<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
Object <span style="color: #339933;">*</span> object_create<span style="color: #009900;">&#40;</span><span style="color: #993333;">char</span><span style="color: #339933;">*</span> name<span style="color: #339933;">,</span> <span style="color: #993333;">int</span> number<span style="color: #009900;">&#41;</span>	<span style="color: #808080; font-style: italic;">/*creates a new Object and returns a Object pointer*/</span>
<span style="color: #009900;">&#123;</span>
	Object <span style="color: #339933;">*</span> obj <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>obj <span style="color: #339933;">=</span> malloc<span style="color: #009900;">&#40;</span><span style="color: #993333;">sizeof</span><span style="color: #009900;">&#40;</span>Object<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</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>
		strncpy<span style="color: #009900;">&#40;</span>obj<span style="color: #339933;">-&gt;</span>name<span style="color: #339933;">,</span> name<span style="color: #339933;">,</span> NAMESIZ<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		obj<span style="color: #339933;">-&gt;</span>print <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>object_print<span style="color: #339933;">;</span>	<span style="color: #808080; font-style: italic;">/*set function pointer for print*/</span>
		obj<span style="color: #339933;">-&gt;</span>getNumber <span style="color: #339933;">=</span> <span style="color: #339933;">&amp;</span>object_getNumber<span style="color: #339933;">;</span>	<span style="color: #808080; font-style: italic;">/*set function pointer for getNumber*/</span>
		obj<span style="color: #339933;">-&gt;</span>number <span style="color: #339933;">=</span> number<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> obj<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> object_delete<span style="color: #009900;">&#40;</span>Object <span style="color: #339933;">**</span> obj<span style="color: #009900;">&#41;</span>	<span style="color: #808080; font-style: italic;">/*free a Object from memory and sets the Object pointer to NULL*/</span>
<span style="color: #009900;">&#123;</span>
	free<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #339933;">*</span>obj <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">int</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	Object <span style="color: #339933;">*</span> obj <span style="color: #339933;">=</span> NULL<span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>obj <span style="color: #339933;">=</span> object_create<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;My Name&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000dd;">70</span><span style="color: #009900;">&#41;</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>
		<span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>obj<span style="color: #339933;">-&gt;</span>print<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #808080; font-style: italic;">/*call void function print. Also we could make a operation on the object by object_print(obj); */</span>
		<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #000066;">printf</span></a><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;%d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>obj<span style="color: #339933;">-&gt;</span>getNumber<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #808080; font-style: italic;">/*call int getNumber function*/</span>
		object_delete<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>obj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">#ifdef WIN32</span>
	system<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;pause&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">#endif</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/167/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Current Projects</title>
		<link>http://www.mafiageek.com/index.php/archives/161</link>
		<comments>http://www.mafiageek.com/index.php/archives/161#comments</comments>
		<pubDate>Sat, 24 Oct 2009 22:35:05 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[misc]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=161</guid>
		<description><![CDATA[Made a update to my current projects.]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-139 alignright" title="caavatar" src="http://www.mafiageek.com/wp-content/uploads/2009/10/caavatar.jpg" alt="caavatar" width="71" height="71" />Made a update to my current projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/161/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World</title>
		<link>http://www.mafiageek.com/index.php/archives/142</link>
		<comments>http://www.mafiageek.com/index.php/archives/142#comments</comments>
		<pubDate>Sat, 24 Oct 2009 12:58:36 +0000</pubDate>
		<dc:creator>Dale</dc:creator>
				<category><![CDATA[news]]></category>

		<guid isPermaLink="false">http://www.mafiageek.com/?p=142</guid>
		<description><![CDATA[Hello World! This site is up and running.]]></description>
			<content:encoded><![CDATA[<h2>Hello World!</h2>
<p>This site is up and running.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mafiageek.com/index.php/archives/142/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
