<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Nick's Place</title>
	
	<link>http://www.vxnick.com</link>
	<description />
	<lastBuildDate>Thu, 17 Dec 2009 10:05:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/vxnick/posts" /><feedburner:info uri="vxnick/posts" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Using a secondary IP with cPanel’s exim</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/ahy2LJWNFqU/</link>
		<comments>http://www.vxnick.com/2009/12/cpanel-exim-secondary-ip/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 09:57:52 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=227</guid>
		<description><![CDATA[Some of our servers have multiple IP addresses configured &#8211; in most cases we want to use eth0:1 rather than eth0, but it wasn&#8217;t immediately clear how to do this on cPanel&#8217;s exim mail server.
The original solution was to modify /etc/exim.conf, but today I discovered that there is a specific file (/etc/mailips) where IPs can [...]]]></description>
			<content:encoded><![CDATA[<p>Some of our servers have multiple IP addresses configured &#8211; in most cases we want to use eth0:1 rather than eth0, but it wasn&#8217;t immediately clear how to do this on cPanel&#8217;s exim mail server.</p>
<p>The original solution was to modify <code>/etc/exim.conf</code>, but today I discovered that there is a specific file (<code>/etc/mailips</code>) where IPs can be specified per-domain or globally.</p>
<p>To get this working, just setup <code>/etc/mailips</code> as follows:</p>
<p><code><br />
[domain]: [ip]<br />
[domain2]: [ip]<br />
</code></p>
<p>Obviously, you need to replace <code>[domain]</code> and <code>[ip]</code> with the appropriate entries. In my case, this wasn&#8217;t ideal as I wanted to use a single IP globally. Luckily, that&#8217;s easily done by using an asterisk (*) for <code>[domain]</code>. I believe it even works alongside specific domain entries, so you could have certain domains sending mail out on unique IPs, and then globally route everything else through another.</p>
<p>Once that file has been edited, you need to modify the cPanel exim configuration by going to <em>Exim Configuration Editor</em> within WHM. If you search for <em>mailips</em> on that page, you&#8217;ll see which box you need to check (don&#8217;t forget to save afterwards).</p>

<p><a href="http://feedads.g.doubleclick.net/~a/shoK8Z9LiXYDOIgAbFvp4VQHX-w/0/da"><img src="http://feedads.g.doubleclick.net/~a/shoK8Z9LiXYDOIgAbFvp4VQHX-w/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/shoK8Z9LiXYDOIgAbFvp4VQHX-w/1/da"><img src="http://feedads.g.doubleclick.net/~a/shoK8Z9LiXYDOIgAbFvp4VQHX-w/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/ahy2LJWNFqU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/12/cpanel-exim-secondary-ip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/12/cpanel-exim-secondary-ip/</feedburner:origLink></item>
		<item>
		<title>WebFaction Memory Usage Script</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/jFB7abyGmeY/</link>
		<comments>http://www.vxnick.com/2009/05/webfaction-memory-usage-script/#comments</comments>
		<pubDate>Mon, 25 May 2009 01:16:22 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[WebFaction]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=221</guid>
		<description><![CDATA[I have knocked up a simple Ruby script (my first &#8211; please be gentle) to parse the output of ps -u  -o pid,rss,command and convert the KB values to MB for easier reading.
The script recurses through each process and displays the process ID, memory usage (in megabytes) and the command that it&#8217;s executing. It [...]]]></description>
			<content:encoded><![CDATA[<p>I have knocked up a simple Ruby script (my first &#8211; please be gentle) to parse the output of <code>ps -u <username> -o pid,rss,command</code> and convert the KB values to MB for easier reading.</p>
<p>The script recurses through each process and displays the process ID, memory usage (in megabytes) and the command that it&#8217;s executing. It then displays the total memory usage at the end.</p>
<p><strong>Download</strong><br />
<a href="http://www.vxnick.com/download/4">memusage.rb</a> ( &mdash; RB file)</p>

<p><a href="http://feedads.g.doubleclick.net/~a/3bJNHUksmpvwngS2gwBYMXvcazk/0/da"><img src="http://feedads.g.doubleclick.net/~a/3bJNHUksmpvwngS2gwBYMXvcazk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3bJNHUksmpvwngS2gwBYMXvcazk/1/da"><img src="http://feedads.g.doubleclick.net/~a/3bJNHUksmpvwngS2gwBYMXvcazk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/jFB7abyGmeY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/05/webfaction-memory-usage-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/05/webfaction-memory-usage-script/</feedburner:origLink></item>
		<item>
		<title>SSH Keep-Alive for Mac OS X</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/T5qlp2J0Wus/</link>
		<comments>http://www.vxnick.com/2009/05/ssh-keep-alive-for-mac-os-x/#comments</comments>
		<pubDate>Thu, 07 May 2009 15:09:25 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=216</guid>
		<description><![CDATA[I discovered a while back that my SSH sessions weren&#8217;t staying active despite having the appropriate settings in /etc/ssh/ssh_config.
The other day, I found an article on Google with another way to get keep-alives working &#8211; luckily this seems to have worked.

You need to edit ~/.ssh/config (create it if it doesn&#8217;t exist), and add the following [...]]]></description>
			<content:encoded><![CDATA[<p>I discovered a while back that my SSH sessions weren&#8217;t staying active despite having the appropriate settings in <code>/etc/ssh/ssh_config</code>.</p>
<p>The other day, I <a href="http://www.help2go.com/Tutorials/Mac_OS/Keep_SSH_session_alive_on_Mac_OS_X.html">found an article</a> on Google with another way to get keep-alives working &#8211; luckily this seems to have worked.</p>
<p><span id="more-216"></span></p>
<p>You need to edit <code>~/.ssh/config</code> (create it if it doesn&#8217;t exist), and add the following lines:</p>
<pre>
ServerAliveInterval 300
ServerAliveCountMax 3
</pre>
<p>I quit <code>Terminal.app</code> just for completeness and it now keeps my sessions alive <img src='http://www.vxnick.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/G49IMXeA_3D4pnauMlhVDutXgLI/0/da"><img src="http://feedads.g.doubleclick.net/~a/G49IMXeA_3D4pnauMlhVDutXgLI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/G49IMXeA_3D4pnauMlhVDutXgLI/1/da"><img src="http://feedads.g.doubleclick.net/~a/G49IMXeA_3D4pnauMlhVDutXgLI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/T5qlp2J0Wus" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/05/ssh-keep-alive-for-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/05/ssh-keep-alive-for-mac-os-x/</feedburner:origLink></item>
		<item>
		<title>WebFaction Bits</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/Yhb470ix5l0/</link>
		<comments>http://www.vxnick.com/2009/05/webfaction-bits/#comments</comments>
		<pubDate>Wed, 06 May 2009 12:37:53 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[WebFaction]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=189</guid>
		<description><![CDATA[A list of some useful bits and pieces gathered from the WebFaction forum, support system and so on.
Find a process and kill it

ps -u &#60;username&#62; -o pid,command
kill &#60;process_id&#62;

Memory usage (outputs in Kilobytes)

ps -u &#60;username&#62; -o rss,command

Cron Setup
If you&#8217;re not familiar with vi, you can change the default editor to something easier such as nano by [...]]]></description>
			<content:encoded><![CDATA[<p>A list of some useful bits and pieces gathered from the WebFaction <a href="http://forum.webfaction.com/">forum</a>, sup<a href="http://help.webfaction.com/">port system</a> and so on.</p>
<p><strong>Find a process and kill it</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">&lt;</span>username<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-o</span> pid,<span style="color: #7a0874; font-weight: bold;">command</span>
<span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #000000; font-weight: bold;">&lt;</span>process_id<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p><strong><a href="https://help.webfaction.com/index.php?_m=knowledgebase&#038;_a=viewarticle&#038;kbarticleid=118">Memory usage</a> (outputs in Kilobytes)</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">&lt;</span>username<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #660033;">-o</span> rss,<span style="color: #7a0874; font-weight: bold;">command</span></pre></div></div>

<p><strong><a href="https://help.webfaction.com/index.php?_m=knowledgebase&#038;_a=viewarticle&#038;kbarticleid=21">Cron Setup</a></strong><br />
If you&#8217;re not familiar with <code>vi</code>, you can change the default editor to something easier such as <code>nano</code> by typing: <code>export VISUAL='nano'</code>.</p>
<p>You can add/modify/remove your cron-jobs by typing: <code>crontab -e</code></p>
<p><strong>Software</strong></p>
<ul>
<li><a href="https://help.webfaction.com/index.php?_m=knowledgebase&#038;_a=viewarticle&#038;kbarticleid=172">Install Redmine</a></li>
</ul>

<p><a href="http://feedads.g.doubleclick.net/~a/Lnm_GmkteMahkIvGvzuX865lxaw/0/da"><img src="http://feedads.g.doubleclick.net/~a/Lnm_GmkteMahkIvGvzuX865lxaw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Lnm_GmkteMahkIvGvzuX865lxaw/1/da"><img src="http://feedads.g.doubleclick.net/~a/Lnm_GmkteMahkIvGvzuX865lxaw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/Yhb470ix5l0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/05/webfaction-bits/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/05/webfaction-bits/</feedburner:origLink></item>
		<item>
		<title>Redmine &amp; Bazaar Repositories</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/H062j-_Au-4/</link>
		<comments>http://www.vxnick.com/2009/05/redmine-bazaar-repositories/#comments</comments>
		<pubDate>Wed, 06 May 2009 12:09:50 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Bazaar]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=184</guid>
		<description><![CDATA[Sigh&#8230;
It&#8217;s taken me about a day of fiddling about to finally get Redmine to work with my Bazaar repositories.
This is the first time I&#8217;ve ever used Redmine (as well as Rails), so much Googling was required.

The Problem
I was trying to add a Bazaar shared repository (consisting of &#8220;trunk&#8221; and &#8220;branches&#8221;). This failed as it appears [...]]]></description>
			<content:encoded><![CDATA[<p>Sigh&#8230;</p>
<p>It&#8217;s taken me about a day of fiddling about to finally get <a href="http://redmine.org">Redmine</a> to work with my <a href="http://bazaar-vcs.org">Bazaar</a> repositories.</p>
<p>This is the first time I&#8217;ve ever used Redmine (as well as Rails), so much Googling was required.</p>
<p><span id="more-184"></span></p>
<p><strong>The Problem</strong><br />
I was trying to add a Bazaar shared repository (consisting of &#8220;trunk&#8221; and &#8220;branches&#8221;). This failed as it appears that Redmine <a href="http://www.redmine.org/issues/2799">does not yet support</a> Bazaar shared repositories. Because of this, I have only been able to setup &#8220;trunk&#8221; (which isn&#8217;t a problem really, as I&#8217;m not using &#8220;branches&#8221; yet).</p>
<p>This worked fine for a while &#8211; I could view the revision history and view the files themselves.</p>
<p>Then &#8211; the next day &#8211; it stopped working. The revision history was gone, and so were the file listings.</p>
<p>I tried creating test Bazaar repositories and changing the path in the Redmine project settings, but to no avail.</p>
<p>Today I discovered I needed to run <code>ruby script/runner "Repository.fetch_changesets" -e production</code> which thankfully restored the revision history, but not the file listings. I was under the impression that the &#8220;Autofetch commits&#8221; administrative setting would have done this whenever the repository was viewed.</p>
<p>After much Googling and a brief moment of <a href="http://twitter.com/vxnick/status/1715653576">hopelessness</a>, I stumbled upon the solution.</p>
<p><strong>The Solution</strong><br />
I had to add the following lines to <code>config/environment.rb</code> (and restart redmine):</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PYTHONPATH'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">'/home/vxnick/lib/python2.5'</span>
ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATH'</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;#{ENV['PATH']}:/home/vxnick/bin&quot;</span></pre></div></div>

<p><strong>Note that I am using WebFaction, so the paths above may vary based on your server environment.</strong></p>
<p>At the moment, everything is working as it should &#8211; revision history is there, and I can view my source files. Hopefully everything will stay as-is, however I may have to setup the <code>ruby script/runner ...</code> line as a cron-job if it breaks or doesn&#8217;t update when I commit to the repository.</p>
<p>Apart from that problem (and the lack of built-in TLS support for mail), Redmine is a nice system for managing projects.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/Kw-XZafxUC99fAlnhAhkBjgLz4o/0/da"><img src="http://feedads.g.doubleclick.net/~a/Kw-XZafxUC99fAlnhAhkBjgLz4o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Kw-XZafxUC99fAlnhAhkBjgLz4o/1/da"><img src="http://feedads.g.doubleclick.net/~a/Kw-XZafxUC99fAlnhAhkBjgLz4o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/H062j-_Au-4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/05/redmine-bazaar-repositories/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/05/redmine-bazaar-repositories/</feedburner:origLink></item>
		<item>
		<title>Shell Line Count</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/mGY-k-TEFXY/</link>
		<comments>http://www.vxnick.com/2009/04/shell-line-count/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 20:52:29 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=183</guid>
		<description><![CDATA[I found this useful page for counting lines in projects that I work on.
There are a couple of different techniques there, but I personally use the following:
find . -type f -name '*.php' &#124; xargs wc -l
]]></description>
			<content:encoded><![CDATA[<p>I found this <a href="http://vision-media.ca/resources/unix/counting-lines-in-a-script">useful page</a> for counting lines in projects that I work on.</p>
<p>There are a couple of different techniques there, but I personally use the following:</p>
<p><code>find . -type f -name '*.php' | xargs wc -l</code></p>

<p><a href="http://feedads.g.doubleclick.net/~a/iTboVm4yZYDkJz3F2buIsnRthSM/0/da"><img src="http://feedads.g.doubleclick.net/~a/iTboVm4yZYDkJz3F2buIsnRthSM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/iTboVm4yZYDkJz3F2buIsnRthSM/1/da"><img src="http://feedads.g.doubleclick.net/~a/iTboVm4yZYDkJz3F2buIsnRthSM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/mGY-k-TEFXY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/04/shell-line-count/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/04/shell-line-count/</feedburner:origLink></item>
		<item>
		<title>Chillax, d00d</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/1-QDnR-75uY/</link>
		<comments>http://www.vxnick.com/2009/04/chillax-d00d/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 19:16:12 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=151</guid>
		<description><![CDATA[Mike from ClickableBliss (which incidentally makes a really nice invoicing application for Mac) has pointed out something that really irks me with modern web companies &#8211; they are too informal!
Whenever I see informal communication between the company and user (i.e. a message displayed on their website), it conjures up images of long-haired hippies, sitting around [...]]]></description>
			<content:encoded><![CDATA[<p>Mike from <a href="http://www.clickablebliss.com/">ClickableBliss</a> (which incidentally makes a really nice invoicing application for Mac) has <a href="http://blog.clickablebliss.com/2009/04/02/chillax/">pointed out</a> something that really irks me with modern web companies &#8211; they are <strong>too informal</strong>!</p>
<p>Whenever I see informal communication between the company and user (i.e. a message displayed on their website), it conjures up images of long-haired hippies, sitting around an office full of children&#8217;s toys, shrugging their shoulders, saying &#8220;meh&#8221; a lot, and generally pretending that they are 10 years younger (on the basis that they&#8217;re likely to be in their twenties).</p>
<p>Why do these companies think it&#8217;s all cool and new-age (or whatever) to communicate in such a juvenile manner? It all seems to emanate from this abundance of start-ups (including more established start-ups). It&#8217;s all down to this web 2.0 nonsense. I predict another dot-com bubble is soon to burst.</p>
<p>I understand that companies should want to appear more &#8220;open&#8221; with their customers, but does that mean that professionalism should be forgotten or disregarded?</p>
<p>Don&#8217;t get me wrong, I admire what most of these companies are trying to achieve, but if they&#8217;re in a position where they&#8217;re trying to make money or a (positive) reputation, it doesn&#8217;t particularly give a good impression to the customer if the communication they receive is informal, vague or suchlike.</p>
<p>Then again, maybe nobody else cares <img src='http://www.vxnick.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>

<p><a href="http://feedads.g.doubleclick.net/~a/hu6Pu-aSJ3S7x1f6Jk1yKSLMx3M/0/da"><img src="http://feedads.g.doubleclick.net/~a/hu6Pu-aSJ3S7x1f6Jk1yKSLMx3M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hu6Pu-aSJ3S7x1f6Jk1yKSLMx3M/1/da"><img src="http://feedads.g.doubleclick.net/~a/hu6Pu-aSJ3S7x1f6Jk1yKSLMx3M/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/1-QDnR-75uY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/04/chillax-d00d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/04/chillax-d00d/</feedburner:origLink></item>
		<item>
		<title>Filesize Formats</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/v-I93tkkb5g/</link>
		<comments>http://www.vxnick.com/2009/03/filesize-formats/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 18:47:29 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Repository]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=98</guid>
		<description><![CDATA[This handy function allows you to pass a filesize in bytes and have it returned with the appropriate suffix.
Credit is due, but I don&#8217;t remember where I originally found it (possibly the PHP documentation site).


function filesize_format &#40;$bytes&#41;
&#123;
    if &#40;$bytes &#62; 0&#41;
    &#123;
        [...]]]></description>
			<content:encoded><![CDATA[<p>This handy function allows you to pass a filesize in bytes and have it returned with the appropriate suffix.</p>
<p>Credit is due, but I don&#8217;t remember where I originally found it (possibly the <a href="http://www.php.net/docs.php">PHP documentation</a> site).</p>
<p><span id="more-98"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> filesize_format <span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</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: #000088;">$bytes</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$suffixes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'B'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'KB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'GB'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'TB'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$bytes</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$bytes</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$bits</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1024</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">log</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bits</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">round</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bytes</span> <span style="color: #339933;">/</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bits</span><span style="color: #339933;">,</span> <span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span><span style="color: #000088;">$suffixes</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'0 B'</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<p><a href="http://feedads.g.doubleclick.net/~a/nWQYstoQZimKsts6pa6QyZzhUKo/0/da"><img src="http://feedads.g.doubleclick.net/~a/nWQYstoQZimKsts6pa6QyZzhUKo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nWQYstoQZimKsts6pa6QyZzhUKo/1/da"><img src="http://feedads.g.doubleclick.net/~a/nWQYstoQZimKsts6pa6QyZzhUKo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/v-I93tkkb5g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/03/filesize-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/03/filesize-formats/</feedburner:origLink></item>
		<item>
		<title>Country Array</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/RIG68xLEWOM/</link>
		<comments>http://www.vxnick.com/2009/03/country-array/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 02:40:33 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Repository]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=67</guid>
		<description><![CDATA[Here is an easy to use function to allow you to display a list of countries to your users &#8211; this avoids them having to type it out (potentially incorrectly), and is ideal for use in a select field (drop-down box).
As an added bonus, you can also download a collection of flag images, with each [...]]]></description>
			<content:encoded><![CDATA[<p>Here is an easy to use function to allow you to display a list of countries to your users &#8211; this avoids them having to type it out (potentially incorrectly), and is ideal for use in a select field (drop-down box).</p>
<p>As an added bonus, you can also download a collection of flag images, with each image filename renamed to match the corresponding array key. The original images can be found at <a href="http://www.famfamfam.com/lab/icons/flags/">famfamfam</a>.</p>
<p><span id="more-67"></span></p>
<p><em><strong>Note:</strong> there may be a couple of countries in the array that don&#8217;t have a corresponding flag image, and vice-versa.</em></p>
<p><strong>Downloads</strong></p>
<p><a href="http://www.vxnick.com/download/1">Country Flags</a> ( &mdash; ZIP file)<br />
<a href="http://www.vxnick.com/download/2">Country Array</a> ( &mdash; ZIP file)<br />
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> country_array <span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span>
    <span style="color: #009900;">&#40;</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Afghanistan&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Albania&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Algeria&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;American Samoa&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">4</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Andorra&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">5</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Angola&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">6</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Anguilla&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">7</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Antarctica&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #666666; font-style: italic;">// ... snip ...</span>
        <span style="color: #cc66cc;">230</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Venezuela&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">231</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Vietnam&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">232</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Virgin Islands, British&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">233</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Virgin Islands, U.S.&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">234</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Wallis and Futuna&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">235</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Western Sahara&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">236</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Yemen&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">237</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Zambia&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #cc66cc;">238</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Zimbabwe&quot;</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: #990000;">is_null</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$list</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$list</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Usage:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">country_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// returns the entire array</span>
country_list<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">224</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// returns &quot;United Kingdom&quot;</span></pre></div></div>


<p><a href="http://feedads.g.doubleclick.net/~a/XAHfpBdTWjbSz7GH6YFF6Ui753s/0/da"><img src="http://feedads.g.doubleclick.net/~a/XAHfpBdTWjbSz7GH6YFF6Ui753s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XAHfpBdTWjbSz7GH6YFF6Ui753s/1/da"><img src="http://feedads.g.doubleclick.net/~a/XAHfpBdTWjbSz7GH6YFF6Ui753s/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/RIG68xLEWOM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/03/country-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/03/country-array/</feedburner:origLink></item>
		<item>
		<title>Privacy Policy Template</title>
		<link>http://feedproxy.google.com/~r/vxnick/posts/~3/T6AMuZjJjV4/</link>
		<comments>http://www.vxnick.com/2009/03/privacy-policy-template/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 19:40:38 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.vxnick.com/?p=43</guid>
		<description><![CDATA[I&#8217;ve just created a privacy policy as Google now requires this for their new interest-based advertising, due to launch in April.
I spent a while Googling for a suitable template aimed at UK-based websites, and managed to stumble upon this, which I have modified for use on this website.
Hopefully this will save somebody the effort of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just created a <a href="http://www.vxnick.com/privacy/">privacy policy</a> as Google now requires this for their new interest-based advertising, due to launch in April.</p>
<p>I spent a while Googling for a suitable template aimed at UK-based websites, and managed to stumble upon <a href="http://www.website-law.co.uk/privacypolicy.html">this</a>, which I have modified for use on this website.</p>
<p>Hopefully this will save somebody the effort of finding a suitable template for their own site!</p>

<p><a href="http://feedads.g.doubleclick.net/~a/8NeZ8tryGkMWG8VmJfTZe7ZXRKU/0/da"><img src="http://feedads.g.doubleclick.net/~a/8NeZ8tryGkMWG8VmJfTZe7ZXRKU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8NeZ8tryGkMWG8VmJfTZe7ZXRKU/1/da"><img src="http://feedads.g.doubleclick.net/~a/8NeZ8tryGkMWG8VmJfTZe7ZXRKU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/vxnick/posts/~4/T6AMuZjJjV4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.vxnick.com/2009/03/privacy-policy-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.vxnick.com/2009/03/privacy-policy-template/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 4.164 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-11 03:58:39 --><!-- Compression = gzip -->
