<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; Web</title>
	<atom:link href="http://www.g-loaded.eu/tag/web/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Use the Alternatives System to switch to a custom Firefox release</title>
		<link>http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/</link>
		<comments>http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 05:46:25 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Customization]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=496</guid>
		<description><![CDATA[From a user&#8217;s perspective, having to use an old beta version of Firefox in my primary desktop, while, at the same time, a final stable release of the browser has been released, is a bit annoying. But, the fact that this happens due to technical issues makes it partially acceptable. The following article aims to [...]]]></description>
			<content:encoded><![CDATA[<p>From a user&#8217;s perspective, having to use an old beta version of <a href="http://www.mozilla.org/">Firefox</a> in <a href="http://www.g-loaded.eu/2008/05/16/desktop-now-uses-fedora-9/">my primary desktop</a>, while, at the same time, a final stable release of the browser has been released, is a bit annoying. But, the fact that this happens due to technical issues makes it partially acceptable. The following article aims to provide step-by-step instructions about how to use the <strong>alternatives system</strong> to set a custom Firefox release, downloaded from mozilla.org, to be the system&#8217;s default. Using this method the user is relieved from having to go through all the firefox launchers and menu entries in order to edit the paths to the firefox executable. Moreover, this post should also be a good example of how to use the alternatives system in the Linux distributions that support it.</p>
<p><strong><em>Update</em></strong>: Firefox 3.0 final has become available from the official fedora updates repository. It seems that the technical issues of the past do not exist any more! Kudos! This tutorial will still give you an idea though about how to <em>quickly</em> and <em>easily</em> switch between the default and custom versions of the same software in your system.<br />
<span id="more-496"></span><br />
Fedora 9 has been used as the desktop system for this article. The provided information will certainly work in CentOS and RHEL, but might also work for other linux distributions which use the alternatives system, such as Debian, Ubuntu, OpenSUSE etc. As far as I know, Gentoo and its derivatives use their own system.</p>
<p>In order to check if &#8220;alternatives&#8221; is available in your system, try one of the following commands:</p>
<pre class="console">
which alternatives
which update-alternatives
</pre>
<h4>Firefox Installation</h4>
<p>First of all, we install a <em>precompiled</em> (binary) Firefox distribution, downloaded from mozilla.org, in the <strong>/opt</strong> directory. All the following commands should be issued by &#8216;<code>root</code>&#8216; or by your regular user using &#8216;<code>sudo</code>&#8216;.</p>
<p><em>Change</em> to the <strong>/opt</strong> directory, <em>download</em> and <em>extract</em> the firefox package:</p>
<pre class="console">
cd /opt/
wget ftp://ftp.mozilla.org/pub/firefox/releases/3.0/linux-i686/en-US/firefox-3.0.tar.bz2
tar -xjf firefox-3.0.tar.bz2
</pre>
<p>Now <em>change</em> to the <strong>/opt/firefox/</strong> directory, <em>delete</em> the <strong>plugins/</strong> subdirectory and create a <em>symlink</em> to the system&#8217;s directory containing the firefox plugins (<code>/usr/lib/mozilla/plugins/</code> in Fedora).</p>
<pre class="console">
cd firefox/
rm -fr plugins
ln -s /usr/lib/mozilla/plugins/ plugins
</pre>
<p>The installation of the custom Firefox version is complete.</p>
<h4>Set the system-wide default Firefox version</h4>
<p>In this section we will use the <strong>alternatives system</strong> in order to provide us with two options:</p>
<ol>
<li>Use Fedora&#8217;s default Firefox release. This means that <strong>/usr/bin/firefox</strong> should be executed whenever we issue the &#8216;<code>firefox</code>&#8216; command.</li>
<li>Set our custom Firefox release as the system&#8217;s default. This means that <strong>/opt/firefox/firefox</strong> should be executed whenever we issue the &#8216;<code>firefox</code>&#8216; command.</li>
</ol>
<p><strong><em>Note</em></strong>: Describing the details of the alternatives system is out of the scope of this article, so it is highly recommended that you study the <em>alternatives manual page</em> (<code>man 8 alternatives</code>)</p>
<p>In the following steps we will add a <strong>group</strong>, named &#8220;<em>firefox</em>&#8220;, of alternative options for the location of the <strong>firefox executable</strong>. These options are actually <em>filesystem locations</em> which will be linked by the <strong>/usr/local/bin/firefox</strong> symlink. Note that we use the <strong>/usr/local/bin/&#8230;</strong> path for our symlink, because <strong>/usr/bin/firefox</strong> is occupied by fedora&#8217;s firefox executable. The latter will not be called directly any more, as the executables located in <strong>/usr/local/bin/</strong> override the ones located in <strong>/usr/bin/</strong>, so whenever the command &#8216;<code>firefox</code>&#8216; is invoked, <strong>/usr/local/bin/firefox</strong> will actually be used. The latter is a symlink, which links to either fedora&#8217;s firefox executable or our custom firefox executable.</p>
<p>So, we add the &#8216;<em>firefox</em>&#8216; group of options:</p>
<pre class="console">
/usr/sbin/alternatives --install /usr/local/bin/firefox firefox /usr/bin/firefox 10
/usr/sbin/alternatives --install /usr/local/bin/firefox firefox /opt/firefox/firefox 20
</pre>
<p>Now we can manually set which firefox executable to use as the system&#8217;s default. In other words, the following command links <strong>/usr/local/bin/firefox</strong> to the desired executable (<strong>/opt/firefox/firefox</strong> in our case):</p>
<pre class="console">
/usr/sbin/alternatives --set firefox /opt/firefox/firefox
</pre>
<p><strong>Instead of the <code>--set</code> option as shown above</strong>, we can use the <strong>&#8211;config</strong> option, so that a list of the available <em>alternatives</em> is displayed and we are prompted to make a selection:</p>
<pre class="console">
# /usr/sbin/alternatives --config firefox
There are 2 programs which provide 'firefox'.
  Selection    Command
-----------------------------------------------
   1           /usr/bin/firefox
*+ 2           /opt/firefox/firefox
Enter to keep the current selection[+], or type selection number: 2
</pre>
<p>Finally, we can issue the following command to get an overview of our current configuration for the group &#8216;<em>firefox</em>&#8216;:</p>
<pre class="console">
# /usr/sbin/alternatives --display firefox
firefox - status is manual.
 link currently points to /opt/firefox/firefox
/usr/bin/firefox - priority 10
/opt/firefox/firefox - priority 20
Current `best' version is /opt/firefox/firefox.
</pre>
<h4>Revert to the original state</h4>
<p>If for any reason you need to revert things back to the default state, all you have to do in order to remove all the &#8220;<em>alternatives</em>&#8221; we had configured in the previous section is the following:</p>
<pre class="console">
/usr/sbin/alternatives --remove firefox /opt/firefox/firefox
/usr/sbin/alternatives --remove firefox /usr/bin/firefox
</pre>
<p>No other configuration is required. From now on, whenever the &#8216;<code>firefox</code>&#8216; command is invoked, fedora&#8217;s old <strong>/usr/bin/firefox</strong> is executed.</p>
<h4>Final Thoughts</h4>
<p>Technical issues in the linux distribution preparation process might limit the user to certain software versions. The alternatives system provides users with the choice to configure the system in a way that it is extremely <strong>easy to switch</strong> between <strong>default</strong> and <strong>custom</strong> versions of the same software.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/">Use the Alternatives System to switch to a custom Firefox release</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2011/09/28/the-new-amateuristic-release-strategy-of-firefox/" rel="bookmark">The new amateuristic release strategy of Firefox</a></li>
<li><a href="http://www.g-loaded.eu/2009/10/30/selinux-setenforce-mode/" rel="bookmark">Using setenforce to switch SELinux mode wisely</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/26/using-a-switch-to-prevent-system-shutdownrebootsuspend/" rel="bookmark">Using a switch to prevent system shutdown/reboot/suspend</a></li>
<li><a href="http://www.g-loaded.eu/2005/12/11/local-yum-repository/" rel="bookmark">Local YUM Repository</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/08/the-use-of-the-uppercase-x-in-chmod/" rel="bookmark">The use of the uppercase X in chmod</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/06/18/use-the-alternatives-system-to-switch-to-a-custom-firefox-release/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Online analysis of a webpage&#8217;s loading time</title>
		<link>http://www.g-loaded.eu/2008/02/25/online-analysis-of-a-webpages-loading-time/</link>
		<comments>http://www.g-loaded.eu/2008/02/25/online-analysis-of-a-webpages-loading-time/#comments</comments>
		<pubDate>Mon, 25 Feb 2008 16:19:34 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Services]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2008/02/25/online-analysis-of-a-webpages-loading-time/</guid>
		<description><![CDATA[Have you ever wondered how much time it takes a browser to load your web page across the internet or how this total webpage load time is distributed among the various HTTP requests that are sent to the web server in order to retrieve all the objects, including images, javascript, flash animations, et cetera your [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever wondered how much time it takes a browser to load your web page across the internet or how this total webpage <strong>load time</strong> is distributed among the various HTTP requests that are sent to the web server in order to retrieve all the objects, including images, javascript, flash animations, et cetera your page contains? Recently, I&#8217;ve been wondering about such things, so I started searching for services that can provide both an estimation of a web page&#8217;s load time and also some analysis about how long the retrieval of each of its objects lasts. The one that caught my attention is Pingdom&#8217;s <a href="http://tools.pingdom.com/fpt/">Full Page Test</a>. The service can be used free of charge. I guess the visual representation of the web page load time and all the available features are quite satisfactory for a free service.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/02/25/online-analysis-of-a-webpages-loading-time/">Online analysis of a webpage&#8217;s loading time</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/12/17/online-for-good/" rel="bookmark">Online for good</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/29/best-practices-of-software-licensing/" rel="bookmark">Best Practices of Software Licensing</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/02/25/online-analysis-of-a-webpages-loading-time/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Featured Epiphany Plugins</title>
		<link>http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/</link>
		<comments>http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 00:45:37 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Epiphany]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/</guid>
		<description><![CDATA[My two plugins &#8211; extensions &#8211; for the Epiphany web browser, Tab-Session-Management and Tab-Links, have been featured on the official Epiphany blog. Thanks Dieguito! ;-) By reading all the entries on the blog, it is quite clear that the people behind this project are very happy to be involved. I assume this is a determinant [...]]]></description>
			<content:encoded><![CDATA[<p>My two plugins &#8211; <strong>extensions</strong> &#8211; for the <a href="http://www.gnome.org/projects/epiphany/">Epiphany</a> web browser, <a href="http://www.g-loaded.eu/2006/05/16/tab-session-management-extension-for-epiphany/">Tab-Session-Management</a> and <a href="http://www.g-loaded.eu/2007/02/28/tab-links-extension-for-the-epiphany-browser/">Tab-Links</a>, have been <a href="http://blogs.gnome.org/epiphany/2007/08/27/some-extensions-you-didnt-know/">featured</a> on the official <a href="http://blogs.gnome.org/epiphany">Epiphany blog</a>. Thanks <a href="http://diego.aureal.com.pe/">Dieguito</a>! ;-) By reading all the entries on the blog, it is quite clear that the people behind this project are very happy to be involved. I assume this is a determinant factor for the project&#8217;s future, as it guarantees the constant improvement of the browser&#8217;s key features.</p>
<p>For all those who have not tried Epiphany yet, I&#8217;d like to say the following:</p>
<blockquote><p>Using Epiphany is not about reaching the sense of uniqueness by using a less popular browser. It is also nowhere near trying to seem elite. Moreover, you will never manage to impress the ladies by using it&#8230;</p>
<p>Epiphany is a tool; a stable, lightweight piece of software, which offers better integration into the GNOME environment than any other browser, the powerful engine of Firefox and some of the most futuristic features that are available among today&#8217;s web browsers, for example tagged bookmarks.</p></blockquote>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/">Featured Epiphany Plugins</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/04/05/epiphany-browser-review/" rel="bookmark">Epiphany Browser Review</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/" rel="bookmark">A Note About The Epiphany Extensions on Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/" rel="bookmark">Smart Bookmarks in Epiphany</a></li>
<li><a href="http://www.g-loaded.eu/2007/05/16/some-thoughts-about-epiphany-extensions/" rel="bookmark">Some thoughts about Epiphany extensions</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/17/epiphany-python-console-open-new-tab/" rel="bookmark">Epiphany Python Console &#8211; Open New Tab</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Moving on to XHTML 1.1</title>
		<link>http://www.g-loaded.eu/2007/07/11/moving-on-to-xhtml-11/</link>
		<comments>http://www.g-loaded.eu/2007/07/11/moving-on-to-xhtml-11/#comments</comments>
		<pubDate>Wed, 11 Jul 2007 05:51:05 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[bbPress]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/07/11/moving-on-to-xhtml-11/</guid>
		<description><![CDATA[I attempted to update the current XHTML 1.0 Transisional WordPress theme in order to comply with the XHTML 1.1 Specification. I must admit that the switch was not that difficult and it required no more than 30 minutes to complete. All the errors and inconsistencies the W3C validator threw at me have been corrected and [...]]]></description>
			<content:encoded><![CDATA[<p>I attempted to update the current <em>XHTML 1.0 Transisional</em> WordPress theme in order to comply with the <em>XHTML 1.1 Specification</em>. I must admit that the switch was not that difficult and it required no more than 30 minutes to complete. All the errors and inconsistencies the W3C validator threw at me have been corrected and all seem to be fine by now. Below, I have posted some information about some of the changes, which may prove helpful to the reader, whenever s/he attempts such a switch of standards.<br />
<span id="more-425"></span><br />
So, start by changing the document type in the <code>header.php</code> file of your theme. Replace the current one with the following:</p>
<pre class="codesnp">
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
</pre>
<p>Then visit the <a href="http://validator.w3.org/">W3C Markup Validation Service</a> and start validating your webpages. Alternatively, you may want to add a hyperlink somewhere in your theme&#8217;s footer, which will point to a specific page on the validator&#8217;s web site, which will automatically examine the referer of the request; that is your page that needs validation. Add the following hyperlink:</p>
<pre class="codesnp">
&lt;a href="http://validator.w3.org/check/referer"&gt;Validate XHTML&lt;/a&gt;
</pre>
<p>If your current theme is well-made you won&#8217;t be needing major modifications.</p>
<p>Below there is some info about the changes that required significantly more time than others, because of the many occurencies throughout the theme and the plugins&#8217; code.</p>
<p><strong>1</strong> &#8211; The <code>&lt;script&gt;</code> element does not have a <code>language</code> attribute any more, so:</p>
<pre class="codesnp">
&lt;script language="Javascript" type="text/javascript"&gt;
</pre>
<p>&#8230; should become just:</p>
<pre class="codesnp">
&lt;script type="text/javascript"&gt;
</pre>
<p><strong>2</strong> &#8211; Named anchors, like:</p>
<pre class="codesnp">
&lt;a name="blah"&gt;&lt;/a&gt;
</pre>
<p>&#8230;should become:</p>
<pre class="codesnp">
&lt;a id="blah"&gt;&lt;/a&gt;
</pre>
<p><strong>3</strong> &#8211; The <code>border</code> attribute should be removed from the <code>&lt;img&gt;</code> element.</p>
<p><strong>4</strong> &#8211; Finally, the <code>target</code> attribute that was frequently used inside <code>&lt;a&gt;</code> elements in order to specify the target frame is not included in the XHTML 1.1 specification. Fortunately, there is a decent workaround for this.</p>
<p>Instead of the:</p>
<pre class="codesnp">
&lt;a [...] target="_blank" [...] &lt;/a&gt;
</pre>
<p>&#8230; one could use some Javascript code to open the hyperlink in a new frame:</p>
<pre class="codesnp">
&lt;a [...] onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;" [...] &lt;/a&gt;
</pre>
<p>Apart from this, there is another way to pass the XHTML 1.1 validation test, even if you use the <code>target</code> attribute. This is because XHTML has been <a href="http://www.w3.org/TR/2001/REC-xhtml-modularization-20010410/">modularized</a>. By default only 4 core modules are included, but one can create a very own document type definition (<a href="http://en.wikipedia.org/wiki/Document_Type_Definition">DTD</a>), which may inlude the <code>target</code> or any other module. The new DTD can then be uploaded somewhere on the net, so that people can link to it from within their pages <code>DOCTYPE</code> declaration. More information about this and an example can be found <a href="http://www.texastar.com/tips/2004/target_blank.shtml">here</a>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/07/11/moving-on-to-xhtml-11/">Moving on to XHTML 1.1</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/03/10/glossyblue-theme-for-wordpress/" rel="bookmark">GlossyBlue theme for WordPress</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/01/upgraded-to-wordpress-2/" rel="bookmark">Upgraded to WordPress 2</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/25/abstractia-theme-for-wordpress/" rel="bookmark">Abstractia Theme for WordPress</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/14/creative-commons-configurator-wordpress-plugin/" rel="bookmark">Creative-Commons-Configurator WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2007/02/08/evil-fighting-wordpress-plugins/" rel="bookmark">Evil-Fighting WordPress Plugins</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/07/11/moving-on-to-xhtml-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>bbPress registration functions patch</title>
		<link>http://www.g-loaded.eu/2007/07/10/bbpress-registration-functions-patch/</link>
		<comments>http://www.g-loaded.eu/2007/07/10/bbpress-registration-functions-patch/#comments</comments>
		<pubDate>Tue, 10 Jul 2007 11:25:28 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[bbPress]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Patch]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/07/10/bbpress-registration-functions-patch/</guid>
		<description><![CDATA[The default messages that are emailed by bbPress to newly registered users or users that have requested password recovery are quite disappointing compared to such messages that are sent by other more mature forum applications. So, here is a patch that modifies the default messages, so that they look more professional, containing some details about [...]]]></description>
			<content:encoded><![CDATA[<p>The default messages that are emailed by <a href="http://bbpress.org/">bbPress</a> to newly registered users or users that have requested password recovery are quite disappointing compared to such messages that are sent by other more mature forum applications. So, here is a patch that modifies the default messages, so that they look more professional, containing some details about the request, such as the IP address, hostname and date/time. The patch also deals with the stupid behaviour of generating 6-character long passwords by default.<br />
<span id="more-424"></span><br />
The number of password characters is raised to 8, but you can edit the patch by hand to set this number to the desired password length.</p>
<p>Copy the file to your <strong>bbPress root directory</strong>, decompress it and apply it:</p>
<pre class="console">
$ gunzip registration-functions.php.patch.gz
$ patch -p0 -b < registration-functions.php.patch
</pre>
<p>Here follows the full patch:</p>
</pre>
<pre class="codesnp">
--- bb-includes/registration-functions.php	2007-07-10 13:29:56.000000000 +0300
+++ bb-includes/registration-functions.php.new	2007-07-10 13:29:50.000000000 +0300
@@ -41,11 +41,10 @@
 	$resetkey = bb_random_pass( 15 );
 	bb_update_usermeta( $user->ID, 'newpwdkey', $resetkey );
 	if ( $user ) :
-		mail( bb_get_user_email( $user->ID ), bb_get_option('name') . ': ' . __('Password Reset'), sprintf( __("If you wanted to reset your password, you may do so by visiting the following address:
-%s
-
-If you don't want to reset your password, just ignore this email. Thanks!"), bb_get_option('uri')."bb-reset-password.php?key=".$resetkey ), 'From: ' . bb_get_option('admin_email') );
+		$message  = sprintf(__("%s,\n\nA request to reset the password for your account has been made at %s\n\nIf you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!\n"), "$user->user_login", bb_get_option('uri'), bb_get_option('uri')."bb-reset-password.php?key=".$resetkey );
+		$message .= sprintf("\n______\n%s\n%s [%s] %s %s\n", __("Password reset request details:"), $_SERVER['REMOTE_ADDR'], gethostbyaddr($_SERVER['REMOTE_ADDR']), __("at"), date("Y-m-d\TH:i:sO"));
+		mail( bb_get_user_email( $user->ID ), bb_get_option('name') . ': ' . __('Password Reset'), $message, 'From: ' . bb_get_option('admin_email') );
 	endif;
 }
@@ -62,7 +61,7 @@
 			bb_block_current_user();
 		if ( !$user->has_cap( 'change_user_password', $user->ID ) )
 			bb_die( __('You are not allowed to change your password.') );
-		$newpass = bb_random_pass( 6 );
+		$newpass = bb_random_pass( 8 );
 		bb_update_user_password( $user->ID, $newpass );
 		bb_send_pass           ( $user->ID, $newpass );
 		bb_update_usermeta( $user->ID, 'newpwdkey', '' );
@@ -85,7 +84,7 @@
 	return $user_id;
 }
-function bb_random_pass( $length = 6) {
+function bb_random_pass( $length = 8) {
 	$number = mt_rand(1, 15);
 	$string = md5( uniqid( microtime() ) );
  	$password = substr( $string, $number, $length );
@@ -98,7 +97,8 @@
 	$user = $bbdb->get_row("SELECT * FROM $bbdb->users WHERE ID = $user");
 	if ( $user ) :
-		$message = __("Your username is: %1\$s \nYour password is: %2\$s \nYou can now log in: %3\$s \n\nEnjoy!");
+		$message = __("%1\$s,\n\nThank you for registering at %3\$s.\n\nYou may now log in at %3\$sbb-login.php using the following username and password:\n\nusername: %1\$s \npassword: %2\$s \n\nAfter logging in, you may want to visit %3\$sprofile-edit.php so you can change your password.\n");
+		$message .= sprintf("\n______\n%s\n%s [%s] %s %s\n", __("Registration request details:"), $_SERVER['REMOTE_ADDR'], gethostbyaddr($_SERVER['REMOTE_ADDR']), __("at"), date("Y-m-d\TH:i:sO"));
 		mail( bb_get_user_email( $user->ID ), bb_get_option('name') . ': ' . __('Password'),
 			sprintf( $message, "$user->user_login", "$pass", bb_get_option('uri') ),
 			'From: ' . bb_get_option('admin_email')
</pre>
<p>I hope WordPress does not mess up the backslashes.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/07/10/bbpress-registration-functions-patch/">bbPress registration functions patch</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/04/25/bbpress-for-wordpress/" rel="bookmark">bbPress for WordPress</a></li>
<li><a href="http://www.g-loaded.eu/2010/04/07/permanently-delete-posts-topics-bbpress/" rel="bookmark">Permanently remove deleted posts and topics in bbPress</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/07/http-status-codes/" rel="bookmark">HTTP Status Codes</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/01/a-temp-solution-for-the-is_preview-wp-issue/" rel="bookmark">A temp solution for the is_preview WP issue</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/07/10/bbpress-registration-functions-patch/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>rtorstat &#8211; a simple rTorrent status web page generator</title>
		<link>http://www.g-loaded.eu/2007/06/23/rtorstat-a-simple-rtorrent-status-web-page-generator/</link>
		<comments>http://www.g-loaded.eu/2007/06/23/rtorstat-a-simple-rtorrent-status-web-page-generator/#comments</comments>
		<pubDate>Sat, 23 Jun 2007 11:35:44 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Bittorrent]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[rTorrent]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/06/23/rtorstat-a-simple-rtorrent-status-web-page-generator/</guid>
		<description><![CDATA[rtorstat is a simple web page generator, written in Python, which shows status information about the rTorrent bittorrent client. This makes it possible to quickly have an overview of your torrent list from a remote location, without having to log into the remote machine that actually runs rTorrent.]]></description>
			<content:encoded><![CDATA[<p><strong>rtorstat</strong> is a simple <em>web page generator</em>, written in <a href="http://www.python.org/">Python</a>, which shows status information about the <a href="http://libtorrent.rakshasa.no/">rTorrent</a> bittorrent client. This makes it possible to quickly have an overview of your torrent list from a remote location, without having to log into the remote machine that actually runs rTorrent.<br />
<span id="more-408"></span><br />
The script can operate in two modes:</p>
<ul>
<li>Run through <strong>cron</strong> at predefined intervals. In this case it reads the saved <em>rtorrent session data</em>, creates a <strong>summary</strong> about the loaded torrent files status and <strong>prints</strong> the HTML code to <strong>stdout</strong>, which can then be <strong>redirected to a file</strong> and thus be made publicly available by a web server.</li>
<li>Run as a <strong>CGI</strong> script, which makes it possible to <strong>dynamically generate the HTML page</strong> on-demand. This method, compared to running rtorstat through cron at short pre-defined intervals, has the advantage of <em>limiting system resource waste</em> by parsing the session data only when a user runs the CGI script through the web browser. Also, depending on your rtorrent settings, the displayed information is usually more current than that of the HTML page generated through cron, unless cron runs the script very often.</li>
</ul>
<p>rtorstat does not support or will never support any kind of remote rTorrent administration. It is not supposed to be a web-based rtorrent frontend, but, as the title says, a <em>simple status page generator</em> (status web interface).</p>
<h4>Requirements</h4>
<p>rtorstat is not dependency-free. Here is the list of the required software in order to run rtorstat:</p>
<ul>
<li><a href="http://www.python.org/">Python</a></li>
<li><a href="http://libtorrent.rakshasa.no/">rTorrent</a> (configured to save session data &#8211; <em>see below</em>)</li>
<li>The file &#8220;<em>bencode.py</em>&#8220;, part of the official <a href="http://www.bittorrent.com/">Bittorrent</a> client (<em>Mainline</em>) distribution, has been included in the <strong>rtorstat</strong> distribution package, so the Mainline Bittorrent client is <strong>no longer a dependency for rtorstat</strong>.</li>
</ul>
<h4>rTorrent Configuration</h4>
<p><em>rtorstat</em> needs to read the <strong>torrent session data</strong>, so rTorrent needs to be configured to save this information to a pre-defined directory. The following shows all the session-data specific configuration rTorrent (<code>.rtorrent.rc</code>) options:</p>
<pre class="codesnp">
# Sets the directory where session data files are stored
session = /opt/bittorrent/sessiondata
# Keeps session data files even if torrent has finished
session_on_completion = yes
# Not really required, but recommended - see rtorrent(1) man page
session_lock = yes
# Setup A: Run through CRON
# Save session data every 5 mins, with a 4 min offset
schedule = session_save,240,300,session_save=
# Setup B: Run as a CGI
# Save session data every 300 seconds
# (This is an example value. Setting it to a lower value is highly recommended)
#schedule = session_save,300,300,session_save=
</pre>
<p>The last directive (<code>schedule</code>) instructs rtorrent to save session data at the specified interval.</p>
<h4>Usage</h4>
<p>rtorstat can be run through cron or as a CGI script. Running it as a CGI is the preferred way of running it as the parsing of the session data and the HTML page generation take place dynamically only when you visit the web page. This leads to wasting less system resources.</p>
<h5>Running rtorstat through cron</h5>
<p>No special <strong>installation</strong> is needed as the location of <code>rtorstat.py</code> can be set within the <strong>cron</strong> job. Just make sure that the file <code>bencode.py</code> exists in the same directory as rtorstat.py.</p>
<p>rtorstat requires one <strong>argument</strong>; that is the <strong>path to the directory</strong> where the session data is saved:</p>
<pre class="console">$ python rtorstat.py /opt/bittorrent/sessiondata/</pre>
<p>Having parsed the session data files and having created the summary, the HTML code is printed to <strong>stdout</strong>, from where it can be redirected to a html file. For example:</p>
<pre class="console">$ python rtorstat.py /opt/bittorrent/sessiondata/ > /var/www/index.html</pre>
<p>rtorstat is supposed to be run through cron at regular intervals. In the example configuration above (<em>Setup A</em>), rtorrent saves the session data every 5 minutes (300 sec), so rtorstat needs to be run at the <strong>same interval</strong> through cron. The 4 min offset (240 sec) that had been set in the rtorrent scheduler serves so that there is good timing between rTorrent saving the session data and rtorstat parsing it.</p>
<p>Such a cron job would be:</p>
<pre class="codesnp">*/5 * * * *   root python /path/to/rtorstat.py /opt/bittorrent/sessiondata/ > /var/www/index.html</pre>
<p>rtorstat will parse the session data files, for example, at 00:05, 00:10 etc.</p>
<p>Having adjusted the paths according to your configuration, <strong>save</strong> the above <strong>cronjob</strong> to a file inside the <code>/etc/cron.d/</code> directory and you are set.</p>
<h5>Running rtorstat as a CGI script</h5>
<p>In this case, you need to place 3 files in your cgi-bin: rtorstat.py, rtorstat.cgi and bencode.py.</p>
<p>Apart from the rtorrent configuration, it is required to set the path of the directory where rtorrent saves session data in rtorstat.cgi. So, open rtorstat.cgi in your favourite text editor and fill-in the required information:</p>
<pre class="codesnp">
session_dir = "/path/to/rtorrent/session/dir/"
</pre>
<p>Now, you can visit the web page http://yourdomain.example.org/cgi-bin/rtorstat.cgi</p>
<p>Setting up a scriptaliased directory is covered by your web server&#8217;s documentation and is outside of the scope of this document.</p>
<h4>Security</h4>
<p>rtorstat generates a HTML page which is made publicly available through a web server (most probably). Therefore it is your responsibility to secure this location using any of your web server&#8217;s access control methods.</p>
<h4>License</h4>
<p>This project is released under the terms of the <a href="http://www.codetrax.org/licenses/ApacheLicenseV2">Apache License version 2</a>.</p>
<h4>Download</h4>
<p>All versions of the software, including the latest stable release, are available from the development web site&#8217;s <a href="http://www.codetrax.org/projects/rtorstat/files">download area</a>.</p>
<h4>Donate</h4>
<p>This software is released as <strong>free software</strong>. Nevertheless, its development requires time and effort. A small donation, as a sign of appreciation of the effort, is welcome. Please, use the following button to visit the <em>Donations</em> page. Thank you.</p>
<p><a href="http://www.g-loaded.eu/about/donate" title="Donate"><img src="/images/donations_button.png" alt="Donations Button" /></a></p>
<h4>Support</h4>
<p>This software is released as <em>free software</em> without any warranties or official support. You can still get first class <strong>support</strong> from the <a href="http://www.codetrax.org/projects/rtorstat/boards">community of users</a>.</p>
<h4>Bugs and Feature Requests</h4>
<p>Found a bug? Want to suggest a new feature for the upcoming release? Feel free to file your requests in the <a href="http://www.codetrax.org/projects/rtorstat/issues">issue database</a> on the <a href="http://www.codetrax.org/projects/rtorstat">development website</a>.</p>
<h4>Things to consider</h4>
<p>It has been mentioned before, but here it goes again:</p>
<p>Note that by making the rtorrent status page publicly available through a web server, the world will know what you download at any time. It is your exclusive responsibility to keep this page private, if this is what you really want. This piece of information is of course beyond the scope of this article.</p>
<p>This script was written in a quick and dirty way. If you encounter any bugs, please notify me through the <em>g-loaded forums</em> and I will get back to you when I have the time.</p>
<p>Last, but not least, if you improve the looks, consider <a href="http://www.g-loaded.eu/about/contributions/">contributing</a> back your <strong>string template</strong>.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/06/23/rtorstat-a-simple-rtorrent-status-web-page-generator/">rtorstat &#8211; a simple rTorrent status web page generator</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/05/09/remove-generator-meta-tag-wordpress-plugin/" rel="bookmark">Remove-Generator-Meta-Tag WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/04/write-a-man-page/" rel="bookmark">Write A Man Page</a></li>
<li><a href="http://www.g-loaded.eu/2006/09/23/use-python-to-get-the-web-page-data-in-epiphany/" rel="bookmark">Use Python to get the web page data in Epiphany</a></li>
<li><a href="http://www.g-loaded.eu/2007/03/05/print-a-man-page/" rel="bookmark">Print a Man Page</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/15/simple-recent-comments-wordpress-plugin/" rel="bookmark">Simple-Recent-Comments WordPress Plugin</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/06/23/rtorstat-a-simple-rtorrent-status-web-page-generator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Smart Bookmarks in Epiphany</title>
		<link>http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/</link>
		<comments>http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/#comments</comments>
		<pubDate>Fri, 11 May 2007 15:17:01 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Epiphany]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/</guid>
		<description><![CDATA[Smart Bookmarks is an extension for the Epiphany browser. Admitedly, its name or description in the browser extensions panel does not help the user understand what exactly it is about. What is a smart bookmark after all? In short, a smart bookmark is a dynamic bookmark. A bookmark which accepts an argument and returns results [...]]]></description>
			<content:encoded><![CDATA[<p><em>Smart Bookmarks</em> is an extension for the <a href="http://www.gnome.org/projects/epiphany/">Epiphany browser</a>. Admitedly, its name or description in the browser extensions panel does not help the user understand what exactly it is about. What is a <em>smart bookmark</em> after all?<br />
<span id="more-383"></span><br />
In short, a smart bookmark is a dynamic bookmark. A bookmark which accepts an argument and returns results in accordance to the given argument. So, it is clear that this type of bookmark suits the needs of bookmarking a search engine&#8217;s URL that contains the necessary search term and returns results.</p>
<h4>How to create a smart (dynamic) bookmark</h4>
<p>This is quite easy. Assume that you need to create a smart bookmark that searches the archives of your favourite mailing list.</p>
<p>All you need to do is perform a search on that list for a distinctive sequence of characters. For example I searched the <abbr title="Greek Linux Users">LGU</abbr> list for the term <em>AAAAAA</em>:</p>
<pre class="codesnp">
AAAAAA site:http://lists.hellug.gr/pipermail/linux-greek-users/
</pre>
<p>Or better, you may want to use Google&#8217;s advanced search feature.</p>
<p>Now, all you have to do is bookmark (<code>Ctrl-D</code>) the results page, but before actually saving the bookmark, you should <strong>substitute</strong> the <strong>AAAAAA</strong> sequence with <strong>%s</strong>. (that&#8217;s two characters <strong>%</strong> and <strong>s</strong>)</p>
<p><strong>%s</strong> will be substituted with the requested search terms every time the smart bookmark is used.</p>
<p>Now, your bookmark is a <strong>smart</strong> one and you may finally press the &#8220;<code>Add</code>&#8221; button to save it. All you have to do is type the search terms on the browser&#8217;s address bar and choose your smart bookmark from the bottom of the <strong>dropdown list</strong> that appears below the address bar.</p>
<p>Another cool thing you can do with a smart bookmark is to open the bookmarks editor (<code>Ctrl-B</code>), right click on your smart bookmark and select the &#8220;<strong>Show on Toolbar</strong>&#8221; option. A textbox should appear in your bookmarks bar, so you can search this resource quickly.</p>
<p>Finally, if you use the <a href="http://raphael.slinckx.net/deskbar/">Deskbar applet</a>, then you should know that this tool recognizes your saved smart bookmarks and lets you assign a shortcut to each one of them. For example, one could assign the &#8220;<code>lgu</code>&#8221; string to the aforementioned search on the mailing list archives. So now a search on the mailing list can be performed right from the desktop (deskbar applet) with the following:</p>
<pre class="codesnp">lgu kernel</pre>
<p>This will search the mailing list for all entries that contain the term <em>kernel</em>.</p>
<p>Smart bookmarks are a neat feature. I use this very frequently. This post was written for those who have overlooked this really useful feature.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/">Smart Bookmarks in Epiphany</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/04/05/epiphany-browser-review/" rel="bookmark">Epiphany Browser Review</a></li>
<li><a href="http://www.g-loaded.eu/2007/09/14/featured-epiphany-plugins/" rel="bookmark">Featured Epiphany Plugins</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/06/a-note-about-the-epiphany-extensions-on-fedora/" rel="bookmark">A Note About The Epiphany Extensions on Fedora</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/17/epiphany-python-console-open-new-tab/" rel="bookmark">Epiphany Python Console &#8211; Open New Tab</a></li>
<li><a href="http://www.g-loaded.eu/2007/05/16/some-thoughts-about-epiphany-extensions/" rel="bookmark">Some thoughts about Epiphany extensions</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/05/11/smart-bookmarks-in-epiphany/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>.htaccess Cheat Sheet</title>
		<link>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/</link>
		<comments>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 17:35:30 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/</guid>
		<description><![CDATA[Apache is a very flexible web server implementation. The .htaccess files give the webmasters the ability to override the default server configuration on a per-directory basis, provided that httpd's configuration pernits the overrides of the htaccess file. I am aware that there are thousands of cheat sheets (aka ready-made recipes) out there, mostly implementing mod_rewrite conditional redirections, but I decided to bookmark this article because it is very well and carefully written.]]></description>
			<content:encoded><![CDATA[<p><a href="http://httpd.apache.org/">Apache</a> is a very flexible web server implementation. The <strong>.htaccess</strong> files give the webmasters the ability to override the default server configuration on a <em>per-directory</em> basis, provided that <strong>httpd</strong>&#8216;s configuration pernits the overrides of the htaccess file. I am aware that there are thousands of cheat sheets (aka ready-made recipes) out there, mostly implementing <em>mod_rewrite</em> conditional redirections, but I decided to bookmark <a href="http://evolt.org/ultimate_htaccess_examples">this article</a> because it is very well and carefully written.</p>
<p>[<em>Update</em>]: Also, another resource of htaccess recipes exists <a href="http://www.htaccesselite.com/htaccess/">here</a>. I didn&#8217;t have the time though to go through all of their sections, but all .htacces rule examples seem very organized and well written too.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/">.htaccess Cheat Sheet</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2006/08/24/modsecurity-overview/" rel="bookmark">ModSecurity Overview</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/07/awesome-awk-tutorial/" rel="bookmark">Awesome AWK Tutorial</a></li>
<li><a href="http://www.g-loaded.eu/2006/05/16/namespace-declarations-with-celementtree/" rel="bookmark">Namespace Declarations With cElementTree</a></li>
<li><a href="http://www.g-loaded.eu/2006/12/08/more-data-recovery-tools/" rel="bookmark">More Data Recovery Tools</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Optimize and Compress CSS Files</title>
		<link>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/</link>
		<comments>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 21:39:02 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/</guid>
		<description><![CDATA[Usually, when writing or modifying a CSS file, the author adds comments and excessive indentation to the code in order to preserve its readability and to simplify maintenance. Although this might be a good habit, all those extra bits stored into the CSS file increase its filesize, often resulting in unnecessary waste of bandwidth, especially if such a file is used in a production web site. Today, I decided to search for tools that can perform compression and optimization of a CSS file.]]></description>
			<content:encoded><![CDATA[<p>Usually, when writing or modifying a <abbr title="Cascading Style Sheets">CSS</abbr> file, the author adds comments and excessive indentation to the code in order to preserve its readability and to simplify maintenance. Although this might be a good habit, all those extra bits stored into the CSS file increase its filesize, often resulting in unnecessary waste of bandwidth, especially if such a file is used in a production web site. Today, I decided to search for tools that can perform <strong>compression</strong> and <strong>optimization</strong> of a CSS file.<br />
<span id="more-315"></span><br />
A command line utility, called <a href="http://csstidy.sourceforge.net/">CSSTidy</a>, seems to be one of the best out there. It&#8217;s <em>open-source</em> software, released under the GPL, and, judging by the optimization results on this web site&#8217;s CSS, I can say it does a good job. Although the source code is available for download, I used the pre-compiled Linux binary.</p>
<p>Before proceeding, make sure you have backed up your current non-optimized style-sheet. CSSTidy will not touch your original file, but taking some precautions is a good habit.</p>
<p>Launch csstidy without arguments for a rather short description of the command line switches:</p>
<pre class="console">csstidy</pre>
<p>Although it is possible to define each parameter individually, some pre-defined templates are what you will most probably use. These include: <code>low</code>|<code>high</code>|<code>highest</code>. The higher the optimization level, the smaller the CSS filesize. More on templates <a href="http://csstidy.sourceforge.net/templates.php">here</a>.</p>
<p>I tried the <code>high</code> and <code>highest</code> templates. The latter produces a style sheet that contains all code in a single line, but that file would not <a href="http://jigsaw.w3.org/css-validator/">validate</a>, so I used the <code>high</code> template:</p>
<pre class="console">csstidy style.css --template=high style.css.out</pre>
<p>The compression ratio for my file was <code>34.86%</code> which was quite satisfactory. Also, the final file validated properly.</p>
<p>CSSTidy does a good job either you want to optimize the stylesheet for readability or for filesize. On the other hand, the CLI interface does not provide enough information about each of the CLI switches. They are pretty self-explanatory, but I guess a little description for each one of them wouldn&#8217;t hurt anyone. Also, I could not make the &#8220;<code>--remove_last_;</code>&#8221; option to work.</p>
<p>The only difference I could notice in my stylesheets between the <code>high</code> and the <code>highest</code> templates was that the whole code was squeezed in a single line when <code>highest</code> was used. Probably, this template performs some more optimizations than just deleting the line-feed characters, but it seems that there was nothing else that could be optimized in my CSS file.</p>
<p>Apart from this command line utility, there are also a lot of online CSS optimizers. I didn&#8217;t have the time to try them all, but I think I can recommend the following:</p>
<ul>
<li><a href="http://www.cleancss.com/">Clean CSS</a> &#8211; this seems to be the PHP version of CSSTidy. Everything seems to work as expected and the results are the same as before.</li>
<li><a href="http://iceyboard.no-ip.org/projects/css_compressor">Icey CSS Compressor</a> &#8211; This is another web-based CSS optimizer which performs very well. By using the default settings you get a single line with highly optimized CSS code. The compression ratio is similar to CSSTidy&#8217;s. In order to separate each selector with a line-feed character, so that the final CSS validates, you can pass the optimized CSS through <code>sed</code>:
<pre class="console">sed -i 's/}/}\n/g' style.css.out</pre>
</li>
</ul>
<p>If anyone knows about any other utility I would be very glad to know about.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/">Optimize and Compress CSS Files</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li>
<li><a href="http://www.g-loaded.eu/2007/12/01/veritar-verify-checksums-of-files-within-a-tar-archive/" rel="bookmark">VeriTAR &#8211; Verify checksums of files within a TAR archive</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/03/how-to-annotate-pdf-files-in-linux-using-xournal/" rel="bookmark">How to annotate PDF files in Linux using Xournal</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/14/creative-commons-configurator-wordpress-plugin/" rel="bookmark">Creative-Commons-Configurator WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/10/wordpress-221-bugs/" rel="bookmark">WordPress 2.2.1 bugs</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Check Server HTTP Headers with CURL</title>
		<link>http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/</link>
		<comments>http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/#comments</comments>
		<pubDate>Fri, 06 Oct 2006 03:17:55 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Audit]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Servers]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/</guid>
		<description><![CDATA[As you may have noticed, I&#8217;ve changed my web site&#8217;s domain recently. Therefore, I had to redirect all requests to the new address. This has been done and it works as expected, but how about taking a closer look at the HTTP responses the web server returns to the client if an old URL is [...]]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed, I&#8217;ve changed my web site&#8217;s domain recently. Therefore, I had to redirect all requests to the new address. This has been done and it works as expected, but how about taking a closer look at the HTTP responses the web server returns to the client if an old URL is requested?<br />
<span id="more-286"></span><br />
This is where <a href="http://curl.haxx.se/">CURL</a> comes handy once again. CURL&#8217;s command line options include two very useful switches, <code>-I</code> and <code>-L</code>:</p>
<ul>
<li><strong>-I</strong> : when used, CURL prints only the server response&#8217;s HTTP headers, instead of the page data.</li>
<li><strong>-L</strong> : if the initial web server response indicates that the requested page has moved to a new location (redirect), CURL&#8217;s default behaviour is not to request the page at that new location, but just print the HTTP error message. This switch instructs CURL to make another request asking for the page at the new location whenever the web server returns a 3xx HTTP code.</li>
</ul>
<p>The combination of the above two switches results in having all the server responses&#8217; headers printed to the terminal, until CURL receives a code other than 3xx.</p>
<p>So, here is a real-life example. I have made two major changes to my web site so far; one included a URL structure modification when I moved from a pure HTML web site to WordPress, while the second was a domain change from the free domain <code>raoul.shacknet.nu</code> to the current paid domain name. So, this makes at least two permanent redirections. I say &#8220;at least&#8221;, because other necessary redirections could take place as well, for example, redirections of the <code>example.org</code> version of the domain to the <code>www.example.org</code> version, or redirections required for permalinks.</p>
<p>So, here is CURL&#8217;s output when I requested an old page of my web site:</p>
<pre class="console">$ curl -I -L http://raoul.shacknet.nu/servers/vnc.html</pre>
<pre class="codesnp">
HTTP/1.1 301 Moved Permanently
Date: Fri, 06 Oct 2006 01:49:06 GMT
Server: Apache/2.2.2
Location: http://www.raoul.shacknet.nu/servers/vnc.html
Connection: close
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 301 Moved Permanently
Date: Fri, 06 Oct 2006 01:49:06 GMT
Server: Apache/2.2.2
Location: http://www.g-loaded.eu/servers/vnc.html
Connection: close
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 301 Moved Permanently
Date: Fri, 06 Oct 2006 01:49:06 GMT
Server: Apache/2.2.2
Location: http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/
Connection: close
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 200 OK
Date: Fri, 06 Oct 2006 01:49:06 GMT
Server: Apache/2.2.2
X-Powered-By: PHP/5.1.4
X-Pingback: http://www.g-loaded.eu/xmlrpc.php
Status: 200 OK
Connection: close
Content-Type: text/html; charset=UTF-8
</pre>
<p>The above output shows that the client has to send 4 HTTP requests and receive 4 respective responses from the server in order to reach that old page&#8217;s final location:</p>
<ol>
<li>The first server response informs the client that the page has been permanently moved to the www version of the old domain.</li>
<li>The second response indicates that the page has been permanently moved to the www version of the new domain using the old URL structure.</li>
<li>The third indicates a permanent move to the new URL structure.</li>
<li>The final response informs the client with a 200 OK code that it has reached the page&#8217;s <a href="http://www.g-loaded.eu/2005/11/10/configure-vnc-server-in-fedora/">final location</a>.</li>
</ol>
<p>In this example, CURL provides a clear view of what situation a browser, a search engine bot or any other HTTP client encounters when it tries to reach an old page.</p>
<p>I am not an expert, but I guess that too many redirects are not a good thing, not only by considering the small increase of the server load, but also that search engine bots might not like them very much. On the other hand, redirections are a necessary evil if you want links from other websites pointing to your old domain or your old URL structure to continue to be valid, which in fact adds &#8220;value&#8221; to your website, as search engine experts would say. So it&#8217;s a matter of choice.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/">Check Server HTTP Headers with CURL</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2005/10/13/http-headers/" rel="bookmark">HTTP headers</a></li>
<li><a href="http://www.g-loaded.eu/2006/04/07/http-status-codes/" rel="bookmark">HTTP Status Codes</a></li>
<li><a href="http://www.g-loaded.eu/2005/10/19/the-if-modified-since-http-header/" rel="bookmark">The If-Modified-Since HTTP Header</a></li>
<li><a href="http://www.g-loaded.eu/2007/09/15/use-wget-or-curl-to-download-from-rapidshare-premium/" rel="bookmark">Use wget or curl to download from RapidShare Premium</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/" rel="bookmark">Set up an anonymous FTP server with vsftpd in less than a minute</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

