<?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>Guillaume Piot &#124; Application Developer &#38; User Interface Designer &#187; Linux</title>
	<atom:link href="http://gpiot.com/category/development-tips/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://gpiot.com</link>
	<description></description>
	<lastBuildDate>Tue, 30 Apr 2013 08:42:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Ubuntu (10.04 LTS) server new website setup: the useful commands</title>
		<link>http://gpiot.com/ubuntu-10-04-lts-server-new-website-setup-the-useful-commands/</link>
		<comments>http://gpiot.com/ubuntu-10-04-lts-server-new-website-setup-the-useful-commands/#comments</comments>
		<pubDate>Thu, 24 May 2012 12:43:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=460</guid>
		<description><![CDATA[Add a group &#38; user 12$ groupadd my_group $ useradd my_username -d /var/www/my_folder Then add the user to the group 1usermod -G my_group my_username Helpers Get a list of all existing users: $ cat /etc/passwd &#124; cut -d: -f1 Get a [...]]]></description>
			<content:encoded><![CDATA[<h2>Add a group &amp; user</h2>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ groupadd my_group<br />
$ useradd my_username -d /var/www/my_folder</div></td></tr></tbody></table></div>
<p>Then add the user to the group</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">usermod -G my_group my_username</div></td></tr></tbody></table></div>
<p><strong>Helpers</strong></p>
<p>Get a list of all existing users: $ cat /etc/passwd | cut -d: -f1</p>
<p>Get a list of all existing groups: $ cat /etc/group |cut -d: -f1</p>
<h2>Running uWSGI with the right user and group</h2>
<p>In this scenario, I use a socket to run my uWSGI instance. That socker must be located in a folder that have write access permission by your new user.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">description &quot;uWSGI server for my_site.com&quot;<br />
start on runlevel [2345]<br />
stop on runlevel [!2345]<br />
respawn<br />
exec /usr/local/bin/uwsgi &nbsp;\<br />
--socket /var/www/my_site/my_site.com.sock \<br />
--chmod-socket \<br />
--module wsgi_app \<br />
--pythonpath /var/www/my_site/my_site \<br />
-p 1 -t 30 \<br />
--uid my_site \<br />
--gid my_group \<br />
--master \<br />
--logto /var/www/my_site/logs/wsgi.log \<br />
-b 10000</div></td></tr></tbody></table></div>
<p>I&#8217;m using &#8211;uid and &#8211;gid to define the user &amp; group that will run uWSGI. My &#8211;socket path is owned by my user. I&#8217;m running it with &#8211;master process so it can respawn processes if necessary.</p>
<h2>Nginx setup with uWSGI</h2>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">location / {<br />
include uwsgi_params;<br />
uwsgi_pass unix:/var/www/my_site/my.site.com.sock;<br />
}</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/ubuntu-10-04-lts-server-new-website-setup-the-useful-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.10: Install PIL in Virtualenv</title>
		<link>http://gpiot.com/ubuntu-9-10-install-pil-in-virtualenv/</link>
		<comments>http://gpiot.com/ubuntu-9-10-install-pil-in-virtualenv/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 10:21:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[pil]]></category>
		<category><![CDATA[virtualenv]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=293</guid>
		<description><![CDATA[Re-blogged from Eddie Welker I started with a –no-site-packages virtualenv, so as not to use (or more  importantly depend) on any of the global site-packages.  Ok, cool. 1$ virtualenv --no-site-packages myEnv First, I needed to install the python developer tools. [...]]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://www.eddiewelker.com/2010/03/31/installing-pil-virtualenv-ubuntu/">Re-blogged from Eddie Welker</a></strong></p>
<p>I started with a –no-site-packages virtualenv, so as not to use (or more  importantly depend) on any of the global site-packages.  Ok, cool.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ virtualenv --no-site-packages myEnv</div></td></tr></tbody></table></div>
<p>First, I needed to install the python developer tools. (Use apt-get or aptitude, whatever floats your boat)</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ sudo aptitude install python-dev</div></td></tr></tbody></table></div>
<p>Then, I needed to install libjpeg and libjpeg-dev.  I’m not sure why, but I needed libjpeg simply doesn’t exist, so I needed to install libjpeg62.  I can’t pretend that I know the difference (or if there is one).  In fact, I may have gotten away with installing libjpeg62 and libjpeg-dev (rather than both “62″ versions… libjpeg62 and libjpeg62-dev), but only further testing will tell.</p>
<p>Why? If you install PIL without this library, you’ll get those wonderful “decoder jpeg not available” messages in Python.  Or worse yet, if you’re trying to use it in a Django, you may get some errors (specifically the “Upload a valid image. The file you uploaded was either not an image or a corrupted image” warning), or you may not get any until you open the shell.  Either way, you can test with the method listed below.  If you get the “decoder jpeg not available” message, your install didn’t work.</p>
<p>&nbsp;</p>
<p>Check version installed of libjpeg:</p>
<p><strong>lsof | grep libjpeg</strong></p>
<p>The zlib package handles PNGs.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ sudo aptitude install libjpeg62 libjpeg62-dev<br />
$ sudo aptitude install zlib1g-dev<br />
$ sudo aptitude install libfreetype6 libfreetype6-dev</div></td></tr></tbody></table></div>
<p>Alright, now we seem to be done with the prerequisites. Start your virtualenv (of course, myEnv in the example is the name of your virtualenv).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ source myEnv/bin/activate</div></td></tr></tbody></table></div>
<p>Download PIL and install.  This will make sure to install PIL within your virtualenv’s site-packages.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(myEnv)$ wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz<br />
(myEnv)$ tar zxvf Imaging-1.1.7.tar.gz<br />
(myEnv)$ cd Imaging-1.1.7<br />
(myEnv)$ python setup.py install</div></td></tr></tbody></table></div>
<p>If you run into further problems (the “decoder jpeg not available” message again), you may have to resort to the <a href="http://effbot.org/zone/pil-decoder-jpeg-not-available.htm">long directions</a> to get PIL and libjpeg to play happily together, but I hope not.</p>
<p>Now that you have everything installed, test it.  Open up a python shell from within your virtualenv.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">(myEnv)$ python</div></td></tr></tbody></table></div>
<p>Now try the following (with an image in your home directory) to see if everything is running smoothly.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;gt;&amp;gt;&amp;gt; from PIL import Image<br />
&amp;gt;&amp;gt;&amp;gt; i = Image.open('/home/username/someJpeg.jpg')<br />
&amp;gt;&amp;gt;&amp;gt; i.save('/home/username/someOtherJpeg.jpg')</div></td></tr></tbody></table></div>
<p>If all of that works, you should now be ready to work.</p>
<p>Note: I would love to install the jpeg, freetype and zlib packages locally as well, but that was a step beyond what I was willing to mess with.  Maybe for a future set of instructions.</p>
<p>&nbsp;</p>
<p>****</p>
<p>UPDATE:</p>
<p>In Ubuntu 11, it seems that you need libjpeg8-dev, rather than libjpeg62.<br />
I have seen cases where multiple of PIL version are installed, under pyshared / pymodules / dist-packages. So PIL may work in the command line but not in mod_wsgi. It is important that only one version of PIL is running and preferably the one that work!</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/ubuntu-9-10-install-pil-in-virtualenv/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create a new Mercurial repository on Mac</title>
		<link>http://gpiot.com/create-a-new-mercurial-repository-on-mac/</link>
		<comments>http://gpiot.com/create-a-new-mercurial-repository-on-mac/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 17:03:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OSX Lion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mercurial]]></category>

		<guid isPermaLink="false">http://piot.co.uk/?p=197</guid>
		<description><![CDATA[Every months or so, I create a new repository for the development project I work on. But I always tend to forget how to setup the repository, so here&#8217;s a quick start quide which I found very helpful and I [...]]]></description>
			<content:encoded><![CDATA[<p>Every months or so, I create a new repository for the development project I work on. But I always tend to forget how to setup the repository, so here&#8217;s a quick start quide which I found very helpful and I hope you will too.</p>
<h2>1. First of all, we need to create a username file: <strong>.hgrc</strong></h2>
<p>Include the following text:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[ui]<br />
username = Your Name &lt;yourname@domain.com&gt;</div></td></tr></tbody></table></div>
</p>
<p>Save it under you home folder eg:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Guillaumes-MacBook-Pro: guillaumepiot$ cat ~/.hgrc<br />
[ui]<br />
username = Your Name &lt;yourname@domain.com&gt;</div></td></tr></tbody></table></div>
</p>
<p>This command should return the content of the file.</p>
<p>&nbsp;</p>
<h2>2. Go to your project folder</h2>
<p>cd /my/folder</p>
<p>Start the repo:</p>
<p>hg init</p>
<p>* You can create a .hgignore file inside the .hg folder (make sure your hidden files are showing). This file will ignore a list of extension for example:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">syntax: glob<br />
*.pyc<br />
*.txt</div></td></tr></tbody></table></div>
</p>
<p>This will ignore Python compiled files and txt files.</p>
<h2>3. Add project files to the repo:</h2>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg add</div></td></tr></tbody></table></div>
</p>
<p>or</p>
<p>hg addremove (if you set up your ignore file after the init)</p>
<h2>4. Commit your work:</h2>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg commit -m 'Explain here the reason of this commit'</div></td></tr></tbody></table></div>
</p>
<p>This will create a new commit, the message explained what has been added or modified.</p>
<h2>5. Push you work to the repository:</h2>
<p>I advice to create a file with default settings for convenience, which will stop you from entering the repo URL each time.</p>
<p>In the <strong>.hg</strong> folder, create a file called <strong>hgrc</strong> and put the following:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[paths]<br />
default-push = ssh://hg@codebasehq.com/vivaaspire/viva-website/hotel_innovation_network.hg&lt;br /&gt;&lt;br /&gt;</div></td></tr></tbody></table></div>
</p>
<p>Then push:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg push</div></td></tr></tbody></table></div>
</p>
<p>It should be all set now.</p>
<p>This is a very basic startup guide, there&#8217;s many things you can do an option but that I recommend you check the Mercurial website: <a href="http://mercurial.selenic.com/">http://mercurial.selenic.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/create-a-new-mercurial-repository-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sphinx start guide</title>
		<link>http://gpiot.com/sphinx-start-guide/</link>
		<comments>http://gpiot.com/sphinx-start-guide/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 11:34:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=113</guid>
		<description><![CDATA[Create a new doc 1. Create a new folder 2. cd to that folder 1cd /folder 3. Run sphinx-quickstart 1sphinx-quickstart 4. Generate documentation 1make html Now you may wanna create a PDF out of your documentation: I&#8217;m using Mac, so [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Create a new doc</strong></p>
<p>1. Create a new folder<br />
2. cd to that folder</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd /folder</div></td></tr></tbody></table></div>
<p>3. Run sphinx-quickstart</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sphinx-quickstart</div></td></tr></tbody></table></div>
<p>4. Generate documentation</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">make html</div></td></tr></tbody></table></div>
<p><strong>Now you may wanna create a PDF out of your documentation:</strong></p>
<p>I&#8217;m using Mac, so you will need to install MacTex (<a href="http://www.tug.org/mactex/">http://www.tug.org/mactex/</a>)</p>
<p>Make sure that /usr/texbin get installed in your PATH, otherwise the make function would not work.</p>
<p>Check is it&#8217;s you path:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">echo $PATH</div></td></tr></tbody></table></div>
<p>If not add it yourself:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">PATH=$PATH\:/usr/texbin</div></td></tr></tbody></table></div>
<p>If using Linux, follow this tutorial: <a href="http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html">http://jimmyg.org/blog/2009/sphinx-pdf-generation-with-latex.html</a></p>
<p>Once this is installed, run</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">make latexpdf</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/sphinx-start-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add custom FTP user on Plesk via command line (SSH)</title>
		<link>http://gpiot.com/add-custom-ftp-user-on-plesk-via-command-line-ssh/</link>
		<comments>http://gpiot.com/add-custom-ftp-user-on-plesk-via-command-line-ssh/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 12:04:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=81</guid>
		<description><![CDATA[Plesk is a great Control Panel in the shared hosting environment, but there are a few things that are not available in the Control Panel. For example, you cannot create additional FTP user in Plesk Control panel for Linux (this [...]]]></description>
			<content:encoded><![CDATA[<p>Plesk is a great Control Panel in  the shared hosting environment, but  there are a few things that are not available in the Control Panel. For  example, you cannot create additional FTP user in Plesk Control panel  for <a id="KonaLink2" href="http://www.webhostingtalk.com/showthread.php?t=494865#" target="undefined"><span style="color: blue;">Linux</span></a> (this support is enabled in Plesk for <a id="KonaLink3" href="http://www.webhostingtalk.com/showthread.php?t=494865#" target="undefined"><span style="color: blue;">windows</span></a>).  But some time it is required to have multiple FTP accounts to upload/<a id="KonaLink4" href="http://www.webhostingtalk.com/showthread.php?t=494865#" target="undefined"><span style="color: blue;">download</span></a> data. You need to have shell access since the Plesk control panel won’t allow it in the GUI.</p>
<p>Assuming you already have an existing domain (example.com) with the  primary FTP user (jack) with password (schmidt) with home directory  (/var/www/vhosts/example.com), and you wish to create additional ftp  users (jill) with the same access privileges as jack to subfolder like  this /var/www/vhosts/example.com/custom_folder (make sure the folder  already exists) or to main folder (/var/www/vhosts/example.com). To do  this follow the instructions below:</p>
<p>1. Login to shell with root access and issue this command:<br />
# id jack<br />
it will show something like that:<br />
# uid=10002(jack) gid=2524(psacln) groups=2524(psacln)</p>
<p>2. remember the uid of jack which is 10002, we will need it later.</p>
<p>3. create user via the command below and use jack&#8217;s uid like this (this will let jill access subfolder):<br />
# /usr/sbin/useradd -u 10002 -o -d /var/www/vhosts/example.com/custom_folder -g psacln -s /bin/false jill</p>
<p>4. create password for jill:<br />
# passwd jill (enter the new password and confirm it, does not have to be the same as jack’s)</p>
<p>You should now be able to use an FTP client to login with that user’s  name and password. This is the only good solution for Plesk for  nowadays.</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/add-custom-ftp-user-on-plesk-via-command-line-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crontab – Quick Reference</title>
		<link>http://gpiot.com/72/</link>
		<comments>http://gpiot.com/72/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 15:51:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=72</guid>
		<description><![CDATA[Useful resource from: http://adminschoice.com/crontab-quick-reference Setting up cron jobs in Unix and Solaris cron is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed [...]]]></description>
			<content:encoded><![CDATA[<p>Useful resource from: <a href="http://adminschoice.com/crontab-quick-reference">http://adminschoice.com/crontab-quick-reference</a></p>
<p><strong>Setting up cron jobs in Unix and Solaris</strong></p>
<p>cron is a unix, solaris utility that allows tasks to be automatically  run in the background at regular intervals by the cron daemon. These  tasks are often termed as cron jobs in unix , solaris.  Crontab (CRON  TABle) is a file which contains the schedule of cron entries to be run  and at specified times.</p>
<p>This document covers following aspects of Unix cron jobs<br />
1. Crontab Restrictions<br />
2. Crontab Commands<br />
3. Crontab file – syntax<br />
4. Crontab Example<br />
5. Crontab Environment<br />
6. Disable Email<br />
7. Generate log file for crontab activity</p>
<p><strong>1. Crontab Restrictions</strong><br />
You can execute crontab if your name appears in the file /usr/lib/cron/cron.allow. If that file does not exist, you can use<br />
crontab if your name does not appear in the file /usr/lib/cron/cron.deny.<br />
If only cron.deny exists and is empty, all users can use crontab. If  neither file exists, only the root user can use crontab. The allow/deny  files consist of one user name per line.</p>
<p><strong>2. Crontab Commands</strong></p>
<p>export EDITOR=vi ;to specify a editor to open crontab file.</p>
<p>crontab -e    Edit your crontab file, or create one if it doesn’t already exist.<br />
crontab -l          Display your crontab file.<br />
crontab -r          Remove your crontab file.<br />
crontab -v          Display the last time you edited your crontab file. (This option is only available on a few systems.)</p>
<p><strong>3. Crontab file</strong><br />
Crontab syntax :<br />
A crontab file has five fields for specifying day , date and time  followed by the command to be run at that interval.</p>
<table id="AutoNumber1" border="0" cellspacing="7" cellpadding="0" width="433" bgcolor="#dbdbdb">
<tbody>
<tr>
<td width="100%">
<pre>*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)</pre>
</td>
</tr>
</tbody>
</table>
<p>* in the value field above means all legal values as in braces for that column.<br />
The value column can have a * or a list of elements separated by commas.  An element is either a number in the ranges shown above or two numbers  in the range separated by a hyphen (meaning an inclusive range).<br />
<strong>Notes</strong><br />
A. ) Repeat pattern like /2  for every 2 minutes or /10 for every 10  minutes is not supported by all operating systems. If you try to use it  and crontab complains it is probably not supported.</p>
<p>B.) The specification of days can be made in two fields: month day  and weekday. If both are specified in an entry, they are cumulative  meaning both of the entries will get executed .</p>
<p><strong>4. Crontab Example</strong><br />
A line in crontab file like below  removes the tmp files from /home/someuser/tmp each day at 6:30 PM.</p>
<p>30      18     *     *     *          rm /home/someuser/tmp/*</p>
<p>Changing the parameter values as below will cause this command to run at different time schedule below :</p>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tbody>
<tr>
<td width="8%" height="13" align="center" bgcolor="#808080">min</td>
<td width="9%" height="13" align="center" bgcolor="#808080">hour</td>
<td width="9%" height="13" align="center" bgcolor="#808080">day/month</td>
<td width="13%" height="13" align="center" bgcolor="#808080">month</td>
<td width="9%" height="13" align="center" bgcolor="#808080">day/week</td>
<td width="66%" height="13" align="left" valign="top" bgcolor="#808080">Execution        time</td>
</tr>
<tr>
<td width="8%" height="38" align="center" bgcolor="#ffffff">30</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">0</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">1</td>
<td width="13%" height="38" align="center" bgcolor="#ffffff">1,6,12</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">*</td>
<td width="66%" height="38" align="left" valign="top" bgcolor="#ffffff">–        00:30 Hrs  on 1st of Jan, June &amp; Dec.</td>
</tr>
<tr>
<td colspan="6" width="114%" height="1" align="center" bgcolor="#dbdbdb"></td>
</tr>
<tr>
<td width="8%" height="38" align="center" bgcolor="#ffffff">0</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">20</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">*</td>
<td width="13%" height="38" align="center" bgcolor="#ffffff">10</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">1-5</td>
<td width="66%" height="38" align="left" valign="top" bgcolor="#ffffff">–8.00        PM every weekday (Mon-Fri) only in Oct.</td>
</tr>
<tr>
<td colspan="6" width="114%" height="2" align="center" bgcolor="#dbdbdb"></td>
</tr>
<tr>
<td width="8%" height="38" align="center" bgcolor="#ffffff">0</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">0</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">1,10,15</td>
<td width="13%" height="38" align="center" bgcolor="#ffffff">*</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">*</td>
<td width="66%" height="38" align="left" valign="top" bgcolor="#ffffff">–        midnight on 1st ,10th &amp; 15th of month</td>
</tr>
<tr>
<td colspan="6" width="114%" height="2" align="center" bgcolor="#dbdbdb"></td>
</tr>
<tr>
<td width="8%" height="38" align="center" bgcolor="#ffffff">5,10</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">0</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">10</td>
<td width="13%" height="38" align="center" bgcolor="#ffffff">*</td>
<td width="9%" height="38" align="center" bgcolor="#ffffff">1</td>
<td width="66%" height="38" align="left" valign="top" bgcolor="#ffffff">–        At 12.05,12.10 every Monday &amp; on 10th of every month</td>
</tr>
<tr>
<td colspan="6" width="114%" height="1" bgcolor="#dbdbdb">:</td>
</tr>
</tbody>
</table>
<p><strong>Note :</strong> If you inadvertently enter the crontab  command with no argument(s), do not attempt to get out with Control-d.  This removes all entries in your crontab file. Instead, exit with  Control-c.</p>
<p><strong>5. Crontab Environment</strong><br />
cron invokes the command from the user’s HOME directory with the shell, (/usr/bin/sh).<br />
cron supplies a default environment for every shell, defining:<br />
HOME=user’s-home-directory<br />
LOGNAME=user’s-login-id<br />
PATH=/usr/bin:/usr/sbin:.<br />
SHELL=/usr/bin/sh</p>
<p>Users who desire to have their .profile executed must explicitly do so in the crontab entry or in a script called by the entry.</p>
<p><strong>6. Disable Email</strong><br />
By default cron jobs sends a email to the user account executing the  cronjob. If this is not needed put the following command At the end of  the cron job line .</p>
<p>&gt;/dev/null 2&gt;&amp;1</p>
<p><strong>7. Generate log file</strong><br />
To collect the cron execution execution log in a file :</p>
<p>30 18  *    *   *    rm /home/someuser/tmp/* &gt; /home/someuser/cronlogs/clean_tmp_dir.log</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/72/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install PHP 5.2 on Centos 5</title>
		<link>http://gpiot.com/install-php-5-2-on-centos-5/</link>
		<comments>http://gpiot.com/install-php-5-2-on-centos-5/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 12:29:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=64</guid>
		<description><![CDATA[Summary This guide describes how to upgrade the standard PHP 5.1.x packages in CentOS 5.x 32-bit to the current development versions 5.2.x. These instructions were created using CentOS 5.3 32-bit and with the following PHP packages installed: # rpm -qa [...]]]></description>
			<content:encoded><![CDATA[<h2 id="head-7a79c4c26d56ec67f7ff8e44140b239159f26750">Summary</h2>
<p>This  guide describes how to upgrade the standard PHP 5.1.x packages in  CentOS 5.x 32-bit to the current development versions 5.2.x. These  instructions were created using CentOS 5.3 32-bit and with the following  PHP packages installed:</p>
<pre># rpm -qa |grep php

 php-common-5.1.6-15.el5.i386
 php-cli-5.1.6-15.el5.i386
 php-5.1.6-15.el5.i386
 php-pdo-5.1.6-15.el5.i386
 php-bcmath-5.1.6-15.el5.i386
 php-ldap-5.1.6-15.el5.i386
 php-devel-5.1.6-15.el5.i386
 php-gd-5.1.6-15.el5.i386
 php-xml-5.1.6-15.el5.i386
 php-mbstring-5.1.6-15.el5.i386
 php-mysql-5.1.6-15.el5.i386
 php-dba-5.1.6-15.el5.i386</pre>
<p>As  long as you&#8217;re using the standard PHP packages on your CentOS server  you won&#8217;t need to do anything extra. If you&#8217;re using extra PHP packages  that aren&#8217;t part of the standard CentOS repositories (like php-mcrypt)  you&#8217;ll have to remove them or find updated versions of them.</p>
<h2 id="head-f3a28eaa2114e3ab40f86cc66f4ca8adb8a8813e">Add the development repositories</h2>
<p>First  thing we need to do is add the development repositories to yum. When we  add the development repository we&#8217;re going to configure it so it only  pulls PHP packages. To start we&#8217;ll need create a new yum repository  configuration file (use your favorite editor):</p>
<pre> # /etc/yum.repos.d/CentOS-Testing.repo</pre>
<p>Copy/paste the following into this file:</p>
<pre>  # CentOS-Testing:
  # !!!! CAUTION !!!!
  # This repository is a proving grounds for packages on their way to CentOSPlus and CentOS Extras.
  # They may or may not replace core CentOS packages, and are not guaranteed to function properly.
  # These packages build and install, but are waiting for feedback from testers as to
  # functionality and stability. Packages in this repository will come and go during the
  # development period, so it should not be left enabled or used on production systems without due
  # consideration.
  [c5-testing]
  name=CentOS-5 Testing
  baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
  enabled=1
  gpgcheck=1
  gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
  includepkgs=php*</pre>
<p>Make sure to remove any spaces at the start of each line, then save and close the file and you&#8217;re done.</p>
<h2 id="head-7c4bda8f0b3ec3430b930030763e6275071f33c5">Update PHP packages</h2>
<p>Before  updating your PHP packages you&#8217;ll want to get a list of what you  currently have installed. To get a list of current PHP packages run the  following:</p>
<pre> # rpm -qa |grep php</pre>
<p>Now you can use yum to update the PHP packages on your system:</p>
<pre> # yum update</pre>
<p>You  should be shown a list of packages that are going to be updated.  Compare it to the list of PHP packages on your system. Note any packages  that are not in the list. You&#8217;ll need to remove these packages or find  updates for them because they won&#8217;t work after you update to PHP 5.2.x.  If that is acceptable type <strong>&#8220;y&#8221;</strong> to continue and let yum update the packages.</p>
<p>Once yum has completed restart Apache:</p>
<pre> # service httpd restart</pre>
<p>To verify the update is working create a simple <em>testing.php</em> in your www directory with the following source code:</p>
<pre>&lt;?php
  phpinfo();
?&gt;</pre>
<p>and open it in a web browser. The new PHP version should be reflected at the top of the page.</p>
<h2 id="head-e4d1265336f4cd7f827ecab6e1dee674a1682616">Conclusion</h2>
<p>You should now have PHP 5.2.6 running on CentOS 5.3 32-bit.</p>
<pre> # rpm -qa |grep php

  php-cli-5.2.6-2.el5s2
  php-mbstring-5.2.6-2.el5s2
  php-devel-5.2.6-2.el5s2
  php-pdo-5.2.6-2.el5s2
  php-gd-5.2.6-2.el5s2
  php-dba-5.2.6-2.el5s2
  php-common-5.2.6-2.el5s2
  php-bcmath-5.2.6-2.el5s2
  php-xml-5.2.6-2.el5s2
  php-pear-1.5.1-2.el5s2
  php-ldap-5.2.6-2.el5s2
  php-5.2.6-2.el5s2
  php-mysql-5.2.6-2.el5s2

 # php -v

  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
  Copyright (c) 1997-2008 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies</pre>
<p>Note: If your <em><strong>&#8220;php -v&#8221;</strong></em> output returns errors about <em>PDO</em> or <em>JSON</em> <a href="http://wiki.centos.org/HowTos/PHP_5.1_To_5.2#PDO_JSON_Error">click here</a></p>
<h2 id="head-ef0150910dfa751fe87d169da5db9567201baa21">Extras</h2>
<h3 id="head-fe084db340a72a9b7b7fca8fcba57ef4e9a34485">Updating/Installing mcrypt</h3>
<p>If you have php-mcrypt for PHP 5.1.x installed you&#8217;ll want to remove it:</p>
<p><strong>Note:</strong> Your version number maybe different. Alter below command accordingly.</p>
<pre> rpm -e php-mcrypt-5.1.6-15.el5.centos.1</pre>
<p>Download php-mcrypt for PHP 5.2.x and install it. You can find a 32-bit php-mcrypt package here <a href="http://redhatjunkies.com/index.php/PHP">FedoraJunkies</a>.</p>
<p><strong>Note:</strong> You&#8217;ll notice the <strong>&#8220;&#8211;nodeps&#8221;</strong> flag in the example. When you try to install php-mcrypt without it you get an error that <em>php-common-5.2.6-2.el5s2</em> is missing even though it is installed.</p>
<pre> wget -c http://sourcemirrors.org/scotth/centos/5/php/php-mcrypt-5.2.6-2.i386.rpm
 rpm -i --nodeps php-mcrypt-5.2.6-2.i386.rpm</pre>
<p>Restart Apache and you should now see mcrypt information on your <em>testing.php</em> page.</p>
<h3 id="head-641f26b3f10bbc70e14b6092fc0ef5592d056b44">JSON and PDO being loaded twice</h3>
<p>When you run the command <strong>&#8220;php -v&#8221;</strong> you might see the following errors:</p>
<pre> # php -v

  PHP Warning:  Module 'json' already loaded in Unknown on line 0
  PHP Warning:  Module 'PDO' already loaded in Unknown on line 0
  PHP 5.2.6 (cli) (built: Sep 15 2008 20:42:05)
  Copyright (c) 1997-2008 The PHP Group
  Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies</pre>
<p>This is caused by the following two lines in the <em>/etc/php.ini</em> file:</p>
<pre>; Extension JSON
extension=json.so

; Extension PDO
extension=pdo.so</pre>
<p>Comment out these lines by adding a <em><strong>&#8220;;&#8221;</strong></em><strong> </strong> in front of <em><strong>&#8220;extension=&#8221;</strong></em>. These two modules are already loaded via these two files:</p>
<pre>/etc/php.d/json.ini
/etc/php.d/pdo.ini</pre>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/install-php-5-2-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux: search for string in files from command line</title>
		<link>http://gpiot.com/linux-search-for-string-in-files-from-command-line/</link>
		<comments>http://gpiot.com/linux-search-for-string-in-files-from-command-line/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 11:49:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cheat sheet]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://localhost/devblog/?p=43</guid>
		<description><![CDATA[grep -H -r &#8220;string to find&#8221; /folder/where/you/want/to/search]]></description>
			<content:encoded><![CDATA[<p>grep -H -r &#8220;string to find&#8221; /folder/where/you/want/to/search</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/linux-search-for-string-in-files-from-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
