<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<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/"
	>

<channel>
	<title>Tai - Think About It</title>
	<link>http://www.tai.ro</link>
	<description>PHP - Think About It</description>
	<pubDate>Wed, 16 Apr 2008 11:33:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
	<language>en</language>
			<item>
		<title>php cache</title>
		<link>http://www.tai.ro/2008/04/16/php-cache/</link>
		<comments>http://www.tai.ro/2008/04/16/php-cache/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/php-cache/</guid>
		<description><![CDATA[ &#60;?php
$url = 'http://www.site.com/file.php';
$dest_file = 'footercache.txt'; //be sure it is chmod-ed to 0666  !!
$pagesource = request_cache($url, $dest_file, 3600*24*7);
echo $pagesource;
function request_cache($url, $dest_file, $timeout=7200) {
 if(strlen($dest_file) &#62; 100) $dest_file = substr($dest_file, 20, 60) . substr($dest_file, strlen($dest_file) - 4);//keep some chars and the probable extension
if(!file_exists($dest_file) &#124;&#124; filemtime($dest_file) &#60; (time()-$timeout)) {
 $data = @file_get_contents($url);
if ($data !== false) {
 [...]]]></description>
			<content:encoded><![CDATA[<p> <code>&lt;?php</code></p>
<p>$url = 'http://www.site.com/file.php';<br />
$dest_file = 'footercache.txt'; //be sure it is chmod-ed to 0666  !!</p>
<p>$pagesource = request_cache($url, $dest_file, 3600*24*7);<br />
echo $pagesource;</p>
<p>function request_cache($url, $dest_file, $timeout=7200) {</p>
<blockquote><p> if(strlen($dest_file) &gt; 100) $dest_file = substr($dest_file, 20, 60) . substr($dest_file, strlen($dest_file) - 4);//keep some chars and the probable extension</p></blockquote>
<blockquote><p>if(!file_exists($dest_file) || filemtime($dest_file) &lt; (time()-$timeout)) {</p>
<blockquote><p> $data = @file_get_contents($url);<br />
if ($data !== false) {</p>
<blockquote><p> $tmpf = tempnam('/tmp','YWS');<br />
$fp = @fopen($tmpf,&raquo;w&raquo;);<br />
@fwrite($fp, $data);<br />
@fclose($fp);<br />
if(file_exists($dest_file)) @unlink($dest_file);<br />
rename($tmpf, $dest_file);</p></blockquote>
<p>}else{</p>
<blockquote><p> touch($dest_file);//update its date only</p></blockquote>
<p>}</p></blockquote>
<p>} else {</p>
<blockquote><p> $data = file_get_contents($dest_file);</p></blockquote>
<p>}<br />
return($data);</p></blockquote>
<p>}</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/php-cache/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Common PHP functions</title>
		<link>http://www.tai.ro/2008/04/16/common-php-functions/</link>
		<comments>http://www.tai.ro/2008/04/16/common-php-functions/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/common-php-functions/</guid>
		<description><![CDATA[function parse_input($var_array, $var_name){ if(!isset($var_array[$var_name])) return '';

 if(!is_array($var_array[$var_name])){  if (!get_magic_quotes_gpc()) {   $retVal = trim(addslashes($var_array[$var_name]));  } else {   $retVal = trim($var_array[$var_name]);  } }else{  if (!get_magic_quotes_gpc()) {   foreach ($var_array[$var_name] as $value){    $retVal[] = trim(addslashes($value));   }  } else {   foreach ($var_array[$var_name] [...]]]></description>
			<content:encoded><![CDATA[<pre>function <span>parse_input</span>($var_array, $var_name){ if(!isset($var_array[$var_name])) return '';

 if(!is_array($var_array[$var_name])){  if (!get_magic_quotes_gpc()) {   $retVal = trim(addslashes($var_array[$var_name]));  } else {   $retVal = trim($var_array[$var_name]);  } }else{  if (!get_magic_quotes_gpc()) {   foreach ($var_array[$var_name] as $value){    $retVal[] = trim(addslashes($value));   }  } else {   foreach ($var_array[$var_name] as $value) {    $retVal[] = trim($value);   }  } } return $retVal;}

function <span>dprint</span>($var, $message = ''){ if(DEBUG){  echo(&laquo;DEBUG : $message\r\n&raquo;);  if(is_array($var) || is_object($var)){   print_r($var);  }else{   echo($var);  }  echo(&laquo;\r\n&raquo;); }}

function <span>sql_date_format</span>($sqldate, $format = 'M j, Y  g:i a'){ list($dy,$dm,$dd, $h,$m,$s) = sscanf($sqldate, &laquo;%4d-%2d-%2d %2d:%2d:%2d&raquo;); $str = date($format, mktime($h, $m, $s, $dm, $dd, $dy)); return $str;}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/common-php-functions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Menu at mouse cursor</title>
		<link>http://www.tai.ro/2008/04/16/menu-at-mouse-cursor/</link>
		<comments>http://www.tai.ro/2008/04/16/menu-at-mouse-cursor/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/menu-at-mouse-cursor/</guid>
		<description><![CDATA[ 
&#60;STYLE TYPE="text/css"&#62;&#60;!--#dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}//--&#62;&#60;/STYLE&#62;&#60;DIV ID="dek"&#62;&#60;/DIV&#62;&#60;SCRIPT TYPE="text/javascript"&#62;&#60;!--function popUp(theURL, myWidth, myHeight) {&#160;&#160;&#160;var winName = 'feedback';&#160;&#160;&#160;var features='toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1';&#160;&#160;&#160;//var myWidth = 290;&#160;&#160;&#160;//var myHeight = 360;&#160;&#160;&#160;var isCenter = 'true';&#160;&#160;&#160;if(window.screen)if(isCenter)if(isCenter=="true"){&#160;&#160;&#160;&#160;&#160;&#160;var myLeft = (screen.width-myWidth)/2;&#160;&#160;&#160;&#160;&#160;&#160;var myTop = (screen.height-myHeight)/2;&#160;&#160;&#160;&#160;&#160;&#160;features+=(features!='')?',':'';&#160;&#160;&#160;&#160;&#160;&#160;features+=',left='+myLeft+',top='+myTop;&#160;&#160;&#160;}&#160;&#160;&#160;var handle = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);&#160;&#160;&#160;handle.opener = window;&#160;&#160;&#160;handle.focus();&#160;&#160;&#160;return handle;}


Xoffset=0;    // modify these values to ...
Yoffset= 0;    // change the popup position.
var old,skn,iex=(document.all),yyy=Yoffset;//-1000;
var ns4=document.layers
var [...]]]></description>
			<content:encoded><![CDATA[<p> <pre><ol>
<li></li><li>&lt;STYLE TYPE="text/css"&gt;</li><li>&lt;!--</li><li>#dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}</li><li>//--&gt;</li><li>&lt;/STYLE&gt;</li><li>&lt;DIV ID="dek"&gt;&lt;/DIV&gt;</li><li>&lt;SCRIPT TYPE="text/javascript"&gt;</li><li>&lt;!--</li><li>function popUp(theURL, myWidth, myHeight) {</li><li>&nbsp;&nbsp;&nbsp;var winName = 'feedback';</li><li>&nbsp;&nbsp;&nbsp;var features='toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1';</li><li>&nbsp;&nbsp;&nbsp;//var myWidth = 290;</li><li>&nbsp;&nbsp;&nbsp;//var myHeight = 360;</li><li>&nbsp;&nbsp;&nbsp;var isCenter = 'true';</li><li>&nbsp;&nbsp;&nbsp;if(window.screen)if(isCenter)if(isCenter=="true"){</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var myLeft = (screen.width-myWidth)/2;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var myTop = (screen.height-myHeight)/2;</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;features+=(features!='')?',':'';</li><li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;features+=',left='+myLeft+',top='+myTop;</li><li>&nbsp;&nbsp;&nbsp;}</li><li>&nbsp;&nbsp;&nbsp;var handle = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);</li><li>&nbsp;&nbsp;&nbsp;handle.opener = window;</li><li>&nbsp;&nbsp;&nbsp;handle.focus();</li><li>&nbsp;&nbsp;&nbsp;return handle;</li><li>}</li>
</ol></pre>
</p>
<p>Xoffset=0;    // modify these values to ...<br />
Yoffset= 0;    // change the popup position.<br />
var old,skn,iex=(document.all),yyy=Yoffset;//-1000;<br />
var ns4=document.layers<br />
var ns6=document.getElementById&amp;&amp;!document.all<br />
var ie4=document.all<br />
var must_close = false;<br />
var mouse_x = 0;<br />
var mouse_y = 0;<br />
var timeoutId = false;<br />
function initdek(){<br />
if (ns4) skn=document.dek;<br />
else if (ns6) skn=document.getElementById(&laquo;dek&raquo;).style;<br />
else if (ie4) skn=document.all.dek.style;</p>
<p>if(ns4)document.captureEvents(Event.MOUSEMOVE);<br />
else{<br />
skn.visibility=&raquo;visible&raquo;<br />
skn.display=&raquo;none&raquo;<br />
}<br />
document.onmousemove=get_mouse;<br />
}<br />
//ONMOUSEOVER=&raquo;keep_it_open()&raquo; ONMOUSEOUT=&raquo;about_to_close()&raquo;<br />
function popupdek(msg){<br />
keep_it_open();<br />
var content='&lt;div style=&raquo;border:1px solid #999; padding:10px;background-color:#f87&raquo; ONMOUSEOVER=&raquo;keep_it_open()&raquo; ONMOUSEOUT=&raquo;about_to_close()&raquo;&gt;' + msg + '&lt;/div&gt;';</p>
<p>yyy=Yoffset;<br />
skn.left = mouse_x;<br />
skn.top = mouse_y;<br />
if(ns4){skn.document.write(content);skn.document.close();skn.visibility=&raquo;visible&raquo;}<br />
if(ns6){document.getElementById(&laquo;dek&raquo;).innerHTML=content;skn.display=''}<br />
if(ie4){document.all(&laquo;dek&raquo;).innerHTML=content;skn.display=''}<br />
}<br />
function get_mouse(e){<br />
if(ns4||ns6){<br />
mouse_x=e.pageX+Xoffset+'px';<br />
mouse_y=e.pageY+yyy + 'px';<br />
}else{<br />
if (document.documentElement){<br />
// IE6 +4.01<br />
mouse_x=event.x+document.documentElement.scrollLeft+Xoffset+'px';<br />
mouse_y=event.y+document.documentElement.scrollTop+yyy + 'px';<br />
}else if (document.body){<br />
// IE5 or DTD 3.2<br />
mouse_x=event.x+document.body.scrollLeft+Xoffset+'px';<br />
mouse_y=event.y+document.body.scrollTop+yyy + 'px';<br />
}<br />
}<br />
}<br />
function kill(){<br />
//yyy=-1000;<br />
if(ns4){skn.visibility=&raquo;hidden&raquo;;}<br />
else if (ns6||ie4)<br />
skn.display=&raquo;none&raquo;<br />
is_visible=0;<br />
}<br />
function keep_it_open(){<br />
if(timeoutId) clearTimeout(timeoutId);<br />
timeoutId = false;<br />
}<br />
function about_to_close(){<br />
timeoutId = setTimeout('kill()',1000);<br />
}<br />
function set_must_close(){<br />
must_close=true;<br />
kill();<br />
}<br />
initdek();<br />
function showTags(str){<br />
var msg = &laquo;&lt;strong&gt;Tags:&lt;/strong&gt;&lt;br/&gt;&raquo; + str.replace(/\,/,'&lt;br/&gt;');<br />
msg += '&lt;br/&gt;&lt;form action=&raquo;"&gt;&lt;input type=&raquo;text&raquo; size=&raquo;10&raquo; value=&raquo;enter tag..&raquo; name=&raquo;tag&raquo;/&gt;&lt;input type=&raquo;submit&raquo; value=&raquo;Add&raquo;&gt;&lt;/form&gt;';<br />
popupdek(msg);<br />
}<br />
function showManage(pid){<br />
var msg = &laquo;&lt;strong&gt;Management:&lt;/strong&gt;&lt;br/&gt;&raquo; ;<br />
msg += '&lt;a href=&raquo;#&raquo; onclick=&raquo;popUp(\'imageop/add_image~' + pid + '.html\',400,300)&raquo; &gt;Add image&lt;/a&gt;&lt;br/&gt;';<br />
msg += '&lt;a href=&raquo;#&raquo; onclick=&raquo;popUp(\'imageop/delete_image~' + pid + '.html\',400,300)&raquo; &gt;Delete image&lt;/a&gt;&lt;br/&gt;';<br />
msg += '&lt;br/&gt;&lt;form action=&raquo;"&gt;&lt;input type=&raquo;file&raquo; size=&raquo;10&raquo; value=&raquo;" name=&raquo;uploadfile&raquo;/&gt;&lt;br/&gt;&lt;input type=&raquo;submit&raquo; value=&raquo;Upload&raquo;&gt;&lt;/form&gt;';<br />
popupdek(msg);<br />
}</p>
<p>function showLinks(pid, iurl){<br />
var msg = &laquo;&lt;strong&gt;Links:&lt;/strong&gt;&lt;br/&gt;&raquo; ;<br />
msg += '&lt;a href=&raquo;&lt;?=$PROFILEORIGIN?&gt;/list_profile~' + pid + '.html&raquo; target=&raquo;_blank&raquo;&gt;Profile home&lt;/a&gt;&lt;br/&gt;';<br />
msg += '&lt;a href=&raquo;' + iurl + '&raquo; target=&raquo;_blank&raquo; &gt;Source URL&lt;/a&gt;&lt;br/&gt;';<br />
popupdek(msg);<br />
}<br />
//--&gt;<br />
&lt;/SCRIPT&gt;</p>
<p><span style="font-weight: bold">Used as:</span><br />
&lt;a href=&raquo;http://www.blogger.com/post-edit.do#&raquo; onmouseover=&raquo;showTags('taglist,comma separated)');keep_it_open()&raquo; onmouseout=&raquo;about_to_close()&raquo; onclick=&raquo;return false&raquo;&gt;Tags&lt;/a&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/menu-at-mouse-cursor/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RegEx email parser</title>
		<link>http://www.tai.ro/2008/04/16/regex-email-parser/</link>
		<comments>http://www.tai.ro/2008/04/16/regex-email-parser/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/regex-email-parser/</guid>
		<description><![CDATA[Split email formats in pieces through preg_match:
$str=' (&#124;(([^a-zA-Z0-9_\-.]&#124;)(.*?)(&#124;[^a-zA-Z0-9_\-.]+?)([a-zA-Z0-9_\-.]+?)(&#124;[^a-zA-Z0-9_\-.]+?)))(&#124;[^a-zA-Z0-9_\-.])([a-zA-Z0-9_\-.]+?)(&#124;[^a-zA-Z0-9_\-.])@(.+?)\.([^>]+)';
]]></description>
			<content:encoded><![CDATA[<p>Split email formats in pieces through preg_match:</p>
<p>$str=' (|(([^a-zA-Z0-9_\-.]|)(.*?)(|[^a-zA-Z0-9_\-.]+?)([a-zA-Z0-9_\-.]+?)(|[^a-zA-Z0-9_\-.]+?)))(|[^a-zA-Z0-9_\-.])([a-zA-Z0-9_\-.]+?)(|[^a-zA-Z0-9_\-.])@(.+?)\.([^>]+)';</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/regex-email-parser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Format long texts</title>
		<link>http://www.tai.ro/2008/04/16/format-long-texts/</link>
		<comments>http://www.tai.ro/2008/04/16/format-long-texts/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/format-long-texts/</guid>
		<description><![CDATA[/** * Cut a text so it won't have more than $max_length chars and any word should not have more than $max_word chars * * @param unknown_type $length_limit * @param unknown_type $length_word */function format_long_text($str, $max_length=99999, $max_word = 60){ //limit string length $has_tail = false; if(strlen($str) > $max_length){  $new_str = substr($str, 0, $max_length);  //search [...]]]></description>
			<content:encoded><![CDATA[<pre>/** * Cut a text so it won't have more than $max_length chars and any word should not have more than $max_word chars * * @param unknown_type $length_limit * @param unknown_type $length_word */function format_long_text($str, $max_length=99999, $max_word = 60){ //limit string length $has_tail = false; if(strlen($str) > $max_length){  $new_str = substr($str, 0, $max_length);  //search for non-alpha char  for($i = $max_length; $i < strlen($str) &#038;&#038; ctype_alpha($str[$i]); $i++) $new_str .= $str[$i];  $str = $new_str;  $has_tail = true; }

 if(3 < $max_word &#038;&#038; $max_word < $max_length){  do{   $words = explode(' ', $str);   $do_loop = false;   foreach ($words as $word){

    if(strlen($word) > $max_word){     //bug in IE: point followed by char does not split the text     $fixed_word = str_replace('.', '. ', $word);

     $new_word = '';     $j = 0;     for($i = 0; $i < strlen($fixed_word); $i++){      $j = (' ' == $fixed_word[$i]?0:$j+1);

      if(($j+1)%$max_word==0){       $new_word .= ' ' . $fixed_word[$i];      }else{       $new_word .= $fixed_word[$i];      }     }     $str = str_replace($word, $new_word, $str);     $do_loop = true;     break;    }   }  }while($do_loop); }

 return $str . ($has_tail?'..':'');}

</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/format-long-texts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Phrase to URL-format</title>
		<link>http://www.tai.ro/2008/04/16/phrase-to-url-format/</link>
		<comments>http://www.tai.ro/2008/04/16/phrase-to-url-format/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/phrase-to-url-format/</guid>
		<description><![CDATA[preg_replace('/[^a-zA-Z]+/','_',$phrase)
]]></description>
			<content:encoded><![CDATA[<p>preg_replace('/[^a-zA-Z]+/','_',$phrase)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/phrase-to-url-format/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Instant popup on mouseover</title>
		<link>http://www.tai.ro/2008/04/16/instant-popup-on-mouseover/</link>
		<comments>http://www.tai.ro/2008/04/16/instant-popup-on-mouseover/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/instant-popup-on-mouseover/</guid>
		<description><![CDATA[&#60;STYLE TYPE="text/css"&#62;&#60;!--#dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}//--&#62;&#60;/STYLE&#62;&#60;DIV&#62;&#60;/DIV&#62;

&#60;SCRIPT TYPE="text/javascript"&#62;&#60;!--

Xoffset=0;    // modify these values to ...Yoffset= 20;    // change the popup position.

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layersvar ns6=document.getElementById&#038;&#38;!document.allvar ie4=document.all

if (ns4)skn=document.dekelse if (ns6)skn=document.getElementById("dek").styleelse if (ie4)skn=document.all.dek.styleif(ns4)document.captureEvents(Event.MOUSEMOVE);else{skn.visibility="visible"skn.display="none"}document.onmousemove=get_mouse;

function popup(msg,bak){var content="&#60;table&#62;&#60;tr&#62;&#60;td";

content += " bgcolor='"+bak+"'";

content += "&#62;"+msg+"&#60;/td&#62;&#60;/tr&#62;&#60;/table&#62;";

yyy=Yoffset;if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}if(ie4){document.all("dek").innerHTML=content;skn.display=''}}

function get_mouse(e){if(ns4&#124;&#124;ns6){ skn.left=e.pageX+Xoffset+'px'; skn.top=e.pageY+yyy + 'px';}else{ if (document.documentElement){  // IE6 +4.01  skn.left=event.x+document.documentElement.scrollLeft+Xoffset+'px';  skn.top=event.y+document.documentElement.scrollTop+yyy + 'px'; [...]]]></description>
			<content:encoded><![CDATA[<pre>&lt;STYLE TYPE="text/css"&gt;&lt;!--#dek {POSITION:absolute;VISIBILITY:hidden;Z-INDEX:200;}//--&gt;&lt;/STYLE&gt;&lt;DIV&gt;&lt;/DIV&gt;

&lt;SCRIPT TYPE="text/javascript"&gt;&lt;!--

Xoffset=0;    // modify these values to ...Yoffset= 20;    // change the popup position.

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layersvar ns6=document.getElementById&&amp;!document.allvar ie4=document.all

if (ns4)skn=document.dekelse if (ns6)skn=document.getElementById("dek").styleelse if (ie4)skn=document.all.dek.styleif(ns4)document.captureEvents(Event.MOUSEMOVE);else{skn.visibility="visible"skn.display="none"}document.onmousemove=get_mouse;

function popup(msg,bak){var content="&lt;table&gt;&lt;tr&gt;&lt;td";

content += " bgcolor='"+bak+"'";

content += "&gt;"+msg+"&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";

yyy=Yoffset;if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}if(ie4){document.all("dek").innerHTML=content;skn.display=''}}

function get_mouse(e){if(ns4||ns6){ skn.left=e.pageX+Xoffset+'px'; skn.top=e.pageY+yyy + 'px';}else{ if (document.documentElement){  // IE6 +4.01  skn.left=event.x+document.documentElement.scrollLeft+Xoffset+'px';  skn.top=event.y+document.documentElement.scrollTop+yyy + 'px'; }else if (document.body){  // IE5 or DTD 3.2   skn.left=event.x+document.body.scrollLeft+Xoffset+'px';  skn.top=event.y+document.body.scrollTop+yyy + 'px'; }}}

function kill(){yyy=-1000;if(ns4){skn.visibility="hidden";}else if (ns6||ie4)skn.display="none"}

//--&gt;&lt;/SCRIPT&gt;</pre>
<h4>Usage:</h4>
<p>&lt;a href=&raquo;mylinkhere.php&raquo;;&gt;click here&lt;/a&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/instant-popup-on-mouseover/feed/</wfw:commentRss>
		</item>
		<item>
		<title>META tag library</title>
		<link>http://www.tai.ro/2008/04/16/meta-tag-library/</link>
		<comments>http://www.tai.ro/2008/04/16/meta-tag-library/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/meta-tag-library/</guid>
		<description><![CDATA[This library if for obtaining content for the META TAGS like keywords, description and also for computing tags to be used in searches based on the given text.
http://www.worldsview.com/metataggen_library.zip
]]></description>
			<content:encoded><![CDATA[<p>This library if for obtaining content for the META TAGS like keywords, description and also for computing tags to be used in searches based on the given text.</p>
<p><a href="http://www.worldsview.com/metataggen_library.zip">http://www.worldsview.com/metataggen_library.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/meta-tag-library/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Email validity check</title>
		<link>http://www.tai.ro/2008/04/16/email-validity-check/</link>
		<comments>http://www.tai.ro/2008/04/16/email-validity-check/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/email-validity-check/</guid>
		<description><![CDATA[PHP code:
function is_email($email){   $x = '\d\w!\#\$%&#038;\'*+\-/=?\^_`{&#124;}~';    //just for clarity

   return count($email = explode('@', $email, 3)) == 2       &#038;&#038; strlen($email[0]) < 65       &#038;&#038; strlen($email[1]) < 256       &#038;&#038; preg_match("#^[$x]+(\.?([$x]+\.)*[$x]+)?$#", $email[0])   [...]]]></description>
			<content:encoded><![CDATA[<p>PHP code:
<pre>function is_email($email){   $x = '\d\w!\#\$%&#038;\'*+\-/=?\^_`{|}~';    //just for clarity

   return count($email = explode('@', $email, 3)) == 2       &#038;&#038; strlen($email[0]) < 65       &#038;&#038; strlen($email[1]) < 256       &#038;&#038; preg_match("#^[$x]+(\.?([$x]+\.)*[$x]+)?$#", $email[0])       &#038;&#038; preg_match('#^(([a-z0-9]+-*)?[a-z0-9]+\.)+[a-z]{2,6}.?$#', $email[1]);}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/email-validity-check/feed/</wfw:commentRss>
		</item>
		<item>
		<title>switch order of two records in a table</title>
		<link>http://www.tai.ro/2008/04/16/switch-order-of-two-records-in-a-table/</link>
		<comments>http://www.tai.ro/2008/04/16/switch-order-of-two-records-in-a-table/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 09:44:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Developers]]></category>

		<guid isPermaLink="false">http://www.tai.ro/2008/04/16/switch-order-of-two-records-in-a-table/</guid>
		<description><![CDATA[When in need to change the order of a list use a field to store the order as an int: Change the order of the records by switching the order value between consecutive elements.

case 'orderdown':case 'orderup':{ //get all list and retain two elements: if moveup operation then I keep prev and current  //otherwise I [...]]]></description>
			<content:encoded><![CDATA[<p>When in need to change the order of a list use a field to store the order as an int: <br />Change the order of the records by switching the order value between consecutive elements.</p>
<pre><ol>
<li>case 'orderdown':case 'orderup':{ //get all list and retain two elements: if moveup operation then I keep prev and current  //otherwise I keep current and next $rec_list = $this->getChildren($record->id_parent);//all records on this level $switch = array(); for($i = 0; $i < count($rec_list) ; $i++){  if($rec_list[$i]['id'] == $record['id']){   if('orderup' == $what &#038;&#038; $i != 0){    //not first    $switch[$rec_list[$i-1]['id']] = $rec_list[$i]['corder'];    $switch[$rec_list[$i]['id']] = $rec_list[$i-1]['corder'];    break;   }elseif('orderdown' == $what &#038;&#038; $i != (count($rec_list)-1)){    //not last    $switch[$rec_list[$i+1]['id']] = $rec_list[$i]['corder'];    $switch[$rec_list[$i]['id']] = $rec_list[$i+1]['corder'];    break;   }  } }</li><li>&nbsp;&nbsp;&nbsp;</li><li>&nbsp;&nbsp;&nbsp;//valid elements found. Switch them if(count($switch) > 0){  foreach ($switch as $id=>$corder) {   $sql = "UPDATE page SET corder=$corder WHERE$id";   $result = mysql_query($sql) or die("SQL ERROR " . mysql_error() . " [$sql] on " . __FILE__ . " at line " . __LINE__);  } }</li>
</ol></pre>

]]></content:encoded>
			<wfw:commentRss>http://www.tai.ro/2008/04/16/switch-order-of-two-records-in-a-table/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
