include("include/feedcreator.class.php"); $rss = new UniversalFeedCreator(); $rss->useCached(); $rss->title = "PHP news"; $rss->description = "daily news from the PHP scripting world"; $rss->link = "http://www.dailyphp.net/news"; $rss->syndicationURL = "http://www.dailyphp.net/".$PHP_SELF; $image = new FeedImage(); $image->title = "dailyphp.net logo"; $image->url = "http://www.dailyphp.net/images/logo.gif"; $image->link = "http://www.dailyphp.net"; $image->description = "Feed provided by dailyphp.net. Click to visit."; $rss->image = $image; // get your news items from somewhere, e.g. your database: mysql_select_db($dbHost, $dbUser, $dbPass); $res = mysql_query("SELECT * FROM news ORDER BY newsdate DESC"); while ($data = mysql_fetch_object($res)) { $item = new FeedItem(); $item->title = $data->title; $item->link = $data->url; $item->description = $data->short; $item->date = $data->newsdate; $item->source = "http://www.dailyphp.net"; $item->author = "John Doe"; $rss->addItem($item); } $rss->saveFeed("RSS1.0", "news/feed.xml");
ESXi server 的 image 處理技巧
通常 converter 用來把 vmware workstation or server 的 image 轉上 ESXi server , 不過我發現 ESXi server 的 image download 下來後 , 一樣也可以用 convert 把它 轉上 ESXi server , 轉上去可以順便改個名字 , 這樣就可以方便的加一台測試機了.
Sting Desert Rose – Live with Cheb Mami
[youtube]http://tw.youtube.com/watch?v=rBJlBS-S9Kw[/youtube]
Sample code , 用 getopt 取得 command line 的參數
#include "stdlib.h" #include "stdio.h" #include "getopt.h" #include "string.h" void print_help(int exval); char program[100] = "sample"; int main(int argc, char *argv[]) { int opt; strcpy(program,argv[0]); if (argc == 1) print_help(1); while((opt = getopt(argc, argv, "hVvf:o:")) != -1) { switch(opt) { case 'h': print_help(0); break; case 'V': printf("%s", program); exit(0); break; case 'v': printf("%s: Verbose option is set '%c'\n", program, optopt); break; case 'f': printf("%s: Filename %s\n", program, optarg); break; case 'o': printf("Output: %s\n", optarg); break; case ':': fprintf(stderr, "%s: Error - Option '%c' needs a value\n\n", program, optopt); print_help(1); break; case '?': fprintf(stderr, "%s: Error - No such option: '%c'\n\n", program, optopt); print_help(1); } } for(; optind < argc; optind++) printf("argument: %s\n", argv[optind]); return 0; } // ----- void print_help(int exval) { printf("Usage: %s [-h] [-V] [-f FILE] [-o FILE]\n\n", program); printf(" -h print this help and exit\n"); printf(" -V print version and exit\n\n"); printf(" -v set verbose flag\n"); printf(" -f FILE set intput file\n"); printf(" -o FILE set output file\n\n"); exit(exval); }
我的 subversion / svn server 設定
OS : Gentoo Linux 2.6.22-gentoo-r5 #11
gcc –version
gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.1)
svnserve –version
svnserve, version 1.5.4 (r33841)
compiled Dec 17 2008, 08:11:10
/usr/bin/svnserve –foreground –daemon –root=/var/svn
一些 subversion command 下的操作:
用 svn co 一個 source 到目錄下 , 把要加到 svn 的檔案/目錄 copy 過來 , 下 svn status 會看到一堆 ? 表示那些是新的檔案
下 svn add * 或 svn add dirname
下 svn status 可以看到 剛剛的 ? 變成 A 了 (add)
下 svn ci 把 source code commit 進 svn
cd 到工作目錄
下
svn –username monster export svn://xxx.com/my_repos/search/src
把 source code export 出來