a new version of keycounter

There is a Sqlite version, which is better IMHO.

Compare to the old one, there are some bug fixes(I forgot which). and a way to output as a compressed binary file instead of txt file.

Still. I don't keep versions. But SVN always have the newest version.

The txt file data format also changed a little.
It's like the original txt format, but everything is separated by space. and nothing is expressed in hex.

It's open source. you will spend at most 2 minutes to change it so it only output one of the 2.

For the binary file, I have wrote a converter to convert it into txt file. Beware, the binary files can't store anything larger than 4095 strokes. If you did over 4095 stroke of one single key in a hour(I don't see how any normal user would do that). It will be stored as only 4095 strokes.

I have wrote a program that convert the .bin file to the .txt file. Looking the keycounter source and that program's source. you should get an idea of it's structure. The .bin file usually should be around 40% of the .txt file's size.

Check the SVN.

Also, an extra. A php script that read the log file and show you the total for the entire log.

function parse($s){
	$a = explode(" ",$s);
	$o["year"] = $a[0];
	$o["month"] = $a[1];
	$o["date"] = $a[2];
	$o["hour"] = $a[3];
	$c = count($a);
	if(strlen($a[$c-1])<2){
		$c--;
	}
 
	for($i=4;$i<$c;$i+=2){
		$o[$a[$i]] = $a[$i+1];
	}
	return $o;
}
 
$filename = "log.txt";
$handle = @fopen($filename, "r");
$sum;
if ($handle) {
    while (!feof($handle)) {
        $res = parse(stream_get_line($handle ,4096,"\n"));
        for($i=0;$i<255;$i++){
        	$sum[$i]+=$res[$i];
        }
        $sum[255] = bcadd($sum[255],$res[255]);
    }
    fclose($handle);
}
for($i=0;$i<256;$i++){
	if($sum[$i]>0){
		echo $i,",",$sum[$i],"\n";
	}
}
$ss = 0;
for($i=0;$i<255;$i++){
	$ss+=$sum[$i];
}
echo 'Total:',$ss;

I will implement a more sophisticated system later. So one can import log.txt it into SQL database. or even better, send log to the server automatically.

AttachmentSize
newkeycounter.zip21.57 KB

Comments

Post new comment

  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <span> <fn>
  • Lines and paragraphs break automatically.
  • Use [fn]...[/fn] (or <fn>...</fn>) to insert automatically numbered footnotes.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].
  • Mathematical equations and graphs can be added between [tex] and [/tex], [graph] and [/graph] tags.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Honey Pot that kill bots