2008年8月4日 星期一

Advanced Syntax Highlighting


有網友在

http://i-never4get.blogspot.com/2008/07/scmp-php.html

這篇文章有詢問如何能貼出 php 代碼於網誌中

我是使用網路上現成的服務

Advanced Syntax Highlighting

如下面的小工具

有興趣的網友可以試試看 :)





















Advanced Syntax Highlighting Tool © Dev Mechanic™

Language
Select Language

Line Numbers
Display line numbers

HTML Code
Display highlighted HTML source code

Code
Enter your code here

Enter Captcha To Continue
To prevent spamming, please enter in the numbers and letters in the box below

Report Problem with Tool.




2008年7月25日 星期五

iGO8 Taiwan Map

昨晚用手機試了一下最近很夯的導航軟體 iGO8

發現了一個地圖上的錯誤

台北市仁愛路自復興南路到敦化南路段

應該是四段才對

但是地圖上顯示的是三段

不過巷弄的地址卻是正確的

不知此地圖最近是否會有更新的版本?

 

地圖影像

2008年7月13日 星期日

在 pda4x 停止報刊的更新

小弟我因為公司工作職務變動的關係

將沒有多餘的時間維護 pda4x 報刊的版面

所以今日(七月13日)將是最後一次更新

也許將來有時間的話

還可繼續為各位服務

也希望各位繼續支持 www.pda4x.com

2008年7月11日 星期五

About SkyDrive's bandwidth limit

 

原先號稱沒有流量限制的 SkyDrive

今天平時上傳報刊的空間竟然被操到出現錯誤訊息:

HTTP/1.1 509 Bandwidth Limit Exceeded

我查遍了 Microsoft 網站

沒有看到任何有關 bandwidth 的限制 @@

看來我得要找些備援的空間了。

2008年7月7日 星期一

SCMP php 原始檔公開

共分兩個檔
第一個檔為 scmp.php
用於顯示新聞標題

  1. <?
  2. header('Content-type:text/html; charset=utf-8');
  3. $out = "<title>SCMP.com</title>\r\n";
  4. $out .= "<b><font size=5>SCMP</font></b><br>\r\n";
  5. $main = file_get_contents('http://www.scmp.com/portal/site/SCMP/');
  6. preg_match('/<td colspan=\"3\" style="padding-top: 3px; font-size:12px;font-family:Arial\;\" align=\"center\" valign=\"middle\">(.*?)<\/td>/s',$main,$issue);
  7. $out .="$issue[1]<hr>\r\n";
  8. $tt = array('Hong Kong','China','Asia','World','Education');
  9. $l = array('hong_kong','china','asia','world','education');
  10. $baseurl = 'http://www.scmp.com/rss/';
  11. for($i=0;$i<5;$i++){
  12. $url = "$baseurl"."$l[$i].xml";
  13. $content = file_get_contents($url);
  14. if (ereg('<item>',$content)){
  15. $out .= "<p><b><font color=#656565>$tt[$i]</font></b><br>\r\n"
  16. $content = preg_replace('/(.*?)<item>(.*?)<\/item>/s',"$2",$content);
  17. $content = preg_replace('/<pubDate>(.*?)<\/pubDate>/s','',$content);
  18. $content = preg_replace('/<description>(.*?)<\/description>/s','',$content);
  19. $content = preg_replace('/<title>(.*?)<\/title>(.*?)<link>(.*?)<\/link>/s',"<li><a href=scmp_view.php?link=$3>$1</a></li>\r\n",$content);
  20. $content = eregi_replace('<!\[CDATA\[','',$content);
  21. $content = eregi_replace('\]\]>','',$content);
  22. $out .= $content;
  23. }
  24. }
  25. $out .= "<hr><img src=http://static.flickr.com/60/219160214_e6ed15d559_o.gif>";
  26. echo $out;
  27. ?>


第二個檔為 scmp_view.php (2009-3-15 更新)
用於顯示新聞內文

  1. <?
  2.     header('Content-type:text/html; charset=utf-8');
  3.     ini_set('user_agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)');
  4.     $link = $_GET['link'];
  5.     $content = file_get_contents($link);
  6.     preg_match('/printform_target\">(.*?)<\/form>/s',$content,$match);
  7.     $content = $match[1];
  8.     preg_match('/artHeadline value=\"(.*?)\">/s',$content,$hl);
  9.     preg_match('/artSubHeadline value=\"(.*?)\">/s',$content,$shl);
  10.     preg_match('/artDate value=\"(.*?)\">/s',$content,$ad);
  11.     preg_match('/artByline value=\"(.*?)\">/s',$content,$bl);
  12.     preg_match('/artBody value=\"(.*?)\">/s',$content,$ab);
  13.     $headline = $hl[1];
  14.     $subheadline = $shl[1];
  15.     $art_date = $ad[1];
  16.     $by_line = $bl[1];
  17.     $body = $ab[1];
  18.     $out .= "<title>SCMP.com $headline</title>";
  19.     $out .= "<b><font color=#656565 size=5>$headline</font></b><br>\r\n";
  20.     $out .= "$subheadline<br>\r\n";
  21.     $out .= "$art_date<br>\r\n";
  22.     $out .= "$by_line<hr>\r\n";
  23.     $out .= "$body<hr>\r\n";
  24.     $out = eregi_replace('&lt;','<',$out);
  25.     $out = eregi_replace('&gt;','>',$out);
  26.     $out = eregi_replace('&amp;quot;','"',$out);
  27.     $out .= "<img src=http://static.flickr.com/60/219160214_e6ed15d559_o.gif>";
  28.     $allowed_tags = "<u>,<b>,<li>,<br>,<hr>,<img>,<font>,<p>,<title>";
  29.     $out = strip_tags($out, $allowed_tags);
  30.     echo $out;
  31. ?>


Enjoy!