memcached set max memory used
May 02
memcached -d -m 2048 -u root
read all »
Apr 02
1 2 3 4 5 6 7 8 | <script language="javascript" type="text/javascript">
var loc = document.location.href + "";
loc = loc.replace("old-website.ru", "new-website.ru");
document.write ('<meta http-equiv="refresh" content="0;url='+loc+'" />');
document.write (loc);
</script> |
Jun 20
#mm .rollOver {
height: 165px; /* IE 6 & bellow */
}
html>body #mm .rollOver {
height: 163px; /* FF & Others */
}
*:first-child+html #mm .rollOver {
height: 165px !important; /* #%@#%(! IE 7 */
}
p.style { color:red; } /* IE7 */
* html p.style { color:blue; } /* Other IE */
*|html p.style { color:pink; } /* FF, Opera, Konqueror, Safari */
#ie7-hook-id div[class^="target-class"] { background: #ff0000; }
div#ie7-hook-id .target-class { background: #0000ff; }
* div[class^="ie7-target-class"] { background: #ff0000; }
body .ie7-target-class { background: #0000ff; }
Valid CSS Selectors
* html {} /* IE 6 and below */
*:first-child+html {} * html {} /* IE 7 and below */
*:first-child+html {} /* IE 7 only */
html>body {} /* IE 7 and modern browsers only */
html>/**/body {} /* Modern browsers only (not IE 7) */
html:first-child {} /* Recent Opera versions 9 and below */
Aug 09
to Scroll to footer of page on javascript
write
read all »
Jan 26
![]()
Run this queries in phpmyadmin to replace text1 to text2 read all »
Oct 28
This simple script makes good things!
1) leave first img tag
2) remove all another img tags
3) cut text by length
So you get simple text short text with one image on it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | function cut_text($x) { $alli = catch_that_image($x); if ($alli) { $x= substr($x, 0, $alli[2]+$alli[3]). substr(strip_only($x, '<img>'), $alli[2]); } if(strlen($x) > 700) { $x = substr($x, 0, 700); $y = strrpos($x, '>'); $x = substr($x, 0, $y). '>...'; } return $x; } function catch_that_image($x) { $first_img = ''; $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $x, $matches); @$first_img = $matches [1][0]; $imglen = strlen($matches [0][0]); if (strlen($matches [1][0]) AND $imglen){ $imgpos = stripos($x, $matches [0][0]); $tx = substr($x, 0, $imgpos).substr($x, $imgpos+$imglen); //Vsio krome<img> }else{ $tx = false; } return array($tx,$matches [0][0], $imgpos, $imglen ); } function strip_only($str, $tags) { if(!is_array($tags)) { $tags = (strpos($str, '>') !== false ? explode('>', str_replace('<', '', $tags)) : array($tags)); if(end($tags) == '') array_pop($tags); } foreach($tags as $tag) $str = preg_replace('#</?'.$tag.'[^>]*>#is', '', $str); return $str; } echo cut_text('<div class="content" style="min-height: 202px;"> <img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/> <div class="pic fl"> <img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/> </div> <div class="post-title"> </div> <img width="200" height="200" alt="Post Pic" src="http://www.wprecipes.com/wp-content/uploads/2009/02/php2.jpg"/> <div class="post-excerpt">'); |