$value )
if( $value['eid'] == $eid )
return $value;
return null;
}
function RecommendedEntry_updateIndexFile( $eid_updated, $eid, $direction ) {
$filename = '/var/www/VirtualDomain/kenji00.com/cat/recommend_data';
is_dir( $filename ) || mkdir( $filename );
$filename .= '/'. substr( $eid_updated, -1 );
is_dir( $filename ) || mkdir( $filename );
$filename .= sprintf( '/%d.txt', $eid_updated);
file_exists( $filename ) || touch( $filename );
$fp = @fopen( $filename, 'r+' );
if( $fp ) {
if( flock( $fp, LOCK_EX | LOCK_NB )) {
$ret = '';
$not_found = 1;
while( !feof( $fp ) && ( $buf = fgets( $fp ))) {
list( $_eid, $_n0, $_n1 ) = split( "[\t\r\n]", $buf );
if( $eid == $_eid ) {
$not_found = 0; $direction ? $_n1++ : $_n0++;
}
$ret .= sprintf( "%d\t%d\t%d\n", $_eid, $_n0, $_n1 );
}
if( $not_found )
$ret .= sprintf( "%d\t%d\t%d\n", $eid, 1 - $direction, $direction);
rewind( $fp );
fwrite( $fp, $ret, strlen( $ret ));
}
fclose( $fp );
}
}
function RecommendedEntry_incoming() {
$eid_prev = $_COOKIE['mtrcmnd_eid'];
if( isset( $eid_prev )) {
if( $eid_prev != 409 && RecommendedEntry_getEntryData( $eid_prev )) {
RecommendedEntry_updateIndexFile( 409, $eid_prev, 0 /*incoming_from*/ );
RecommendedEntry_updateIndexFile( $eid_prev, 409, 1 /*outgoing_to*/ );
}
} else {
RecommendedEntry_updateIndexFile( 409, 409, 0 /*incoming_from*/ );
}
}
RecommendedEntry_incoming();
function RecommendedEntry_outgoing() {
setcookie( 'mtrcmnd_eid', 409, time() + 2592000, '/' );
}
RecommendedEntry_outgoing();
function RecommendedEntry_initialize( $mode = 0 ) {
global $RecommendedEntry_table;
$RecommendedEntry_table = array();
$filename = '/var/www/VirtualDomain/kenji00.com/cat/recommend_data/'. substr( '409', -1 ). '/409.txt';
$fp = @fopen( $filename, 'r' );
if( $fp ) {
if( flock( $fp, LOCK_SH | LOCK_NB )) {
while( !feof( $fp ) && ( $buf = fgets( $fp ))) {
list( $_eid, $_n0, $_n1 ) = split( "[\t\r\n]", $buf );
if( 409 == $_eid ) continue;
else if( $mode == 1 ) $RecommendedEntry_table{$_eid} = $_n0;
else if( $mode == 2 ) $RecommendedEntry_table{$_eid} = $_n1;
else $RecommendedEntry_table{$_eid} = $_n0 + $_n1;
}
arsort( $RecommendedEntry_table, SORT_NUMERIC );
}
fclose( $fp );
}
}
function RecommendedEntry_GetEntry( $_index ) {
global $RecommendedEntry_table;
foreach( $RecommendedEntry_table as $eid => $count ) {
if( --$_index ) continue;
$entry = RecommendedEntry_getEntryData( $eid );
if( $entry )
$entry['count'] = $count;
return $entry;
}
}
?>
夢のように日は過ぎて・・・ - 養猫日記
うちには猫が2匹います。
いいえ、ミーアの仔猫はまだ来ていません。
今現在の話です。
小さい猫が1匹、それがミーア。
そして、
大きい猫が・・・・・・彼。
平日、私よりも忙しく、帰りが遅い彼。
帰ってきても夜中まで、時には朝まで、仕事をしている。
----夜行性?
週末、放っておくと、
いつまでも、いつまでも、
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
イツマデモ
寝ている。
土曜日、
朝10時、起きてミーアにごはんを作る私。寝ている彼。ご飯を食べるミーア。
お昼12時、洗濯をしている私。寝ている彼。毛繕いしてから寝ているミーア。
午後2時、パソコンをしている私。寝ている彼。私の膝に乗って寝ているミーア。
午後4時、お腹が空いてフラフラの私。寝ている彼。遊び疲れて寝ているミーア。
・・・
午後5時、彼起床。
もはや人間業でも猫業でもない。
熊です。冬眠中の。(^^;;
一緒にご飯(朝食?昼食?夕食?3in1!!)を食べに行って、お買い物して、DVD借りて帰った。
次の日。
歴史は繰り返される・・・
夢のように日は過ぎて、
ではなく、
彼の場合、夢の中で日は過ぎて。
ちなみにタイトルは田辺聖子の恋愛小説からパクッたもの。
コメントする