CSS常用中文字體與英文名稱比對

 

CSS 常用的中文字體英文名稱︰

Mac OS:

華文細黑:STHeiti Light [STXihei]
華文黑體:STHeiti
華文楷體:STKaiti
華文宋體:STSong
華文仿宋:STFangsong
儷黑 Pro:LiHei Pro Medium
儷宋 Pro:LiSong Pro Light
標楷體:BiauKai
蘋果儷中黑:Apple LiGothic Medium
蘋果儷細宋:Apple LiSung Light

Windows:

新細明體:PMingLiU
細明體:MingLiU
標楷體:DFKai-SB
黑體:SimHei
宋體:SimSun
新宋體:NSimSun
仿宋:FangSong
楷體:KaiTi
仿宋_GB2312:FangSong_GB2312
楷體_GB2312:KaiTi_GB2312
微軟正黑體:Microsoft JhengHei
微軟雅黑體:Microsoft YaHei

Office:

隸書:LiSu
幼圓:YouYuan
華文細黑:STXihei
華文楷體:STKaiti
華文宋體:STSong
華文中宋:STZhongsong
華文仿宋:STFangsong
方正舒體:FZShuTi
方正姚體:FZYaoti
華文彩雲:STCaiyun
華文琥珀:STHupo
華文隸書:STLiti
華文行楷:STXingkai
華文新魏:STXinwei

取消Apache日誌中的搜索引擎bot記錄在log file設置

打開httpd.conf

SetEnvIf Remote_Addr “127\.0\.0\.” dontlog

SetEnvIfNoCase User-Agent “(msnbot|googlebot|slurp|Baiduspider|bingbot)” dontlog

ErrorLog “../apache-2.2.17-error.log”
CustomLog “|bin/rotatelogs -f ./logs/logfile.%Y.%m.%d.log 86400” combined

 

保存

重啟apache

Leverage Browser Caching

以下代碼可以幫你把Apache 的圖片做更長久緩存

 

放在.htaccess 頭部就可以:

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg “access 1 year”
ExpiresByType image/jpeg “access 1 year”
ExpiresByType image/gif “access 1 year”
ExpiresByType image/png “access 1 year”
ExpiresByType text/css “access 1 month”
ExpiresByType text/html “access 1 month”
ExpiresByType application/pdf “access 1 month”
ExpiresByType text/x-javascript “access 1 month”
ExpiresByType application/x-shockwave-flash “access 1 month”
ExpiresByType image/x-icon “access 1 year”
ExpiresDefault “access 1 month”
</IfModule>
## EXPIRES CACHING ##

不過要更新圖就得要改圖片名了

如何停止wordpress 評論pingback

煩人的垃圾pingback 評論占用了系統大部份的空間

可以在控制台的Setting > discussion 把第二項取消 :

DisableTrackbacksCompletelyonWordpress

 

舊有的刪除需要到MYSQL 運行語句一次過清掉 :

DELETE FROM wp_options WHERE option_name LIKE ('_transient_%');
DELETE FROM wp_comments WHERE wp_comments.comment_type = 'pingback';
DELETE FROM wp_comments WHERE wp_comments.comment_type = 'trackback';
DELETE a,b,c FROM wp_posts a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id)
LEFT JOIN wp_postmeta c ON (a.ID = c.post_id) WHERE a.post_type = 'revision';

How to install Memcached on Windows machine

After some research I found that there is a Win32 binary version of memcached available here.

So go there and download win32 binary version to your computer. When downloaded, extract the file to folder memcahced on your C partition.

You should get only one file named memcached.exe. Now we need to install this as a service, as memCached is daemon and should be run only as service.

To install Memcached as a service, follow these steps (please change all forward slashes to backslashes):

  1. If you’re running Vista, you should set memcached.exe to Run as administrator
  2. Install the service using the command:
    1 c:/memcached/memcached.exe  -d install

    from the command prompt

  3. Start the server from the Services or by running one of the following commands:
    1 c:/memcached/memcached.exe -d  start

    or

    1 net start "memcached Server"

That is it, now your memcached server is installed and is listening to port 11211. There is one more thing left to do. By default, server is set to 64Mb memory limit, which is too small. To correct, go to Registry Editor and find key

1 HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/memcached  Server .

Change the ImagePath entry to:

1 “C:/memcached/memcached.exe” -d runservice -m 512

This way you will use 512 Mb memory limit for your server.

Google Client auth Login with PHP and Curl

// Construct an HTTP POST request
$clientlogin_url = "https://www.google.com/accounts/ClientLogin";
$clientlogin_post = array(
    "accountType" => "HOSTED_OR_GOOGLE",
    "Email" => "[email protected]",
    "Passwd" => "yourgooglepassword",
    "service" => "writely",
    "source" => "your application name"
);

// Initialize the curl object
$curl = curl_init($clientlogin_url);

// Set some options (some for SHTTP)
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $clientlogin_post);
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

// Execute
$response = curl_exec($curl);

// Get the Auth string and save it
preg_match("/Auth=([a-z0-9_\-]+)/i", $response, $matches);
$auth = $matches[1];

echo "The auth string is: " . $auth;
// Include the Auth string in the headers
// Together with the API version being used
$headers = array(
    "Authorization: GoogleLogin auth=" . $auth,
    "GData-Version: 3.0",
);

// Make the request
curl_setopt($curl, CURLOPT_URL, "{Google service feed link}");
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
curl_setopt($curl, CURLOPT_POST, false);

$response = curl_exec($curl);
curl_close($curl);

// Parse the response
$response = simplexml_load_string($response);

echo "<pre>";
print_r($response); 
echo "</pre>";