<?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>Magento Design and Development &#187; Tools</title>
	<atom:link href="http://inchoo.net/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://inchoo.net</link>
	<description>Magento Design and Magento Development Professionals - Inchoo</description>
	<lastBuildDate>Mon, 21 May 2012 11:00:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Magento mobile theme &#8211; imobile</title>
		<link>http://inchoo.net/ecommerce/magento/magento-mobile-theme-imobile/</link>
		<comments>http://inchoo.net/ecommerce/magento/magento-mobile-theme-imobile/#comments</comments>
		<pubDate>Mon, 07 May 2012 11:22:43 +0000</pubDate>
		<dc:creator>Stanislav Mihic</dc:creator>
				<category><![CDATA[Frontend]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[Mobile web]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[magento theme]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[responsive design]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=14461</guid>
		<description><![CDATA[Magento meets jQuery mobile (ver 1.1.0), before we start please note this is only experiment, use this theme on your own, this is not (yet) production ready. In a nutshell &#8230;]]></description>
			<content:encoded><![CDATA[<p>Magento meets jQuery mobile (ver 1.1.0), before we start please note <strong>this is only experiment, use this theme on your own, this is not (yet) production ready</strong>. In a nutshell we have &#8220;package&#8221; under which we place all edited files. For start we use magento iphone theme and then add some &#8220;extra stuff&#8221;.<span id="more-14461"></span></p>
<p>Some of key features:</p>
<ul>
<li>Autodetects the mobile device</li>
<li>jQuery mobile (v. 1.1.0)</li>
<li>Homepage slider (<a href="http://swipejs.com/">http://swipejs.com/</a>)</li>
<li>Almost all pages styled <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>Installation is simple, just copy downloaded files, (app, skin) after that go to administration and do some Magento magic. Magento already have browser detection, you only need to create rule. In our case we dropped table support because most of them will display normal desktop view store. Here is rule:</p>
<pre class="brush: php; title: ; notranslate">
iPhone|iPod|BlackBerry|Palm|Googlebot-Mobile|mobile|mobi|Windows Mobile|Safari Mobile|Android|Opera Mini|Fennec
</pre>
<p>You can add any other browser to this Expression, just point your device to <a href="http://whatsmyuseragent.com/">http://whatsmyuseragent.com/</a> and find out user agent name of device browser. And this is how it looks in administration</p>
<div id="attachment_14465" class="wp-caption aligncenter" style="width: 619px"><a href="http://inchoo.net/wp-content/uploads/2012/05/packagesettings.jpg"><img class=" wp-image-14465 " title="packagesettings" src="http://inchoo.net/wp-content/uploads/2012/05/packagesettings.jpg" alt="" width="609" height="238" /></a><p class="wp-caption-text">Using expressions</p></div>
<p>We need to mention that theme is independent from main store theme, all files which are edited don&#8217;t &#8220;break&#8221; default Magento markup we are only using power of HTML5 and one of the new cool feature &#8220;<a href="http://www.w3.org/html/wg/html5/#custom">custom data attributes</a>&#8220;.</p>
<blockquote><p>Simply, the specification for custom data attributes states that any attribute that starts with &#8220;data-&#8221; will be treated as a storage area for private data (private in the sense that the end user can&#8217;t see it &#8211; it doesn&#8217;t affect layout or presentation).</p></blockquote>
<p>Short explanation by <a href="http://ejohn.org/blog/html-5-data-attributes/">John Resig</a></p>
<p>And here is our example for store header:</p>
<pre class="brush: php; title: ; notranslate">&lt;/pre&gt;
&lt;div data-role=&quot;header&quot; data-position=&quot;inline&quot; data-theme=&quot;c&quot;&gt;
&lt;h1&gt;&lt;a href=&quot;&lt;?php echo $this-&gt;getUrl('') ?&gt;&quot; data-icon=&quot;home&quot;&gt;
&lt;img src=&quot;&lt;?php echo $this-&gt;getLogoSrc() ?&gt;&quot; alt=&quot;&lt;?php echo $this-&gt;getLogoAlt() ?&gt;&quot; /&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;!--?php echo $this-----&gt;getChildhtml('top-user');?&gt;&lt;/div&gt;
&lt;pre&gt;</pre>
<p>We don&#8217;t have any local hosted files regarding to jQuery because it is much easier to edit and place the newest version of js.</p>
<pre class="brush: php; title: ; notranslate">
					&lt;![CDATA[&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot;&gt;jQuery.noConflict();&lt;/script&gt;]]&gt;
					&lt;![CDATA[&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js&quot;&gt;&lt;/script&gt;]]&gt;
				&lt;![CDATA[		&lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css&quot; /&gt;]]&gt;
            skin_jsjs/swipe.js
</pre>
<p>Ah, if you need more info about jQuery mobile framework go to: <a href="http://jquerymobile.com/">http://jquerymobile.com/</a>.</p>
<p>Swipe JS, <a href="http://swipejs.com/">http://swipejs.com/</a>,</p>
<blockquote><p>Swipe is a lightweight mobile slider with 1:1 touch movement, resistant bounds, scroll prevention, and completely library agnostic. <img src='http://inchoo.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p></blockquote>
<p>Ok, we made simple approach, create static block, named Slider with ID slider and place this code</p>
<pre class="brush: php; title: ; notranslate">&lt;/pre&gt;
&lt;div style=&quot;display: block;&quot;&gt;&lt;img src=&quot;{{media url=&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;display: none;&quot;&gt;&lt;img src=&quot;{{media url=&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;display: none;&quot;&gt;&lt;img src=&quot;{{media url=&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;display: none;&quot;&gt;&lt;img src=&quot;{{media url=&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;
&lt;pre&gt;
</pre>
<p>If is there no needs for homepage slider just removed it from local.xml (from line 44).</p>
<p>For styling pages, we cover most of them but there is always more space to improve some part of Magento interface.</p>
<p>For demo and download go to our demo store <a href="http://imobile.inchoo4u.net">http://imobile.inchoo4u.net</a> with your smartphone, emulate in browser (change user agent), <a href="https://github.com/doxikus/imobile">visit @ github</a>, or just scan this QR code.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2012/05/qr.png"><img class="aligncenter size-full wp-image-14484" title="qr" src="http://inchoo.net/wp-content/uploads/2012/05/qr.png" alt="" width="400" height="400" /></a></p>
<p>So if you have any suggestion, issues, trouble just comment below, enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/ecommerce/magento/magento-mobile-theme-imobile/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Using custom php.ini  file with php CLI</title>
		<link>http://inchoo.net/tools-frameworks/custom-php-ini-php-cli/</link>
		<comments>http://inchoo.net/tools-frameworks/custom-php-ini-php-cli/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 08:16:52 +0000</pubDate>
		<dc:creator>Darko Goles</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php.ini]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=11688</guid>
		<description><![CDATA[Considering that I have never been real Linux user before, there was few things that I had to learn to successfully handle my code on server through SSH. One of &#8230;]]></description>
			<content:encoded><![CDATA[<p>Considering that I have never been real Linux user before, there was few things that I had to learn to successfully handle my code on server through SSH.</p>
<p>One of these things is forcing php CLI to use my custom php.ini file on server.</p>
<p>Let me start this story from beginning …<span id="more-11688"></span></p>
<p>Situation was that we took managed dedicated server for my Symfony2 project installation to be used as production server. I have no root access there (it&#8217;s level 2 managed server), but I always have possibility to ask support to enable me some things that I need inside my project&#8217;s account.</p>
<p>Of course, during the testing server configuration with my project I asked support to enable local php.ini file inside my account, so I can change setting as necessary without every time sending mail to support and waiting their response.</p>
<p>So, I got my local php.ini in which I first needed to remove shell_exec function from disabled functions &#8211; used in my custom command for handling database backups with cron job (independently and slightly different from default backups handling in control panel)</p>
<p>Yeah, I removed the function from php.ini and made custom command for back up and restore my data using php console command (Symfony2 shell).</p>
<p>Then I noticed that shell_exec is not working from php CLI. It&#8217;s still disabled ….<br />
When I add shell_exec function in controller and run the code via web browser, it is working, but within SSH: php console backup create not working and it says that “shell_exec function is disabled for security reasons”&#8230;</p>
<p>Luckily, my colleague <a title="Linux terminator" href="http://inchoo.net/author/tomas/">@Tomas Novoselic</a> was near and thanks to him that this agony was not took too long. (He is hardcore Linux user … <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> )</p>
<p>If you want to force specific php.ini file to be used with Php CLI, you just have to add path to php.ini file that you want to use inside command, so instead of:</p>
<pre class="brush: php; title: ; notranslate">

$ php console backup create
</pre>
<p>you should use something like this:</p>
<pre class="brush: php; title: ; notranslate">

php -c /home/divineof/etc/php.ini console backup create
</pre>
<p>… and that solved my problem&#8230;</p>
<p>In meantime, I found one more elegant solution, considering that I am using bash shell with SSH:<br />
Inside root installation of my hosting account, there is hidden file called &#8216;.bashrc&#8217;, so I opened it and entered inside:</p>
<pre class="brush: php; title: ; notranslate">

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# User specific aliases and functions

alias php='php -c /home/divineof/etc/php.ini'
</pre>
<p>After defining alias for php command, I am able to write again like this:</p>
<pre class="brush: php; title: ; notranslate">

$ php console backup create
</pre>
<p>… and it works now!</p>
<p>That&#8217;s all from me for today … <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/custom-php-ini-php-cli/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TWIG with WordPress part1</title>
		<link>http://inchoo.net/wordpress/twig-with-wordpress-part1/</link>
		<comments>http://inchoo.net/wordpress/twig-with-wordpress-part1/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 08:33:22 +0000</pubDate>
		<dc:creator>Darko Goles</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[twig]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=9949</guid>
		<description><![CDATA[Making TWIG autoload from WP plugin Maybe someone will say: this is a crazy idea. Why would someone want to do that? Maybe it really is crazy, but I would &#8230;]]></description>
			<content:encoded><![CDATA[<p><strong>Making TWIG autoload from WP plugin</strong></p>
<p><em>Maybe someone will say: this is a crazy idea. Why would someone want to do that?<br />
Maybe it really is crazy, but I would say: why not?<span id="more-9949"></span></em></p>
<p>What is TWIG? TWIG is new generation php templating engine made by Sensio Labs. It is used in their new project Symfony2 as main templating engine provided with framework.<br />
As <a title="TWIG project" href="http://www.twig-project.org/" target="_blank">official page </a> says:</p>
<p><em><strong>Fast:</strong> Twig compiles templates down to plain optimized PHP code. The overhead compared to regular PHP code was reduced to the very minimum.</em><br />
<em> <strong>Secure:</strong> Twig has a sandbox mode to evaluate untrusted template code. This allows Twig to be used as a template language for applications where users may modify the template design.</em><br />
<em> <strong>Flexible:</strong> Twig is powered by a flexible lexer and parser. This allows the developer to define its own custom tags and filters, and create its own DSL.</em><br />
It is not necessary to explain in detail why will someone (me) want to use that as wordpress templating engine, but one of the main reasons is that I want to rewrite some messed up php template for WP to better code organized one, and at the and I want it to be with cleaner code as possible.<br />
I don&#8217;t like very much when is necessary to mix up php tags and functions inside HTML code to make it work.<br />
After some thinking about TWIG and how to implement it in my WP installation I got idea:<br />
I will make plug in for WP that will provide all necessary stuff to start using TWIG with WP.</p>
<p>First I created the plugin folder named wp_twig_engine.I put folder named &#8216;<em>lib</em>&#8216; downloaded from<a title="TWIG project site" href="http://www.twig-project.org/" target="_blank"> twig-project site </a> in there. So I had the twig library almost prepared for using.<br />
Now I had to find some appropriate wordpress hook to inject my code into wordpress application logic. After some investigating and testing, I found that it will be possible to use the &#8216;<em>init</em>&#8216; hook and register autoloaders for TWIG library and my custom class in the same function, so I can reach my code from inside template folder later.</p>
<p>Main plugin file: wp-twig.php</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php

/*
  Plugin Name: WordPress Twig templating engine
  Version: 1.0
  Plugin URI: http://inchoo.net
  Description: Engine for creating twig templates for wordpress
  Author: Darko Goleš
  Author URI: http://inchoo.net/author/darko.goles/
 */
//Main twig library autoloader file
require_once dirname(__FILE__) . '/lib/Twig/Autoloader.php';
//My custom class made, I also want it to be autoloaded
require_once dirname(__FILE__) . '/Wp_TwigEngine.php';

function twigAutoLoad() {

    Twig_Autoloader::register();
    Wp_TwigEngine_Autoloader::register();
}

add_action('init', 'twigAutoLoad');
?&gt;
</pre>
<p>Just to show you how to autoload my custom class with that (of course I got idea from original twig autoloader and just changed the code to fit my needs:</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php
/*
Wp_TwigEngine.php
  Author: Darko Goleš
  Author URI: http://inchoo.net/author/darko.goles/
*/
class Wp_TwigEngine_Autoloader {

    static public function register() {
        ini_set('unserialize_callback_func', 'spl_autoload_call');
        spl_autoload_register(array(new self, 'autoload'));
    }

    static public function autoload($class) {
        if (0 !== strpos($class, 'Wp_TwigEngine')) {
            return;
        }

        if (file_exists($file = dirname(__FILE__) . '/../' . str_replace(array('_', &quot;&#92;&#48;&quot;), array('/', ''), $class) . '.php')) {
            echo($file);
            exit;
            require $file;
        }
    }

}
</pre>
<p>And that&#8217;s it from the plugin side for now. Just have to implement it in the template folder. That is additional theme for another article. <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/wordpress/twig-with-wordpress-part1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing Amazon affiliate links in WordPress</title>
		<link>http://inchoo.net/wordpress/amazon-asin-wordpress/</link>
		<comments>http://inchoo.net/wordpress/amazon-asin-wordpress/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 08:16:22 +0000</pubDate>
		<dc:creator>Darko Goles</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=9942</guid>
		<description><![CDATA[Recently my team had problem with Amazon affiliate links on our web site. On the web, we have wordpress installation and inside main content of web page we have some &#8230;]]></description>
			<content:encoded><![CDATA[<p>Recently my team had problem with Amazon affiliate links on our web site.<br />
On the web, we have wordpress installation and inside main content of web page we have some Amazon affiliate links that entered in the content few years ago and not working any more because Amazon changed API somehow. I searched the web for some new version of wordpress plug-in for new API version, because our old plug-in for displaying that links properly was turned off.</p>
<p>FYI that links inside content look like this:<span id="more-9942"></span></p>
<pre class="brush: php; title: ; notranslate">
&lt;a type=&quot;amzn&quot;&gt; “Jerusalem the Golden” performed by Rupert Gough–Malcolm Archer–Wells Cathedral Choir&lt;/a&gt;
</pre>
<p>When links was formed like that, our site could never pass HTML validation, and also we had some click-able non-functional links in our content. It would be very hard work to parse every article inside database and remove that links from our content, because we have much content that would need checking and fixing.</p>
<p>I found the good plug-in that parses that links into proper formed links and making our links work, but there was  one more problem to solve with that:</p>
<p>With regular Amazon API, like this new plug-in does, links are parsed with some included Javascript files that are linked directly from Amazon.com and small chunk of calling Javascript are included inside page to make it work.</p>
<p>But, what is happening when my colleagues  develop  iPhone application that reads content from web site&#8217;s rss feed are trying to make this links functional? They have to manually include all of this Javascript inside iPhone application and run that script locally from device.</p>
<p>I don&#8217;t think that is the best solution for us. So decided to make some own wordpress plug-in that will build that links with php and show them already parsed on web page and also inside feed to avoid Javascript parsing.</p>
<p>Here is the code:</p>
<pre class="brush: php; title: ; notranslate">

&lt;!--?php /*   Plugin Name: Amazon ASIN links parser   Plugin URI: http://www.surgeworks.com   Description: Plugin that parses Amazon links with ASIN code and converts them to full Amazon affiliate url without javascript   Version: 1.0   Author: Darko Goleš   Author URI: http://inchoo.net/author/darko.goles/   License: Surgeworks - all rights reserved.  */ define('DVO_LOCATIONS_PLUGIN_PATH', dirname(__FILE__)); define('DVO_LOCATIONS_PLUGIN_URL', get_option('siteurl') . '/wp-content/plugins/' . basename(DVO_LOCATIONS_PLUGIN_PATH)); include(dirname(__FILE__) . '/simple_html_dom.php'); //Adding filter into content add_filter('the_content', 'parseLinks'); function parseLinks($content) { 	/*if(is_feed()) 	{*/ 		$html = new simple_html_dom(); 		$html---&gt;load($content);

		$ret = $html-&gt;find('a[type=&quot;amzn&quot;]');

		foreach($ret as $val)
		{
			if(isset($val-&gt;asin))
			{
				$asin = $val-&gt;asin;
				$linktext = $val-&gt;plaintext;

				$newLinkStr = buildURL($asin,$linktext,'divine-office-20');

				$val-&gt;outertext = $newLinkStr;
			}

		}

		$content = $html-&gt;save();

	/*}*/
    return $content;
}

function buildURL($asin, $linktext, $affiliate)
{
	return '&lt;a href=&quot;http://www.amazon.com/dp/' . $asin . '/?tag=' . $affiliate . '&quot;&gt;' . $linktext . '&lt;/a&gt;';
}
</pre>
<p>For parsing I used the <a title="simplehtmldom" href="http://simplehtmldom.sourceforge.net" target="_blank">SimpleHtmlDOM library</a> that can be found on web for free download.</p>
<p>Now when displayed, Amazon links looks like this:</p>
<pre class="brush: php; title: ; notranslate">

http://www.amazon.com/dp/B0000542GQ/?tag=divine-office-20
</pre>
<p>Feel free to use this code to make own plugin for AMZN links with ASIN code.</p>
<p>Cheers <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/wordpress/amazon-asin-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How difficult is Git branching?</title>
		<link>http://inchoo.net/tools-frameworks/how-difficult-is-git-branching/</link>
		<comments>http://inchoo.net/tools-frameworks/how-difficult-is-git-branching/#comments</comments>
		<pubDate>Thu, 27 Jan 2011 07:10:34 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git branches]]></category>
		<category><![CDATA[git merging]]></category>
		<category><![CDATA[git resolve conflict]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=8120</guid>
		<description><![CDATA[Well, in short &#8211; it isn&#8217;t! But, when it comes to branching, it comes to &#8220;merging problem&#8221;. I say problem although it isn&#8217;t, and if you&#8217;re interested, I&#8217;ll show you &#8230;]]></description>
			<content:encoded><![CDATA[<p>Well, in short &#8211; it isn&#8217;t! But, when it comes to branching, it comes to &#8220;merging problem&#8221;. I say problem although it isn&#8217;t, and if you&#8217;re interested, I&#8217;ll show you why.<br />
<span id="more-8120"></span></p>
<h3>Basics About Git Branching</h3>
<p>Well, I&#8217;ve noticed that some Git users that have just switched from SVN didn&#8217;t know that every single one of Git repositories contain at least one branch called &#8220;master&#8221;. And all commits to Git repository, if you don&#8217;t work with branches are pushed to it, by default. I say this because if you&#8217;ve used SVN, branches are considered as high-end knowledge, and in Git &#8211; it&#8217;s considered almost as the basic knowledge (it comes just after you learn how to use <strong>commit</strong> -&gt; <strong>push</strong> -&gt; <strong>pull</strong> loop).</p>
<p>So, to conclude this introduction &#8211; since everything you do with Git is on some branch, you should learn how tho use them in your advantage.</p>
<h3>The Creation</h3>
<p>Fist of all, go to console, navigate to your repository, and type this:</p>
<pre class="brush: plain; title: ; notranslate">
git branch -a
</pre>
<p>You should see something like this:</p>
<pre class="brush: plain; title: ; notranslate">
* master
</pre>
<p>Make sure you have at least one file inside your repository (project) directory and make sure it&#8217;s added to repository. If it isn&#8217;t, create sample file &#8220;test.txt&#8221; and do the following:</p>
<pre class="brush: plain; title: ; notranslate">
git add test.txt
git commit -m &amp;quot;Added test.txt to repo&amp;quot;
</pre>
<p>And now, let&#8217;s create our first branch manually:</p>
<pre class="brush: plain; title: ; notranslate">
git branch mybranch
git checkout mybranch
</pre>
<p>With first command <strong>git branch mybranch</strong> we&#8217;ve created a new branch called <strong>mybranch</strong>, and at this point you&#8217;ve created your first &#8220;tree&#8221; of branches. At that point, you&#8217;ve copied &#8220;local repository state&#8221; to new branch. And with second one, you&#8217;ve switched to work on your new branch.</p>
<p>And with this, I&#8217;ll conclude &#8220;The Creation&#8221; part of this article. Moving on to the fun part:</p>
<h3>The Work</h3>
<p>Let&#8217;s say we created our local branch for testing. When we&#8217;re done, we&#8217;ll merge it back to master branch, if we&#8217;re satisfied with our work, and if not, we&#8217;ll simply delete it.<br />
So, just to be sure, after you type in:</p>
<pre class="brush: plain; title: ; notranslate">
git branch -a
</pre>
<p>You should see this:</p>
<pre class="brush: plain; title: ; notranslate">
  master
* mybranch
</pre>
<p>This means there are currently two branches &#8220;master&#8221; and &#8220;mybranch&#8221;, and we&#8217;re currently working on latter.<br />
Now, let&#8217;s edit our test.txt file. Just add a line of text that&#8217;s saying &#8220;mybranch &#8211; first line&#8221; with your favorite text editor.<br />
Back on to the &#8220;Git stuff&#8221; again. We&#8217;ll commit our changes to our current branch (mybranch):</p>
<pre class="brush: plain; title: ; notranslate">
git commit -a -m &amp;quot;mybranch - first commit&amp;quot;
</pre>
<p><em>Note: &#8220;-a&#8221; i our last commit just commits files that have been edited, in our case, test.txt.</em></p>
<p>To get a clearer picture, just write this to console:</p>
<pre class="brush: plain; title: ; notranslate">
git log -1
</pre>
<p>After it executes, you should see last commit&#8217;s author, date and message. It should be yours with message &#8220;mybranch &#8211; first commit&#8221;.<br />
Moving on:</p>
<pre class="brush: plain; title: ; notranslate">
git checkout master
git log -1
</pre>
<p>We&#8217;ve just switched back to master branch and looked at last commit&#8217;s info. Message should go like this &#8220;Added test.txt to repo&#8221; &#8211; from our initial commit when we added the test.txt file at the beginning of this article.</p>
<p>Now, let&#8217;s say we&#8217;re satisfied with our work on test branch we called &#8220;mybranch&#8221;, and we want to merge it back to master, and move on with development. Since we just switched to master branch, just do the following:</p>
<pre class="brush: plain; title: ; notranslate">
git merge mybranch
</pre>
<p><em>Note: with this command, we&#8217;re merging branch called &#8220;mybranch&#8221; into branch we&#8217;re currently in (&#8220;master&#8221; branch)</em></p>
<p>If you followed everything to the letter, you should see a success message in your console. If not, you&#8217;ve already reached next part of this article:</p>
<h3>The Problem</h3>
<p>Well what if we edited same file on both branches and tried to merge them? We&#8217;d ge a merge conflict. Git will tell us there&#8217;s a problem, and we need to look into the file while it&#8217;s in the MERGING phase, resolve the conflict, re-add the file and commit merge. After that, it&#8217;s resolved.</p>
<p>I know this sounds complicated, but let&#8217;s move on with our example. While we&#8217;re in &#8220;master&#8221; branch, edit out test.txt file, and add new line of text &#8211; &#8220;line two&#8221;, and save it. Just after that execute the following:</p>
<pre class="brush: plain; title: ; notranslate">
git commit -a -m &amp;quot;Edited file on master&amp;quot;
git checkout mybranch
</pre>
<p>First line committed current state of files (our line we added) to &#8220;master&#8221; branch, and second line just got us back to &#8220;mybranch&#8221; branch. Open our sample file again, and you shouldn&#8217;t see our second line. Add a new line here as well &#8211; &#8220;line three&#8221;. Commit the change with following command:</p>
<pre class="brush: plain; title: ; notranslate">
git commit -a -m &amp;quot;Edited file on mybranch&amp;quot;
</pre>
<p>Switch back to master, and try to repeat the merge:</p>
<pre class="brush: plain; title: ; notranslate">
git checkout master
git merge mybranch
</pre>
<p>You should get the &#8220;Automatic merge failed&#8221; message, in file called &#8220;test.txt&#8221;. If so, you&#8217;ve done everything right. Then, in console, you can notice that you&#8217;re on &#8220;master|MERGING&#8221; branch. This is state in repository where you need to resolve the conflicts, re-add the files, and commit the merge to finish. So open the file, keep what you need after the merge, save it and execute the following:</p>
<pre class="brush: plain; title: ; notranslate">
git add test.txt
git commit -m &amp;quot;First conflict resolved&amp;quot;
</pre>
<p>You might notice you&#8217;re back on &#8220;master&#8221; branch (not &#8220;master|MERGING&#8221;). This means you&#8217;ve done it. You managed to do the following:</p>
<ul>
<li> create a branch</li>
<li> edit files on both branches</li>
<li> cause the conflict</li>
<li> resolve the conflict</li>
</ul>
<p>And now on to the last part:</p>
<h3>The conclusion</h3>
<p>Although all of this might seem like an overkill for something simple, it really isn&#8217;t. Even if you use console instead of some GUI tool, all of this is done under 1 minute, when you get used to it. And in return, you can isolate your work from your colleagues to work without messing into each other&#8217;s code. </p>
<p>I hope I was clear, and that this article will be of some help for beginners.</p>
<p>Feel free to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/how-difficult-is-git-branching/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Basic Git usage from console</title>
		<link>http://inchoo.net/tools-frameworks/basic-git-usage-from-console/</link>
		<comments>http://inchoo.net/tools-frameworks/basic-git-usage-from-console/#comments</comments>
		<pubDate>Tue, 18 Jan 2011 12:56:23 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[magento git]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=8052</guid>
		<description><![CDATA[Hi! Today I&#8217;m going to write an article about basic Git usage in practice. I&#8217;m not going to go into depth of Git repository setup, but rather on developer&#8217;s side &#8230;]]></description>
			<content:encoded><![CDATA[<p>Hi! Today I&#8217;m going to write an article about basic Git usage in practice. I&#8217;m not going to go into depth of Git repository setup, but rather on developer&#8217;s side &#8211; what&#8217;s important to understand to start using it?<br />
<span id="more-8052"></span></p>
<h3>Introduction</h3>
<p>First of all, here&#8217;s the one and only goal:</p>
<p><strong>Allow developers to work with Git as they did before it.</strong></p>
<p>I&#8217;ll be explaining the logic through console approach because of clean informations you get, and you&#8217;ll get yourself familiarized with Git project workflow.</p>
<p>First, take a look at this:</p>
<p style="text-align: center;"><a href="http://inchoo.net/wp-content/uploads/2011/01/workflow-a.png"><img class="size-full wp-image-8053 aligncenter" title="workflow-a" src="http://inchoo.net/wp-content/uploads/2011/01/workflow-a.png" alt="" width="415" height="209" /></a></p>
<p>Ok, I really haven&#8217;t show any rocket science here. I just show you a graphic that represents any repository. But it&#8217;s important to understand that only when each developer <em>pushes</em> his <em>commits</em> to shared repository, it will be available to his colleagues developers to <em>pull</em> them.</p>
<p><strong><em>And you must know the difference between local and remote (shared) repository.</em></strong></p>
<p>And now, take a look at this one:</p>
<p style="text-align: center;"><img class="size-full wp-image-8056 aligncenter" title="git-transport" src="http://inchoo.net/wp-content/uploads/2011/01/git-transport.png" alt="" width="481" height="455" /></p>
<p style="text-align: left;">
<p style="text-align: left;">Now, this is the best graphic I found that would in brief and yet comprehensive way show the workflow between the developer and remote repository. Don&#8217;t worry if you think that it&#8217;s too complicated, or if you&#8217;re scared of commands. It&#8217;s pretty simple.</p>
<h3>Commands logic and flow</h3>
<p style="text-align: left;">Like (almost?) with any other repository, Git is cyclic. It means nothing but you pull the changes from others, do your changes, commit them, and finally push them to repository for others. Then, you just repeat the process.</p>
<p style="text-align: left;">On to the fun stuff:</p>
<h3>Start point commands</h3>
<p style="text-align: left;">Well, regarding the commands, I&#8217;ll go through them by example as follows, as simple as possible (working on master branch only):</p>
<p style="text-align: left;">
<pre class="brush: php; title: ; notranslate">
//This will get me updated on current online repository status
$git pull origin master
</pre>
<p style="text-align: left;">Then, I&#8217;ll create my index.php in the document root, and add content to it, and go to console to <strong>add</strong> my file to the local repository:</p>
<pre class="brush: php; title: ; notranslate">
//This will add file to my local repository
$git add index.php
</pre>
<p style="text-align: left;">Then, I&#8217;ll make a <strong>commit</strong> with new file:</p>
<pre class="brush: php; title: ; notranslate">
//This will add file to my local repository
//And leave amessage &quot;index.php added&quot;
$git commit -m &quot;index.php added&quot;
</pre>
<p style="text-align: left;">Finally, I&#8217;ll <strong>push</strong> my index.php with its contents to remote repository as follows:</p>
<pre class="brush: php; title: ; notranslate">
//Push to the repository origin, on branch master
$git push origin master
</pre>
<p style="text-align: left;">And there you go. Your first file added to Git. And as I wrote before, you now just need to repeat the process.</p>
<h3>A bit longer list of commands</h3>
<p><strong>git add</strong> &#8211; adds a file to local repository</p>
<p><strong>git commit</strong> &#8211; it will &#8220;save&#8221; current state of files locally, and prepare them for git push</p>
<p><strong>git push</strong> &#8211; it will collect all of your current commits that havent been commited and push them to remote repository</p>
<p><strong>git pull</strong> &#8211; combination of git fetch and git merge</p>
<p><strong>git fetch</strong> &#8211; it fetches the remote changes to your local repository, but it doesn&#8217;t change your current source contents</p>
<p><strong>git merge</strong> &#8211; it&#8217;s used for merging 2 branches into one, if theres no need for 2 anymore</p>
<p><strong>git branch &lt;new-branch-name&gt;</strong> &#8211; creates a branch with name &#8220;new-branch-name&#8221;</p>
<p><strong>git checkout</strong> or <strong>git co</strong> &#8211; used for switching between branches</p>
<p><strong>git diff</strong> &#8211; if you <strong>fetch</strong> the changes from remote, you can then see the difference between your code current version and last one on remote</p>
<p><strong>git status</strong> &#8211; shows you the current status of your repository (like changed / added / deleted files)</p>
<p><strong>git log -n</strong> &#8211; shows you the <strong>n </strong>last commit messages with some other data</p>
<h3>Conclusion</h3>
<p>I haven&#8217;t gone into depth of project setup, I just wanted to show everyone how to use basic console commands. And I hope someone will find something useful in here!</p>
<p>Cheers!</p>
<p>&nbsp;</p>
<p><strong>git help &lt;command-name&gt;</strong> &#8211; it will show you the official documentation of selected command</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/basic-git-usage-from-console/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to generate SSH keys for Git authorization</title>
		<link>http://inchoo.net/tools-frameworks/how-to-generate-ssh-keys-for-git-authorization/</link>
		<comments>http://inchoo.net/tools-frameworks/how-to-generate-ssh-keys-for-git-authorization/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 14:02:41 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=7613</guid>
		<description><![CDATA[Hi there! This post will be pretty straightforward and will cover Windows, Mac and Linux, so if you don&#8217;t know how to do it already, read on. Head 1: Windows &#8230;]]></description>
			<content:encoded><![CDATA[<p>Hi there! This post will be pretty straightforward and will cover Windows, Mac and Linux, so if you don&#8217;t know how to do it already, read on.<span id="more-7613"></span></p>
<h3>Head 1: Windows</h3>
<p>Just follow these 5 steps:</p>
<ol>
<li>Go to <a href="http://code.google.com/p/msysgit/downloads/list" target="_blank">this address</a>, and download <em>msysgit, </em>after the download install it with default settings</li>
<li>Open Git Bash that you just installed (Start-&gt;All Programs-&gt;Git-&gt;Git Bash)</li>
<li>Type in the following: <em>ssh-keygen -t rsa</em> (when prompted, enter password, key name can stay the same)</li>
<li>Open file <em>your_home_directory/.ssh/id_rsa.pub</em> with your favorite text editor, and copy contents to your Git repository&#8217;s keys field (<em>GitHub</em>, <em>beanstalk</em>, or any other repository provider), under your account.</li>
<li>Be sure that you <strong>don&#8217;t copy</strong> any whitespace while copying public key&#8217;s content (id_rsa.pub)</li>
</ol>
<p>Note: your_home_directory is either <em>C:\Users\your_username</em> (on Windows Vista / 7), or <em>C:\Documents and Settings\your_username</em> (on Windows XP)</p>
<h3>Head 2: Mac</h3>
<p>Follow these 5 steps:</p>
<ol>
<li>Start the <em>terminal</em></li>
<li><em>Navigate to your home directory by typing: cd ~/</em></li>
<li>Execute the following command: <em>ssh-keygen -t rsa</em> (when prompted, enter password, key name can stay the same)</li>
<li>open file you&#8217;ve just created <em>~/.ssh/id_rsa.pub</em> with your favorite text editor, and copy contents to your Git repository&#8217;s keys field (GitHub, beanstalk, or any other repository provider), under your account.</li>
<li>Be sure that you <strong>don&#8217;t copy</strong> any whitespace while copying public key&#8217;s content (id_rsa.pub)</li>
</ol>
<h3>Head 3: Linux (Ubuntu)</h3>
<p>Follow these 5 steps:</p>
<ol>
<li>Open <em>console</em></li>
<li><em>cd ~</em></li>
<li><em>ssh-keygen -t rsa</em> (when prompted, enter password, key name can stay the same)</li>
<li>open file <em>/home/your_username/.ssh/id_rsa.pub</em> with your favorite text editor, and copy contents to your Git repository&#8217;s keys field (<em>GitHub</em>, <em>beanstalk</em>, or any other repository provider), under your account.</li>
<li>Be sure that you <strong>don&#8217;t copy</strong> any whitespace while copying public key&#8217;s content (id_rsa.pub)</li>
</ol>
<h3>Head 4: Additional info</h3>
<p>When you create private / public SSH keys on your machine (that&#8217;s what you did in above steps), it&#8217;s not enough. You need to give your public key to the repository in order to pair the Git server with your local machine (that&#8217;d be steps 4. and 5. above).</p>
<p>Most of the popular repositories will give you web interface access to the application, and here&#8217;s how it looks like on beanstalk when you did all you needed, for example:<br />
<img class="alignnone size-full wp-image-7646" title="git-ssh-key-generate" src="http://inchoo.net/wp-content/uploads/2011/01/git-ssh-key-generate.jpg" alt="" width="620" height="594" /><br />
After this step, you&#8217;re ready to start using Git.</p>
<h3>Head 5: Conclusion</h3>
<p>I hope this wasn&#8217;t to complicated to follow, and also I hope it was helpful to someone!</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/how-to-generate-ssh-keys-for-git-authorization/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to limit web services so they don&#8217;t kill CPU</title>
		<link>http://inchoo.net/tools-frameworks/how-to-limit-web-services-so-it-wont-kill-cpu/</link>
		<comments>http://inchoo.net/tools-frameworks/how-to-limit-web-services-so-it-wont-kill-cpu/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 13:53:47 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=7158</guid>
		<description><![CDATA[Hi! As any developer, I&#8217;ve encountered a small problem when working with PHP under Apache. It&#8217;s all good until you have to test the &#8220;real life&#8221; situations. For example &#8211; &#8230;]]></description>
			<content:encoded><![CDATA[<p>Hi! As any developer, I&#8217;ve encountered a small problem when working with PHP under Apache. It&#8217;s all good until you have to test the &#8220;real life&#8221; situations. For example &#8211; if you use imagemagick library in your application. It can get quite heavy on server load. So if you want to read a solution for it, read on.<span id="more-7158"></span></p>
<p>First of all, what do I mean by &#8220;quite heavy&#8221;. Well, imagemagick as my example is great image manipulation tool, but it takes quite a lot of CPU power compared to gd library that PHP uses. And if you have a site that has something around 50 users at the same moment who use imagemagick in the same time, with poor server they&#8217;ll mots probably create a mini DDOS attack on you, non intentionally. A solution for Linux based servers is &#8220;CPU limit&#8221;.</p>
<p><strong>About CPU limit</strong></p>
<p>CPU limit is open source Linux based solution that gives you option to limit each process&#8217;s (by PID) CPU power consumption in percentage. So for example, you can always limit your apache to 2% of CPU, and MySQL to let&#8217;s say 10%. Its pretty much straightforward, so you can fit your needs.</p>
<p><strong>Installation process on Ubuntu</strong></p>
<p>There are few steps to complete this tasks, so here they are in right order:</p>
<p>First, 2 packages are needed, and you can install those with following commands:</p>
<pre class="brush: php; title: ; notranslate">
sudo apt-get install cpulimit
sudo apt-get install gawk
</pre>
<p>Next step is to create Daemon for CPU limit:</p>
<pre class="brush: php; title: ; notranslate">
#!/bin/bash
# ==============================================================
# CPU limit daemon - set PID's max. percentage CPU consumptions
# ==============================================================

# Variables
CPU_LIMIT=20       	# Maximum percentage CPU consumption by each PID
DAEMON_INTERVAL=3  	# Daemon check interval in seconds
BLACK_PROCESSES_LIST=   # Limit only processes defined in this variable. If variable is empty (default) all violating processes are limited.
WHITE_PROCESSES_LIST=   # Limit all processes except processes defined in this variable. If variable is empty (default) all violating processes are limited.

# Check if one of the variables BLACK_PROCESSES_LIST or WHITE_PROCESSES_LIST is defined.
if [[ -n &quot;$BLACK_PROCESSES_LIST&quot; &amp;amp;&amp;amp;  -n &quot;$WHITE_PROCESSES_LIST&quot; ]] ; then    # If both variables are defined then error is produced.
   echo &quot;At least one or both of the variables BLACK_PROCESSES_LIST or WHITE_PROCESSES_LIST must be empty.&quot;
   exit 1
elif [[ -n &quot;$BLACK_PROCESSES_LIST&quot; ]] ; then                                 # If this variable is non-empty then set NEW_PIDS_COMMAND variable to bellow command
   NEW_PIDS_COMMAND=&quot;top -b -n1 -c | grep -E '$BLACK_PROCESSES_LIST' | gawk '\$9&gt;CPU_LIMIT {print \$1}' CPU_LIMIT=$CPU_LIMIT&quot;
elif [[ -n &quot;$WHITE_PROCESSES_LIST&quot; ]] ; then                                 # If this variable is non-empty then set NEW_PIDS_COMMAND variable to bellow command
   NEW_PIDS_COMMAND=&quot;top -b -n1 -c | gawk 'NR&gt;6' | grep -E -v '$WHITE_PROCESSES_LIST' | gawk '\$9&gt;CPU_LIMIT {print \$1}' CPU_LIMIT=$CPU_LIMIT&quot;
else
   NEW_PIDS_COMMAND=&quot;top -b -n1 -c | gawk 'NR&gt;6 &amp;amp;&amp;amp; \$9&gt;CPU_LIMIT {print \$1}' CPU_LIMIT=$CPU_LIMIT&quot;
fi

# Search and limit violating PIDs
while sleep $DAEMON_INTERVAL
do
   NEW_PIDS=$(eval &quot;$NEW_PIDS_COMMAND&quot;)                                                                    # Violating PIDs
   LIMITED_PIDS=$(ps -eo args | gawk '$1==&quot;cpulimit&quot; {print $3}')                                          # Already limited PIDs
   QUEUE_PIDS=$(comm -23 &lt; (echo &quot;$NEW_PIDS&quot; | sort -u) &lt;(echo &quot;$LIMITED_PIDS&quot; | sort -u) | grep -v '^$')   # PIDs in queue

   for i in $QUEUE_PIDS
   do
       cpulimit -p $i -l $CPU_LIMIT -z &amp;amp;   # Limit new violating processes
   done
done
</pre>
<p>If you wish to auto-start the Daemon on PC start, you have to do the following 3 steps:<br />
Step 1: </p>
<pre class="brush: php; title: ; notranslate">
sudo chmod 700 /usr/bin/cpulimit_daemon.sh
</pre>
<p>Step 2: Now save this to /etc/init.d/cpulimit: </p>
<pre class="brush: php; title: ; notranslate">
#!/bin/sh
#
# Script to start CPU limit daemon
#
set -e

case &quot;$1&quot; in
start)
if [ $(ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print $1}' | wc -l) -eq 0 ]; then
    nohup /usr/bin/cpulimit_daemon.sh &gt;/dev/null 2&gt;&amp;amp;1 &amp;amp;
    ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print}' | wc -l | gawk '{ if ($1 == 1) print &quot; * cpulimit daemon started successfully&quot;; else print &quot; * cpulimit daemon can not be started&quot; }'
else
    echo &quot; * cpulimit daemon can't be started, because it is already running&quot;
fi
;;
stop)
CPULIMIT_DAEMON=$(ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print $1}' | wc -l)
CPULIMIT_INSTANCE=$(ps -eo pid,args | gawk '$2==&quot;cpulimit&quot; {print $1}' | wc -l)
CPULIMIT_ALL=$((CPULIMIT_DAEMON + CPULIMIT_INSTANCE))
if [ $CPULIMIT_ALL -gt 0 ]; then
    if [ $CPULIMIT_DAEMON -gt 0 ]; then
        ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print $1}' | xargs kill -9   # kill cpulimit daemon
    fi

    if [ $CPULIMIT_INSTANCE -gt 0 ]; then
        ps -eo pid,args | gawk '$2==&quot;cpulimit&quot; {print $1}' | xargs kill -9                    # release cpulimited process to normal priority
    fi
    ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print}' | wc -l | gawk '{ if ($1 == 1) print &quot; * cpulimit daemon can not be stopped&quot;; else print &quot; * cpulimit daemon stopped successfully&quot; }'
else
    echo &quot; * cpulimit daemon can't be stopped, because it is not running&quot;
fi
;;
restart)
$0 stop
sleep 3
$0 start
;;
status)
ps -eo pid,args | gawk '$3==&quot;/usr/bin/cpulimit_daemon.sh&quot;  {print}' | wc -l | gawk '{ if ($1 == 1) print &quot; * cpulimit daemon is running&quot;; else print &quot; * cpulimit daemon is not running&quot; }'
;;
esac
exit 0
</pre>
<p>Step 3:</p>
<pre class="brush: php; title: ; notranslate">
sudo chown root:root /etc/init.d/cpulimit
//Set the ownership
sudo chmod 755 /etc/init.d/cpulimit
//Set the privileges
sudo update-rc.d cpulimit defaults
//Add script to boot
</pre>
<p>And only thing left to do is test it out. You can do that with following commands (which are self-explanatory):</p>
<pre class="brush: php; title: ; notranslate">
sudo service cpulimit status
sudo service cpulimit start
sudo service cpulimit stop
sudo service cpulimit restart
</pre>
<p><strong>Conclusion</strong></p>
<p>Well, I not the author of those scripts, but I think it is quite useful, and I wanted to share it with all of you. So have fun with limiting your processes! <img src='http://inchoo.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/how-to-limit-web-services-so-it-wont-kill-cpu/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How the Grinch stole my backup?</title>
		<link>http://inchoo.net/tools-frameworks/how-the-grinch-stole-my-backup-important-one/</link>
		<comments>http://inchoo.net/tools-frameworks/how-the-grinch-stole-my-backup-important-one/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 07:48:11 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[backup]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=7011</guid>
		<description><![CDATA[Hello everyone! Recently I&#8217;ve participated in quite a few discussions regarding version control systems. I&#8217;ve noticed that not so many people rely on good old &#8220;copy &#8211; paste&#8221; backup. I &#8230;]]></description>
			<content:encoded><![CDATA[<p>Hello everyone! Recently I&#8217;ve participated in quite a few discussions regarding version control systems. I&#8217;ve noticed that not so many people rely on good old &#8220;copy &#8211; paste&#8221; backup. I still do, and this is why!<span id="more-7011"></span></p>
<h2>Version control systems</h2>
<p>Great thing for both backups as well as for versioning your software. Whoever uses / has used SVN, CVS or Git knows what I&#8217;m talking about. Although backup isn&#8217;t their primary function, you can easily pull some old version, and start over if some things got too corrupted to fix.</p>
<h2>Manual backup (&#8220;copy &#8211; paste&#8221; backup)</h2>
<p>Some will for sure say that I&#8217;m a dinosaur just for mention it. But if you read this article so far, please read on. You won&#8217;t have one click / one command to get your version from lets say &#8211; last Tuesday. You&#8217;ll have to do at least 4 clicks to do so. And if you don&#8217;t think of some &#8220;naming convention&#8221;, you&#8217;ll most probably end up searching for your file for at least an hour, again unlike VCS solutions. </p>
<p>Well, since I still haven&#8217;t wrote down single reason why should anyone use manual backup over VCS, here it is:</p>
<h2>Real life example</h2>
<p>Personally i use Git as primary version control system, just to be clear. But also I create manual backups on daily basis (at least 1 week of versions, and after that I keep general versions). Recently there was a problem with Git merging of branches &#8211; it got corrupted. So a full time week of work of both my colleague and me (cca 80 hrs). </p>
<p>I took my manually created copy from day before, and replaced my local version of project on git. Did some Git&#8217;s HEAD modifications, and committed as last version. Combined with great IDE which has local version control system of its own, I&#8217;ve managed to get my branch working as it was when it got corrupted in 45 minutes.</p>
<h2>Conclusion</h2>
<p>Some of you will perhaps still say that I could do this or that, but I disagree. Mainly because I work in a company that bills per hour, and this would mean that either the client would get billed 8 hours more for same amount of functionality (from business side &#8211; impossible) or in my bosses head I&#8217;ve cost him 8 billable hours (this would have happen). And if I had to recreate a week of work &#8211; I cant even imagine that.</p>
<p>I hope you now understand the importance of manually created backup copies. And I hope at least some of you will make a practice of this.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/how-the-grinch-stole-my-backup-important-one/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dynamic grids anyone?</title>
		<link>http://inchoo.net/tools-frameworks/dynamic-grids-anyone/</link>
		<comments>http://inchoo.net/tools-frameworks/dynamic-grids-anyone/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 15:14:30 +0000</pubDate>
		<dc:creator>Iva Korlevic</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[grid]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=6883</guid>
		<description><![CDATA[For my second article I&#8217;m again writing about Ext.js. Ext.js has one great part for showing data &#8211; grids. These look really nice and you can style them pretty easily. &#8230;]]></description>
			<content:encoded><![CDATA[<p>For my second <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  article I&#8217;m again writing about Ext.js. Ext.js has one great part for showing data &#8211; grids. These look really nice and you can style them pretty easily. It all works like a charm when you&#8217;re using them for static data. But what when things get dynamic? What when you don&#8217;t know the number of the headers that you need in the table and not just rows? Here&#8217;s where this article will help.<br />
<span id="more-6883"></span><br />
First lets input some data to our view(i used ajax requests). For the request I modeled my json so it has several parts: fields-name of the fields in table, results &#8211; data to be shown, and flag &#8211; is it input data our output(i had to make a sort of a spreadsheet where input and output data had to be separated.)</p>
<p>Since I used Array store I modeled my data into an array. </p>
<pre class="brush: jscript; title: ; notranslate">
 var vari = Ext.util.JSON.decode(results.responseText);

//names of the fields
Ext.each(vari.fields, function(ell, ind) {
                names[ind] = vari.fields[ind],
                i_total++
            });

//data to be shown
Ext.each(vari.results,function(el,i){
                values[i] = vari.results[i],
            });

//input element count
Ext.each(vari.flag, function(el, i) {
                if (vari.flag[i] == "I") in_elem++;
            });
</pre>
<p>Now that we got our data the way we want it we need to put it in a store:</p>
<pre class="brush: jscript; title: ; notranslate">
var store = new Ext.data.ArrayStore({
                autoDestroy: true,
                autoload:false,
                data:values,                       //values need to be array of arrays if youre using ArrayStore
                totalProperty: vari.total,
                fields: names,                     // names is an array containing names of the fields
                proxy: new Ext.data.ScriptTagProxy({
                    url: 'proxylink ?&gt;',
                    method:'POST'
                })
            });
</pre>
<p>Now let&#8217;s prepare heading for our grid:</p>
<pre class="brush: jscript; title: ; notranslate">
//array col has data needed for showing of the grid and inputing data in a grid: header and dataIndex
var col=[];
Ext.each(names, function(el, i) {
                if (i + 1 == in_elem) {
                    col[i + 1] = {header:names[i], dataIndex: names[i],id:'end-row'};   //this gives the last input field an id so you can style it to separate the data
                }
                else {
                    col[i + 1] = {header:names[i], dataIndex: names[i]};
                }
            });

//making a selection model
            var sm = new Ext.grid.CheckboxSelectionModel({
                listeners:{
                    selectionchange: function(sm) {
                        if (sm.getCount()) {
                            grid.deli.enable();
                        } else {
                            grid.deli.disable();
                        }
                    }
                }
            });

            // making selection model the first column in the column model
            col[0] = sm;

            // adding the rest of the columns to the column model
            var cm = new Ext.grid.ColumnModel({
                columns: col,
                defaults:{sortable: true}
            });
</pre>
<p>And now lets make our grid:</p>
<pre class="brush: jscript; title: ; notranslate">
var grid = new Ext.grid.GridPanel({
                id:'gridin',
                store: store,
                loadMask:true,
                cls:'inval',
                colModel: cm,
                sm:sm,
                //title: 'In values',
                stripeRows: true,
                viewConfig:{forceFit:true},
                //clicksToEdit:1,
                height: 365,
                width: 1080,
                columnLines:true
});

store.load({params:{start:0, limit:10}});
grid.render('sample');
</pre>
<p>And we&#8217;re done <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Our dynamic grid should be shown now. Everytime you make a new request you will be able to upload new set of data, regardles of the number of columns or rows. This grid can also be editable, but that&#8217;s another story.<br />
Cheers! <img src='http://inchoo.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/dynamic-grids-anyone/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PhpStorm IDE overview</title>
		<link>http://inchoo.net/tools-frameworks/phpstorm-ide-overview/</link>
		<comments>http://inchoo.net/tools-frameworks/phpstorm-ide-overview/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 13:12:54 +0000</pubDate>
		<dc:creator>Zeljko Prsa</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[phpstorm]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=6865</guid>
		<description><![CDATA[Developing sites and applications demands the best tool you can afford. PhpStorm is by far the best friend you can get when dealing with web development. Here&#8217;s why. What sets &#8230;]]></description>
			<content:encoded><![CDATA[<p>Developing sites and applications demands the best tool you can afford. PhpStorm is by far the best friend you can get when dealing with web development. Here&#8217;s why.<br />
<span id="more-6865"></span><br />
What sets PHPStorm apart from the competition is one incredible fact: It&#8217;s the first JAVA application that doesn&#8217;t suck. Period. I know, it doesn&#8217;t  sound plausible but it&#8217;s true.</p>
<p>I&#8217;ve been using it for over 6 months or so and this review will be based on their 2.0 EAP. They are releasing bug fixes and features/enhancements on almost weekly bases. You can check the progress on their blog and track the change-list.</p>
<p>The following points are based on the app itself and not as a comparison to any other IDE on the market. Also, Im writing this mainly from a front-end developer perspective so bare with me.</p>
<p><strong>1. Local history</strong></p>
<p>&#8220;&#8230;Is independent of external version control systems and works with the directories of your project even when they are not under any VCS control. It applies to any structural artifacts: a project, a directory or package, a file, a class, class members, tags, or selected fragment of text.&#8221;</p>
<p>It works the way it&#8217;s supposed to and never fails. The moment you set up the project, like &#8220;Magento&#8221; it keeps track of all changes in the files and even folders. Once you need to compare the files with a previous version it&#8217;s a piece of cake to find the differences between files in a nice and intuitively highlighted file comparison window. Only textual files are kept inside the local history and for the files over 1MB it only tracks the very fact of the changes.   </p>
<p>Note: PhpStrom has the version control integration built in so you can control the project through SVN, GIT, Mercurial or any other major versioning system you&#8217;re using. It even has GitHub integration off the bat.</p>
<p><img src="http://inchoo.net/wp-content/uploads/2010/11/local-history-menu-300x114.png" alt="PhpStorm Version control menu" title="Version control menu" width="300" height="114" class="alignnone size-thumbnail wp-image-6869" /></p>
<p><a href="http://inchoo.net/wp-content/uploads/2010/11/local-history-window.png"><img src="http://inchoo.net/wp-content/uploads/2010/11/local-history-window-600x437.png" alt="" title="local-history-window" width="600" height="437" class="alignnone size-medium wp-image-6870" /></a></p>
<p><strong>2. Refactoring</strong></p>
<p>The refactoring feature has been built in since it&#8217;s earliest versions. With the latest build of the 2.0 EAP it has some great refactoring options:</p>
<p>- Search for references (File)<br />
- Rename accessors (Field)<br />
- Rename containing file (Class, Interface)<br />
- Rename parameters in hierarchy (Method parameter)<br />
- Rename inheritors (Class, Interface)<br />
- Rename Heredoc/Nowdoc delimeters</p>
<p>If while performing refactoring any conflicts occur, PhpStorm will display a dialog box with a problem description. At this point you can ignore, preview or cancel the action.</p>
<p>A more detailed description of refactoring can be found at their <a href="http://blogs.jetbrains.com/webide/2010/11/new-rename-refactoring-features-in-phpstorm-2-0/">site</a> or once you <a href="http://confluence.jetbrains.net/display/WI/Web+IDE+EAP">download</a> the app check put the manual which has an extensive overview of features with examples. </p>
<p><strong>3. Productivity</strong></p>
<p>This one is a killer feature. In fact the main purpose of this app is to make your life as a web developer as easy as possible while programming full-time.<br />
From autocompletion to numerous shortcuts and de-cluttered workspace it becomes your extension rather than just a tool. It even has a &#8220;Productivity guide&#8221; built-in so you can keep track of all of the features that you use or what&#8217;s more important what you&#8217;re not that could be of great benefit to you.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2010/11/productivity-list-with-hints.png"><img src="http://inchoo.net/wp-content/uploads/2010/11/productivity-list-with-hints-600x665.png" alt="PhpStrom productivity list with hints" title="productivity-list-with-hints" width="600" height="665" class="alignnone size-medium wp-image-6871" /></a></p>
<p>Here&#8217;s a second screenshot of all of the productivity enhancements you can find in PhpStorm. </p>
<p><a href="http://inchoo.net/wp-content/uploads/2010/11/productivity-list.png"><img src="http://inchoo.net/wp-content/uploads/2010/11/productivity-list.png" alt="" title="productivity-list" width="424" height="547" class="alignnone size-full wp-image-6872" /></a></p>
<p><strong>4. Deployment</strong></p>
<p>This one is a huge feature that makes my job a lot easier. Starting from setting the default server configurations and mapping the working folders, comparing local and deployed files to a great feature of optional &#8220;Automatic upload&#8221; with a neat sub-option of saving upon changing the window focus. This makes my work as streamlined as possible. Combine this with local history by checking the differences between the deployed version and the local version and your teamwork is a breeze. Supports FTP, SFTP, mounted folder and local.</p>
<p><a href="http://inchoo.net/wp-content/uploads/2010/11/deployment.png"><img src="http://inchoo.net/wp-content/uploads/2010/11/deployment.png" alt="PhpStorm deployment" title="PhpStorm deployment" width="481" height="490" class="alignnone size-full wp-image-6873" /></a></p>
<p><strong>5. Editor</strong></p>
<p>Here&#8217;s the list of the editing features that PhpStorm currently has:</p>
<p>- Syntax and error highlighting. The color attributes are configurable in the Colors and Fonts | &lt;language&gt; page of the Settings dialog.<br />
- File templates for the supported languages that enable creating stub classes, scripts etc.<br />
- Live templates for creating complicated code constructs.<br />
- Code completion.<br />
- Code generation.<br />
- Code folding, formatting, and highlighting.<br />
- Zen Coding<br />
- SASS support<br />
- Intention actions and quick fixes.<br />
- Possibility to view code hierarchy.<br />
- Quick access to the API documentation.<br />
- Using macros in the editor.<br />
- Advanced search and replace facilities.<br />
- Advanced means of navigation.<br />
- Refactoring.<br />
- Import Assistance</p>
<p>It&#8217;s fast, accurate and if you follow the &#8220;Productivity guide&#8221; as much as possible and of course over time you&#8217;ll be pouring code in no time. Since I&#8217;m 90% of the time editing the css and xml files I honestly couldn&#8217;t go back to anything I&#8217;ve previously used. Period. </p>
<p>Ivica, my team colleague uses it for 99% of time for PHP and Javascript and every now and then he gets amazed by the way the editor alone works. I hope he&#8217;ll make a review from the back-end development perspective soon <img src='http://inchoo.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I&#8217;ll have t stop here and let you try it yourself since the more I try to be as brief as possible I keep wanting to add every other feature that this app has. </p>
<p>To conclude this. As in the humble beginnings of my PhpStorm usage and now after more than a half a year later, one thought remains. It&#8217;s this: The guys at JetBrains did this application (and WebStorm) with developer in mind from start to finish. Even now, they keep focused on their work to make this app a developer&#8217;s extension rather than just a product to sell. </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/phpstorm-ide-overview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Git vs SVN A.K.A. Everyone likes control</title>
		<link>http://inchoo.net/tools-frameworks/git-vs-svn-a-k-a-everyone-likes-control/</link>
		<comments>http://inchoo.net/tools-frameworks/git-vs-svn-a-k-a-everyone-likes-control/#comments</comments>
		<pubDate>Tue, 23 Nov 2010 07:06:15 +0000</pubDate>
		<dc:creator>Mladen Lotar</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Tools & Frameworks]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://inchoo.net/?p=6618</guid>
		<description><![CDATA[Hi! Today I&#8217;ll try to make an objective overview of both SVN&#8217;s and Git&#8217;s pros and cons from developer side. I won&#8217;t go into depth of configuration of any of &#8230;]]></description>
			<content:encoded><![CDATA[<p>Hi! Today I&#8217;ll try to make an objective overview of both SVN&#8217;s and Git&#8217;s pros and cons from developer side. I won&#8217;t go into depth of configuration of any of them neither will discuss specific commands, but rather functionality itself.<span id="more-6618"></span></p>
<p>I&#8217;d like to point out that the two most famous types of version control systems are:</p>
<ul>
<li>Centralized version control system &#8211; subversion (SVN)</li>
<li>Distributed or decentralized version control system &#8211; Git</li>
</ul>
<p>And that&#8217;s the big difference, others are just a small smaller things that are based upon this main fact. I won&#8217;t say that they don&#8217;t matter, <em>au contraire</em>, like French would say, amount of that small things is greater in volume than you&#8217;d think.</p>
<p>And now, enough with the &#8220;general stuff&#8221;, let&#8217;s put everything on a list.</p>
<h2>SVN</h2>
<p>SVN is a powerful version control tool and many companies have been using it for quite some time. Over the history, it became the most popular version control system in the world.</p>
<p><strong>The &#8220;Pros&#8221;</strong></p>
<ul>
<li>SVN is well-known, wide-spread solution that makes everyone comfortable.</li>
<li>Its centralized repository makes tracking simpler</li>
<li>There are only two basic commands (used on daily basis):</li>
</ul>
<ol>
<li><strong>svn commit</strong> or           <strong>svn ci</strong>. This command           recursively sends your changes to the SVN server. It will commit           changed files, added files, and deleted files.</li>
<li> <strong>svn update</strong> or           <strong>svn up</strong>. This command           syncs your local sand box with the server. If you have made local           changes, it will try and merge any changes on the server with your           changes <em>on your machine</em>.</li>
</ol>
<ul>
<li>SVN help is more organized and to the point. Even a quick Google search will get you much more simple examples than for Git</li>
</ul>
<p><strong>The &#8220;Cons&#8221;</strong></p>
<ul>
<li>SVN stores a pristine copy of every checked-out source file on the client side, in a subdirectory of &#8220;<code>.svn</code>&#8220;.</li>
<li>Space requirement is much greater than with Git</li>
<li>Requires Internet connection for many &#8220;daily&#8221; stuff &#8211; which makes it much slower compared to Git</li>
</ul>
<h2>Git</h2>
<p><strong>The &#8220;Pros&#8221;</strong></p>
<ul>
<li>Stronger branching than any other Source Code Management</li>
<li>Faster than SVN (in this example) &#8211; mainly because it does common tasks like &#8220;diff&#8221; locally, which include</li>
</ul>
<ol>
<li> Perform a diff.</li>
<li> View file history.</li>
<li> Commit changes.</li>
<li> Merge branches.</li>
<li> Obtain any other revision of a file (not just the prior committed revision).</li>
<li> Switch branches.</li>
</ol>
<ul>
<li>Smaller complete &#8220;filesize&#8221; of repository</li>
</ul>
<p><strong>The &#8220;Cons&#8221;</strong></p>
<ul>
<li>Overkill on documentation (IMHO) &#8211; can&#8217;t easily find small examples</li>
<li>It can get difficult to track branches and revisions</li>
</ul>
<h2>The Conclusion</h2>
<p>Although SVN is the popular choice, I&#8217;d go with Git any day. Not because I&#8217;m geeky (and Git would fit into that perfectly), but from the developer side. The fact is that when using version control system, you&#8217;ll mainly do a &#8220;push&#8221;, &#8220;pull&#8221; and &#8220;difference&#8221;. And If it has to be directly on server, it will get lagged sometimes (depending on the changes and connection). Git&#8217;s capability to create number of &#8220;commits&#8221; locally and putting it to server with one push is great. Combined together with &#8220;difference&#8221; locally its my choice of tool. Solely on those two facts.</p>
<p>On the other hand &#8211; you will hear that some clients require SVN, and you&#8217;ll almost never hear that kind of request for Git &#8211; that&#8217;s true. But you can always use SVN for specifics, and Git for your comfortability on other projects. And another relevant fact &#8211; when I looked into material for this article &#8211; I almost couldn&#8217;t find an article &#8220;SVN over Git&#8221; &#8211; it was the opposite way.</p>
<p>To &#8220;<strong>conclude the conclusion</strong>&#8221; &#8211; small example from &#8220;real life&#8221; I found on the Internet:</p>
<p>For example the Mozilla repository is reported to be almost 12 GiB when  stored in SVN using the fsfs backend.  Previously, the fsfs backend also  required over 240,000 files in one directory to record all 240,000  commits made over the 10 year project history. This was fixed in SVN  1.5, where every 1000 revisions are placed in a separate directory. The  exact same history is stored in Git by only two files totaling just over  420 MiB.  SVN requires 30x the disk space to store the same history.</p>
<p>As this is exclusively my opinion, I&#8217;m very interested in yours. Please express yourselves!</p>
<p>Cheers! <img src='http://inchoo.net/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://inchoo.net/tools-frameworks/git-vs-svn-a-k-a-everyone-likes-control/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.395 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2012-05-21 12:40:21 -->

