發表文章

tw quote

證交所即時資訊解析 今天是2014/8/1忽然發現舊版的即時資訊拉不下來,上去看才知到舊版已經被停用了, 要取得新版資料(以Json呈現),必須連現以下網址 http://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch=( tse | otc )_ SYMBOL .tw_ YYYYMMDD &json=1&delay=0 例如 http://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch=tse_3474.tw _20140801 &json=1&delay=0 可以取得 2014/8/1 當日的華亞科的股價(經測試不打 _20140801 &仍可取得最新資料) 這次的API也可以進行串接,例如同時取得華亞科與精華的股價可以使用 | (pipe符號) 進行串接,例如 http://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch=tse_3474.tw_20140804 | otc_1565.tw_20140804&json=1&delay=0 取得指數的方式如下: http://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch= 指數代號 &json=1&delay=0 給個例子,同時取得上市與上櫃指數 http://mis.twse.com.tw/stock/api/getStockInfo.jsp?ex_ch=tse_t00.tw | otc_o00.tw&json=1&delay=0 參數說明: ( tse | otc ): 若是上市使用tse,若是上櫃則使用otc, 注意左右括號要拿掉 SYMBOL :則是4碼或6碼的股票代號 YYYYMMDD :則是當日日期 回傳的JSON欄位說明 z 當盤成交價 tv 當盤成交量 v 累積成交量 b 揭示買價(從高到低,以_分隔資料) g 揭示買量(配合b,以_分隔資料) a 揭示賣價(從低到高,以_分隔資料) f 揭示賣量(配合a,以_分隔資料) o 開盤 h 最高 l 最低 y 昨收 u 漲停價 ...

How to use PHP session

圖片
PHP Session 使用介紹,啟用與清除 session Session 一直到 PHP4 之後才有的,PHP3(含)以前幾乎都是使用 Cookie 來記錄一些資訊,然而 Session 的出現,對於 PHP 的安全性有很大的提升,同時也讓網站功能更全面。你要完全拋棄 cookie 嗎?其實也不盡然,如果能夠用 session 搭配 cookie 有的時候可以做出很多更方便的東西。 PHP Session 與 Cookie 的比較 Session:儲存於伺服器端,不用擔心用戶禁用session的問題,但計錄檔案的負荷由伺服器承擔。 Cookie:儲存於用戶端,可能有用戶端禁用cookie,但伺服器不需承擔計錄檔案的負荷。 各有優缺點,所以並沒有完全捨棄 cookie 的問題存在,有些不重要的資料其實用 cookie 儲存就可以了,降低一些 server 的負荷;但是重要的資訊,像是用戶的登入帳號等,請用 session 會比較安全。 Session 使用的地方 通常如果你的網站具有會員登入的功能或是購物車的功能,基本上就可以使用到 session 來幫助你記錄這些資訊。另外如果你的會員有權限上的差異(管理員權限、版主權限、一般會員權限 ...... 等),同樣也可以透過 session 來記錄,這個部份就比 cookie 來得安全。 第一步、啟用 Session : session_start() 在你使用 session 來記錄用戶的資訊前,要先用 session_start() 這個函式,告訴系統準備開始使用,請記住 session_start() 一定要放在網頁的最上方還沒有輸出任何東西之前,也就是類似下面這樣,如果前面出現了任何的輸出可是會出錯的唷!這也是一般人常碰到的問題。 第二步、給變數值並記錄在伺服器上 我們設定了一個 number 的變數,並給他一個值 =10,接著這個 number=10 就存在伺服器上囉!基本上這樣最簡單的 session 就設定好了。 第三步、取得 session 的值,使用 $_SESSION["變數名稱"]; 在取得變數值之前一樣要先用 session_star() 函數唷!接著就可以直接 echo 出來了。 第四步、刪除 session  其實預設伺服器會自動刪除超過有效時間的 ses...

selinux ftp access setting

List all of the selinux related ftp setting ======================================================== sestatus -b | grep ftp                                         allow_ftpd_anon_write                       off                                         allow_ftpd_full_access                      off                                        allow_ftpd_use_cifs                         off                                       ...

Node JS on Centos NPM (Node Package Management)

How to install Node JS on Centos You must have OpenSSL installed, curl installed and root access. yum install gcc gcc-c++ yum install autoconf automake make yum install curl yum install openssl-devel Use `su` for root or login as root. How to install Node JS Download NoteJS's packages wget http://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz Extract it with the following command: tar zxvf node-v0.8.20.tar.gz Finish installing it cd node-v0.8.20 ./configure make make install Finally test if it works node --version Congratulations, NodeJS is installed. You may now install npm and packages such as socket.io.

efax FAX class 2 VS class 2.0 selection

* Note when selecting modems for fax remember to pick the right modem class. * Fax Class 2  is NOT the same as Class 2.0 * AT+FCLASS=?  will show the supporting class.  usually 0,1,2,2.0,6,8   see below for definition. efax.c for linux works really easy and compatible with class 2 modems only, NOT 2.0. USR modems are not supported. ================= /usr/bin/efax -d /dev/cua1 -t 25639432 ./testline2.txt ================== The following class 2 commands are supported and implemented per EIA PN2388 (8/20/90). Command Style +<command>=<value> Execute a command or set a parameter +<command>? Read possible settings +<command>=? Read current setting Supported Commands (per EIA PN2388 8/20/90) +FAA=n Auto answer mode parameter n=0 DCE to answer as set by +FCLASS n=1 DCE can answer and auto. determine calling type +FCLASS=n Service class...

BBS Sysop List > Riverside Far East Asian Connection

Historical List of BBSes in the 909 Area Code --------------------------------------------- Created by TEXTFILES.COM From Many Sources 909-242-1767 | Power BBS! | Moreno Valley, CA (1994-1997) SYSOP | Robert Annetta SOFTWARE | Wildcat --------------+----------------------------------------------------------- 909-242-3975 | Adventurer's Guild, Mickey's Kingdom | SUNNYMEAD, CA (1993-1994) SYSOP | Steven Soria Jr. --------------+----------------------------------------------------------- 909-242-6903 | Synthetic Systems | SUNNYMEAD, CA (1992-1995) SYSOP | Darryl Kimmel --------------+----------------------------------------------------------- 909-243-5894 | Lazarus BBS | SUNNYMEAD, CA (1997-1999) SYSOP | Ben Corbin --------------+----------------------------------------------------------- 909-243-8570 | Mental Illusions | SUNNYMEAD, CA (1993-1994) --...