Tuesday, July 29, 2008

Your own favorite Fonts on web

If you have your font and want to put in webpage try this method
1) created from existing TrueType font files(.ttf) using Microsoft's Web Embedding Fonts Tool (WEFT). (A similar software product called "FAIRY", by BorWare AG, also generated .eot files, with some improvements.)
2) embeddeb font with the css

@font-face {
  font-family: 05_ZZ Death Note 1.0;
  font-style:  normal;
  font-weight: normal;
  src: url(ZZDEATH1.eot);
}
.deathnote { font-family: "05_ZZ Death Note 1.0"; }
and use the code in html
<FONT FACE="05_ZZ Death Note 1.0" SIZE="5"> Aa Bb Cc Dd Ee Ff Gg </FONT>
or
<div class="deathnote">testing</div>
Example : http://www.microsoft.com/typography/web/embedding/default.aspx
wiki : http://en.wikipedia.org/wiki/Embedded_OpenType
link : http://www.microsoft.com/typography/WEFT.mspx

Friday, July 25, 2008

coding php to extract or get filename and extension

it's not hard to code but not easy to solve
easyiest way is use explode function but this is advance :)

 
  $url = "htpp://www.example.com/filename.txt
  $file = substr(strrchr($url, '/'), 1); //get file
  $ext = substr(strrchr($file, '.'), 1); //get extension
  $filename = substr($file,0,strrpos($file,'.')); // get file name
and another code is function to remove file in folder and/or empty folder
<?php
// ggarciaa at gmail dot com (04-July-2007 01:57)
// I needed to empty a directory, but keeping it
// so I slightly modified the contribution from
// stefano at takys dot it (28-Dec-2005 11:57)
// A short but powerfull recursive function
// that works also if the dirs contain hidden files
// $dir = the target directory
// $DeleteMe = if true delete also $dir, if false leave it alone
function SureRemoveDir($dir, $DeleteMe) {
  if(!$dh = @opendir($dir)) return;
  while (false !== ($obj = readdir($dh))) {
    if($obj=='.' || $obj=='..') continue;
    if (!@unlink($dir.'/'.$obj)) SureRemoveDir($dir.'/'.$obj, true);
  }
  closedir($dh);
  if($DeleteMe){
    @rmdir($dir);
  }
}
//SureRemoveDir('EmptyMe', false);
//SureRemoveDir('RemoveMe', true);
?>
link: http://th.php.net/unlink link2:

Thursday, July 17, 2008

Magic wand mouse script

simple add the following script into the <BODY> section of your page

coding php to solve crossword

<?
$table[] = "CYPURSITSRAELTEN";
$table[] = "ARZERBAIJANFIGIE";
$table[] = "IPORLANDPANNAMAA";
$table[] = "REUNTIONEGULYNUT";
$table[] = "ANDORATYREWANDAE";
$table[] = "LEBNONATUNICIADR";
$table[] = "ALNRPILSTTUKEYOL";
$table[] = "NAEOORGHOICUCUBA";
$table[] = "DOWMLLEAKNYEMANN";
$table[] = "SSSELARDOAHEITID";
$table[] = "IVENANICAMAROONP";
$table[] = "NEAINDAKIRIBATTE";
$table[] = "GTLEDELSAVADOROD";
$table[] = "GNAPORTUGALYESNB";
$table[] = "AANTUKMENISTANKA";
$table[] = "PMDPELANDPUCCAAA";
for($i=0;$i<count($table);$i++){
 for($j=0;$j<count($table);$j++){
  $table2[$i] .= $table[$j][$i];
 }
}
$handle = fopen("country.txt", "rb");
$contents = '';
while (!feof($handle)) {
  $contents .= fread($handle, 8192);
}
fclose($handle);
$contents2 = explode("\n", $contents);
for($i=0;$i<16;$i++){
 for($j=0;$j<count($contents2);$j++){
  if (preg_match("/".trim($contents2[$j])."/i", $table[$i])) {
   echo $contents2[$j]." on row ".($i+1)."<BR>";
  }
  if (preg_match("/".trim($contents2[$j])."/i", $table2[$i])) {
   echo $contents2[$j]." on column ".($i+1)."<BR>";
  }
 }
}
?>