<?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>@mariusboitor - thoughts &#38; ideas</title>
	<atom:link href="http://www.devessence.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devessence.com</link>
	<description>Lean, Agile, Rightshifting, Digital, Creative, Technology, Strategy, Innovation, Kaizen, Continuous Improvement</description>
	<lastBuildDate>Sun, 11 Nov 2012 18:23:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>The Source of Inspiration</title>
		<link>http://www.devessence.com/2012/11/11/the-source-of-inspiration/</link>
		<comments>http://www.devessence.com/2012/11/11/the-source-of-inspiration/#comments</comments>
		<pubDate>Sun, 11 Nov 2012 14:48:44 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Lean]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Thoughts]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[continuous improvement]]></category>
		<category><![CDATA[creative]]></category>
		<category><![CDATA[essence]]></category>
		<category><![CDATA[eternal return]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[kaizen]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=491</guid>
		<description><![CDATA[The author of the first history of religions &#8211; Mircea Eliade &#8211; said that if we want to understand the things we need to go back to the essence. He also had a theory of the eternal return which had two perspectives, a religious one and a philosophical one. They both are a great example ...]]></description>
				<content:encoded><![CDATA[<p>The author of the first history of religions &#8211; <a title="Mircea Eliade" href="http://en.wikipedia.org/wiki/Mircea_Eliade" target="_blank">Mircea Eliade</a> &#8211; said that if we want to understand the things we need to go back to the essence. He also had a theory of the eternal return which had two perspectives, a <a title="religious" href="http://en.wikipedia.org/wiki/Eternal_Return_%28Eliade%29" target="_blank">religious</a> one and a <a title="philosophical" href="http://en.wikipedia.org/wiki/Eternal_return" target="_blank">philosophical</a> one. They both are a great example of this idea.<br />
I, personally, totally agree with this approach.<br />
Now, fast forward to our days which are blessed to be overflowing with technology.<br />
Today the problem is not technology, we have plenty, today our problem is called <em>opportunity</em>.</p>
<p>What do we do with all the existing technology?<br />
We have the means but what&#8217;s the end? Where are we going?<br />
We probably can solve the problem but have we defined the problem or we just create possible scenarios around the means?<br />
We have huge amounts of data but how good are we at translating that into knowledge?</p>
<p>I tend to agree that these are intermediary times between an, let&#8217;s say, Industrial Era and probably an Intelligence Era.<br />
This imagination and innovation age, revolutionary nonetheless, is a great time to live in but when will we put all these amazing discoveries to work towards an end? When we&#8217;ll take that moment to properly define the problem so we can come up with the solution?<br />
I think the era of &#8220;let&#8217;s create some more needs&#8221; is very close to its end.<br />
This approach is not feasible in any way, shape or form and the best example is our relation with Nature. We could go micro as well and have a quick look in some offices too.<br />
We definitely need to be much more flexible and agile because if we&#8217;re not, Darwin&#8217;s words might become our nightmare. Why? Well, because it&#8217;s not about the strongest, it&#8217;s about the most adaptable, it&#8217;s about how fast can you anticipate, understand and adapt.<br />
And if you might be able to anticipate using your imagination, intuition and rationale, in order to understand you need to go back to the essence.<br />
Adaptability is change and means how fast can you learn and put into practice what you&#8217;ve just learnt.<br />
That is what makes the difference.<br />
It&#8217;s not about systems, it&#8217;s not about markets and it&#8217;s not about customers. It&#8217;s not about micro or macro, it&#8217;s about us and the values we use, the perspective we have and the commitment.<br />
Of these values we unfortunately use two sets, the one that we follow when we do, which are the main proof of ones character &#8211; many close an eye quite often on these ones &#8211; and the other set of values that is used when we expect &#8211; this makes us hyper critical.<br />
Solution? Well, going back to the first paragraph I&#8217;d say that a return to the essence might help us put the balance right and this way open a new, much wider and clearer perspective. From all these as we know one outcome is a deeper understanding and a much more focused energy. Being in balance, I&#8217;d say, we&#8217;ll give us that constant and sustainable flow of creative energy that in the end separates us from everything else and even from each other.<br />
Probably this way we&#8217;ll have better professionals, better organisations, better society &#8230; and definitely, individuals that are survivors and a better relation with what&#8217;s around us.</p>
<p>So, 2 cents, the source of inspiration can be the essence of things.<br />
My advice, the essence can( and should) definitely be the source, including the source of inspiration. And the <em>eternal return</em> is the foundation of what can be described as a continuous process of improvement.</p>
<p>If you&#8217;d like to add anything to this please use the comments form below.</p>
<p>Thank you</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2012/11/11/the-source-of-inspiration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Continuous Delivery: How to set up a deployment pipeline &#8211; Part 1</title>
		<link>http://www.devessence.com/2012/01/02/continuous-delivery-how-to-set-up-a-deployment-pipeline/</link>
		<comments>http://www.devessence.com/2012/01/02/continuous-delivery-how-to-set-up-a-deployment-pipeline/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 23:07:05 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Lean]]></category>
		<category><![CDATA[Operations & Infrastructure]]></category>
		<category><![CDATA[Process & Practices]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[continuous delivery]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[deployment pipeline]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[lean]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[selenium]]></category>
		<category><![CDATA[sonar]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=437</guid>
		<description><![CDATA[As we all know Continuous Delivery was born from the Agile Continuous Improvement practice and even if it&#8217;s newer than other practices has already won his place as being a critical component in most Lean/Agile environments. In these series we&#8217;ll assume that the reader is familiar with at least some basic Agile concepts as we won&#8217;t ...]]></description>
				<content:encoded><![CDATA[<p>As we all know <strong>Continuous Delivery</strong> was born from the Agile <strong>Continuous Improvement</strong> practice and even if it&#8217;s newer than other practices has already won his place as being a critical component in most Lean/Agile environments.</p>
<p>In these series we&#8217;ll assume that the reader is familiar with at least some basic Agile concepts as we won&#8217;t discuss anything else but how to set up a <em>deployment pipeline,</em> term introduced by Continuous Delivery.</p>
<p>We all know that the demand for quality software at a faster and faster rate is always on an ascending trend and<span id="more-437"></span> because of that every organization (who understands the challenge and want&#8217;s to stay in business) is putting more and more effort to become more and more flexible/adaptable/agile (like in the word agile) adopting methodologies like Lean and Agile.</p>
<p>In our scenario we&#8217;ll assume some things and we&#8217;ll use some tools or approaches but they are just an example and they might not necessarily represent the ideal set up for all organizations. However it should give you an idea (if you don&#8217;t have one already) about how a deployment pipeline might look like, or, if you are already agile it can work for you as an example or as a term of comparison.<br />
Also Continuous Delivery is not only about automation, so when this is about to be put in place a deep investigation must be done as this is also about sales and pricing, about organizational structure and governance system and more.</p>
<p>In our series we&#8217;ll try to create a scenario in which a <em>deployment pipeline</em> is being set up for a SME which delivers web solutions. Also the components used in our example are just for testing purposes only and you can use any other component from the same category and rules should still apply (apart from those custom solutions which might need custom settings).</p>
<p><strong>Prerequisites:</strong></p>
<ul>
<li><a href="http://www.ubuntu.com">Ubuntu</a></li>
<li><a href="http://www.apache.org">Apache</a></li>
<li><a href="http://tomcat.apache.org">Apache Tomcat</a></li>
<li><a href="http://hudson-ci.org">Hudson</a></li>
<li><a title="Selenium Web Application Testing" href="http://seleniumhq.org/" target="_blank">Selenium</a></li>
<li><a href="http://www.sonarsource.org">Sonar</a></li>
<li><a href="http://mercurial.selenic.com/">Mercurial</a></li>
<li><a href="http://www.mediawiki.org">MediaWiki</a></li>
<li><a href="http://www.mantisbt.org/">MantisBT</a></li>
</ul>
<p>The above is a list of tools that will be used and the below is the list of an (maybe Agile) Integrated Development Environment:</p>
<ul>
<li>Build Servers</li>
<li>Source Control</li>
<li>Development</li>
<li>Staging</li>
<li>Production</li>
</ul>
<p>That being said the introduction should be almost at the end but before we close it we&#8217;ll just mention that there will be a few other tools/components that we&#8217;ll use in our example and they are as follows (even if as we already mentioned the set up is not necessarily dependant on one or the other):</p>
<ul>
<li><a title="CodeIgniter PHP Framework" href="http://codeigniter.com/" target="_blank">CodeIgniter</a> (and <a title="Django Python Web Framework" href="https://www.djangoproject.com/" target="_blank">Django</a>)</li>
<li><a title="MySQL Database Engine" href="http://www.mysql.com" target="_blank">MySQL</a> Database</li>
<li>BASH Shell Scripting</li>
<li>SSH</li>
</ul>
<p>In Part 2 we&#8217;ll start making our hands dirty so hang on.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2012/01/02/continuous-delivery-how-to-set-up-a-deployment-pipeline/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SysAdmin &#8211; reset Ubuntu Gnome panel</title>
		<link>http://www.devessence.com/2011/04/26/sysadmin-reset-ubuntu-gnome-panel/</link>
		<comments>http://www.devessence.com/2011/04/26/sysadmin-reset-ubuntu-gnome-panel/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 08:28:38 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[gnome]]></category>
		<category><![CDATA[ubuntu. sysadmin]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=427</guid>
		<description><![CDATA[Just another small answer to a possible annoying issue if you don&#8217;t know what to do. In some circumstances you might change you Gnome panel configuration file or an update might change it or the file can get corrupt or maybe from different other reasons you might want to re-set your Gnome panel. How can ...]]></description>
				<content:encoded><![CDATA[<p>Just another small answer to a possible annoying issue if you don&#8217;t know what to do. In some circumstances you might change you Gnome panel configuration file or an update might change it or the file can get corrupt or maybe from different other reasons you might want to re-set your Gnome panel.<br />
How can you do that?<span id="more-427"></span><br />
Well in Ubuntu you just need to run these commands:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;">gconftool-<span style="color: #000000;">2</span> <span style="color: #660033;">--shutdown</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> ~<span style="color: #000000; font-weight: bold;">/</span>.gconf<span style="color: #000000; font-weight: bold;">/</span>apps<span style="color: #000000; font-weight: bold;">/</span>panel
pkill gnome-panel</pre>
</td>
</tr>
</table>
</div>
<p>That&#8217;s it.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2011/04/26/sysadmin-reset-ubuntu-gnome-panel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SysAdmin &#8211; Easiest way to install LAMP on Ubuntu</title>
		<link>http://www.devessence.com/2011/03/08/sysadmin-easiest-way-to-install-lamp-on-ubuntu/</link>
		<comments>http://www.devessence.com/2011/03/08/sysadmin-easiest-way-to-install-lamp-on-ubuntu/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 09:08:41 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=422</guid>
		<description><![CDATA[Most of my short articles are just answers to questions that come from different sources. To be able to help those who ask on long term I am trying to add them as they come along. They are at different levels and are more like tips and tricks. So, if you want to install a ...]]></description>
				<content:encoded><![CDATA[<p>Most of my short articles are just answers to questions that come from different sources. To be able to help those who ask on long term I am trying to add them as they come along. They are at different levels and are more like tips and tricks.<br />
So, if you want to install a LAMP environment on your Ubuntu machine just type this in the command line:<br />
<span id="more-422"></span></p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> tasksel</pre>
</td>
</tr>
</table>
</div>
<p>Select LAMP server from the list and hit Ok.<br />
Make sure you follow the installation process to be sure that everything went well but also because you&#8217;ll probably be prompted for a root password for MySQL Database server.<br />
This way you don&#8217;t need to search for each package and you have the option to install more packages that are usually being used with the LAMP environment (i.e. OpenSSH, PostgreSQL &#8230;).<br />
Also please note that not all the modules/extensions/libraries will be installed for a specific package i.e. if you need cURL for PHP you need to install it manually like this:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> php5-curl</pre>
</td>
</tr>
</table>
</div>
<p>The above is pattern is valid for all other packages/modules/extensions/libraries that you might need for existing packages or for new packages like Version Control Systems.<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2011/03/08/sysadmin-easiest-way-to-install-lamp-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SysAdmin &#8211; What Linux distribution version is installed?</title>
		<link>http://www.devessence.com/2011/02/08/sysadmin-what-linux-distribution-version-is-installed/</link>
		<comments>http://www.devessence.com/2011/02/08/sysadmin-what-linux-distribution-version-is-installed/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 22:55:18 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=406</guid>
		<description><![CDATA[Sometimes even the smallest task can be an issue if you are at the beginning of your Sysadmin career. More than that, in most of the cases if you ask the community you&#8217;ll not necessarily get an answer to be fully covered by your level of knowledge at that point in time. In the end, ...]]></description>
				<content:encoded><![CDATA[<p>Sometimes even the smallest task can be an issue if you are at the beginning of your Sysadmin career. More than that, in most of the cases if you ask the community you&#8217;ll not necessarily get an answer to be fully covered by your level of knowledge at that point in time. In the end, as I said, you can be at the beginning and you need<span id="more-406"></span> more support than a simple command which is mostly used by the community.<br />
Seeing this problem made me start a short series of Sysadmin articles as responses to many questions and/or situations saw I faced.<br />
This time we&#8217;ll just answer the question: What linux distribution version is installed on this server? (The exact question I was asked was: How can I find the version of Linux installed on this server?)<br />
On most of the forums usually you&#8217;ll probably get this answer:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-a</span></pre>
</td>
</tr>
</table>
</div>
<p>A good one but not everyone is a techie so you&#8217;ll need to give them something that can be pronounced and is more comercial than the output of the above command.<br />
For some Linux distros you can also use these commands (in conjunction with the above):</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Debian based distros - i.e. Ubuntu</span>
lsb_release <span style="color: #660033;">-a</span>
<span style="color: #666666; font-style: italic;"># Redhat based distros - i.e. Fedora, CentOs</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>redhat-release</pre>
</td>
</tr>
</table>
</div>
<p>This way you get the commercial name of your distro.<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2011/02/08/sysadmin-what-linux-distribution-version-is-installed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminder &#8211; The Zen of Python by Tim Peters</title>
		<link>http://www.devessence.com/2011/02/04/reminder-the-zen-of-python-by-tim-peters/</link>
		<comments>http://www.devessence.com/2011/02/04/reminder-the-zen-of-python-by-tim-peters/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 16:54:53 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=398</guid>
		<description><![CDATA[The Zen of Python by Tim Peters Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren&#8217;t special enough to break the rules. Although practicality beats purity. Errors should never ...]]></description>
				<content:encoded><![CDATA[<p><strong>The Zen of Python</strong><br />
<em>by Tim Peters</em><br />
<span id="more-398"></span></p>
<blockquote><p>Beautiful is better than ugly.<br />
    Explicit is better than implicit.<br />
    Simple is better than complex.<br />
    Complex is better than complicated.<br />
    Flat is better than nested.<br />
    Sparse is better than dense.<br />
    Readability counts.<br />
    Special cases aren&#8217;t special enough to break the rules.<br />
    Although practicality beats purity.<br />
    Errors should never pass silently.<br />
    Unless explicitly silenced.<br />
    In the face of ambiguity, refuse the temptation to guess.<br />
    There should be one&#8211; and preferably only one &#8211;obvious way to do it.<br />
    Although that way may not be obvious at first unless you&#8217;re Dutch.<br />
    Now is better than never.<br />
    Although never is often better than *right* now.<br />
    If the implementation is hard to explain, it&#8217;s a bad idea.<br />
    If the implementation is easy to explain, it may be a good idea.<br />
    Namespaces are one honking great idea &#8212; let&#8217;s do more of those!
</p></blockquote>
<p>Link: <a href="http://www.python.org/dev/peps/pep-0020/" target="_blank">The Zen of Python</a></p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2011/02/04/reminder-the-zen-of-python-by-tim-peters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SysAdmin &#8211; Apache rewrite redirect to holding page during maintenance</title>
		<link>http://www.devessence.com/2011/02/03/sysadmin-apache-rewrite-redirect-to-holding-page-during-maintenance/</link>
		<comments>http://www.devessence.com/2011/02/03/sysadmin-apache-rewrite-redirect-to-holding-page-during-maintenance/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 11:30:45 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=390</guid>
		<description><![CDATA[Question asked, answer provided Let&#8217;s assume that we want to redirect everyone except us to a holding page &#8211; called by us maintenance.html &#8211; during our maintenance work. This is one of the most common scenarios out there. If you use Apache as your web server you could use something like the code below. This ...]]></description>
				<content:encoded><![CDATA[<p>Question asked, answer provided <img src='http://www.devessence.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Let&#8217;s assume that we want to redirect everyone except us to a holding page &#8211; called by us <em>maintenance.html</em> &#8211;  during our maintenance work. This is one of the most common scenarios out there.<br />
If you use Apache as your web server you could use something like the code below. This is what I am using and it does the job.<br />
However, any improvements are<span id="more-390"></span> more than welcome.</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
</pre>
</td>
<td class="code">
<pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>IfModule mod_rewrite.c<span style="color: #000000; font-weight: bold;">&gt;</span>
RewriteEngine On
RewriteBase <span style="color: #000000; font-weight: bold;">/</span>
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>REMOTE_ADDR<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>^<span style="color: #000000;">12</span>\.23\.34\.45$     
<span style="color: #666666; font-style: italic;"># If you want to add more IP's add OR </span>
<span style="color: #666666; font-style: italic;"># at the end of the previous line like below</span>
<span style="color: #666666; font-style: italic;"># RewriteCond %{REMOTE_ADDR} ^12\.23\.34\.45$ [OR]</span>
<span style="color: #666666; font-style: italic;"># Make sure your file exists</span>
RewriteRule <span style="color: #000000; font-weight: bold;">!</span>^maintenance <span style="color: #000000; font-weight: bold;">/</span>maintenance.html <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">R</span>=<span style="color: #000000;">302</span>,L<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>IfModule<span style="color: #000000; font-weight: bold;">&gt;</span></pre>
</td>
</tr>
</table>
</div>
<p>That&#8217;s it. Make sure you add this code to your <em>.htaccess</em> file and you have <em>maintenance.html</em> in the same folder with <em>.htaccess</em>. This relies on a web server setting that allows the server to read the .htaccess file. If that is there then everything should be just fine.<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2011/02/03/sysadmin-apache-rewrite-redirect-to-holding-page-during-maintenance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeIgniter search and pagination, terms and uri segments (session)</title>
		<link>http://www.devessence.com/2010/07/29/codeigniter-search-and-pagination-terms-and-uri-segments-session/</link>
		<comments>http://www.devessence.com/2010/07/29/codeigniter-search-and-pagination-terms-and-uri-segments-session/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 18:33:40 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php framework]]></category>
		<category><![CDATA[php5 oop]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=365</guid>
		<description><![CDATA[In our previous &#8220;CodeIgniter search and pagination, terms and uri segments&#8221; we tried to present our approach to a search system using CodeIgniter. Everything goes well but also everything can be improved. Also we need to understand that not all requirements are the same and different environments may require different solutions. This is one of ...]]></description>
				<content:encoded><![CDATA[<p>In our previous &#8220;CodeIgniter search and pagination, terms and uri segments&#8221; we tried to present our approach to a search system using CodeIgniter. Everything goes well but also everything can be improved. Also we need to understand that not all requirements are the same and different environments may require different solutions. This is one of developer&#8217;s talent measure to choose the right solution for a particular problem.<br />
In this article we&#8217;ll try to use another approach, maybe a bit more reliable, using sessions.<span id="more-365"></span><br />
We&#8217;ll assume that you have a basic knowledge of PHP, MySQL and, of course, CodeIgniter. So, let&#8217;s get to work.<br />
Assuming that you have CodeIgniter installed and you have a database already running and configured to work with the framework. Also make sure you the sessions table created and you load the libraries needed (database and session).<br />
First step is to build our controller and here is the code:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Application <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000088;">$results_per_page</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$terms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// default empty search terms array</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results_per_page</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$results_per_page</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Application_model'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">search</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> search<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// reset the search terms</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">unset_userdata</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s_key_one'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">unset_userdata</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s_key_two'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">unset_userdata</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s_key_three'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// application_search is our view that contains the form</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application_search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// this is how it works if you store your validation rules in a file</span>
			<span style="color: #666666; font-style: italic;">// if you do, good, if not, make sure that you have a file that contains your</span>
			<span style="color: #666666; font-style: italic;">// validation rules in a format that can be found in CI's user guide</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'form_validation'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_rules</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">item</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'form_validation'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">form_validation</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application_search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">terms</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'s_key_one'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'key_one'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">terms</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'s_key_two'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'key_two'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">terms</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'s_key_three'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'key_three'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_userdata</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">terms</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				redirect<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application/view'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> view<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">library</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pagination'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$offset</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">segment</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$total</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Application_model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">count_all</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'results'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Application_model</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_all</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results_per_page</span><span style="color: #339933;">,</span> <span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'total_rows'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$total</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'base_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> base_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'application/view'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'total_rows'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$total</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'per_page'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">results_per_page</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uri_segment'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'num_links'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">initialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'page_links'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">pagination</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create_links</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// application_view is our results page</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'application_view'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file application.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: ./system/application/controllers/application.php */</span></pre>
</td>
</tr>
</table>
</div>
<p>As you probably already saw we have the class properties <em>$results_per_page</em> which is static as will contain the value of how many results will be displayed per page. We have also an empty array <em>$terms</em> that will contain the search terms from the form.<br />
Inside the controller we have only a few methods, probably you&#8217;ll have more than that but for the sake of this article we&#8217;ll display only the ones that are needed by the search system.<br />
The default method, <em>index()</em>, will only load the search method. For the search you need a view (we called our view <em>application_search</em>), a view that will contain the form.<br />
The method will process the form is submit button was pressed if not will reset the session values for every search term. You can use this space to re-populate the search form if needed.<br />
If the submit button was pressed then the form will be processed. As you see inside the code we assumed that you store your validation rules inside a form_validation file.<br />
If everything goes well you build the <em>$this->terms</em> array and based on which you create the session search keys and you redirect your search to the view method.<br />
Now you can display all your results without having any search term displayed in the url. Depending on your requirements you could use <em>flashdata</em>.<br />
The view is extremely simple so will not stay to much on it.<br />
What is very important is the model. And here it is:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'BASEPATH'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No direct script access allowed'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Application_model <span style="color: #000000; font-weight: bold;">extends</span> Model <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$s_key_one</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$s_key_two</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$s_key_three</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000088;">$search_terms</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s_key_one'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'s_key_two'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'s_key_three'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Model</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">search_terms</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$search_terms</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_check_search_session<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> _check_search_session<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">search_terms</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$chk</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">session</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">userdata</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</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: #000088;">$chk</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$chk</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009900;">&#125;</span>
				<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
&nbsp;
					<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$chk</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009900;">&#125;</span>
				<span style="color: #990000;">unset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$chk</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> _filter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_one</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; applications.key_one = &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_one</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_two</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; applications.key_two LIKE('%&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_two</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;%') &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_three</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">where</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; DATE(applications.key_three) &gt;= DATE(FROM_UNIXTIME(&quot;</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">s_key_three</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' 00:00:00'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;)) &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>	
	<span style="color: #000000; font-weight: bold;">function</span> count_all<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;applications.id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_filter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;applications&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 *
 * Here goes your function description
 *
*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> get_all<span style="color: #009900;">&#40;</span><span style="color: #000088;">$limit</span><span style="color: #339933;">,</span> <span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">select</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;applications.*&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_filter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">order_by</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;applications.id&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;DESC&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">limit</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$limit</span><span style="color: #339933;">,</span> <span style="color: #000088;">$offset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;applications&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
&nbsp;
&nbsp;
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file application_model.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: ./system/application/models/application_model.php */</span></pre>
</td>
</tr>
</table>
</div>
<p>Similar to the controller you&#8217;ll declare a few properties which are the search keys from your session. Also you need to declare an array having the same values. You&#8217;ll make a loop based on this array checking for the existence of each key in the session. This is what <em>_check_search_session()</em> does.<br />
Also we&#8217;ve placed all the filters in a separate function. That way you have the flexibility to build your rules. We call the function inside the <em>count_all()</em> and <em>get_all()</em>.<br />
This is it. You can do a lot with this piece code what we tried here was to show a different approach.<br />
If you need more details please leave a message.<br />
Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2010/07/29/codeigniter-search-and-pagination-terms-and-uri-segments-session/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>CodeIgniter MySQL Database UPDATE with JOIN statement</title>
		<link>http://www.devessence.com/2010/07/11/codeigniter-mysql-database-update-with-join-statement/</link>
		<comments>http://www.devessence.com/2010/07/11/codeigniter-mysql-database-update-with-join-statement/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 21:54:30 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://www.devessence.com/?p=266</guid>
		<description><![CDATA[This article will be an answer to a question on how I would UPDATE multiple tables using JOIN. Well, the complete question was if I&#8217;ll use CodeIgniter. There are a few details that you need to understand when you make this kind of query and one of them is that the ORDER BY and LIMIT ...]]></description>
				<content:encoded><![CDATA[<p>This article will be an answer to a question on how I would UPDATE multiple tables using JOIN. Well, the complete question was if I&#8217;ll use CodeIgniter.<br />
There are a few details that you need to understand when you make this kind of query and one of them is that<span id="more-266"></span> the ORDER BY and LIMIT is not working on multiple table update.<br />
Because the answer to this short question can be as well a short one here is what I&#8217;ll do in that situation:</p>
<div class="wp_syntax">
<table>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre>
</td>
<td class="code">
<pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;UPDATE 
		t1 
	LEFT JOIN 
		t2
		ON 
		t2.a = t1.a 
	SET 
		t1.b = ?, 
		t1.c = ?, 
		t2.d = ?, 
		t2.e = ? 
	WHERE 
		t1.f = ? 
	AND 
		t1.g = ? 
	;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$t1b</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t1c</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t2d</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t2e</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t1f</span><span style="color: #339933;">,</span> <span style="color: #000088;">$t1g</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre>
</td>
</tr>
</table>
</div>
<p>It was easy, wasn&#8217;t it?<br />
I hope this helps. If you have any more questions don&#8217;t hesitate to leave a message.<br />
Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2010/07/11/codeigniter-mysql-database-update-with-join-statement/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ubuntu 10.04 Lucid Lynx</title>
		<link>http://www.devessence.com/2010/04/13/ubuntu-10-04-lucid-lynx/</link>
		<comments>http://www.devessence.com/2010/04/13/ubuntu-10-04-lucid-lynx/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 16:22:26 +0000</pubDate>
		<dc:creator>Marius Boitor</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.devessence.com/2010/04/13/ubuntu-10-04-lucid-lynx/</guid>
		<description><![CDATA[Ubuntu 10.04 Lucid Lynx. That is the subject of this article. And probably because of the reasons mentioned below this will be quite a short article. It works. As simple as that. I&#8217;ve left just the counter in this article for a while because I wanted to have a good look at it, I wanted ...]]></description>
				<content:encoded><![CDATA[<p>Ubuntu 10.04 Lucid Lynx. That is the subject of this article. And probably because of the reasons mentioned below this will be quite a short article.<br />
It works. As simple as that. I&#8217;ve left just the counter in this article for a while because I wanted to have a good look at it, I wanted to see how it goes in production. The answer: it works.<br />
I&#8217;ve used this release as<span id="more-308"></span> any Software Architect, SysAdmin, DBA or Senior Developer would.<br />
I&#8217;ve used this release for my personal techie and/or financial activities.<br />
And I&#8217;ve used this release as a business owner.<br />
For me worked, for you, I don&#8217;t know but you should try it. You&#8217;ll have a brilliant sensation when everything it&#8217;s at your fingertips and you don&#8217;t need to pay for it. It&#8217;s free like in freedom.<br />
From emails to bluetooth connections, from proprietary drivers (especially graphic ones) to financial software, from the best development environment to games everything just worked.<br />
Every piece of my hardware it&#8217;s working, every package that has been installed it&#8217;s working in other words I have a Linux distribution that it&#8217;s working.<br />
I don&#8217;t have Photoshop(tm) and I will not have any trace of Photoshop(tm) very soon but everything else its even better than everything you are used too, if you&#8217;ve used a different OS.<br />
There are things to do and there&#8217;s plenty of place for improvement but this release has everything to be a real competitor for what&#8217;s already on the market.<br />
I will not give technical details here about my tests or other benchmarks, its not the aim for this article, but I will make my opinion public as it can give you an inside look from a real world Ubuntu user.<br />
My advise: try it and you won&#8217;t be disappointed, you&#8217;ll be amazed. I lost to much precious time from my life waiting for applications to open or execute commands, I lost to much time waiting for the very well know button called &#8220;Next&#8221;. I had enough. I just need something that works and it doesn&#8217;t give me head aches even if its about money or speed. I just need a stress free experience when its about using my computer.<br />
I hope this helps and if you are a Ubuntu user(techie or not) you&#8217;re welcome to say your opinion.<br />
Excellent job Ubuntu team/Ubuntu community.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.devessence.com/2010/04/13/ubuntu-10-04-lucid-lynx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
