<?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>Naatan.com - Opensource Web Developer &#187; Snippets</title>
	<atom:link href="http://naatan.com/category/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>http://naatan.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 23 Jul 2009 02:35:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Crisp Fonts on Linux</title>
		<link>http://naatan.com/2008/12/crisp-fonts-on-linux/</link>
		<comments>http://naatan.com/2008/12/crisp-fonts-on-linux/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 04:42:08 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Other Snippets]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[crisp fonts]]></category>
		<category><![CDATA[linux fonts]]></category>
		<category><![CDATA[ubuntu fonts]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=269</guid>
		<description><![CDATA[Well I just installed Linux Mint tonight as I really liked where the Project was going, it&#8217;s basically Ubuntu with some extra&#8217;s for the real Linux geeks.
The only problem with any (or most) new Linux installations is that the fonts are blurry and spacing is just off.. So I did some googling and found this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://naatan.com/wp-content/uploads/2008/12/fonts.png"><img class="alignright size-medium wp-image-271" title="fonts" src="http://naatan.com/wp-content/uploads/2008/12/fonts-300x260.png" alt="fonts" width="168" height="146" /></a>Well I just installed Linux Mint tonight as I really liked where the Project was going, it&#8217;s basically Ubuntu with some extra&#8217;s for the real Linux geeks.</p>
<p>The only problem with any (or most) new Linux installations is that the fonts are blurry and spacing is just off.. So I did some googling and found <a rel="nofollow" href="http://ubuntuforums.org/showthread.php?p=16896">this thread on the Ubuntu forums</a>, if you follow the 2 simple steps given you&#8217;re fonts will look a lot better..</p>
<p>Create a file called <strong>.fonts.conf</strong> in your home directory (<em>vim ~/.fonts.conf</em>) and paste in the following contents</p>
<pre title="code" class="xml">
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE fontconfig SYSTEM "fonts.dtd"&gt;
&lt;fontconfig&gt;
&nbsp; &lt;match target="font"&gt;
&nbsp;&nbsp;&nbsp; &lt;edit name="autohint" mode="assign"&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;bool&gt;true&lt;/bool&gt;
&nbsp;&nbsp;&nbsp; &lt;/edit&gt;
&nbsp; &lt;/match&gt;
&lt;/fontconfig&gt;
</pre>
<p>After that relog.</p>
<p>Apperantly the reason this isn&#8217;t done by default is because Apple has some patents on the techniques used to make this happen.. don&#8217;t you just hate patents..</p>
<p>Note that I&#8217;ve only tried it on Linux Mint 6 (based on Ubuntu 8.10), but I reckon it should work for most distro&#8217;s.. gonna try it tomorrow on Centos 4.7 at work.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/12/crisp-fonts-on-linux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>cPanel &#8211; How to put all Domains in the same Folder</title>
		<link>http://naatan.com/2008/12/cpanel-how-to-put-all-domains-in-the-same-folder/</link>
		<comments>http://naatan.com/2008/12/cpanel-how-to-put-all-domains-in-the-same-folder/#comments</comments>
		<pubDate>Fri, 12 Dec 2008 04:57:04 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Other Snippets]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[cpanel]]></category>
		<category><![CDATA[domain root]]></category>
		<category><![CDATA[multiple domains]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=260</guid>
		<description><![CDATA[If you&#8217;ve ever used cPanel you probably know that each account is tied to a default domain for that account.. you can add more domains to each account but these will be seen as additional domains..
This idealogy has always annoyed me.. because it also means that your default domain is bound to the public_html folder [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignright size-full wp-image-264" title="cpanel" src="http://naatan.com/wp-content/uploads/2008/12/cpanel.jpg" alt="cpanel" width="53" height="49" />If you&#8217;ve ever used cPanel you probably know that each account is tied to a default domain for that account.. you can add more domains to each account but these will be seen as additional domains..<br />
This idealogy has always annoyed me.. because it also means that your default domain is bound to the public_html folder and all other domains can have either that folder or any sub folder as it&#8217;s homedir.. but I want all my domains in the same folder, not one &#8220;<em>default</em>&#8221; domain as the main folder and put all other domains in a subfolder of that domain.. where&#8217;s the logic in that?
</p>
<p style="text-align: justify;">So I used htaccess to have mod_rewrite redirect the main domain to the &#8220;domains&#8221; folder&#8230; which is the same folder all my other domains use, this way I can have things the way I like.</p>
<p style="text-align: justify;">Here&#8217;s the code that you put right inside your public_html folder;</p>
<p style="text-align: justify;"><pre class="terminal">&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
ReWriteCond %{HTTP_HOST} naatan.com<br />
ReWriteCond %{DOCUMENT_ROOT} !domains/<br />
ReWriteCond %{DOCUMENT_ROOT} !subdomains/<br />
ReWriteRule ^(.*)$ domains/naatan.com/$1 [L]<br />
&lt;/IfModule&gt;</pre>
</p>
<p style="text-align: justify;">Of course you&#8217;re gonna want to replace naatan.com with your domain..</p>
<p style="text-align: justify;"><span id="more-260"></span>Note that I am placing an ignore on the domains and subdomains folder, seeing as it would keep redirecting indefinitely if I didn&#8217;t put that on the domains folder, and I want to have my subdomains in their own folder as well.</p>
<p style="text-align: justify;">Now you can still use htaccess in the main domains folder, but as it&#8217;s home directory&nbsp; is different from the directory the files are actually in (thanks to mod_rewrite) you need to base the path on the homedirectory.. so my .htaccess file for my default domain looks like this;</p>
<p><pre class="terminal">&lt;IfModule mod_rewrite.c&gt;<br />
RewriteEngine On<br />
RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /domains/naatan.com/index.php [L]<br />
&lt;/IfModule&gt;</pre></p>
<p style="text-align: justify;">And voila, I got all my domains in one folder..</p>
<p style="text-align: justify;">I am still hoping for cPanel to allow you to customize this some day.. but it doesn&#8217;t seem like this limitation bothers the developers behind cPanel much.</p>
<p style="text-align: justify;">On a small side note, I&#8217;ve had a bit of trouble with wordpress admin redirecting after a login using the method described above.. but by simply logging in and then manually entering the wp-admin url it all works fine. Even so, if anyone knows a better way of going about this, I&#8217;d love to hear it.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/12/cpanel-how-to-put-all-domains-in-the-same-folder/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Multiple spaces in Wordpress posts</title>
		<link>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/</link>
		<comments>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 13:20:00 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Snippets]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=76</guid>
		<description><![CDATA[If you&#8217;ve ever tried posting source code on your blog you probably have noticed that Wordpress has the annoying habbit of stripping out multiple spaces out of your post, god knows why.
Anyway, I was not the only one getting annoyed by this and so a plugin already exists to fix this behaviour, only this plugin [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a href="http://naatan.com/wp-content/uploads/2008/11/nbsp.png"><img class="alignright size-full wp-image-78" title="nbsp" src="http://naatan.com/wp-content/uploads/2008/11/nbsp.png" alt="nbsp" width="150" height="75" /></a>If you&#8217;ve ever tried posting source code on your blog you probably have noticed that Wordpress has the <em>annoying habbit</em> of stripping out multiple spaces out of your post, god knows why.</p>
<p style="text-align: justify;">Anyway, I was not the only one getting annoyed by this and so <a href="http://englishmike.net/other-plugins/tinymceentities-plugin/" target="_blank">a plugin already exists</a> to fix this behaviour, only this plugin will make ugly nbsp&#8217;s appear in your post when editing it, to fix this, simply replace line 39 with the following</p>
<pre title="code" class="php">
$text = str_replace('&amp;amp;nbsp;','&amp;nbsp;',$text); // Allow NBSP's
</pre>
<p>That&#8217;s it, you should now be able to use multiple spaces in your posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/11/multiple-spaces-in-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Adding Smilies to your Wordpress Plugins</title>
		<link>http://naatan.com/2008/11/adding-smilies-to-your-plugins/</link>
		<comments>http://naatan.com/2008/11/adding-smilies-to-your-plugins/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 02:11:00 +0000</pubDate>
		<dc:creator>Naatan</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Snippets]]></category>

		<guid isPermaLink="false">http://naatan.com/?p=65</guid>
		<description><![CDATA[Whilst monitoring the #wordpress irc channel on irc.freenode.net I came across a question by &#8220;erchik&#8221; asking how to add smilies to his widgets.
After some researching I found this to be quite simple, of course there is unfortunately no global way of doing this for all your widgets at once, since every widget has it&#8217;s own [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-69" title="wordpress-logo" src="http://naatan.com/wp-content/uploads/2008/11/wordpress-logo-300x282.png" alt="wordpress-logo" width="118" height="111" />Whilst monitoring the <a href="irc://irc.freenode.org/#wordpress">#wordpress</a> irc channel on <a href="irc://irc.freenode.org">irc.freenode.net</a> I came across a question by &#8220;<em>erchik</em>&#8221; asking how to add smilies to his widgets.</p>
<p>After some researching I found this to be quite simple, of course there is unfortunately no global way of doing this for all your widgets at once, since every widget has it&#8217;s own backend, but it&#8217;s quite easy to achieve and is not limited to widgets, you can use it in plugins and templates all the same.</p>
<p>Simply add the following lines to your code right before you are outputting the string that you want to contain smilies</p>
<pre title="code" class="php">

global $wp_smiliessearch, $wp_smiliesreplace;
$content = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $content);
</pre>
<p>Replace <em>$content</em> with the name of your string containing the content.<br />
<span id="more-65"></span></p>
<p>If for whatever reason this does not work for you, try adding the following line before the 2 lines given:</p>
<pre title="code" class="php">

smilies_init();
</pre>
<p>This will populate the smilie replacement vars.</p>
<p>And that&#8217;s it, in this case I was applying it to a widget called <a href="http://www.piepalace.ca/blog/projects/miniposts" target="_blank">MiniPosts (version 0.6.6)</a>, you can get the patch file for it <a href="http://naatan.com/files/patch/miniposts2.php.patch">here</a> (right click &gt; save as).</p>
<p>To apply the patch on a linux box simply execute the following command</p>
<p><pre class="terminal"><br />
patch -i /path/to/miniposts2.php.patch /path/to/miniposts2.php<br />
</pre></p>
<p>Basically what you need to do is add the following 2 lines at line 424 of miniposts2.php</p>
<pre title="code" class="php">

global $wp_smiliessearch, $wp_smiliesreplace;
$text = preg_replace($wp_smiliessearch, $wp_smiliesreplace, $text);
</pre>
<p>I&#8217;d drop the modified miniposts2.php file here but I don&#8217;t feel comfortable posting / hosting somebody elses work, I&#8217;ll contact the author though.</p>
]]></content:encoded>
			<wfw:commentRss>http://naatan.com/2008/11/adding-smilies-to-your-plugins/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
