<?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>Blog by Andreas Glaser</title>
	<atom:link href="http://www.andreas-glaser.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.andreas-glaser.com</link>
	<description>Development, Technology and such...</description>
	<lastBuildDate>Mon, 09 Aug 2010 15:48:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Import Mysql Dump with correct character encoding</title>
		<link>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/</link>
		<comments>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 11:58:05 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Commandline]]></category>
		<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=593</guid>
		<description><![CDATA[It happened to me quite a few times now, that I imported a mysql dump file and afterwards noticed that the character encoding was broken. To help you guys preventing this from happening use following import command. ?View Code BASH1 mysql -u root -p --default_character_set utf8 NAME_OF_YOUR_DATABASE &#38;lt; mysql_dump_file.sql The important argument is &#8220;&#8211;default_character_set utf8&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>It happened to me quite a few times now, that I imported a mysql dump file and afterwards noticed that the character encoding was broken.<br />
To help you guys preventing this from happening use following import command.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p593code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5932"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p593code2"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span> --default_character_set utf8 NAME_OF_YOUR_DATABASE <span style="color: #000000; font-weight: bold;">&amp;</span>lt; mysql_dump_file.sql</pre></td></tr></table></div>

<p>The important argument is &#8220;<strong>&#8211;default_character_set utf8</strong>&#8221; to preserve the encoding.</p>
<p>Enjoy</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/08/09/import-mysql-dump-with-correct-character-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana 3 &#8211; ErrorException [ Warning ]: htmlspecialchars() expects at most 3 parameters, 4 given</title>
		<link>http://www.andreas-glaser.com/2010/06/11/kohana-3-errorexception-warning-htmlspecialchars-expects-at-most-3-parameters-4-given/</link>
		<comments>http://www.andreas-glaser.com/2010/06/11/kohana-3-errorexception-warning-htmlspecialchars-expects-at-most-3-parameters-4-given/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 17:05:18 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Kohana]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Kohana 3.x]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=585</guid>
		<description><![CDATA[?View Code CODE1 ErrorException [ Warning ]: htmlspecialchars() expects at most 3 parameters, 4 given If Kohana 3 throws this exception, that means that your currently installed PHP version is lower than 5.2.3 . This can be easily be fixed by updating PHP to the latest stable version (recommended) or by changing one of Kohana [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p585code7'); return false;">View Code</a> CODE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5857"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p585code7"><pre class="code" style="font-family:monospace;">ErrorException [ Warning ]: htmlspecialchars() expects at most 3 parameters, 4 given</pre></td></tr></table></div>

<p>If Kohana 3 throws this exception, that means that your currently installed PHP version is lower than 5.2.3 .<br />
This can be easily be fixed by updating PHP to the latest stable version (recommended) or by changing one of Kohana (not recommended).</p>
<h3>To fix it code wise open following file with your preferred editor</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p585code8'); return false;">View Code</a> CODE</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5858"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p585code8"><pre class="code" style="font-family:monospace;">/system/classes/kohana/html.php</pre></td></tr></table></div>

<h3>Search for&#8230;</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p585code9'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5859"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p585code9"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">return</span> <a href="http://www.php.net/htmlspecialchars"><span style="color: #990000;">htmlspecialchars</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #339933;">,</span> Kohana<span style="color: #339933;">::</span><span style="color: #000088;">$charset</span><span style="color: #339933;">,</span> <span style="color: #000088;">$double_encode</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>&#8230; and change it into</h3>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p585code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p58510"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p585code10"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">return</span> <a href="http://www.php.net/htmlspecialchars"><span style="color: #990000;">htmlspecialchars</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>string<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">ENT_QUOTES</span><span style="color: #339933;">,</span> Kohana<span style="color: #339933;">::</span><span style="color: #000088;">$charset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Done :)</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/06/11/kohana-3-errorexception-warning-htmlspecialchars-expects-at-most-3-parameters-4-given/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/06/11/kohana-3-errorexception-warning-htmlspecialchars-expects-at-most-3-parameters-4-given/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP Beginners &#8211; How to get online time of a user</title>
		<link>http://www.andreas-glaser.com/2010/05/24/php-beginners-how-to-get-online-time-of-a-user/</link>
		<comments>http://www.andreas-glaser.com/2010/05/24/php-beginners-how-to-get-online-time-of-a-user/#comments</comments>
		<pubDate>Mon, 24 May 2010 16:49:04 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=560</guid>
		<description><![CDATA[A common task in web development is to track or show a users online time. Theory We record and save the time (in seconds) of the users first interaction with our website. On every following click we subtract this information with the current time. Working example ?View Code PHP1 2 3 4 5 6 7 [...]]]></description>
			<content:encoded><![CDATA[<p>A common task in web development is to track or show a users online time.</p>
<h2>Theory</h2>
<p>We record and save the time (in seconds) of the users first interaction with our website. On every following click we subtract this information with the current time.</p>
<h2>Working example</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p560code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p56012"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p560code12"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* tell php to start a new or resume an existing session */</span>
<a href="http://www.php.net/session_start"><span style="color: #990000;">session_start</span></a><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;">/* store time of first user interaction */</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session.started'</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>
 <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session.started'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* calculate time elapsed since first click */</span>
<span style="color: #000088;">$onlineTime</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'session.started'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* display online time in various formats */</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">'Seconds: '</span><span style="color: #339933;">.</span><span style="color: #000088;">$onlineTime</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'Minutes:'</span><span style="color: #339933;">.</span><a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$onlineTime</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'Hours:'</span><span style="color: #339933;">.</span><a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$onlineTime</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #0000ff;">&quot;&lt;br /&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'Days:'</span><span style="color: #339933;">.</span><a href="http://www.php.net/floor"><span style="color: #990000;">floor</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$onlineTime</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">60</span> <span style="color: #339933;">/</span> <span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

Note: There is a file embedded within this post, please visit this post to download the file.
<p>Enjoy!</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/05/24/php-beginners-how-to-get-online-time-of-a-user/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/05/24/php-beginners-how-to-get-online-time-of-a-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kohana 3 &#8211; How to get current absolute and relative url</title>
		<link>http://www.andreas-glaser.com/2010/05/17/kohana-3-how-to-get-current-absolute-and-relative-url/</link>
		<comments>http://www.andreas-glaser.com/2010/05/17/kohana-3-how-to-get-current-absolute-and-relative-url/#comments</comments>
		<pubDate>Mon, 17 May 2010 09:10:22 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Kohana 3.x]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=553</guid>
		<description><![CDATA[?View Code PHP1 2 print URL::site&#40;Request::instance&#40;&#41;-&#62;uri&#40;&#41;, TRUE&#41;; // http://www.example.com/kohana/info/index print URL::site&#40;Request::instance&#40;&#41;-&#62;uri&#40;&#41;&#41;; // /kohana/info/index]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p553code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p55314"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p553code14"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> URL<span style="color: #339933;">::</span><span style="color: #004000;">site</span><span style="color: #009900;">&#40;</span>Request<span style="color: #339933;">::</span><span style="color: #004000;">instance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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: #666666; font-style: italic;">// http://www.example.com/kohana/info/index</span>
<span style="color: #b1b100;">print</span> URL<span style="color: #339933;">::</span><span style="color: #004000;">site</span><span style="color: #009900;">&#40;</span>Request<span style="color: #339933;">::</span><span style="color: #004000;">instance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">uri</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// /kohana/info/index</span></pre></td></tr></table></div>

<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/05/17/kohana-3-how-to-get-current-absolute-and-relative-url/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/05/17/kohana-3-how-to-get-current-absolute-and-relative-url/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Allow mock locations&#8221; &#8211; Android</title>
		<link>http://www.andreas-glaser.com/2010/04/28/allow-mock-locations-android/</link>
		<comments>http://www.andreas-glaser.com/2010/04/28/allow-mock-locations-android/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 08:54:47 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[HTC Desire]]></category>
		<category><![CDATA[Smartphone]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=551</guid>
		<description><![CDATA[&#8220;Allow mock locations&#8221; &#8211; means to be able to fake/simulate the location you&#8217;re at for development purposes]]></description>
			<content:encoded><![CDATA[<p>&#8220;Allow mock locations&#8221; &#8211; means to be able to fake/simulate the location you&#8217;re at for development purposes</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/04/28/allow-mock-locations-android/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/04/28/allow-mock-locations-android/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>(Python) Mysqldump Backup 1.1</title>
		<link>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/</link>
		<comments>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 08:00:02 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[Mysql]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=326</guid>
		<description><![CDATA[Backups are crucial! Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server. How do i configure it? After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root: apt-get update apt-get install python [...]]]></description>
			<content:encoded><![CDATA[<p>Backups are crucial!<br />
Since that is fact I wrote a little script in Python to easily backup mysql databases on a linux server.</p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong><br />
How do i configure it?<br />
</strong>After you downloaded the script to your Linux server you will need a few Linux packages. Execute the following commands as root:</p>
<blockquote><p><em>apt-get update<br />
apt-get install python mysqldump bzip2</em></p></blockquote>
<p><strong>What does it do?</strong><br />
This script dumps a certain database (or all databases) into a single mysql file, which is zipped (bzip2) afterwards.</p>
<p>Now edit the script with your preferred editor.</p>
<blockquote><p><em>vim mysqldump-backup.py</em></p></blockquote>
<p><strong>Customize the following lines:</strong></p>
<blockquote><p># 2. Config<br />
mysqlUser = &#8220;root&#8221;<br />
mysqlPwd = &#8220;YOUR_PASSWORD&#8221;<br />
mysqlDatabase = &#8220;&#8211;all-databases&#8221;<br />
dumpDir = &#8220;/tmp/&#8221;<br />
dumpFile = &#8220;mysqldump-&#8221; + strftime(&#8220;%Y-%m-%d-%H-%M-%S&#8221;, gmtime()) + &#8220;.sql&#8221;</p></blockquote>
<p>The last step is to make the script executable:</p>
<blockquote><p><em>chmod u +x mysqldump-backup-1.1.py</em></p></blockquote>
<p>Thats it!</p>
<p>You can now run the script:</p>
<blockquote><p><em>/path/to/the/script/mysqldump-backup-1.1.py</em></p></blockquote>
<p><strong>To run it daily (crontab):</strong></p>
<blockquote><p><em>crontab -e</em></p></blockquote>
<p>Add at the bottom:</p>
<blockquote><p>0 3 * * * <em>/path/to/the/script/mysqldump-backup.py</em></p></blockquote>
<p>Now your databases will be backupped daily at 03:00 am</p>
<p><strong>Download</strong></p>
Note: There is a file embedded within this post, please visit this post to download the file.
<p><strong>Changelog</strong><br />
1.1</p>
<ul>
<li>Removed trailing semicolons</li>
<li>Renamed variables</li>
</ul>
<p>1.0 </p>
<ul>
<li>Initial release</li>
</ul>
<p>Have fun!<br />
Andreas Glaser aka JaZz</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/04/12/python-mysqldump-backup-1-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Drupal &#8211; User Permissions &#8211; Validation error, please try again. If this error persists, please contact the site administrator.</title>
		<link>http://www.andreas-glaser.com/2010/03/26/drupal-user-permissions-validation-error-please-try-again-if-this-error-persists-please-contact-the-site-administrator/</link>
		<comments>http://www.andreas-glaser.com/2010/03/26/drupal-user-permissions-validation-error-please-try-again-if-this-error-persists-please-contact-the-site-administrator/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 10:59:16 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Drupal-6.x]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=544</guid>
		<description><![CDATA[I just came across a problem with &#8220;Drupal&#8221; related to my server configuration. I tried to set the user permissions and Drupal would tell me &#8220;Validation error, please try again. If this error persists, please contact the site administrator.&#8221;. This error was caused be the php extension &#8220;suhosin&#8221; which limits the maximal length of post [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across a problem with &#8220;Drupal&#8221; related to my server configuration.<br />
I tried to set the user permissions and Drupal would tell me &#8220;Validation error, please try again. If this error persists, please contact the site administrator.&#8221;.</p>
<p>This error was caused be the php extension &#8220;suhosin&#8221; which limits the maximal length of post requests.</p>
<p>To fix that open <strong>/etc/php5/apache2/conf.d/suhosin.ini</strong> and increase the value of <strong>suhosin.request.max_value_length</strong> to your needs.</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/03/26/drupal-user-permissions-validation-error-please-try-again-if-this-error-persists-please-contact-the-site-administrator/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/03/26/drupal-user-permissions-validation-error-please-try-again-if-this-error-persists-please-contact-the-site-administrator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drupal &#8211; Get Vocabulary Name by VID</title>
		<link>http://www.andreas-glaser.com/2010/03/24/drupal-get-vocabulary-name-by-vid/</link>
		<comments>http://www.andreas-glaser.com/2010/03/24/drupal-get-vocabulary-name-by-vid/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 12:26:30 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Drupal-6.x]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=540</guid>
		<description><![CDATA[This function retrieves vocabulary names by their id. getVocabularyNameByVID($vid) ?View Code PHP1 2 3 4 5 6 7 8 9 10 11 function getVocabularyNameByVID&#40;$vid&#41; &#123; /* make sure vid is numeric */ if&#40;!is_numeric&#40;$vid&#41;&#41; return false; &#160; /* fetch name */ $result = db_query&#40;&#34;SELECT name FROM {vocabulary} WHERE vid = %d&#34;, $vid&#41;; $name = db_fetch_object&#40;$result&#41;-&#38;gt;name; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>This function retrieves vocabulary names by their id.</p>
<h2>getVocabularyNameByVID($vid)</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p540code17'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p54017"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p540code17"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> getVocabularyNameByVID<span style="color: #009900;">&#40;</span><span style="color: #000088;">$vid</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">/* make sure vid is numeric */</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_numeric"><span style="color: #990000;">is_numeric</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$vid</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</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: #666666; font-style: italic;">/* fetch name */</span>
  <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> db_query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT name FROM {vocabulary} WHERE vid = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$vid</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> db_fetch_object<span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>name<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">/* return name or false if not found */</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$name</span> ? <span style="color: #000088;">$name</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Usage</h2>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p540code18'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p54018"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p540code18"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">print</span> getVocabularyNameByVID<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/03/24/drupal-get-vocabulary-name-by-vid/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/03/24/drupal-get-vocabulary-name-by-vid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Comments # // or /* /*</title>
		<link>http://www.andreas-glaser.com/2010/03/22/php-comments-or/</link>
		<comments>http://www.andreas-glaser.com/2010/03/22/php-comments-or/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 10:52:15 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=535</guid>
		<description><![CDATA[PHP as well as most (all?) other programming languages provide different ways to comment source code. Most common comment indicators are # , // and /* */ . ?View Code PHP1 2 3 4 5 6 # this is a comment echo 'print something'; // another comment phpinfo&#40;&#41;; /* and one more */ var_dump&#40;$_ENV&#41;; Which [...]]]></description>
			<content:encoded><![CDATA[<p>PHP as well as most (all?) other programming languages provide different ways to comment source code.<br />
Most common comment indicators are # , // and /* */ .</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p535code21'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p53521"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p535code21"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># this is a comment
</span><span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'print something'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// another comment</span>
<a href="http://www.php.net/phpinfo"><span style="color: #990000;">phpinfo</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">/* and one more */</span>
<a href="http://www.php.net/var_dump"><span style="color: #990000;">var_dump</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_ENV</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h1>Which one should I use?</h1>
<h3><strong># vs //</strong></h3>
<p>I definitely tend to # since it&#8217;s only one character instead of two slashes.</p>
<h3># and // vs. /* */</h3>
<p>If you plan to pack your code I would highly recommend to always use /* */ due to it&#8217;s <a href="http://en.wikipedia.org/wiki/Minification_(programming)">source code packer</a> compatibility.</p>
<p>/* */ also provides multi line commenting.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p535code22'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p53522"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p535code22"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
* this
* is a
* valid comment
**/</span></pre></td></tr></table></div>

<p>So long,<br />
JaZz</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2010/03/22/php-comments-or/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2010/03/22/php-comments-or/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache2 &#8211; Perfect mod_expires configuration</title>
		<link>http://www.andreas-glaser.com/2009/12/14/apache2-perfect-mod_expires-configuration/</link>
		<comments>http://www.andreas-glaser.com/2009/12/14/apache2-perfect-mod_expires-configuration/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 13:37:41 +0000</pubDate>
		<dc:creator>Andreas Glaser</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Operating system]]></category>
		<category><![CDATA[Apache2]]></category>
		<category><![CDATA[Modules]]></category>

		<guid isPermaLink="false">http://www.andreas-glaser.com/?p=522</guid>
		<description><![CDATA[Well, &#8220;perfect&#8221; might be a little exaggerated although I consider this a good configuration at the moment. You can put this globally into your httpd.conf or separately in every vhost configuration file you need it. ?View Code BASH1 2 3 4 5 6 7 8 9 10 &#160; ExpiresActive On ExpiresByType text/css &#34;access plus 1 [...]]]></description>
			<content:encoded><![CDATA[<p>Well, &#8220;perfect&#8221; might be a little exaggerated although I consider this a good configuration at the moment.<br />
You can put this globally into your httpd.conf or separately in every vhost configuration file you need it.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p522code25'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p52225"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p522code25"><pre class="bash" style="font-family:monospace;">&nbsp;
        ExpiresActive On
        ExpiresByType text<span style="color: #000000; font-weight: bold;">/</span>css <span style="color: #ff0000;">&quot;access plus 1 month&quot;</span>
        ExpiresByType text<span style="color: #000000; font-weight: bold;">/</span>javascript <span style="color: #ff0000;">&quot;access plus 1 month&quot;</span>
        ExpiresByType application<span style="color: #000000; font-weight: bold;">/</span>x-javascript <span style="color: #ff0000;">&quot;access plus 1 month&quot;</span>
        ExpiresByType application<span style="color: #000000; font-weight: bold;">/</span>javascript <span style="color: #ff0000;">&quot;access plus 1 month&quot;</span>
        ExpiresByType image<span style="color: #000000; font-weight: bold;">/</span>png <span style="color: #ff0000;">&quot;access plus 1 year&quot;</span>
        ExpiresByType image<span style="color: #000000; font-weight: bold;">/</span>jpeg <span style="color: #ff0000;">&quot;access plus 1 year&quot;</span>
        ExpiresByType image<span style="color: #000000; font-weight: bold;">/</span>gif <span style="color: #ff0000;">&quot;access plus 1 year&quot;</span>
        ExpiresByType image<span style="color: #000000; font-weight: bold;">/</span>x-icon <span style="color: #ff0000;">&quot;access plus 1 month&quot;</span></pre></td></tr></table></div>

<p>Make sure you versionize your JavaScript/CSS to be able to force an update, in case you change them.<br />
<strong>Example:</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p522code26'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p52226"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p522code26"><pre class="html" style="font-family:monospace;">&nbsp;
    My Example
&nbsp;
Some Content
&nbsp;
    &lt;script src=&quot;javascript.js?version=1&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>You should also give newly updated pictures new names!</p>
<p>Over and out,<br />
JaZz</p>
<p class='fb-like'><iframe src='http://www.facebook.com/plugins/like.php?href=http://www.andreas-glaser.com/2009/12/14/apache2-perfect-mod_expires-configuration/&amp;layout=standard&amp;show_faces=true&amp;width=260&amp;action=like&amp;colorscheme=light' scrolling='no' frameborder='0' allowTransparency='true' style='border:none; overflow:hidden; width:260px; height:26px'></iframe></p>]]></content:encoded>
			<wfw:commentRss>http://www.andreas-glaser.com/2009/12/14/apache2-perfect-mod_expires-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
