<?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>Gudubeth</title>
	<atom:link href="http://www.gudubeth.net/en/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gudubeth.net/en</link>
	<description>A blog about web design and programming - php, actionscript, javascript, java, css</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:01:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Email verification with PHP</title>
		<link>http://www.gudubeth.net/en/articles/email-verification-with-php</link>
		<comments>http://www.gudubeth.net/en/articles/email-verification-with-php#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:01:59 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regular expression]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=74</guid>
		<description><![CDATA[There are so many email verification functions written with PHP. But how many of them work perfect? In the search of perfect email verification with regular expression, the site fightingforalostcause.net has tested 13 of them and published the results at this page: Comparing E-mail Address Validating Regular Expressions. He found that Geert De Deckere from [...]


Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-directory-with-php' rel='bookmark' title='Permanent Link: Remove a Directory and Its Content with PHP'>Remove a Directory and Its Content with PHP</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>There are so many email verification functions written with PHP. But how many of them work perfect? In the search of perfect email verification with regular expression, the site fightingforalostcause.net has tested 13 of them and published the results at this page: <a href="http://fightingforalostcause.net/misc/2006/compare-email-regex.php" target="_blank">Comparing E-mail Address Validating Regular Expressions</a>. He found that Geert De Deckere from the <a href="http://kohanaphp.com/">Kohana project</a> has the best one. Details are at the page above and here is the email verification function made of this regex.</p>
<pre>
/**
 *
 * @param <type> $email
 * @return bool true if email is valid
 */
function validateEmail($email){
	return (bool) preg_match('/^[-_a-z0-9\'+*$^&#038;%=~!?{}]++(?:\.[-_a-z0-9\'+*$^&#038;%=~!?{}]+)*+@(?:(?![-.])[-a-z0-9.]+(?&lt;![-.])\.[a-z]{2,6}|\d{1,3}(?:\.\d{1,3}){3})(?::\d++)?$/iD', $email);
}
</pre>


<p>Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-directory-with-php' rel='bookmark' title='Permanent Link: Remove a Directory and Its Content with PHP'>Remove a Directory and Its Content with PHP</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/email-verification-with-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Date &amp; Time Difference in PHP</title>
		<link>http://www.gudubeth.net/en/articles/date-time-difference-in-php</link>
		<comments>http://www.gudubeth.net/en/articles/date-time-difference-in-php#comments</comments>
		<pubDate>Thu, 14 Jan 2010 10:00:40 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[date-time functions]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=66</guid>
		<description><![CDATA[To calculate the difference between dates, PHP has a date_diff function but it only works in PHP version 5.3 and above. So we still need a date substraction function. Here you can find a simple one coded by me. You can find a detailed documentation in PHPDoc format below in the code section.
Usage
The function takes [...]


Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/web-2-0-style-relative-date-writing' rel='bookmark' title='Permanent Link: Web 2.0 Style Relative Date Writing'>Web 2.0 Style Relative Date Writing</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>To calculate the difference between dates, PHP has a date_diff function but it only works in PHP version 5.3 and above. So we still need a date substraction function. Here you can find a simple one coded by me. You can find a detailed documentation in PHPDoc format below in the code section.</p>
<h2>Usage</h2>
<p>The function takes three parameters. Only the first one is mandatory.<br />
dateDiff($d1[, $d2=null [, $format="all"]);</p>
<p>First two parameters are dates in unix timestamp format or any string strtotime functions accepts. This means you can use time() function to take the time or you possibly can use MySQL data directly with this function. <a href="http://tr.php.net/manual/en/function.strtotime.php" target="_blank">Click to find about strtotime function</a>. It doesn&#8217;t matter which date is bigger. Always positive result is returned. The last parameter tells the function in what format the result should be returned. You can choose one of &#8220;second&#8221;, &#8220;minute&#8221;, &#8220;hour&#8221;, &#8220;day&#8221;, &#8220;week&#8221;, &#8220;month&#8221; or &#8220;year&#8221; as a format. If you use one of these, the function returns the result as an integer. If you don&#8217;t use this parameter or set it as &#8220;all&#8221;, an array containing all the format parameters above will be returned. You can try it with this code: print_r(dateDiff(time(), &#8220;2009-12-04&#8243;));</p>
<h2>Examples</h2>
<pre>
echo "now:".date("r",time())."";
echo "1: ".dateDiff("20090401040302", time(), "month")." months";
echo "2: ".dateDiff(time(), "2009-07-23 04:00:00", "hour")." hours";
echo "3: ".dateDiff("-3 day", "2009-07-23 04:00:00", "day")." days";
echo "4: ".dateDiff("2008-06-23", "2009-07-23", "years")." years";
</pre>
<h2>Code</h2>
<pre>
/**
 * finds the difference between dates.
 * <strong>usage:</strong> dateDiff($d1[, $d2=null [, $format="all"]);
 * <strong>examples:</strong>
 *     dateDiff("20090401040302");
 *     dateDiff("20090401040302", time(), "month");
 *     dateDiff(time(), "2009-07-23 04:00:00", "hour");
 *     dateDiff("-3 day", "2009-07-23 04:00:00");
 *     dateDiff("2008-06-23", "2009-07-23", "years");
 *
 * @param mixed $d1     first date. can be unix timestamp or any date string
 *                      strtotime accepts.
 * @param mixed $d2     second date. if it is empty or not given,
 *                      the function uses the current time. which date is bigger or
 *                      smaller doesn't matters. can be an unix timestamp or any
 *                      date string strtotime accepts.
 * @param str $format   one of "second", "minute", "hour", "day", "week",
 *                      "month", "year", "all".
 *                      if it is empty or set as "all", all the types are
 *                      calculated and an array is returned. if not, result
 *                      is returned in specified format as an integer.
 * @return mixed        difference between dates as int or array depending on
 *                      the value of $format. if result is array, it contains
 *                      these parameters: "second", "minute", "hour", "day",
 *                      "week", "month", "year"
 */
function dateDiff($d1, $d2=null, $format="all"){
    if($d2==null){
        $d2=$d1;
        $d1=time();
    }

    if(!is_int($d1)) $d1=strtotime($d1);
    if(!is_int($d2)) $d2=strtotime($d2);
    $d=abs($d1-$d2);

    $format=strtolower($format);
    if(empty($format) || $format=="*") $format="all";
    if(strrpos($format, 's')==strlen($format)-1){
        $format=substr($format, 0, strlen($format)-1);
    }

    $result = array();

    if($format=="all" || $format=="day")    $result["day"]   = floor($d/(60*60*24));
    if($format=="all" || $format=="month")  $result["month"] = floor($d/(60*60*24*30));
    if($format=="all" || $format=="year")   $result["year"]  = floor($d/(60*60*24*365));
    if($format=="all" || $format=="week")   $result["week"]  = floor($d/(60*60*24*7));
    if($format=="all" || $format=="hour")   $result["hour"]  = floor($d/(60*60));
    if($format=="all" || $format=="minute") $result["minute"]= floor($d/60);

    if($format!="all") return $result[$format];
    else return $result;
}
</pre>


<p>Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/web-2-0-style-relative-date-writing' rel='bookmark' title='Permanent Link: Web 2.0 Style Relative Date Writing'>Web 2.0 Style Relative Date Writing</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/date-time-difference-in-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove a Directory and Its Content with PHP</title>
		<link>http://www.gudubeth.net/en/articles/remove-directory-with-php</link>
		<comments>http://www.gudubeth.net/en/articles/remove-directory-with-php#comments</comments>
		<pubDate>Sat, 09 Jan 2010 00:18:44 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[file operations]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=60</guid>
		<description><![CDATA[The function below deletes directories with many options. You can delete directories recursively, delete only content of directories or remove files in a directory with regular expression. I wrote details in PHPDoc format. 

/**
 * removes files in a directory
 * examples:
 * &#60;pre&#62;
 * removeDir('/home/gudubeth/pics');
 *      //delete everything and [...]


Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-accents-in-utf-8-strings' rel='bookmark' title='Permanent Link: Remove Accents In UTF-8 Strings'>Remove Accents In UTF-8 Strings</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>The function below deletes directories with many options. You can delete directories recursively, delete only content of directories or remove files in a directory with regular expression. I wrote details in PHPDoc format. </p>
<pre lang="php">
/**
 * removes files in a directory
 * examples:
 * &lt;pre&gt;
 * removeDir('/home/gudubeth/pics');
 *      //delete everything and the directory itself.
 * removeDir('/home/gudubeth/pics', false);
 *      //delete only content of the directory. subdirectories are deleted too.
 * removeDir('/home/gudubeth/pics', false, false);
 *      //delete only content of the directory. subdirectories
 *      //are NOT deleted
 * removeDir('/home/gudubeth/pics', false, true, '/.*\.jpg/');
 *      //delete only jpg files inside this directory and its sub directories.
 * &lt;/pre&gt;
 * @param str $dir  directory path
 * @param bool $deleteDir   deletes the directory itself if it is true.
 *                          default is true
 * @param bool $recursive   deletes files recursively if it is true.
 *                          default is true
 * @param str $regEx        deletes files only if they match this $regEx.
 *                          Regular expression checking is done with preg_match.
 *                          default is '/.*/' which means 'everything'
 * @return  bool    true if every file is deleted successfully or there are
 *                  no files found to delete. false if any of the deletions
 *                  is unsuccessful
 *
 * */
function removeDir($dir, $deleteDir=true, $recursive=true, $regEx="/.*/") {
    if(!$dh = @opendir($dir)) return false;
    $result=true;
    while (($file=readdir($dh))!==false) {
        if($file!='.' &#038;&#038; $file!='..'){
            if(is_dir( $dir.'/'.$file) &#038;&#038; $recursive)
                $result = removeDir($dir.'/'.$file, true, true, $regEx) &#038;&#038; $result;
            else if(preg_match($regEx, $file))
                $result = @unlink($dir.'/'.$file) &#038;&#038; $result;
        }
    }
    closedir($dh);
    if($deleteDir) $result = @rmdir($dir) &#038;&#038; $result;
    return $result;
}
</pre>


<p>Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-accents-in-utf-8-strings' rel='bookmark' title='Permanent Link: Remove Accents In UTF-8 Strings'>Remove Accents In UTF-8 Strings</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/remove-directory-with-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling browser caching</title>
		<link>http://www.gudubeth.net/en/articles/disabling-browser-caching</link>
		<comments>http://www.gudubeth.net/en/articles/disabling-browser-caching#comments</comments>
		<pubDate>Sun, 03 Jan 2010 20:53:50 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=56</guid>
		<description><![CDATA[There are two basic ways of disabling browsers to cache your web page. You can add related meta tags inside the head part of html or add response headers to page at the server side if you are using server side programming languages like PHP, Java/JSP or ASP.NET. 
1. Disabling browser caching inside HTML
&#60;meta http-equiv=&#8221;Pragma&#8221; [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>There are two basic ways of disabling browsers to cache your web page. You can add related meta tags inside the head part of html or add response headers to page at the server side if you are using server side programming languages like PHP, Java/JSP or ASP.NET. </p>
<h3>1. Disabling browser caching inside HTML</h3>
<p>&lt;meta http-equiv=&#8221;Pragma&#8221; content=&#8221;No-Cache&#8221; /&gt;<br />
&lt;meta http-equiv=&#8221;cache-control&#8221; content=&#8221;no-cache, no store&#8221; /&gt;<br />
&lt;meta name=&#8221;Expires&#8221; content=&#8221;Mon, 26 Jul 1997 05:00:00 GMT&#8221; /&gt;</p>
<p>Add the code above inside &lt;head&gt;&lt;/head&gt; tags of your page. The main disadvantage of this technique is that you can&#8217;t use inside non-html pages like XML or RSS.</p>
<h3>2. Disabling the browser from caching at the server side</h3>
<p>To prevent caching you have to add some headers to response. You can find code samples for PHP, ASP.NET and Java/JSP above. You can add these header to any kind of pages / files.</p>
<p><strong>PHP</strong></p>
<pre lang="php"> header("Expires: Mon, 01 Jul 1990 05:00:00 GMT");
 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 header("Cache-Control: no-store, no-cache, must-revalidate");
 header("Cache-Control: post-check=0, pre-check=0", false);
 header("Pragma: no-cache");</pre>
<p><strong>ASP.NET</strong></p>
<pre lang="java">Response.ClearHeaders();
Response.AppendHeader("Cache-Control", "no-cache"); //HTTP 1.1
Response.AppendHeader("Cache-Control", "private"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "no-store"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "must-revalidate"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "max-stale=0"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "post-check=0"); // HTTP 1.1
Response.AppendHeader("Cache-Control", "pre-check=0"); // HTTP 1.1
Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0
Response.AppendHeader("Expires", "Mon, 26 Jul 1997 05:00:00 GMT"); // HTTP 1.0</pre>
<p>I found this ASP.NET code at Stackoverflow: <a href="http://stackoverflow.com/questions/49547/making-sure-a-web-page-is-not-cached-across-all-browsers" target="_blank">Making Sure a Web Page is not Cached Across All Browsers</a>. I hope it works (:</p>
<p><strong>Java</strong></p>
<pre lang="java">response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", -1); //proxy level cache disabling</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/disabling-browser-caching/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mini Ajax Library</title>
		<link>http://www.gudubeth.net/en/articles/mini-ajax-library</link>
		<comments>http://www.gudubeth.net/en/articles/mini-ajax-library#comments</comments>
		<pubDate>Sat, 26 Dec 2009 11:32:59 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[lightweight]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=50</guid>
		<description><![CDATA[You need basic ajax functions and you need a simple, small library not like those big, complex libraries like prototype. Well, open source community hears you. MiniAjax is a lightweight ajax library which is only 1.4 kb without compression. MiniAjax can do simple form serializing, send request to a url, get its response by both [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>You need basic ajax functions and you need a simple, small library not like those big, complex libraries like prototype. Well, open source community hears you. MiniAjax is a lightweight ajax library which is only 1.4 kb without compression. MiniAjax can do simple form serializing, send request to a url, get its response by both GET or POST methods and insert the result in a html element if needed, submit a form. </p>
<p>Here is the Google Code page of this library: <a href="http://code.google.com/p/miniajax/" target="_blank">http://code.google.com/p/miniajax/</a> (Everything in one page). You can find discussions and some extra functions at <a href="http://snippets.dzone.com/posts/show/2025" target="_blank">DZone Snippets</a></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/mini-ajax-library/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove Accents In UTF-8 Strings</title>
		<link>http://www.gudubeth.net/en/articles/remove-accents-in-utf-8-strings</link>
		<comments>http://www.gudubeth.net/en/articles/remove-accents-in-utf-8-strings#comments</comments>
		<pubDate>Fri, 11 Dec 2009 23:01:14 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=41</guid>
		<description><![CDATA[If you need to convert accented characters to plain ones such as ğ to g, ä to a, ß to ss, here is the good news. Wordpress has already done this and you can freely use their implementation. I shortened the function a bit (remove the &#8216;remove accents for latin-1 charset&#8217; part). You can find [...]


Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-directory-with-php' rel='bookmark' title='Permanent Link: Remove a Directory and Its Content with PHP'>Remove a Directory and Its Content with PHP</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>If you need to convert accented characters to plain ones such as ğ to g, ä to a, ß to ss, here is the good news. Wordpress has already done this and you can freely use their implementation. I shortened the function a bit (remove the &#8216;remove accents for latin-1 charset&#8217; part). You can find the original version in wp-inlcludes/formatting.php under the name of remove_accents or <a title="Wordpress formatting.php code" href="http://wordpress.taragana.net/nav.html?wp-includes/formatting.php.source.html" target="_blank">you can check formatting.php online at this site</a>.</p>
<p><strong>Usage:</strong></p>
<pre lang="php">echo remove_accents("ĞÜŞİÖÇÄËÏÃ ğüşıöçäëïã ");
//output: 'GUSIOCAEIA gusiocaeia'</pre>
<p><span id="more-41"></span></p>
<p><strong>Now, here is the function:</strong></p>
<pre lang="php">
function remove_accents($string) {
	if ( !preg_match('/[\x80-\xff]/', $string) )
		return $string;

    $chars = array(
    // Decompositions for Latin-1 Supplement
    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
    chr(195).chr(191) => 'y',
    // Decompositions for Latin Extended-A
    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
    );

    $string = strtr($string, $chars);

	return $string;
}
</pre>


<p>Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/remove-directory-with-php' rel='bookmark' title='Permanent Link: Remove a Directory and Its Content with PHP'>Remove a Directory and Its Content with PHP</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/remove-accents-in-utf-8-strings/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change Flash Size with Javascript</title>
		<link>http://www.gudubeth.net/en/articles/change-flash-size-with-javascript</link>
		<comments>http://www.gudubeth.net/en/articles/change-flash-size-with-javascript#comments</comments>
		<pubDate>Wed, 11 Nov 2009 17:55:13 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=24</guid>
		<description><![CDATA[Here is the crossbrowser javascript code for changing flash object&#8217;s size. Works fine in IE5.5, IE6, IE7, IE8,  Firefox 3, Opera 10, Safari 4, Chrome 3.
Usage
Resizing Flash:
flashResizer.resize(width, height, flash_object_id);
Zoom In:
flashResizer.zoomin(flash_object_id);
Zoom Out:
flashResizer.zoomout(flash_object_id);
Javascript Code:
var flashResizer = {
    ZOOM_IN:1,ZOOM_OUT:-1,
    fo:null,ZOOM_FACTOR:0.1,
    findObj:function(_foid){if(_foid==undefined &#124;&#124; _foid==null){return this.fo;}
     [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Here is the crossbrowser javascript code for changing flash object&#8217;s size. Works fine in IE5.5, IE6, IE7, IE8,  Firefox 3, Opera 10, Safari 4, Chrome 3.</p>
<p>Usage<br />
<strong>Resizing Flash:</strong><br />
flashResizer.resize(width, height, flash_object_id);</p>
<p><strong>Zoom In:</strong><br />
flashResizer.zoomin(flash_object_id);</p>
<p><strong>Zoom Out:</strong><br />
flashResizer.zoomout(flash_object_id);</p>
<p><strong>Javascript Code:</strong></p>
<pre lang="javascipt">var flashResizer = {
    ZOOM_IN:1,ZOOM_OUT:-1,
    fo:null,ZOOM_FACTOR:0.1,
    findObj:function(_foid){if(_foid==undefined || _foid==null){return this.fo;}
        this.fo=null;if (window.document[_foid]) this.fo=window.document[_foid];
        else if (navigator.appName.indexOf("Microsoft Internet")==-1){
            if (document.embeds &amp;&amp; document.embeds[_foid]) this.fo = document.embeds[_foid];}
        else this.fo = document.getElementById(_foid);return this.fo;},
    resize:function(_w,_h,_foid){if(this.findObj(_foid)){
            this.fo.width=_w;this.fo.height=_h;}return this;},
    zoom:function(_d,_f){if(this.findObj(_f)){var zf=1+_d*this.ZOOM_FACTOR;
            this.resize(this.fo.width*zf,this.fo.height*zf);}return this;},
    zoomin:function(_f){this.zoom(this.ZOOM_IN,_f);},
    zoomout:function(_f){this.zoom(this.ZOOM_OUT, _f);}
}</pre>
<p><strong>Same Javascript Code With Comments (Longer Code):</strong></p>
<pre lang="javascript">var flashResizer = {
    fo:null, //flash object
    ZOOM_FACTOR:0.1, // how much resizing will happen. used in zoom

    ZOOM_IN:1,
    ZOOM_OUT:-1,

    /**
     * find flash object - cross browser
     * look at http://blog.codefidelity.com/?p=14
     * @param _foid  DOM id of flash object. if no _foid is given,
     *               uses previously found flash object
     * @return       flash object. null if no object is found
     */
    findObj:function(_foid){
        if(_foid==undefined || _foid==null){
           return this.fo;
        }
        this.fo=null;
        if (window.document[_foid]) this.fo=window.document[_foid];
        else if (navigator.appName.indexOf("Microsoft Internet")==-1){
            if (document.embeds &amp;&amp; document.embeds[_foid]) this.fo = document.embeds[_foid];
        }
        else this.fo = document.getElementById(_foid);

        return this.fo;
    },

    /**
     * resize flash to specified size
     * @param _w: new width
     * @param _h: new height
     * @param _foid: flash object id. if no _foid is given,
     *               uses previously found flash object.
     * @return this object
     */
    resize:function(_w, _h, _foid){
        if(this.findObj(_foid)){
            this.fo.width = _w;
            this.fo.height = _h;
        }
        return this;
    },

    /**
    * @param _d: zoom direction. flashResize.ZOOM_IN or 1 to zoom in,
    *            flashResize.ZOOM_OUT or-1 to zoom out.
    *            factor size also changes the zoom factor
    * @param _foid: flash object id. if no _foid is given,
    *               uses previously found flash object.
    * @return  this object
    */
    zoom:function(_d, _foid){
        if(this.findObj(_foid)){
            var zf = 1 + _d * this.ZOOM_FACTOR;
            this.resize(this.fo.width*zf, this.fo.height*zf);
        }
        return this;
    },

    /**
     * @param _foid: flash id. if no _foid is given, uses previously found flash object.
     */
    zoomin:function(_foid){
        return this.zoom(this.ZOOM_IN, _foid);
    },

    /**
     * @param _foid: flash id. if no _foid is given, uses previously found flash object.
     */
    zoomout:function(_foid){
        return this.zoom(this.ZOOM_OUT, _foid);
    }
}</pre>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/change-flash-size-with-javascript/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web 2.0 Style Relative Date Writing</title>
		<link>http://www.gudubeth.net/en/articles/web-2-0-style-relative-date-writing</link>
		<comments>http://www.gudubeth.net/en/articles/web-2-0-style-relative-date-writing#comments</comments>
		<pubDate>Fri, 06 Nov 2009 23:00:06 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[date-time functions]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[turkish]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=12</guid>
		<description><![CDATA[Some sites like Youtube use a simple  formatting style in comments&#8217; date &#38; times. Instead of writing long and detailed dates (like October 12, 2009 07:23 PM) , they use relative dates like 3 days ago, 2 weeks ago, etc.
The code below does the same thing. It takes your date,in any format php&#8217;s strtotime uses [...]


Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/date-time-difference-in-php' rel='bookmark' title='Permanent Link: Date &#038; Time Difference in PHP'>Date &#038; Time Difference in PHP</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Some sites like Youtube use a simple  formatting style in comments&#8217; date &amp; times. Instead of writing long and detailed dates (like October 12, 2009 07:23 PM) , they use relative dates like 3 days ago, 2 weeks ago, etc.</p>
<p>The code below does the same thing. It takes your date,in any format php&#8217;s strtotime uses (which means, in most situations dates coming from your database can be used directly), and converts it into this simle format.</p>
<p><a title="PHP'de yorumlar için bağıl tarih yazma" href="http://www.gudubeth.net/tr/yazi/phpde-gun-once-seklinde-bagil-tarih-yazma/">Click here for turkish version</a></p>
<pre lang="PHP">

/**
 * finds passed time in a readable format like
 * "2 days ago", "5 years ago", etc...
 * Sample usage:
 *  echo relativeTime("2009-08-23 12:05:14");
 * @param str $dateStr  date to calculate. any format readable by
 *                      php's strtotime function is appropriate.
 *                      check out http://www.php.net/manual/tr/function.strtotime.php
 *                      for usage of strtotime.
 * @param str $now      default is null which means running time. this is the
 *                      bigger date which $dateStr is substracted from.
 * @return str
 */
function relativeTime($dateStr, $now=null){
    if(!$now) $now=time();
    $time=$now-strtotime($dateStr);

    if($time<0) return "";

    if($time<60){$no=$time; $str="second";}
    else if($time<3600){$no=$time/60; $str="minute";}
    else if($time<86400){$no=$time/(3600); $str="hour";}
    else if($time<86400*7){$no=$time/(86400); $str="day";}
    else if($time<86400*30){$no=$time/(86400*7); $str="week";}
    else if($time<86400*365){$no=$time/(86400*30); $str="month";}
    else {$no=$time/(86400*365); $str="year";}

    return round($no)." ".$str.((round($no)>1)?"s":"")." ago";
}
</pre>


<p>Related posts:<ol><li><a href='http://www.gudubeth.net/en/articles/date-time-difference-in-php' rel='bookmark' title='Permanent Link: Date &#038; Time Difference in PHP'>Date &#038; Time Difference in PHP</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/web-2-0-style-relative-date-writing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello world!</title>
		<link>http://www.gudubeth.net/en/articles/hello-world</link>
		<comments>http://www.gudubeth.net/en/articles/hello-world#comments</comments>
		<pubDate>Sun, 01 Nov 2009 00:50:02 +0000</pubDate>
		<dc:creator>Gudubeth</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://www.gudubeth.net/en/?p=1</guid>
		<description><![CDATA[Here comes a new blogger.


No related posts.


No related posts.]]></description>
			<content:encoded><![CDATA[<p>Here comes a new blogger.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.gudubeth.net/en/articles/hello-world/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
