<?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/"
	>

<channel>
	<title>Juraj Seffer &#124; Playground</title>
	<atom:link href="http://jurajsplayground.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jurajsplayground.com</link>
	<description>Web development trinkets, articles about LAMP development, productivity tools and every day struggles</description>
	<pubDate>Sun, 05 Dec 2010 16:56:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Compiz performance problem - Ubuntu Lucid Lynx 10.04</title>
		<link>http://jurajsplayground.com/2010/05/08/compiz-performance-problem-ubuntu-lucid-lynx-1004/</link>
		<comments>http://jurajsplayground.com/2010/05/08/compiz-performance-problem-ubuntu-lucid-lynx-1004/#comments</comments>
		<pubDate>Sat, 08 May 2010 13:17:03 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=250</guid>
		<description><![CDATA[On 5th May 2010, there was an update to &#8220;libgnome-window-settings1&#8221; and related packages (&#8221;capplets-data&#8221; &#38; &#8220;gnome-control-center&#8221;). This caused terrible compiz performance (CPU often spiking to 80%). Workaround is to downgrade to the previous version, I also recommend locking the version via Synaptic/Aptitude for the time being.
Workaround - downgrading the package:
aptitude install libgnome-window-settings1=1:2.30.0-0ubuntu4
Launchpad bug: https://bugs.launchpad.net/bugs/576604
]]></description>
			<content:encoded><![CDATA[<p>On 5th May 2010, there was an update to &#8220;<a href="http://packages.ubuntu.com/lucid/libgnome-window-settings1">libgnome-window-settings1</a>&#8221; and related packages (&#8221;capplets-data&#8221; &amp; &#8220;gnome-control-center&#8221;). This caused terrible compiz performance (CPU often spiking to 80%). Workaround is to downgrade to the previous version, I also recommend locking the version via Synaptic/Aptitude for the time being.</p>
<p>Workaround - downgrading the package:</p>
<pre><strong>aptitude install libgnome-window-settings1=1:2.30.0-0ubuntu4</strong></pre>
<p>Launchpad bug: <a href="https://bugs.launchpad.net/bugs/576604">https://bugs.launchpad.net/bugs/576604</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2010/05/08/compiz-performance-problem-ubuntu-lucid-lynx-1004/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Zend Framework &#038; Smarty with Zend view helpers</title>
		<link>http://jurajsplayground.com/2010/04/04/zend-framework-smarty-with-zend-view-helpers/</link>
		<comments>http://jurajsplayground.com/2010/04/04/zend-framework-smarty-with-zend-view-helpers/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:40:54 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=213</guid>
		<description><![CDATA[If you wish to use Smarty templating engine together with Zend Framework, the following will give you an idea how it can be accomplished.
1. Download Smarty class that extends Zend_View_Abstract
Download Smarty class
Zend Framework is located in its default location: project/library/Zend
Smarty should be located in project/library/Smarty
2. Define smarty and view variables in your application config:
smarty.compile_dir = [...]]]></description>
			<content:encoded><![CDATA[<p>If you wish to use <a href="http://www.smarty.net">Smarty</a> templating engine together with <a href="http://framework.zend.com/">Zend Framework</a>, the following will give you an idea how it can be accomplished.</p>
<h3><strong>1. <a href="http://www.jurajsplayground.com/blog/wp-content/uploads/2010/04/jazz_view_smartyphp.txt">Download Smarty class</a> that extends Zend_View_Abstract</strong></h3>
<p><a href="http://www.jurajsplayground.com/wp-content/uploads/2010/04/jazz_view_smartyphp.phps">Download Smarty class</a></p>
<p>Zend Framework is located in its default location: project/library/Zend<br />
Smarty should be located in project/library/Smarty</p>
<h3><strong>2. Define smarty and view variables in your application config:</strong></h3>
<pre>smarty.compile_dir = APPLICATION_PATH "/storage/smarty/compiled"
smarty.cache_dir = APPLICATION_PATH "/storage/smarty/cache"
smarty.template_dir = APPLICATION "views/templates/"
smarty.config_dir = APPLICATION "views/config/"
smarty.layout_dir = APPLICATION "views/layouts/"
app.encoding = "ISO-8859-1"</pre>
<h3><strong>3. Initialise the view in your bootstrap class, e.g. _initView() method:</strong></h3>
<pre>protected function _initView() {

/* Create view object, assign paths and disable checking of templates if in production */
$view = new Jazz_View_Smarty($this-&gt;_appConfig-&gt;smarty-&gt;template_dir, array(
  'cache_dir' =&gt; $this-&gt;_appConfig-&gt;smarty-&gt;cache_dir,
  'compile_dir' =&gt; $this-&gt;_appConfig-&gt;smarty-&gt;compile_dir,
  'config_dir' =&gt; $this-&gt;_appConfig-&gt;smarty-&gt;config_dir,
  'compile_check' =&gt; APPLICATION_ENV == 'production' ? FALSE : TRUE
));

/* Set correct encoding - omitting may cause problems with forms etc. */
$view-&gt;setEncoding($this-&gt;_appConfig-&gt;app-&gt;encoding);

/*
  Zend view helpers will become available as $zendView-&gt; in smarty templates
  Examples: {$zendView-&gt;headLink()} {$zendView-&gt;headScript()}
*/
$view-&gt;assign('zendView', $view);

/* Notify the view helper */
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')
  -&gt;setView($view)
  -&gt;setViewScriptPathSpec(':controller/:action.:suffix')
  -&gt;setViewScriptPathNoControllerSpec(':action.:suffix')
  -&gt;setViewSuffix(Jazz_View_Smarty::TEMPLATE_EXTENSION);

}</pre>
<p><strong>If you use Zend_Layout, you can pass the view into it:</strong></p>
<pre>Zend_Layout::startMvc(array(
    'layout' =&gt; 'default_layout_template_name',
    'view' =&gt; $view,
    'viewSuffix' =&gt; Jazz_View_Smarty::TEMPLATE_EXTENSION)
  )
  -&gt;setInflectorTarget('layouts_path/:script.:suffix');</pre>
<h3><strong>4. Use the view in your controller as usual:</strong></h3>
<pre>public function indexAction() {
  $this-&gt;view-&gt;someVariable = array('one', 'two', 'three');</pre>
<pre>}</pre>
<p>This becomes</p>
<pre>{$someVariable}</pre>
<p>in Smarty templates</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2010/04/04/zend-framework-smarty-with-zend-view-helpers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fixing Plymouth in Ubuntu 10.04 Lucid Lynx (server)</title>
		<link>http://jurajsplayground.com/2010/04/02/fixing-plymouth-in-ubuntu-1004-lucid-lynx-server/</link>
		<comments>http://jurajsplayground.com/2010/04/02/fixing-plymouth-in-ubuntu-1004-lucid-lynx-server/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 16:35:20 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=210</guid>
		<description><![CDATA[Some time during the upgrades, Plymouth got broken. It seems that the theme got removed and so I was not getting a graphical interface and it also kept generating some warnings during updates such as:
grep: /lib/plymouth/themes/text.plymouth: No such file or directory
grep: /lib/plymouth/themes/default.plymouth: No such file or directory
Installing the following two packages fixed it for me:
sudo [...]]]></description>
			<content:encoded><![CDATA[<p>Some time during the upgrades, <a href="http://packages.ubuntu.com/lucid/plymouth">Plymouth</a> got broken. It seems that the theme got removed and so I was not getting a graphical interface and it also kept generating some warnings during updates such as:</p>
<p>grep: /lib/plymouth/themes/text.plymouth: No such file or directory<br />
grep: /lib/plymouth/themes/default.plymouth: No such file or directory</p>
<p>Installing the following two packages fixed it for me:</p>
<p><strong>sudo apt-get install plymouth-theme-ubuntu-logo<br />
sudo apt-get install plymouth-theme-text</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2010/04/02/fixing-plymouth-in-ubuntu-1004-lucid-lynx-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Postfix relay setup in 5 minutes (Ubuntu)</title>
		<link>http://jurajsplayground.com/2010/03/17/postfix-relay-setup-in-5-minutes-ubuntu/</link>
		<comments>http://jurajsplayground.com/2010/03/17/postfix-relay-setup-in-5-minutes-ubuntu/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 20:06:18 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=202</guid>
		<description><![CDATA[The following procedure will install and set up postfix and use another mail server to relay emails. Tested on Ubuntu 10.04 (Lucid Lynx).
sudo su
apt-get install postfix
Choose &#8220;satellite/smarthost&#8221; type, all emails will be relayed to another mail server
cd /etc/postfix
vim main.cf
Add:
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
vim sasl_passwd
Add:
relay.server.com user@name:password
chmod 600 sasl_passwd
postmap /etc/postfix/sasl_passwd
service postfix restart
sendmail email@domain.com
Type:
Hello!
.
Read postfix documentation in [...]]]></description>
			<content:encoded><![CDATA[<p>The following procedure will install and set up postfix and use another mail server to relay emails. Tested on Ubuntu 10.04 (Lucid Lynx).</p>
<p><strong>sudo su</strong></p>
<p><strong>apt-get install postfix</strong><br />
<em>Choose &#8220;satellite/smarthost&#8221; type, all emails will be relayed to another mail server</em></p>
<p><strong>cd /etc/postfix</strong></p>
<p><strong>vim main.cf</strong><br />
<em>Add:</em><br />
smtp_sasl_auth_enable = yes<br />
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd<br />
smtp_sasl_security_options =</p>
<p><strong>vim sasl_passwd</strong><br />
<em>Add:</em><br />
relay.server.com user@name:password</p>
<p><strong>chmod 600 sasl_passwd</strong></p>
<p><strong>postmap /etc/postfix/sasl_passwd</strong></p>
<p><strong>service postfix restart</strong></p>
<p><strong>sendmail email@domain.com</strong><br />
<em>Type:</em><br />
Hello!<br />
.</p>
<p>Read postfix documentation in order to make your installation more secure.</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2010/03/17/postfix-relay-setup-in-5-minutes-ubuntu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing PHP4 &#038; Apache2.2 from source (Ubuntu 9.04 Jaunty Server)</title>
		<link>http://jurajsplayground.com/2009/05/16/installing-php4-apache22-from-source-ubuntu-904-jaunty-server/</link>
		<comments>http://jurajsplayground.com/2009/05/16/installing-php4-apache22-from-source-ubuntu-904-jaunty-server/#comments</comments>
		<pubDate>Sat, 16 May 2009 12:23:07 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=133</guid>
		<description><![CDATA[I had to install PHP4 on a server in order to a test an application that will run under PHP4. Being a fan of Ubuntu, I chose Ubuntu 9.04 Jaunty Server edition as OS.
At first, I tried to install Apache using apt but subsequent compiling of PHP failed, perhaps due to different location of apache [...]]]></description>
			<content:encoded><![CDATA[<p>I had to install PHP4 on a server in order to a test an application that will run under PHP4. Being a fan of Ubuntu, I chose Ubuntu 9.04 Jaunty Server edition as OS.</p>
<p>At first, I tried to install Apache using apt but subsequent compiling of PHP failed, perhaps due to different location of apache installation when using apt. Possibly, this can be fixed with some directives where to find certain Apache modules etc.</p>
<p>I then decided to install both latest Apache 2.2x and latest PHP4 (4.4.9) from scratch - compiling it. The process is quite simple as outlined on (<a href="http://www.php.net/manual/en/install.unix.apache2.php">php.net website</a>):</p>
<ol>
<li>make yourself root<br />
<code>sudo su</code></li>
<li>download both, <a href="http://httpd.apache.org/download.cgi">Apache 2.2</a>, <a href="http://uk3.php.net/get/php-4.4.9.tar.bz2/from/a/mirror">PHP4</a></li>
<li>decompress as necessary<br />
<code>gunzip filename.gz</code><br />
or<br />
<code>tar -xvf filename.tar</code></li>
<li>install &#8220;flex&#8221; and &#8220;bison&#8221;<br />
<code>apt-get install flex<br />
apt-get install bison</code></li>
<li>configure Apache<br />
<code>cd httpxx<br />
./configure --enable-so</code></li>
<li>install make if missing<br />
<code>apt-get install make</code></li>
<li>compile Apache<br />
<code>make<br />
make install</code></li>
<li>install apache2-threaded-dev<br />
<code>apt-get install apache2-threaded-dev</code></li>
<li>Configure PHP<br />
<code>./configure --with-apxs2=/usr/bin/apxs2 --with-mysql</code><br />
Please note this is the minimal configuration including mysql libraries, if you need more modules, you need to add them.</p>
<p>If config fails because of missing libicu, install it using:<br />
<code>apt-get install libicu-dev</code><br />
If you get xml2-config error message, install:<br />
<code>apt-get install libxml2-dev</code></li>
<li>Compile PHP<br />
<code>make<br />
make install</code></li>
<li>Copy over default php.ini, amend as necessary and add handler for php files to Apache config file (if necessary).</li>
<li>You can also modify default index page to include index.php.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/05/16/installing-php4-apache22-from-source-ubuntu-904-jaunty-server/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fetching of emails from a POP3 server and serving via IMAP (Ubuntu)</title>
		<link>http://jurajsplayground.com/2009/04/19/fetching-of-emails-from-a-pop3-server-and-serving-via-imap-ubuntu/</link>
		<comments>http://jurajsplayground.com/2009/04/19/fetching-of-emails-from-a-pop3-server-and-serving-via-imap-ubuntu/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 21:50:06 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=115</guid>
		<description><![CDATA[One of the servers from which I download emails regularly doesn&#8217;t provide IMAP access. The obvious solution seemed to be install my own IMAP server and fetch emails from the original server via POP3.
After a brief research, I&#8217;ve decided to install Dovecot and getmail to accomplish the above.
First step was to install Dovecot:
sudo apt-get install [...]]]></description>
			<content:encoded><![CDATA[<p>One of the servers from which I download emails regularly doesn&#8217;t provide IMAP access. The obvious solution seemed to be install my own IMAP server and fetch emails from the original server via POP3.</p>
<p>After a brief research, I&#8217;ve decided to install <a href="http://ww.dovecot.org">Dovecot</a> and <a href="http://pyropus.ca/software/getmail/">getmail</a> to accomplish the above.</p>
<p>First step was to install Dovecot:</p>
<p><code>sudo apt-get install dovecot-imapd</code></p>
<p>Then I followed <a href="http://wiki.dovecot.org/BasicConfiguration">instructions from Dovecot website</a>, set the location of <a href="http://wiki.dovecot.org/MailLocation">IMAP mail directories</a> and configured it to use <a href="http://wiki.dovecot.org/SSL/DovecotConfiguration">SSL connections</a> only. I have also modified standard port in /etc/dovecot/dovecot.conf from 993 to a different one:</p>
<p><code>protocol imap {<br />
ssl_listen = *:7777<br />
}</code></p>
<p>Restarted Dovecot</p>
<p><code>sudo /etc/init.d/dovecot restart</code></p>
<p>and tested my first IMAP account using Thunderbird. As the SSL certificate I used on the server was self-signed, Thunderbird complained about it but that can be ignored and SSL certificate saved.</p>
<p>After that, I installed getmail:</p>
<p><code>sudo apt-get install getmail4</code></p>
<p>For each mailbox I wanted to download from a POP3 server, I defined a separate config file for getmail:</p>
<p><code>[retriever]<br />
type = SimplePOP3Retriever<br />
server = mailserver<br />
username = user<br />
password = pass<br />
</code><code><br />
[destination]<br />
type = Maildir<br />
path = ~/Maildir/<br />
</code></p>
<p>Note that emails will be saved into Maildir directory within home directory of a particular user. Maildir is also the format in which emails will be saved. This configuration works nicely with Dovecot when serving emails.</p>
<p>The last step was to set up a cron job to fetch emails from POP3 and save them into IMAP folder:</p>
<p><code>crontab -e<br />
* * * * * getmail -d >> getmail.log<br />
</code></p>
<p>where &#8220;-d&#8221; means it will delete messages from the server after downloading them.</p>
<p>getmail can also load multiple config files at once, so if you have more then one account to fetch:</p>
<p><code>getmail -d -r configfile1 -r configfile2</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/04/19/fetching-of-emails-from-a-pop3-server-and-serving-via-imap-ubuntu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP Magic Methods - enforce defining of class properties</title>
		<link>http://jurajsplayground.com/2009/04/10/php-magic-methods-enforce-defining-of-class-properties/</link>
		<comments>http://jurajsplayground.com/2009/04/10/php-magic-methods-enforce-defining-of-class-properties/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 16:53:23 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[getter]]></category>

		<category><![CDATA[magic methods]]></category>

		<category><![CDATA[objects]]></category>

		<category><![CDATA[setter]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=68</guid>
		<description><![CDATA[Sometimes it&#8217;s desirable to have a control over which properties can be assigned to an object. Typo mistakes, duplicating of property names, among others, are the commons pitfalls of PHP&#8217;s ability to set/get properties without defining them in a class.
The MagicMethods class enforces that class properties are defined in a class before we can set [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s desirable to have a control over which properties can be assigned to an object. Typo mistakes, duplicating of property names, among others, are the commons pitfalls of PHP&#8217;s ability to set/get properties without defining them in a class.</p>
<p>The MagicMethods class enforces that class properties are defined in a class before we can set or get their values. Any class that extends this class will benefit from this behavior (unless magic method get overridden in the exteding class). If a getter or setter method is needed to manipulate a property, MagicMethod class will use these instead of directly accessing the value.</p>
<p>This functionality is especially handy for value objects or config classes.</p>
<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ConfigMagic <span style="color: #000000; font-weight: bold;">extends</span> MagicMethods_Abstract
<span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// note $name is protected, not private, so that MagicMethods_Abstract can access it</span>
  protected <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
     <span style="color: #666666; font-style: italic;">// provides more complex way of getting a variable</span>
     <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> setName<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// provides more complex way of setting a variable</span>
   <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ConfigMagic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name <span style="color: #339933;">=</span> <span style="color: #0000ff;">'magic'</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// string 'magic' (length=5)</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// true</span>
<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// false</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Exception: Cannot set property 'nonExisting'. Not defined in class ConfigMagic ...</span>
<span style="color: #000088;">$config</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>nonExisting <span style="color: #339933;">=</span> <span style="color: #0000ff;">'magic'</span><span style="color: #339933;">;</span></pre></div></div>

<p>Download the files:<br />
<a href="http://www.jurajsplayground.com/wp-content/uploads/2009/04/magicmethods_abstract.php.txt">MagicMethods_Abstract.php</a><br />
<a href="http://www.jurajsplayground.com/wp-content/uploads/2009/04/magicmethodsexception.php.txt">MagicMethodsException.php</a></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #009933; font-style: italic;">/**
 * Magic Methods
 * Provides magic methods for other classes, enforces property names.
 * Undefined property name throws an exception
 *
 * @package DAO
 * @uses MagicMethodsException
 * @example MyOwnClass extends MagicMethods_Abstract
 * @license Free to use and modify (including commercial use)
 * @see http://php.net/manual/en/language.oop5.magic.php
 * @author Juraj Seffer 
 * @copyright 2009, Juraj Seffer
 * @version $Id$
 * @access public
 */</span>
abstract <span style="color: #000000; font-weight: bold;">class</span> MagicMethods_Abstract
<span style="color: #009900;">&#123;</span>
  <span style="color: #009933; font-style: italic;">/**
   * Magic getter
   *
   * @param string $property
   * @access protected
   * @return mixed
   */</span>
  protected <span style="color: #000000; font-weight: bold;">function</span> __get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$getterMethod</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;get&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">method_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$getterMethod</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;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$getterMethod</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      throw <span style="color: #000000; font-weight: bold;">new</span> MagicMethodsException<span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;Cannot get property '<span style="color: #006699; font-weight: bold;">$property</span>'. Not defined in class &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$property</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Magic setter
   *
   * @param string $property
   * @param mixed $value
   * @access protected
   * @return void
   */</span>
  protected <span style="color: #000000; font-weight: bold;">function</span> __set<span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$setterMethod</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;set&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtoupper</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">method_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$setterMethod</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;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$setterMethod</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      throw <span style="color: #000000; font-weight: bold;">new</span> MagicMethodsException<span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;Cannot set property '<span style="color: #006699; font-weight: bold;">$property</span>'. Not defined in class &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$property</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Magic isset
   *
   * @param string $property
   * @access protected
   * @return mixed
   */</span>
  protected <span style="color: #000000; font-weight: bold;">function</span> __isset<span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</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: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      throw <span style="color: #000000; font-weight: bold;">new</span> MagicMethodsException<span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;Property '<span style="color: #006699; font-weight: bold;">$property</span>' not defined in class &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #b1b100;">return</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #009933; font-style: italic;">/**
   * Magic unset
   *
   * @param string $property
   * @access protected
   * @return void
   */</span>
  protected <span style="color: #000000; font-weight: bold;">function</span> __unset<span style="color: #009900;">&#40;</span><span style="color: #000088;">$property</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: #339933;">!</span>property_exists<span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #000088;">$property</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      throw <span style="color: #000000; font-weight: bold;">new</span> MagicMethodsException<span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">&quot;Property '<span style="color: #006699; font-weight: bold;">$property</span>' not defined in class &quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span>
      <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$property</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"> <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>copyright <span style="color: #cc66cc;">2009</span><span style="color: #339933;">,</span> Juraj Seffer
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>version <span style="color: #000088;">$Id</span>$
 <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>access <span style="color: #000000; font-weight: bold;">public</span>
 <span style="color: #339933;">*/</span>
<span style="color: #000000; font-weight: bold;">class</span> MagicMethodsException <span style="color: #000000; font-weight: bold;">extends</span> Exception
<span style="color: #009900;">&#123;</span>
  <span style="color: #009933; font-style: italic;">/**
   * Constructor
   *
   * @param string $exception
   * @access public
   * @return void
   */</span>
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$exception</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    throw <span style="color: #000000; font-weight: bold;">new</span> Exception<span style="color: #009900;">&#40;</span><span style="color: #000088;">$exception</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/04/10/php-magic-methods-enforce-defining-of-class-properties/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Forwarding of ports via SSH - multiple hops</title>
		<link>http://jurajsplayground.com/2009/04/04/forwarding-of-ports-via-ssh-multiple-hops/</link>
		<comments>http://jurajsplayground.com/2009/04/04/forwarding-of-ports-via-ssh-multiple-hops/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 17:46:40 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=64</guid>
		<description><![CDATA[So you have a server to which you can&#8217;t connect directly because it&#8217;s behind a firewall? Or even two firewalls/computers ?
In my example, I wanted to set up port forwarding of port 80 from server via pc1 and gateway to pc2.
First thing is to connect from pc2 to gateway
ssh user@gateway
Then when logged into gateway, map [...]]]></description>
			<content:encoded><![CDATA[<p>So you have a server to which you can&#8217;t connect directly because it&#8217;s behind a firewall? Or even two firewalls/computers ?</p>
<p>In my example, I wanted to set up port forwarding of port 80 from <strong>server</strong> via <strong>pc1</strong> and <strong>gateway</strong> to <strong>pc2</strong>.</p>
<p>First thing is to connect from <strong>pc2</strong> to <strong>gateway</strong><br />
<code>ssh user@gateway</code></p>
<p>Then when logged into <strong>gateway</strong>, map port 80 of <strong>server</strong> via <strong>pc1</strong><br />
<code>ssh -N -L8888:server:80 user@pc1</code></p>
<p>Last step is to forward port from <strong>gateway</strong> to <strong>cp2</strong><br />
<code>ssh -N -L8888:localhost:8888 user@gateway</code></p>
<p>Note that port number 8888 is random, you can use any open port. You can also fork any of the above commands to the background using &#8220;-f&#8221; option, e.g:<br />
<code>ssh -f -N -L8888:localhost:8888 user@gateway</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/04/04/forwarding-of-ports-via-ssh-multiple-hops/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java applets Ubuntu 8.10 64bit</title>
		<link>http://jurajsplayground.com/2009/03/19/java-applets-ubuntu-810-64bit/</link>
		<comments>http://jurajsplayground.com/2009/03/19/java-applets-ubuntu-810-64bit/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:44:55 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=58</guid>
		<description><![CDATA[The following made Java applets work in Firefox 3 on Ubuntu 8.10 64bit:
sudo apt-get install icedtea6-plugin openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib
]]></description>
			<content:encoded><![CDATA[<p>The following made Java applets work in Firefox 3 on Ubuntu 8.10 64bit:</p>
<p><code>sudo apt-get install icedtea6-plugin openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/03/19/java-applets-ubuntu-810-64bit/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gnome / Nautilus hangs?</title>
		<link>http://jurajsplayground.com/2009/03/10/gnomenautilus-hangs/</link>
		<comments>http://jurajsplayground.com/2009/03/10/gnomenautilus-hangs/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:23:11 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=56</guid>
		<description><![CDATA[I had a problem with Gnome starting late and hanging while Nautilus would start but would not show. It turned out to be one of the bookmarks in Nautilus causing both of them to hang. This is the file where Nautilus&#8217; bookmarks are kept (Ubuntu 8.10):
~/.gtk-bookmarks
This problem can be also caused by an unresponsive samba [...]]]></description>
			<content:encoded><![CDATA[<p>I had a problem with Gnome starting late and hanging while Nautilus would start but would not show. It turned out to be one of the bookmarks in Nautilus causing both of them to hang. This is the file where Nautilus&#8217; bookmarks are kept (Ubuntu 8.10):</p>
<p>~/.gtk-bookmarks</p>
<p>This problem can be also caused by an unresponsive samba share mounted to your filesystem.</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/03/10/gnomenautilus-hangs/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Default terminal size in Ubuntu</title>
		<link>http://jurajsplayground.com/2009/03/08/default-terminal-size-in-ubuntu/</link>
		<comments>http://jurajsplayground.com/2009/03/08/default-terminal-size-in-ubuntu/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 00:22:22 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=54</guid>
		<description><![CDATA[Too small for you?
sudo gedit /usr/share/vte/termcap/xterm
and replace :co#80:it#8:li#24:\ with say :co#180:it#8:li#30:\
That will give you 180&#215;30
]]></description>
			<content:encoded><![CDATA[<p>Too small for you?<br />
<code>sudo gedit /usr/share/vte/termcap/xterm</code><br />
and replace <strong>:co#80:it#8:li#24:\</strong> with say <strong>:co#180:it#8:li#30:\</strong><br />
That will give you 180&#215;30</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/03/08/default-terminal-size-in-ubuntu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Conky!</title>
		<link>http://jurajsplayground.com/2009/03/01/conky/</link>
		<comments>http://jurajsplayground.com/2009/03/01/conky/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 00:57:27 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=35</guid>
		<description><![CDATA[Stumbled upon this lovely monitor today.
Conky is a free, light-weight system monitor for X, that displays any information on your desktop.
Here is a screenshot of my configuration:

To get the same:
$ sudo apt-get install conky
$ vi .conkyrc
paste the contents of this conky config:
&#8230; save the file, download and extract this archive into your home directory (cd [...]]]></description>
			<content:encoded><![CDATA[<p>Stumbled upon this lovely monitor today.</p>
<blockquote><p>Conky is a <strong>free, light-weight system monitor for X</strong>, that displays any information on your desktop.</p></blockquote>
<p>Here is a screenshot of my configuration:</p>
<p style="text-align: center;"><a href="http://www.jurajsplayground.com/wp-content/uploads/2009/03/conky.png"><img class="aligncenter size-full wp-image-36" title="conky" src="http://www.jurajsplayground.com/wp-content/uploads/2009/03/conky.png" alt="conky" /></a></p>
<p>To get the same:</p>
<p><code>$ sudo apt-get install conky<br />
$ vi .conkyrc</code></p>
<p>paste the contents of this <a href="http://www.jurajsplayground.com/wp-content/uploads/2009/03/conkyconfig.txt">conky config</a>:</p>
<p>&#8230; save the file, download and extract <a href="http://www.jurajsplayground.com/wp-content/uploads/2009/03/conky.zip">this archive</a> into your home directory (cd ~) and run</p>
<p><code>$ conky</code></p>
<p>Please note that I have removed CPUs 2-4 from the config to make it more compatible with single processor systems. <a href="http://conky.sourceforge.net/variables.html" target="_blank">Full list of Conky variables</a>.</p>
<p>If you wish to monitor a remote Ubuntu computer and display conky&#8217;s output on your desktop:</p>
<p><code>$ scp .conkyrc scp username@remoteserver:<br />
$ ssh -X username@remoteserver<br />
$ sudo apt-get install conky<br />
$ conky</code></p>
<p>UPDATE: If your server doesn&#8217;t have Xorg installed (which most don&#8217;t), you can use {execi} to issue commands over ssh and grep the info you need. The below part of conkyrc is based on a Ubuntu Jaunty server, your distribution may vary in where some of the details are stored.<br />
${voffset 30}<br />
${execi 43200 ssh vds hostname} ${hr 2}<br />
${voffset 2}${font OpenLogos:size=16}u${font}   Kernel:  ${alignr}${execi 43200 ssh vds uname -r}<br />
${execi 43200 ssh vds less /proc/cpuinfo | head -n 5 | tail -n 1 | cut -d @ -f 2 | cut -c 2-} ${alignr}Load: ${execi 60 ssh vds uptime |cut -d , -f 4- | cut -c 17-}<br />
${execibar 60 ssh vds bash ~/cpuload.sh}<br />
${execigraph 60 ssh vds bash ~/cpuload.sh}<br />
${font StyleBats:size=16}q${font}   Uptime: ${alignr}${execi 60 ssh vds uptime |cut -d , -f 1 | cut -c 2-}<br />
${font StyleBats:size=16}q${font}   Users logged in: ${alignr}${execi 60 ssh vds w | head -n 1 | cut -d \  -f 7- | cut -d \, -f1}</p>
<p>HD ${hr 2}<br />
${execi 600 ssh vds df -h | head -n2 | tail -n1 | cut -c 24-}<br />
${voffset 4}${execibar 600 ssh vds df -h | head -n2 | tail -n1 | cut -c 41-42}</p>
<p>NETWORK ${hr 2}<br />
${voffset 4}${font PizzaDude Bullets:size=14}N${font}   Download: ${alignr}${execi 600 ssh vds ifconfig | head -n 8 | tail -n 1 | cut -d \( -f 2 | cut -d \) -f 1}<br />
${voffset 4}${font PizzaDude Bullets:size=14}T${font}   Upload: ${alignr}${execi 600 ssh vds ifconfig | head -n 8 | tail -n 1 | cut -d \( -f 3 | cut -d \) -f 1}<br />
${voffset 4}${font PizzaDude Bullets:size=14}b${font}   Public IP: ${alignr}${execi 43200 ssh vds ifconfig | head -n 2 | tail -n 1 | cut -c 21- | cut -d \  -f 1}</p>
<p>TOP: ${hr 2}<br />
${voffset 4}${execi 60 ssh vds ps -eo pcpu,pid,user,args | sort -k 1 -r | head -5}</p>
<p>Note that if you run both local and remote conky, you may need to amend conky&#8217;s position on the remote server in .conkyrc so they won&#8217;t overlap.</p>
<p>To start conky from a remote computer and have it displayed on yours, create this as a .sh script and run:</p>
<p><code>ssh -X username@remoteserver 'conky'</code></p>
<p>And finally, if you wish to start conky automatically after your log in, create a bash script with the following and add it into your Ubuntu start up programs:</p>
<p><code>#!/bin/bash<br />
sleep 20 &amp;&amp; conky;</code></p>
<p>Halting it for 20 seconds prevents compiz from applying border and drop down shadows etc. to conky&#8217;s window.</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/03/01/conky/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Need drive space? Look into root&#8217;s Trash</title>
		<link>http://jurajsplayground.com/2009/02/27/need-drive-space-look-into-root-trash/</link>
		<comments>http://jurajsplayground.com/2009/02/27/need-drive-space-look-into-root-trash/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 19:36:56 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=29</guid>
		<description><![CDATA[I came across files stored in /root/.local/share/Trash/files that were taking quite a lot of space. I presume this were deleted during various installations/updates and command line deletions (as root).
To delete root&#8217;s Trash files, type in terminal:
$sudo su
$ cd /root/.local/share/Trash/
$ rm -f files
]]></description>
			<content:encoded><![CDATA[<p>I came across files stored in /root/.local/share/Trash/files that were taking quite a lot of space. I presume this were deleted during various installations/updates and command line deletions (as root).</p>
<p>To delete root&#8217;s Trash files, type in terminal:</p>
<p><code>$sudo su<br />
$ cd /root/.local/share/Trash/<br />
$ rm -f files</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/02/27/need-drive-space-look-into-root-trash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Running a script after log off in Ubuntu</title>
		<link>http://jurajsplayground.com/2009/02/24/running-a-script-after-log-off-in-ubuntu/</link>
		<comments>http://jurajsplayground.com/2009/02/24/running-a-script-after-log-off-in-ubuntu/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 20:59:16 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=24</guid>
		<description><![CDATA[Perhaps bit of a hack I but could not find another way of unmounting Samba shares automatically before my user session ends. If I do not unmount them myself, they would stay mounted after network manager has shutdown making Ubuntu hang. So to overcome this problem, I&#8217;ve done the following:
$ cd /etc/gdm/PostSession
$ sudo vi Default
add [...]]]></description>
			<content:encoded><![CDATA[<p>Perhaps bit of a hack I but could not find another way of unmounting Samba shares automatically before my user session ends. If I do not unmount them myself, they would stay mounted after network manager has shutdown making Ubuntu hang. So to overcome this problem, I&#8217;ve done the following:</p>
<p><code>$ cd /etc/gdm/PostSession<br />
$ sudo vi Default</code></p>
<p>add your commands before &#8220;exit 0&#8243;, for example:</p>
<p><code>...<br />
sudo fusermount -u /home/juraj/shareA/<br />
sudo fusermount -u /home/juraj/shareB/<br />
exit 0</code></p>
<p>Save (:wq) and give it a go - restart or logoff. Tested in Ubuntu 8.10</p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/02/24/running-a-script-after-log-off-in-ubuntu/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu - visual tuning</title>
		<link>http://jurajsplayground.com/2009/02/07/ubuntu-visual-tuning/</link>
		<comments>http://jurajsplayground.com/2009/02/07/ubuntu-visual-tuning/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 23:45:39 +0000</pubDate>
		<dc:creator>Juraj</dc:creator>
		
		<category><![CDATA[All]]></category>

		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.jurajsplayground.com/blog/?p=18</guid>
		<description><![CDATA[Ubuntu comes with Gnome and default settings include some visual effects (provided graphic card and drivers can handle them). To get the most out of it, consider installing the following  (using Synaptec or &#8220;sudo apt-get install package-name&#8220;):
compizconfig-settings-manager
This manager includes endless compiz configuration options including burning of windows on closing, Mac-like window effects and much [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu comes with Gnome and default settings include some visual effects (provided graphic card and drivers can handle them). To get the most out of it, consider installing the following  (using Synaptec or &#8220;sudo apt-get install <strong>package-name</strong>&#8220;):</p>
<p><strong>compizconfig-settings-manager</strong><br />
This manager includes endless compiz configuration options including burning of windows on closing, Mac-like window effects and much more.</p>
<p><strong>gnome-color-chooser</strong><br />
Allows to customise Gnome colours - panels, desktop, icons etc. Try these <a href="http://www.jurajsplayground.com/blog/wp-content/uploads/2009/02/84941-dax_ultrapack220_3v2_gnomecctar.bz2">220 Gnome colour schemes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jurajsplayground.com/2009/02/07/ubuntu-visual-tuning/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

