| 前往頁面 ←上一頁 1 ... 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 ... 561 下一頁→
|
[h1]日本「姓氏」來源衍生種類、常見姓氏分類[/h1]
根據這張圖片,「大略」可分五類,
其中前三類都是和「居住地、地理、地形、位置」相關
各種類也有混合。
1. 居住地附近的「地形、周邊、建築、景觀」衍生姓氏:
山本、山田、田中、吉田、山內、本田、中山、小林、高橋、濱口、
大野、小野、中島、大島、小川、山崎、木村
2.「 實際的地名、景點」衍生姓氏
鈴木、渡邊、佐佐木、小笠原、池田、石川
3. 相對「位置、方位(東西南北、內外、上中下)」衍生姓氏
東、東村、東原、西野、西村、北村、北原、北野、南原、南野、內山、內川、內村
中島、中村、中野、前田、川上、下野
4. 職業相關的地名衍生姓氏
犬飼, 鵜飼, 大藏, 門倉, 矢倉, 土保
5. 「藤原氏(藤原氏系)」衍生相關,配合職業或地理衍生姓氏
加藤(加賀守)、近藤(近江守)、齋藤(齋)、工藤(工)、佐藤(佐)、伊藤(伊勢守)
(2014-07-12 16:13) |
|
[h1]CentOS 7 安裝失敗 "Warning: /dev/root does not exist, could not boot"[/h1]
[h2]How To Fix CentOS could not boot Install failures[/h2]
1. Around buring CentOS 7 DVD, please reassign the Label as "CENTOS7" (No Space within label)
2. Then, around Boot Disk Menu, press "Tab",
Change Label from "CENTOS\x207\x20x86_64" to "CENTOS7"
(ie. remove x20 space)
3. If you dd CentOS 7 Install DVD into USB Boot Disk,
Just using mtools/mlabel to change USB disk Label, like the following commands:
See also: http://vovo2000.com/phpbb2/viewtopic-365717.html (Same issues Fedora 17/18/19/20)
代碼:
$ yum install mtools (or, apt-get install mtools)
$ sudo echo "mtools_skip_check=1" > ~/.mtoolsrc
$ sudo mlabel -i /dev/sdX1 ::CENTOS7 (the '::' prefix is a must!)
代碼:
[OK] Started Dracut Pre-trigger hook.
Starting udev Coldplug all Devices...
Mounting Configuration File System
...
[OK] Reached Target system Initialization.
Starting Show Plymouth Boot Screen...
[OK] Started Show Plymouth Boot Screen.
[OK] Reached Target Paths.
[OK] Reached Target Basic System.
(Halt for 120+ seconds)
dracut-initqueue[682]: Warning: Could not boot
dracut-initqueue[682]: Warning: Could not boot
dracut-initqueue[682]: Warning: /dev/root does not exist
Starting Dracut Emergency Shell...
Generating "/run/initramfs/rdsosreport.txt"
Entering emergency mode. Exit the Shell to Continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.
dracut:/#
(2014-07-10 16:16) |
| |
[h1]Fedora 20 / CentOS 7: How to "text mode" Install[/h1]
1. Press 'Tab' (edit) with "Install CentOS 7" or "Install Fedora 20" selected
2. Remove "quiet" kernel parameter
3. Add "text" kernel parameter
(2014-07-10 12:13) |
|
[h1]Cat related CG Artwork[/h1](2014-07-08 23:32) |
| | | | |
讚阿!
一定很至少有有兩次 C.C.F Special 吧!?(2014-07-02 11:26) |
|
GOAL: Convert old gallery v1 (or even v2) .dat serialized data to SQL data
Gallery v1.0: About 2001 ~ 2002, which used PHP serialized data as DB
Gallery v1.x: About 2002 ~ 2004, which I still used PHP serialized data as Database
These codes are to parse & convert legacy Gallery V1 DB *.dat file into SQL
in order to build them as static HTML pages (or Dynamic Pages Integration, yet in fact static archive).
Of course, only some of fields were retrieved/parse.
Note: Main stream Gallery v2/v3+ has integrated with MySQL, no such issues any more!
Q: What fields were reterieved from Gallery v1/v1.x album.dat?
A:
gallery_type => For my internal usage. (e.g. I got many different Gallery v1/1.x ... repositories)
albumname => Gallery v1 album folder name
imgitem => Album Caption or Album Title
imgtype => I set it as "RDIR" for root album, 'DIR' for sub-album
caption => Detail Description of this album(sub-album)
datetime => Creation date of this album
comment => Only useful for 'ROOT Album", contains all sub-album in CSV format. Empty if this is a sub-album
Q: What fields were reterieved from Gallery v1/v1.x photos.dat?
A:
gallery_type => For my internal usage. (e.g. I got many seperated/different Gallery v1/1.x ... repositories)
albumname => Gallery v1 album folder name
imgitem => Image Name
imgtype => Image Type (jpg/png/gif/...)
caption => Detail Description of this IMAGE (Image title)
datetime => Creation date of this album (== uploadDate)
comment => The comment of this Image, only include "username/datetime/comment", use some big5-utf8 translate.
Q: It looks like that you combined "photos.dat & album.dat" into single Database Table?
A: Yes, because my requirement is very simple,
make gallery v1 photo repositories into static pages.
(though the "static pages" are in fact dynamic generated from PHP + DB)
Q: Didn't see your code parsing sub-album(DIR) CSV into root album comment field?
A: To make the conversion faster, and, my root album are not that many,
so I did that __manually__.
Q: Why not using Gallery Project's Import Tool? Do you ever use official tools to import v1.0 into v2.x
A: True, I ever tried it years ago around 2007 ~ 2011;
yet, futile; the Gallery v1.x album.dat & photos.dat looked too legacy to be imported.
Q: I got lots of SPAM messages in my Gallery v1 photos.dat, what I can do?
A: I have the same issue,
but since you cloud make them into database,
SPAM-comment removal will be much easier by using something like
代碼:
SELECT * from gallery_database_table where comment
like '%some bad words%' or comment like '%another bad words%'
compared digging into thousands of photos.dat
Convert USAGE Example:
代碼:
$ find /var/www/gallery-v1/ -name "album.dat" | xargs parse_album_dat_to_database_sql.php
[h1]parse_album_dat_to_database_sql.php[/h1]
代碼:
<?PHP
/*
Goal: Convert Gallery v1 album.dat format into DataBase SQL
*/
/* data */
$title = array();
$desc = array();
$dtime = array();
function is_line_still_value($line_str)
{
if (strstr($line_str, "' => "))
return false;
else
return true;
}
function get_val($str, $is_str = true, $multiple_lines = false)
{
if ($multiple_lines == false)
list($a, $b) = explode("' => ", str_replace("\r", "", $str));
else
$b = str_replace("\r", "", $str);
if ($is_str)
{
/* 字串要去掉頭尾 quote */
if (substr($b, 0, 1) == "'" && $multiple_lines == false)
{
$b = substr($b, 1, strlen($b) - 1);
}
$b = str_replace("',\n", '', $b);
}
else
{
$b = intval(str_replace(',', '', $b));
}
return $b;
}
function get_photosdat_pass_1($str, $idx)
{
global $title, $desc;
$done_1 = 0;
$done_2 = 0;
foreach(preg_split("/((\r?\n)|(\r\n?))/", $str) as $line)
{
$line .= "\n";
if ($done_1 == 0 && strstr($line, "'title' => "))
{
$title[$idx] = get_val($line);
$done_1++;
}
if ($done_2 == 0 && strstr($line, "'description' => "))
{
$desc[$idx] = get_val($line);
$done_2++;
}
if ($done_2 == 0 && strstr($line, "'description' => "))
{
$desc[$idx] = get_val($line);
$done_2++;
}
if ($done_1 && $done_2)
break;
}
/*
* Optional
*/
$title[$idx] = mb_convert_encoding($title[$idx], 'UTF-8', 'BIG-5');
$desc[$idx] = mb_convert_encoding($desc[$idx], 'UTF-8', 'BIG-5');
if (trim($desc[$idx]) == 'No description')
{
$desc[$idx] = '';
}
}
/*
* BEGIN
*/
if (isset($argv[1]) && file_exists($argv[1]))
{
echo "CHECK albums.dat Integrity and Parse it, file count=".count($argv)." ...\n";
for ($i=1; $i<(count($argv)); $i++)
{
$str = file_get_contents($argv[$i]);
$var = unserialize($str);
// echo "[$i] Checking ".$argv[$i]."\n";
if ($var === false || strlen($str) <= 3) {
echo "_____ERROR_____ @ ". $argv[$i] . "\n";
echo "ABORT: Please Fix this first! You could restore it from backup album.dat.[1~N]\n";
exit;
}
//echo "[$i] Parsing ".$argv[$i]."\n";
$str = var_export($var, true);
get_photosdat_pass_1($str, $i);
// echo $argv[$i].' => '.$title[$i].'_'.$desc[$i]."__EOF\n";
list($a, $folder, $c) = explode('/', $argv[$i]);
echo "Insert into gallery_database_table (gallery_type, albumname, imgitem, imgtype, caption, datetime, comment)
values(0, '".$folder."', '".$title[$i]."', 'DIR', '".$desc[$i]."', 0, '');\n";
// "Insert into gallery_database_table (gallery_type, albumname, imgtype, imgitem, caption)
// values(1, '$argv[$i]', '$title[$i]', 'DIR', '0', '$desc[$i]')"
}
}
else
{
echo 'find /gallery-folder/ -name "album.dat" | xargs php parse_album_dat.php';
}
exit;
[h1]parse_photos_dat_to_database_sql.php[/h1]
代碼:
<?PHP
/*
Goal: Convert Gallery v1 photos.dat format into DataBase SQL
*/
/*
找法:
1. 先 parse var export 一行一行找,找到關鍵字
2. 如果下一行,沒有 '=>' '[' ']' 那麼下一行還是資料
資料欄位
auto-idx, folder, imgname, imgtype, caption, date, comment(serialized)
*/
/* data */
$imgname = array();
$imgtype = array();
$caption = array();
$dateint = array(); /* int */
$comment = array(); /* three diementional array */
function is_line_still_value($line_str)
{
if (strstr($line_str, "' => "))
return false;
else
return true;
}
function get_val($str, $is_str = true, $multiple_lines = false)
{
// 'name' => 'waidai_05',
// 'type' => 'jpg',
//
// 'uploadDate' => 123124312,
if ($multiple_lines == false)
list($a, $b) = explode("' => ", str_replace("\r", "", $str));
else
$b = str_replace("\r", "", $str);
if ($is_str)
{
/* 字串要去掉頭尾 quote */
if (substr($b, 0, 1) == "'" && $multiple_lines == false)
{
$b = substr($b, 1, strlen($b) - 1);
}
$b = str_replace("',\n", '', $b);
}
else
{
$b = intval(str_replace(',', '', $b));
}
return $b;
}
/*
Pass #1 從零開始找
*/
function get_photosdat_pass_1($str, $idx)
{
global $imgname, $imgtype, $caption, $dateint;
$done_1 = 0;
$done_2 = 0;
$done_3 = 0;
$done_4 = 0;
foreach(preg_split("/((\r?\n)|(\r\n?))/", $str) as $line)
{
$line .= "\n";
if ($done_1 == 0 && strstr($line, "'name' => "))
{
$imgname[$idx] = get_val($line);
$done_1++;
}
if ($done_2 == 0 && strstr($line, "'type' => "))
{
$imgtype[$idx] = get_val($line);
$done_2++;
}
if (($done_3 < 31 && $done_3 > 0) || strstr($line, "'caption' => "))
{
if ($done_3 == 0)
$caption[$idx] = get_val($line);
else
{
if (is_line_still_value($line) == true)
$caption[$idx] .= get_val($line, true, true);
else
$done_3 = 31;
}
$done_3++;
}
if ($done_4 == 0 && strstr($line, "'uploadDate' => "))
{
$dateint[$idx] = get_val($line, false);
$done_4++;
}
if ($done_1 && $done_2 && $done_3 >= 31 && $done_4)
break;
}
/*
* Optional
*/
$imgname[$idx] = mb_convert_encoding($imgname[$idx], 'UTF-8', 'BIG-5');
$caption[$idx] = mb_convert_encoding($caption[$idx], 'UTF-8', 'BIG-5');
}
/*
Pass #2 從 ["comments"]=> 往後找下列三個
["commentText"]=>
["datePosted"]=>
["name"]=>
*/
function get_photosdat_pass_2($str, $idx)
{
global $comment;
$done_1 = 0;
$done_2 = 0;
$done_3 = 0;
$done_4 = 0;
$comment_count = 0;
$comment[$idx] = array();
$comment[$idx][$comment_count] = array(3);
list($tmp, $str) = explode("'comments' => ", $str);
foreach(preg_split("/((\r?\n)|(\r\n?))/", $str) as $line)
{
$line .= "\n";
if ($done_1 == 0 && strstr($line, "'name' => "))
{
$comment[$idx][$comment_count][0] = get_val($line);
$done_1++;
}
if ($done_2 == 0 && strstr($line, "'datePosted' => "))
{
$comment[$idx][$comment_count][1] = get_val($line, false);
$done_2++;
}
if (($done_3 < 31 && $done_3 > 0) || strstr($line, "'commentText' => "))
{
if ($done_3 == 0)
$comment[$idx][$comment_count][2] = get_val($line);
else
{
if (is_line_still_value($line) == true)
$comment[$idx][$comment_count][2] .= get_val($line, true, true);
else
$done_3 = 31;
}
$done_3++;
}
if ($done_3 >= 31 && $done_1 && $done_2)
{
$done_1 = 0;
$done_2 = 0;
$done_3 = 0;
/*
* Clean Gallery's SPAM comments
*/
if ( (stristr($comment[$idx][$comment_count][2], "url="))
|| (stristr($comment[$idx][$comment_count][2], "url:"))
|| (substr_count($comment[$idx][$comment_count][2], 'http') >= 2)
|| (strlen(trim($comment[$idx][$comment_count][2])) <= 2)
|| ($comment[$idx][$comment_count][2] == $comment[$idx][$comment_count][0])
|| (mb_detect_encoding($comment[$idx][$comment_count][0]) == 'ASCII'
&& mb_detect_encoding($comment[$idx][$comment_count][2]) == 'ASCII')
)
{
$comment[$idx][$comment_count] = null;
continue;
}
/*
* Optional: convert BIG-5 --> UTF-8
*/
$comment[$idx][$comment_count][0] = mb_convert_encoding($comment[$idx][$comment_count][0], 'UTF-8', 'BIG-5');
$comment[$idx][$comment_count][2] = mb_convert_encoding($comment[$idx][$comment_count][2], 'UTF-8', 'BIG-5');
$comment_count++;
$comment[$idx][$comment_count] = array(3);
}
}
}
/*
* BEGIN
*/
if (isset($argv[1]) && file_exists($argv[1]))
{
echo "CHECK Photos.dat Integrity and Parse it, file count=".count($argv)." ...\n";
for ($i=1; $i<(count($argv)); $i++)
{
$str = file_get_contents($argv[$i]);
$var = unserialize($str);
// echo "[$i] Checking ".$argv[$i]."\n";
if ($var === false || strlen($str) <= 3) {
echo "_____ERROR_____ @ ". $argv[$i] . "\n";
echo "ABORT: Please Fix this first! You could restore it from backup photos.dat.[1~N]\n";
exit;
}
// echo "[$i] Parsing ".$argv[$i]."\n";
for ($j=0; $j<count($var); $j++)
{
$str = var_export($var[$j], true);
get_photosdat_pass_1($str, $j);
get_photosdat_pass_2($str, $j);
/*
var_dump($imgname[$j]);
var_dump($imgtype[$j]);
var_dump($caption[$j]);
var_dump($dateint[$j]);
var_dump($comment[$j]);
*/
$comment[$j] = serialize($comment[$j]);
list($a, $folder, $c) = explode('/', $argv[$i]);
echo "Insert into gallery_database_table (gallery_type, albumname, imgitem, imgtype, caption, datetime, comment)
values(0, '".$folder."', '".$imgname[$j]."', '".$imgtype[$j]."', '".$caption[$j]."', ".$dateint[$j].",
'".$comment[$j]."');\n";
}
}
}
else
{
echo 'find /gallery-folder/ -name "photos.dat" | xargs php parse_photos_dat.php';
}
exit;
(2014-06-30 00:25) |
|
[h1]PHP + ImageMagick Codes: PNG2JPG, JPG Quality, Shrink JPG Quality[/h1]
PHP Read All files in this directory and the proceed the following Image processing
1. convert_PNG_to_JPG($source): Convert PNG image files to JPG image files within this directory
2. convert_jpg_to_quality_90($source): Convert JPG quality to 90 within same folder
3. shrink_to_goolge_800($source): Shrink all images files in this folder to max 800 width or 800 height
代碼:
<?PHP
function convert_PNG_to_JPG($source)
{
// $source = "1.jpg";
$convert = "D:\ImageMagick-6.6.3-Q16\convert.exe"; // define in constant.php
/* 一律 90 品質 */
if (filesize($source) > 524288)
{
$dest = str_replace('.png', '.jpg', $source);
echo "Q90 $dest \n";
exec($convert.' '.$source.' -strip -quality 90 '.$dest);
}
else
{
echo ".";
}
}
function convert_jpg_to_quality_90($source)
{
// $source = "1.jpg";
$convert = "D:\ImageMagick-6.6.3-Q16\convert.exe"; // define in constant.php
/* 一律 90 品質 */
if (filesize($source) > 524288)
{
echo "Q90 $source \n";
exec($convert.' '.$source.' -strip -quality 90 '.$source);
}
else
{
echo ".";
}
}
function shrink_to_goolge_800($source)
{
// $source = "1.jpg";
$mid = 800;
$convert = "D:\ImageMagick-6.6.3-Q16\convert.exe"; // define in constant.php
$size = getimagesize($source);
if ($size[0] > 800 || $size[1] > 800)
{
echo $source."\n";
usleep(10);
if ($size[0] > $size[1])
{
$toWWW = ( $size[0] >= $mid ? $mid : $size[0] );
//echo $convert.' '.$source.' -strip -resize '.$toWWW.'x '.$source;
exec($convert.' '.$source.' -resize '.$toWWW.'x '.$source);
}
else
{
$toHHH = ( $size[1] >= $mid ? $mid : $size[1] );
// echo $convert.' '.$source.' -strip -resize x'.$toHHH.' '.$source;
exec($convert.' '.$source.' -resize x'.$toHHH.' '.$source);
}
}
else
{
echo "-";
}
}
function prepare_readidr($pid)
{
/* 準備清單 */
$file_list = array();
if ($handle = opendir("."))
{
while (false !== ($filedir = readdir($handle)))
{
/* 確定目錄 */
if (is_dir($filedir))
{
/* 再從目錄讀出檔案 */
if ($handle2 = opendir($filedir))
while (false !== ($files = readdir($handle2)))
{
/* 不能是目錄 */
if (!is_dir($files))
{
$z = $filedir.'\\'.$files;
//if (filemtime($z) > (time() - 100))
// echo '.';
//else
shrink_to_goolge_800($z);
// convert_jpg_to_quality_90($z)
// convert_PNG_to_JPG($z)
}
}
}
}
}
}
/* main */
prepare_readidr();
?>
(2014-06-29 16:15) |
|
[h1]Fedora 17: Fedorax2017x20x86_64 does not exist - Install Failed[/h1]
[h2]症狀 Symptoms[/h2]
代碼:
ERROR: could not insert 'floppy': No such device
Loading Fedora 17 x86_64 installer...
dracut Warning: Unable to process initqueue
dracut Warning: /dev/disk/by-label/Fedorax2017x20x86_64 does not exist
dracut Warning: /dev/mapper/live-rw does not exist
Dropping to debug shell.
dracut:/#
[h2]解決方式[/h2]
1. 燒錄 FC17 DVD 時,請將 DVD Label 設定為 "FC17" ,也就是「不要有空格!」 "Label No Space (x20)"
(這有可能是 BIOS bug 的問題,也有可能是 Fedora Dracut 本身的 bug )
2. 然後在 Boot Disk Menu 畫面按下 "Tab",把 LABEL 從 "Fedora\x2017\x20x86_64" 改成 "FC17"
*NOTE*: 如果你用 USB 當成 ISO-DVD Boot Disk,那更簡單,使用 mtools/mlabel 改 USB Label,參考下面
代碼:
$ yum install mtools (or, apt-get install mtools)
$ sudo echo "mtools_skip_check=1" > ~/.mtoolsrc
$ sudo mlabel -i /dev/sdX1 ::FC17 (the '::' prefix is a must!)
(2014-06-29 16:02) |
|
[h1]嗶...戰鬥力只有5?雜碎 |
|
[h1]X Window System 歡慶 30 週年 (June 2014)[/h1]
廣泛使用於 Linux, *BSD, SunOS, Iris, Solaris, Unix, 甚至是 Microsoft Windows 的「視窗主從架構系統」 "X"
或稱為 X-Windows, X Window System
在這個月 19 日 (2014/06/19) 正式歡慶 30 週年。
30 年前的這個時候 (1984/06/19),MIT 的 Bob Scheifler 宣布了 X Window System 的誕生。
X 視窗系統可說是最早期 Open Software / Free Software 的先驅者,
甚至比 Linux / BSD / Solaris / GPL / FSF / Apache / POSIX / C89 / C99 這些系統、標準、組織等,都來得早!
至今,經過三十年的演化,基於 X 視窗系統衍生出了 GNOME, KDE, XFCE, Unity, Enlightment 這麼多種的桌面環境,
廣泛的服務著數百萬以上的 Desktop GUI 桌面環境使用者。
(然而,這麼多 Desktop env 不知是好是壞...)
目前最新的 X Window System 版本為: X11 Release 7.7, 下個版本是 R7.8, 使用的是 MIT License
目前是由 X.org 基金會維護:
Xorg官網 => http://x.org/
Google+ => https://plus.google.com/102057777074369211973
(2014-06-23 15:56) |
|
Dear Kelly
麻煩請補一下薪資範圍!
Thank you
(2014-06-22 20:34) |
|
[h1]UI Template for the above Perl Codes[/h1]
代碼:
<h2>新增美術&插畫作品,歡迎參觀~</h2>
<h2>新增美術&插畫作品,一定要看看~</h2>
<h2>新增美術&插畫作品,讚的唷,要看喔!</h2>
<h2>新增美術&插畫作品,不看可惜!</h2>
<h2>新增美術&插畫作品,點選進入觀賞~</h2>
代碼:
<html>
<head>
<title>過去的事::美術、插畫、美術數位內容/News Archives/Fine Art Illustration/Fine Art Content</title>
<meta http-equiv="content-type" content="text/html; charset=big5">
<meta name="keywords" content="News Archives,Fine Art Content,Fine Art Illustration,插畫,小說插畫">
<meta name="description" content="Vovo2000.Com: 包含竹吟個人之插畫、漫畫、同人誌;駐站畫家之美術、藝術作品;另有線上繪圖版 PaintBBS, 繪圖聊天室 PaintChat, 討論區 PHPBB, 投稿區">
<meta name="ROBOTS" CONTENT="ALL">
<base target="_self">
<link rel="stylesheet" href="/style.css" type="text/css">
<STYLE TYPE='text/css'>
<!-- TextRollover-1 -->
a:link { color:#000000; text-decoration:none}
a:visited { color:#000000; text-decoration:none}
a:hover { color:#000000; text-decoration:none; background:#33CCFF}
a:active { color:#000000; text-decoration:none}
</STYLE>
</head>
<body background="/image/backround-1.gif" text="#000000" link="#000000" vlink="#000000" alink="#000000">
<table border="0" cellspacing="2" cellpadding="1">
<tr>
<td nowrap>
<H3>[ <a href="news.php" target="_self">Latest News Archive 最新動向過去的事</a> ] </H3>
<H2>News-2004</H2>
{V2K_NEWS_THISYEAR_DAYBYDAY}
<hr>
<H2><a href="/news/2003.htm">Vovo2000.Com News Archive :: News-2003</a></H2>
<H2><a href="/news/2002.htm">Vovo2000.Com News Archive :: News-2002</a></H2>
<H2><a href="/news/2001.htm">Vovo2000.Com News Archive :: News-2001</a></H2>
</td>
</tr>
</table>
<div>
<div align="center"><font color="333333">©All Rights Reserved by
<a href="http://vovo2000.Com/" target="_blank" class="nounderline">Vovo2000.Com</a>
| <a href="http://vovo2000.com/friend/about.php" target="_self" class="nounderline">About
Vovo2000</a>
| Last Update {UPDATE_TIME}</font> </div>
</div>
</body>
</html>
代碼:
<td>
<div align=center>
<a href='http://artist.vovo2000.com/{AUTH}#new'
title="Artist:{AUTH} {RNAME}, 插畫,美術插畫,美術數位內容, Image of Fine Art Artwork/Illustration/Content"
target='_self' onclick="window.open( 'http://artist.vovo2000.com/{AUTH}#new', '_self' )">
<table width=85 height=100 border=1 background="{NEWS-IMG-SRC}" class="everydaynews">
<tr><td> </td></tr>
</table>
</a>
<font size=-1>駐站畫家「<a href='http://artist.vovo2000.com/{AUTH}#new' target='_self'>{RNAME}</a>」
</font>
</div>
</td>
代碼:
<h2><a href="http://vovo2000.com/gallery/{A_GALLERY}/{A_PIC}"
target="_blank">
<img src="/gallery/albums/{A_GALLERY}/{A_PIC_THUMB}" border="1" width="100">
</a>
...<strong>#{NUM}</strong> by <a href="http://vovo2000.com/friend/{A_INDEX}" target="_rankit"><font color=black size=+1>{A_REALNAME}</font></a>
<font size="-1"> [
點閱 {A_CLICKS} 次 /
<a href="http://artist.vovo2000.com/{A_GALLERY}" target="_rankit">Gallery</a>
/
<a href="http://vovo2000.com/phpbb2/forum-{A_FORUM}.html" target="_rankit">Forum</a>
/
<a href="http://vovo2000.com/friend/{A_INDEX}" target="_rankit">Profile</a>
]</font> {HOT_IMG}</h2>
代碼:
<div align="center">
<table width="80%" border="0" cellpadding="8">
<tr>
<td>
<div align="right">
<p><font size="+2" face="Verdana, Arial, Helvetica, sans-serif"> [Artwork
Hits Rank] 作品點閱統計</font><br>
<font size=-1>(投稿園地排除)</font>
<br>
<strong>畫廊取樣作品:取 <font color=red>{HOWMUCH}</font> / 共 <font color=red>{TOTAL_PICS}</font> 張</strong><br>
最後更新時間:
<!-- #BeginDate format:Am1 --> {UPDATE_TIME} <!-- #EndDate -->
<br />
本名次排行依據畫廊點閱次數逐日自動統計,工作坊並不以此數據做為任何其他用途<br />
<font size="-1">This rank stat is just A-Gallery-FYR. Vovo2000.Com does not and will not use it for alternative usage.</font>
</p>
</div>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="but1"> <br>
{RANK_LIST}
</td>
</tr>
</table>
</div>
代碼:
<div align='left'>
{NEWS-DATE-TIME}
{WELCOME}
<table width='100%' border='0'>
{NEWS-IMG-ONLY}
</table>
<hr>
<div align="center"><font size="-1" face="Courier New, Courier, mono">
<a href="http://vovo2000.com/" style="color:#0000ff" target="_blank">(C)Vovo2000.Com</a></font>
</div>
</div>
代碼:
<tr><td>
<table width="100%">
<tr>
<td>
<a href="http://artist.vovo2000.com/{AUTH}" title="{AUTH}'s Art Gallery">
<img width="80" src="/gallery/albums/{AUTH}{HIGHLIGHT}">
</a>
</td>
<td>
<font size=-1>
<strong><a href="/gallery/{AUTH}">Artist: {RNAME}</a></strong><br>
<b></b>
<a href="http://artist.vovo2000.com/{AUTH}" alt="{AUTH}'s Art Gallery">個人畫廊</a><br />
<b></b>
<a href="/phpbb2/forum-{FNUM}.html" alt="{AUTH}'s Forum">個人論壇</a><br />
<b></b>
<a href="/friend/{FIDX}" alt="Intro to {AUTH}">畫家介紹</a><br />
</font>
</td>
</tr>
</table>
</td></tr>
</td></tr>
代碼:
<li><h2><font color="blue" size="+0" face="Verdana, Arial, Helvetica, sans-serif">
<a href="http://vovo2000.com/friend/{A_INDEX}" target="_blank" alt="Artist {A_REALNAME}">
<strong>{A_REALNAME}</strong></font> <font size=-2>(#{NUM}-畫家,插畫家,美術工作者)</font></a>
<br>
<font size="-2" face="Verdana, Arial, Helvetica, sans-serif"> [
美術、漫畫、插畫作品 {A_PCOUNT} 張 /
平均 {A_CLICKS} Hits /
總點閱 {T_CLICKS} Hits /
<font color=blue>
<a href="http://artist.vovo2000.com/{A_GALLERY}#new" target="_self" alt="個人畫廊 Personel Gallery">Gallery</a>
</font> /
<font color=blue>
<a href="http://vovo2000.com/phpbb2/forum-{A_FORUM}.html" target="_self" alt="個人討論區 Personel Forum">Forum</a>
</font> /
<font color=blue>
<a href="http://vovo2000.com/friend/{A_INDEX}" target="_self" alt="個人資訊 Personel Profile">Profile</a>
</font> ]</font> {HOT_IMG}</h2>
</li>
代碼:
<div align="center">
<table width="80%" border="0" cellpadding="8">
<tr>
<td>
<div align="right">
<p><font size="+2" face="Verdana, Arial, Helvetica, sans-serif"> [Artist
Hits Rank] 駐站畫家點閱統計</font><font size=-2>(投稿園地、社團排除)</font><br>
駐站畫家總數:共 {TOTAL_ROOMER} 位<br>
最後更新時間:
<!-- #BeginDate format:Am1 --> {UPDATE_TIME} <!-- #EndDate -->
<br />
本名次排行依據畫廊點閱次數逐日自動統計,工作坊並不以此數據做為任何其他用途<br />
<font size="-1">This rank stat is just A-Gallery-FYR. Vovo2000.Com does not and will not use it for alternative usage.</font>
</p>
</div>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="but1"> <br>
{RANK_LIST}
</td>
</tr>
</table>
</div>
(2014-06-22 18:26) |
|
[h1]stat_Gallery_Top10.pl[/h1]
應該是取出 Top10 Gallery Hits
代碼:
#!C:/perl/bin/perl.exe
$directory = "D:/Apache2/htdocs/gallery/albums/";
$directory2 = "D:\\Apache2\\htdocs\\gallery\\albums\\";
$file_tmp = "D:/VovoUtil/tmp.file";
$file_artistHit = "D:/Apache2/Htdocs/friend/rank_artistHit{NUM}.htm";
$file_artistHit2 = "D:/Apache2/Htdocs/friend/rank_artistHit.txt";
$file_template1 = "template-artisthitrank.tpl";
$file_template2 = "template-artisthitrank-detail.tpl";
$file_roomer_list = "D:/Apache2/Htdocs/friend/roomer_list.txt";
@not_in_list = ( "18", "ClubTWCP", "friend", "distrib", "vovo2000" );
$per_page = 25; # 分頁
system( "dir $directory2 > $file_tmp" );
$i = 0;
$j = 0;
$hot_gap = 5;
$hot_imgrsc = "<img src=\"/image/hot.gif\"></img>";
$null_imgrsc = "<img src=\"/image/null.gif\"></img>";
#####################################
# 娶作家
#####################################
if ( open( FILE, "<$file_tmp" ) )
{
@a = <FILE>;
foreach( @a )
{
if ( index( $_, "<DIR>" ) > 0 )
{
($c1,$c2) = split( "<DIR>", $_ );
$c2 =~ s/^ //g;
$c2 =~ s/$\///g;
#if ( !($c2 in @not_in_list) )
#{
$addit = 1;
for ( $j=0; $j<scalar(@not_in_list); $j++)
{
if ( lc($not_in_list[$j]) eq lc($c2) )
{
$addit=0;
}
}
if ( $addit == 1 )
{
$subdirs[$i++] = $c2;
print "o";
}
print ".";
}
else
{
}
}
close( FILE );
}
$dfile = "photos.dat";
$dlimt = "clicks\";i:";
$plimt = "cached_photo_count\";i:";
$fileBuf = "";
$strbuf = "";
$strtmp = "";
@fdata = ();
%auth_kname;
%auth_rname;
%auth_pcount;
%auth_clicks;
####################################
# 名字到 %auth_rname,
# Forum 到 %auth_fnum,
# index 到 %auth_index
####################################
if ( open( FILE, "<$file_roomer_list" ) )
{
my @a=<FILE>;
$total_roomer = $.;
foreach( @a )
{
( $rname, $fnum, $com1 ) = split( ",", $_ );
( $kname, $com2 ) = split( "\/", $com1 );
$kname = lc($kname);
$auth_rname{$kname} = $rname;
$auth_fnum{$kname} = $fnum;
$auth_index{$kname} = $com1;
}
close( FILE );
}
#####################################
# 讀取 ClickCount / PCOUNT / # "clicks";i:XXXX;
#####################################
foreach( @subdirs )
{
$df = $_;
$fileBuf = $directory.$df."/".$dfile;
$df = lc($df);
if ( -e $fileBuf )
{
print $fileBuf.$/;
if ( open( FILE, $fileBuf ) )
{
$cntBuf = 0;
$artBuf = 0;
if ( open( FILE, $fileBuf ) )
{
$strbuf = join( "", <FILE> );
$strbuf =~ s/;/\n/g;
@a = split( "\n", $strbuf );
foreach( @a )
{
$zBuf = 0;
if ( index( $_, "i\:" ) != -1 && index( $last, "clicks" ) != -1 )
{
($zBuf,$zBuf) = split( ":", $_ );
$cntBuf += $zBuf;
++$artBuf;
}
$last = $_;
}
#print $cntBuf.$/;
#print $artBuf.$/;
}
$auth_pcount{$df} = $artBuf;
$auth_tclicks{$df} = $cntBuf;
$auth_clicks{$df} = sprintf( "%.2f", ($cntBuf/$artBuf));
close( FILE );
}
}
}
########################################## 把 template 讀進來,然後至換
$strbuf = "";
$strAll = "";
if ( open( FILE, "<$file_template1" ) )
{
$strTpl1 = join( "", <FILE> );
close( FILE );
}
if ( open( FILE, "<$file_template2" ) )
{
$strTpl2 = join( "", <FILE> );
close( FILE );
}
#print $strTpl2;
$j = 1;
$k = 0;
$l = 1;
$strAltAll="";
foreach $key (sort {$auth_clicks{$b} <=> $auth_clicks{$a}} keys %auth_clicks)
{
$strbuf = $strTpl2;
$strbuf =~ s/{A_REALNAME}/$auth_rname{$key}/g;
$strbuf =~ s/{A_PCOUNT}/$auth_pcount{$key}/g;
$strbuf =~ s/{A_CLICKS}/$auth_clicks{$key}/g;
$strbuf =~ s/{A_GALLERY}/$key/g;
$strbuf =~ s/{A_FORUM}/$auth_fnum{$key}/g;
$strbuf =~ s/{A_INDEX}/$auth_index{$key}/g;
$strbuf =~ s/{NUM}/$j/g;
$strbuf =~ s/{T_CLICKS}/$auth_tclicks{$key}/g;
$strAltAll .= $key.",".$auth_clicks{$key}.$/;
if ( $j <= $hot_gap )
{
$strbuf =~ s/{HOT_IMG}/$hot_imgrsc/g;
}
else
{
$strbuf =~ s/{HOT_IMG}//g;
}
$j++;
$l++;
$strAll .= $strbuf;
if ( $l > $per_page )
{
print " 換頁...$k ".$/;
$strAll[$k] = $strAll;
$l = 1;
$k++;
$strAll = "";
}
}
$strAll[$k] = $strAll;
print "========> ".$j.$/;
########################################## 寫進去
#if ( open( FILE, ">$file_artistHit" ) )
#{#
# print FILE ($strTpl1);
# close( FILE );
#}
print "========> ".scalar(@strAll).$/;
$strbuf = "";
$strtmp = "";
$i = 1;
foreach (@strAll)
{
$strbuf = $strTpl1;
$loct = localtime();
$strbuf =~ s/{RANK_LIST}/$_/;
$strbuf =~ s/{TOTAL_ROOMER}/$total_roomer/;
$strbuf =~ s/{UPDATE_TIME}/$loct/;
########################################## 寫進去
$strtmp = $file_artistHit;
$strtmp =~ s/{NUM}/$i/g;
$i++;
print "產生: $strtmp".$/;
if ( open( FILE, ">$strtmp" ) )
{
print FILE ($strbuf);
close( FILE );
}
}
#########################################
if ( open( FILE, ">$file_artistHit2" ) )
{
print FILE ($strAltAll);
close( FILE );
}
exit;
(2014-06-22 18:24) |
|
[h1]Perl Code: Perl Web Utilities decades ago (3) [/h1]
看不太懂這段的目的了...應該是當時駐站畫家的處理;
總之一樣和土法煉鋼 Image Gallery 有關。
代碼:
#!C:/Perl/bin/Perl.exe
use File::Find;
use Time:😜iece;
use LWP::Simple;
use POSIX qw(strftime);
$timeOneDay = 86400;
$dayMultipler = 1;
$ByteCount = 0;
$fileAll = 0;
$fileJpg = 0;
$fileYes = 0;
####### 總共查三個目錄 ToTra / ToHa (CG) / ToSFX (SFX)
$pathToTra = "D:/Apache2/htdocs/gallery/albums/";
$pathToHa = "D:/Apache2/htdocs/vovo-gallery/data/VovoCG/";
$pathToSFX = "D:/Apache2/htdocs/vovo-gallery/data/sfx/";
$thumbExt = ".thumb.jpg";
$contrib = "distrib";
$roomerlist = "D:/Apache2/htdocs/friend/roomer_list.txt";
$targetPath = "D:/Apache2/htdocs/news/2005/";
$targetExt = ".htm";
$template = "D:/vovoutil/template-gala.tpl";
$template_img = "D:/vovoutil/template-img.tpl";
$template_welcome = "D:/vovoutil/news_wordlist_welcome.tpl";
@auth=();
@fnam=();
@roomer_list=();
if ( open(FILE, $template_img) )
{
$strImg = join( "", <FILE>);
close( FILE );
}
if ( open(FILE, $roomerlist) )
{
@roomer_list = <FILE>;
close( FILE );
}
$roomer_count = scalar(@roomer_list);
$gt = localtime;
$t1 = $gt->epoch;
@ppp = ( $pathToHa, $pathToTra, $pathToSFX );
find(\&fileThumb, @ppp );
$gt = localtime;
$t2 = $gt->epoch;
print "Total KByte: ".($ByteCount/1024)."\n";
print "Total Scan: ".$fileAll."\n";
print "Total Jpeg: ".$fileJpg."\n";
print "Total Match: ".$fileYes."\n";
print "Total TimeCost: ".($t2-$t1)."\n";
## 產生 YYYYMMDD.htm
$strAll = "";
$bbCount = 0;
$lastAuth = "";
$piccount = 0;
for ( $i = 0; $i < scalar(@auth); $i++ )
{
print $auth[$i].$/;
if ( $bbCount == 0 )
{
$strAll .= "<tr>\n";
}
$strBuf = $strImg;
if ( $auth[$i] ne "VovoCG" && $auth[$i] ne "VovoSFX" )
{
$g_imag = "/gallery/albums/$auth[$i]/$fnam[$i]"."$thumbExt";
$g_view = "/gallery/view_photo.php?set_albumName=$auth[$i]&id=$fnam[$i]";
$strBuf =~ s/{NEWS-IMG-SRC}/$g_imag/g;
$strBuf =~ s/{NEWS-HREF}/$g_view/g;
$authBuf = findRealAuth($auth[$i]);
print $authBuf;
if ( $auth[$i] eq $contrib )
{
$strBuf =~ s/{AUTH}/$auth[$i]/g;
$strBuf =~ s/駐站畫家//g;
$strBuf =~ s/{RNAME}/投稿園地/g;
$strAll .= $strBuf;
$switch = 1;
}
else
{
$strBuf =~ s/{AUTH}/$auth[$i]/g;
$strBuf =~ s/{RNAME}/$authBuf/g;
if ( $lastAuth eq $auth[$i] )
{
$switch = 0;
$piccount++;
}
else
{
$strAll .= $strBuf;
$switch = 1;
$piccount=0;
}
}
}
else
{
if ( $auth[$i] eq "VovoCG" )
{
$gala_ha = "http://vovo2000.com/vovo-gallery/data/VovoCG";
$gala_ha2 = "http://vovo2000.com/vovo-gallery/VovoCG";
}
elsif ( $auth[$i] eq "VovoSFX" )
{
$gala_ha = "http://vovo2000.com/vovo-gallery/data/sfx";
$gala_ha2 = "http://vovo2000.com/vovo-gallery/sfx";
}
$g_imag = $gala_ha."/".$ha_p;
$g_view = $gala_ha2;
$strBuf =~ s/{NEWS-IMG-SRC}/$g_imag/g;
$strBuf =~ s/http:\/\/artist.vovo2000.com\/{AUTH}/$g_view/g;
$strBuf =~ s/駐站畫家//g;
$strBuf =~ s/{RNAME}/小哈美術插畫/g;
$strAll .= $strBuf;
$switch = 1;
print "=======".$fname[$i]."=========".$/;
}
$lastAuth = $auth[$i];
if ( $switch == 1 )
{
$bbCount++;
if ( $bbCount >= 4 )
{
$strAll .= "</tr>\n";
$bbCount = 0;
}
}
}
if ( $i >= 1 && ($bbCount != 0 && $bbCount !=4 ) )
{
$strAll .= "</tr>";
}
if ( $strAll ne "" )
{
$strAll .= "<\!-- ".scalar(localtime)." AutoCreated end-(thwu) \/\/-->";
if ( open(FILE, $template) )
{
$strTpl = join( "", <FILE>);
close( FILE );
}
$strTpl =~ s/{NEWS-IMG-ONLY}/$strAll/g;
$strBuf = $gt->ymd;
$strBuf =~ s/-//g;
$strToday = "<li>".($gt->ymd("/"))." (".$gt->wdayname.")</li><br>";
$strTpl =~ s/{NEWS-DATE-TIME}/$strToday/g;
### 歡迎 {WELCOME}
srand;
if ( open( FILE, "<$template_welcome" ) )
{
@tmp=<FILE>;
$strTpl =~ s/{WELCOME}/$tmp[rand($.)]/g;
close( FILE );
}
if( open(FILE, ">$targetPath".$strBuf.$targetExt ) )
{
print FILE ($strTpl);
close( FILE );
}
}
exit;
sub fileThumb
{
$fileAll++;
if ( (/thumb\.jpg$/) )
{
$fileJpg++;
my $lt = 0;
$lt = localtime;
my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat($_) or die "Unable to stat $_\n";
my $ctime_str = strftime "%Y-%m-%d", localtime($mtime);
my $nowcp_str = $lt->ymd("-");
if ( $ctime_str eq $nowcp_str )
{
my $tmp = $File::Find::name;
if ( index( $tmp, "VovoCG" ) == -1 )
{
if ( index( $tmp, "sfx" ) == -1 )
{
## 駐站
$tmp =~ s/$pathToTra//g;
($auth[$fileYes], $fnam[$fileYes])=split( "\/", $tmp );
$fnam[$fileYes] =~ s/$thumbExt//g;
$fileYes++;
print "駐站===".$tmp.$/;
}
else
{
## SFX
$tmp =~ s/$pathToSFX//g;
($auth[$fileYes], $fnam[$fileYes])=split( "\/", $tmp );
$ha_p = $auth[$fileYes];
$auth[$fileYes] = "VovoSFX";
$fileYes++;
print "哈哈===SFX".$tmp.$/;
}
}
else
{
$tmp =~ s/$pathToHa//g;
($auth[$fileYes], $fnam[$fileYes])=split( "\/", $tmp );
$ha_p = $auth[$fileYes];
$auth[$fileYes] = "VovoCG";
$fileYes++;
print "哈哈===".$tmp.$/;
}
}
}
}
sub findRealAuth
{
local($par) = shift(@_);
my $j=0;
for( $j = 0; $j < $roomer_count; $j++ )
{
$roomer_list[$j] =~ s/\n//g;
$roomer_list[$j] =~ s/\r//g;
( $a, $b, $c ) = split( ",", $roomer_list[$j] );
( $e, $f ) = split( "\/", $c );
if ( $par eq $e )
{
return $a;
}
}
return $par;
}
(2014-06-22 18:21) |
|
[h1]Perl Code: 十幾年前的 Vovo2000.Com Perl Web Utilities (2)[/h1]
[h2]stat_Gallery_HotPic[/h2]
這是 2003 年,土法煉鋼硬讀取 Gallery 1 資料庫,取出「最熱門作品」的 Perl Code
代碼:
#!C:/perl/bin/perl.exe
$directory = "D:/Apache2/htdocs/gallery/albums/";
$directory2 = "D:\\Apache2\\htdocs\\gallery\\albums\\";
$file_tmp = "D:/VovoUtil/tmp2.file";
$file_hotpicHit = "D:/Apache2/Htdocs/friend/rank_hotestPic{NUM}.htm";
$file_template1 = "template-hotpicrank.tpl";
$file_template2 = "template-hotpicrank-detail.tpl";
$file_roomer_list = "D:/Apache2/Htdocs/friend/roomer_list.txt";
#@not_in_list = ( "18", "ClubTWCP" , "friend", "distrib" );
@not_in_list = ( "friend", "distrib" );
system( "dir $directory2 > $file_tmp" );
$i = 0;
$j = 0;
$hot_gap = 5;
$stop_gap = 300;
$per_page = 15;
$hot_imgrsc = "<img src=\"/image/hot.gif\"></img>";
$null_imgrsc = "<img src=\"/image/null.gif\"></img>";
#####################################
# 娶作家
#####################################
if ( open( FILE, "<$file_tmp" ) )
{
@a = <FILE>;
foreach( @a )
{
if ( index( $_, "<DIR>" ) > 0 )
{
($c1,$c2) = split( "<DIR>", $_ );
$c2 =~ s/^ //g;
$c2 =~ s/$\///g;
$addit = 1;
for ( $j=0; $j<scalar(@not_in_list); $j++)
{
if ( lc($not_in_list[$j]) eq lc($c2) )
{
$addit=0;
}
}
if ( $addit == 1 )
{
$subdirs[$i++] = $c2;
}
#print $_;
}
else
{
}
}
close( FILE );
}
$dfile = "photos.dat";
$dlimt = "clicks\";";
$plimt = "\"image\":12:{s:4:\"name\";s:";
$fileBuf = "";
$strbuf = "";
$strtmp = "";
@fdata = ();
%auth_kname;
%auth_rname;
%auth_pcount;
%auth_clicks;
####################################
# 名字到 %auth_rname,
# Forum 到 %auth_fnum,
# index 到 %auth_index
####################################
if ( open( FILE, "<$file_roomer_list" ) )
{
my @a=<FILE>;
$total_roomer = $.;
foreach( @a )
{
( $rname, $fnum, $com1 ) = split( ",", $_ );
( $kname, $com2 ) = split( "\/", $com1 );
$kname = lc($kname);
$auth_rname{$kname} = $rname;
$auth_fnum{$kname} = $fnum;
$auth_index{$kname} = $com1;
}
close( FILE );
}
#####################################
# 讀取 ClickCount / PCOUNT
#####################################
$total_pics = 0;
foreach( @subdirs )
{
$df = $_;
$fileBuf = $directory.$df."/".$dfile;
$df = lc($df);
if ( -e $fileBuf )
{
print $fileBuf.$/;
if ( open( FILE, $fileBuf ) )
{
$strbuf = join("",<FILE>);
$strtmp = "";
( $i, $l, $k ) = split( ":", $strbuf );
$i = 0;
$a = "";
for( $k=0; $k<$l; $k++ )
{
$total_pics++;
##### 讀取作品數 到 %auth_pcount
$strtmp = "";
$i = index( $strbuf, $plimt, $i );
$i += length($plimt);
$strspc = substr( $strbuf, $i, 2 ); ## 取最多兩位
$strspc =~ s/://g;
$zz = ( $strspc eq substr( $strbuf, $i, 2 ) ? 2 : 1 );
$i += 2 + $zz;
for( $j=0; $j<int($strspc); $j++ )
{
$a = substr($strbuf, $i+$j, 1 );
if ( $a ne ";" )
{
$strtmp .= $a;
}
else
{
$j = 10;
}
}
$strtmp =~ s/\"//g;
$strtmp =~ s/://g;
#print "檔名: ".$strtmp.$/;
$fname = $strtmp;
##### 讀取總點擊數 到 %auth_clicks
$i = index( $strbuf, $dlimt, $i );
$i += length($dlimt);
$strtmp = "";
$a = "";
if ( substr($strbuf, $i, 1 ) ne "N" )
{
for( $j=2; $j<8; $j++ )
{
$a = substr($strbuf, $i+$j, 1 );
if ( $a ne ";" )
{
$strtmp .= $a;
}
else
{
$j = 10;
}
}
}
else
{
$strtmp = "0";
}
#print "點點: ".$strtmp.$/;
$auth_clicks{$df.":".$fname} = $strtmp;
close( FILE );
}
}
}
}
########################################## 把 template 讀進來,然後至換
$strbuf = "";
$strall = "";
@strAll = ();
if ( open( FILE, "<$file_template1" ) )
{
$strTpl1 = join( "", <FILE> );
close( FILE );
}
if ( open( FILE, "<$file_template2" ) )
{
$strTpl2 = join( "", <FILE> );
close( FILE );
}
#print $strTpl2;
$j = 1;
$l = 1;
$k = 0;
foreach $key (sort {$auth_clicks{$b} <=> $auth_clicks{$a}} keys %auth_clicks)
{
$strbuf = $strTpl2;
( $key1, $key2 ) = split( ":", $key );
$clicks = $auth_clicks{$key};
$pica = $key2.".thumb.jpg";
if ( $auth_rname{$key1} ne "" )
{
$strbuf =~ s/{A_REALNAME}/$auth_rname{$key1}/g;
}
else
{
$strbuf =~ s/{A_REALNAME}/[CLUB]-$key1/g;
}
#$strbuf =~ s/{A_PCOUNT}/$auth_pcount{$key1}/g;
$strbuf =~ s/{A_CLICKS}/$clicks/g;
$strbuf =~ s/{A_GALLERY}/$key1/g;
$strbuf =~ s/{A_FORUM}/$auth_fnum{$key1}/g;
$strbuf =~ s/{A_INDEX}/$auth_index{$key1}/g;
$strbuf =~ s/{A_PIC_THUMB}/$pica/g;
$strbuf =~ s/{NUM}/$j/;
$strbuf =~ s/{A_PIC}/$key2/g;
if ( $j <= $hot_gap )
{
$strbuf =~ s/{HOT_IMG}/$hot_imgrsc/g;
}
else
{
$strbuf =~ s/{HOT_IMG}//g;
}
$j++;
$l++;
$strAll .= $strbuf;
if ( $l > $per_page )
{
$strAll[$k] = $strAll;
$l = 1;
$k++;
$strAll = "";
}
if ( $j > $stop_gap ) { last; }
}
$loct = localtime();
$strbuf = "";
$strtmp = "";
$i = 1;
foreach (@strAll)
{
$strbuf = $strTpl1;
#print $_;
$strbuf =~ s/{RANK_LIST}/$_/;
$strbuf =~ s/{TOTAL_PICS}/$total_pics/;
$strbuf =~ s/{HOWMUCH}/$stop_gap/;
$strbuf =~ s/{UPDATE_TIME}/$loct/;
########################################## 寫進去
$strtmp = $file_hotpicHit;
$strtmp =~ s/{NUM}/$i/g;
$i++;
print "產生: $strtmp".$/;
if ( open( FILE, ">$strtmp" ) )
{
print FILE ($strbuf);
close( FILE );
}
}
exit;
代碼:
#!C:/perl/bin/perl.exe
$directory = "D:/Apache2/htdocs/gallery/albums/";
$directory2 = "D:\\Apache2\\htdocs\\gallery\\albums\\";
$file_tmp = "D:/VovoUtil/tmp.file";
$file_artistHit = "D:/Apache2/Htdocs/friend/rank_artistHit{NUM}.htm";
$file_artistHit2 = "D:/Apache2/Htdocs/friend/rank_artistHit.txt";
$file_template1 = "template-artisthitrank.tpl";
$file_template2 = "template-artisthitrank-detail.tpl";
$file_roomer_list = "D:/Apache2/Htdocs/friend/roomer_list.txt";
@not_in_list = ( "18", "ClubTWCP", "friend", "distrib", "vovo2000" );
$per_page = 25; # 分頁
system( "dir $directory2 > $file_tmp" );
$i = 0;
$j = 0;
$hot_gap = 5;
$hot_imgrsc = "<img src=\"/image/hot.gif\"></img>";
$null_imgrsc = "<img src=\"/image/null.gif\"></img>";
#####################################
# 娶作家
#####################################
if ( open( FILE, "<$file_tmp" ) )
{
@a = <FILE>;
foreach( @a )
{
if ( index( $_, "<DIR>" ) > 0 )
{
($c1,$c2) = split( "<DIR>", $_ );
$c2 =~ s/^ //g;
$c2 =~ s/$\///g;
#if ( !($c2 in @not_in_list) )
#{
$addit = 1;
for ( $j=0; $j<scalar(@not_in_list); $j++)
{
if ( lc($not_in_list[$j]) eq lc($c2) )
{
$addit=0;
}
}
if ( $addit == 1 )
{
$subdirs[$i++] = $c2;
print "o";
}
print ".";
}
else
{
}
}
close( FILE );
}
$dfile = "photos.dat";
$dlimt = "clicks\";i:";
$plimt = "cached_photo_count\";i:";
$fileBuf = "";
$strbuf = "";
$strtmp = "";
@fdata = ();
%auth_kname;
%auth_rname;
%auth_pcount;
%auth_clicks;
####################################
# 名字到 %auth_rname,
# Forum 到 %auth_fnum,
# index 到 %auth_index
####################################
if ( open( FILE, "<$file_roomer_list" ) )
{
my @a=<FILE>;
$total_roomer = $.;
foreach( @a )
{
( $rname, $fnum, $com1 ) = split( ",", $_ );
( $kname, $com2 ) = split( "\/", $com1 );
$kname = lc($kname);
$auth_rname{$kname} = $rname;
$auth_fnum{$kname} = $fnum;
$auth_index{$kname} = $com1;
}
close( FILE );
}
#####################################
# 讀取 ClickCount / PCOUNT / # "clicks";i:XXXX;
#####################################
foreach( @subdirs )
{
$df = $_;
$fileBuf = $directory.$df."/".$dfile;
$df = lc($df);
if ( -e $fileBuf )
{
print $fileBuf.$/;
if ( open( FILE, $fileBuf ) )
{
$cntBuf = 0;
$artBuf = 0;
if ( open( FILE, $fileBuf ) )
{
$strbuf = join( "", <FILE> );
$strbuf =~ s/;/\n/g;
@a = split( "\n", $strbuf );
foreach( @a )
{
$zBuf = 0;
if ( index( $_, "i\:" ) != -1 && index( $last, "clicks" ) != -1 )
{
($zBuf,$zBuf) = split( ":", $_ );
$cntBuf += $zBuf;
++$artBuf;
}
$last = $_;
}
#print $cntBuf.$/;
#print $artBuf.$/;
}
$auth_pcount{$df} = $artBuf;
$auth_tclicks{$df} = $cntBuf;
$auth_clicks{$df} = sprintf( "%.2f", ($cntBuf/$artBuf));
close( FILE );
}
}
}
########################################## 把 template 讀進來,然後至換
$strbuf = "";
$strAll = "";
if ( open( FILE, "<$file_template1" ) )
{
$strTpl1 = join( "", <FILE> );
close( FILE );
}
if ( open( FILE, "<$file_template2" ) )
{
$strTpl2 = join( "", <FILE> );
close( FILE );
}
#print $strTpl2;
$j = 1;
$k = 0;
$l = 1;
$strAltAll="";
foreach $key (sort {$auth_clicks{$b} <=> $auth_clicks{$a}} keys %auth_clicks)
{
$strbuf = $strTpl2;
$strbuf =~ s/{A_REALNAME}/$auth_rname{$key}/g;
$strbuf =~ s/{A_PCOUNT}/$auth_pcount{$key}/g;
$strbuf =~ s/{A_CLICKS}/$auth_clicks{$key}/g;
$strbuf =~ s/{A_GALLERY}/$key/g;
$strbuf =~ s/{A_FORUM}/$auth_fnum{$key}/g;
$strbuf =~ s/{A_INDEX}/$auth_index{$key}/g;
$strbuf =~ s/{NUM}/$j/g;
$strbuf =~ s/{T_CLICKS}/$auth_tclicks{$key}/g;
$strAltAll .= $key.",".$auth_clicks{$key}.$/;
if ( $j <= $hot_gap )
{
$strbuf =~ s/{HOT_IMG}/$hot_imgrsc/g;
}
else
{
$strbuf =~ s/{HOT_IMG}//g;
}
$j++;
$l++;
$strAll .= $strbuf;
if ( $l > $per_page )
{
print " 換頁...$k ".$/;
$strAll[$k] = $strAll;
$l = 1;
$k++;
$strAll = "";
}
}
$strAll[$k] = $strAll;
print "========> ".$j.$/;
########################################## 寫進去
#if ( open( FILE, ">$file_artistHit" ) )
#{#
# print FILE ($strTpl1);
# close( FILE );
#}
print "========> ".scalar(@strAll).$/;
$strbuf = "";
$strtmp = "";
$i = 1;
foreach (@strAll)
{
$strbuf = $strTpl1;
$loct = localtime();
$strbuf =~ s/{RANK_LIST}/$_/;
$strbuf =~ s/{TOTAL_ROOMER}/$total_roomer/;
$strbuf =~ s/{UPDATE_TIME}/$loct/;
########################################## 寫進去
$strtmp = $file_artistHit;
$strtmp =~ s/{NUM}/$i/g;
$i++;
print "產生: $strtmp".$/;
if ( open( FILE, ">$strtmp" ) )
{
print FILE ($strbuf);
close( FILE );
}
}
#########################################
if ( open( FILE, ">$file_artistHit2" ) )
{
print FILE ($strAltAll);
close( FILE );
}
exit;
(2014-06-22 18:17) |
| 前往頁面 ←上一頁 1 ... 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 ... 561 下一頁→
|
|