I wish to put my chat logs in a database, then I can do a lot of fun operation on it. I wrote this php script so read Pidgin's html logs. I will write something separate to put it in a database.
I use html instead of text log so there is no ambiguous expressions (for example, someone copied a chat log and sent to you), and provided all information(which nickname is the user? one that's colored blue.).
To achieve what I really want, it's much better to wrote a plugin for Pidgin. I heard there was a Remote Logging plugin(which is exactly what I needed) but never saw anything come out from it. I hope there is someone who want to revive the project.
Some notes:
1. Pidgin can change the format anytime and render this not usable.
2. This is only useful in 1 on 1 IM's. in conversations, it can only record if you said something vs someone else said something.
3. the log will not be parsed if it's not complete(which means it didn't end in html end tag)
//this script reads a pidgin log html file. //Configuration!!!! //Logs to check //The directory to the log file, without the last slash $f = 'C:\Documents and Settings\UserXP\Application Data\.purple\logs'; //$s is an array of service name //$u is an array of usernames $s[] = 'aim'; $u[] = 'mgcclx'; //use html or not $html = 1; //if use html, which html tags are allowed $html_allow = '<br/><span><font><p><a>'; //Write your own logging function //For every message, it call this function once function logging_function($service,$user,$other,$user_or_other,$time,$speaker,$content){ return true; } for($i=count($s)-1;$i>-1;$i--){ $o = scandir($f.'/'.$s[$i].'/'.$u[$i]); for($j=count($o)-1;$j>1;$j--){ $d[$j] = $f.'/'.$s[$i].'/'.$u[$i].'/'.$o[$j].'/'; $files = file_list($d[$j],'html'); for($k=0;$k<count($files);$k++){ $log = parse_log($d[$j].$files[$k],$html,$html_allow); if($log===FALSE){ continue; } for($l=0;$l<count($log);$l++){ logging_function($s[$i],$u[$i],$o[$j],$log[$l][0],$log[$l][1],$log[$l][2],$log[$l][3]); } } } } function parse_log($file_name,$html=0,$html_allow = '<br/><span><font><p><a>'){ $line = file($file_name); $c = count($line); if(rtrim($line[$c-1])!='</body></html>'){ return FALSE; } preg_match("@Conversation with (.*?) at (.*?) (.*?) on (.*?) \((.*?)\)@u", $line[0], $match); $date=$match[2]; $prev = 'AM'; for($i=1;$i<$c;$i++){ if(preg_match('@<font color="#(.*?)"><font size="2">\((.*?)\)</font> <b>(.*?):</b></font> (.*)<br/>@u', $line[$i], $match)==1){ if($match[1]=="16569E"){ $match[1]=1; }else{ $match[1]=0; } if(substr($match[2],-2)=='AM'&&$prev=='PM'){ $t = explode('/',$date); $date = gmdate("n/j/Y", gmmktime(0,0,0,$t[0],$t[1],$t[2])+86401); } $prev = substr($match[2],-2); $match[2] = $date.' '.$match[2]; if(strpos($match[3],' <AUTO-REPLY>')!== FALSE){ $match[3] = str_replace(' <AUTO-REPLY>','',$match[3]); $match[4] = '<AUTO-REPLY> '.$match[4]; } if($html){ $match[4] = strip_tags($match[4],'<br/><span><font><p><a>'); }else{ $match[4] = str_replace('<br/>',"\n",$match[4]); $match[4] = strip_tags($match[4]); } $log[] = array($match[1],$match[2],$match[3],$match[4]); } } return $log; } //this function found on http://us3.php.net/manual/en/function.scandir.php //by phpdotnet at lavavortex dot com function file_list($d,$x){ foreach(array_diff(scandir($d),array('.','..')) as $f)if(is_file($d.'/'.$f)&&(($x)?ereg($x.'$',$f):1))$l[]=$f; return $l; }
I just installed Mathematics Filter for Drupal, and now working toward more professional math(μαθηματικά) blog 

graph of sin(x) and 5*cos(x) [Using javascript]
I'm using Site5's hosting, currently I'm really happy with it. Never used their support system, and I don't want to get support either because I like to do everything myself.
The difficult part to install mathematics filter is to compile mimetex on the server. Because I have no idea of SSH, and I'm currently in BNL, which blocks the SSH port to the outside for some reason...
so I wrote a auto installer script for mimetex, basically, it's just using PHP to execute the shell command.
Create a new PHP script, add the code below.
<?php echo `cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi`; ?>
move that script in the same folder as the mimetex source. run it. and now move mimetex.cgi to your CGI folder and it should work.
The gif class is made by SuperRembo back in 2006, very short and compact. View the source here. The old time favorite, GIFEncoder is still at hand, so I did a test and the result shows SuperRembo's gif class is faster after a little modification(my test could be inaccurate because the structure of 2 gif system is different). Take out the ob_start and other part, let the user input the output image instead of the resource provide better result improves speed a thousandfold.
SuperRembo's gif class could be faster because it uses the PHP built in function pack instead of a massive amount of bitwise operators.
Anyone who thinks they can do a better job, read the gif89a specification. Strange, I don't see anything about animated gif in there.
Recent comments
6 min 14 sec ago
7 min 41 sec ago
8 min 48 sec ago
10 min 19 sec ago
10 min 23 sec ago
10 min 39 sec ago
12 min 29 sec ago
12 min 51 sec ago
1 hour 41 min ago
2 hours 33 min ago