PHP 7.1.x with VC14
PHP 7.2.x with VC15
FastCGI use non-TS
ISAPI use TS
OS 32bit use x86
OS 64bit use x86_64
show code js
2018年4月21日 星期六
2015年7月14日 星期二
股票平台建立記錄「二」取得有價證券代號及名稱
有了股票群組代碼,接著就是要抓取股票代號及名稱,
使用上一篇的連接,可以發現 http://www.twse.com.tw/ch/trading/inc/STKCHOICE/STK01.php?STK=01 中的01就是群組代號,若要抓「造紙工業」就是 http://www.twse.com.tw/ch/trading/inc/STKCHOICE/STK09.php?STK=09
因此抓股票代號就要使用上篇抓到的群組資料來進行
// 群組資料庫(略)
$type = array();
$num = count($type);
for( $i = 0 ; $i < $num ; $i++ )
{
$url = 'http://www.twse.com.tw/ch/trading/inc/STKCHOICE/STK' . $type[$i] . '.php?STK=' . $type[$i];
$text = file_get_contents($url);
preg_match_all('/]*)>([^<>]*)<\/span>/', convert85str($text), $match);
$type_num = count($match[0]);
for( $j = 0 ; $j < $type_num ; $j++ )
{
$stock = explode(" ", $match[0][$j]);
echo '
' . str_replace("","",$stock[0]) . ',' . str_replace("","", $stock[1]);
}
}
抓到的資料會在頁面呈現 [股票代號],[股票名稱]
唯一美中不足的就是無法分辨,已下市或其他成分。
另外,也可以抓 本國上市證券國際證券辨識號碼一覽表 的資料來充實股票代號的資訊
股票平台建立記錄「一」取得證券群組代號及名稱
此作為個人建立股票平台記錄用
首先要取得分類,並建立分類資料表,可以連到 臺灣證券交易所 取得,
而由 如何擷取所有的股票代號| Justlink 碎碎念 得知直接連結為 選擇證券代號
但由於選擇證券代號是一iframe頁面,因此,再了解結構後可以得到更直接的頁面連結為 http://www.twse.com.tw/ch/trading/inc/STKCHOICE/data_Top.htm
然後使用php來抓取並轉成sql指令,當然table要先設計好欄位要放什麼資料
接著利用以下程式碼來展出列表:
url = 'http://www.twse.com.tw/ch/trading/inc/STKCHOICE/data_Top.htm';
$text = file_get_contents($url);
$text = convert85str($text);
$preg='/echo '
' . $temp[0] . ',' . $temp[1]; // 證券群組代碼,證券群組名稱
}
首先要取得分類,並建立分類資料表,可以連到 臺灣證券交易所 取得,
而由 如何擷取所有的股票代號| Justlink 碎碎念 得知直接連結為 選擇證券代號
但由於選擇證券代號是一iframe頁面,因此,再了解結構後可以得到更直接的頁面連結為 http://www.twse.com.tw/ch/trading/inc/STKCHOICE/data_Top.htm
然後使用php來抓取並轉成sql指令,當然table要先設計好欄位要放什麼資料
接著利用以下程式碼來展出列表:
url = 'http://www.twse.com.tw/ch/trading/inc/STKCHOICE/data_Top.htm';
$text = file_get_contents($url);
$text = convert85str($text);
$preg='/echo '
' . $temp[0] . ',' . $temp[1]; // 證券群組代碼,證券群組名稱
}
其中由1開始是避開選擇項目的第一項及48是去除後面不必要的群組,當然,如果將來群組調整了,48這個數字就表示不是固定的一組數字,可以檢閱直接連接的原始程式碼後自已去計算總共要抓多少筆
由於只是隨便寫寫,因此截取代碼及名稱上,重覆使用了多次去除不必要的code
2015年4月1日 星期三
purchase list from our supplier
I work as a purchaser for parts of apparatus for a long time ago.
I using my professional to create a "micro" erp system
I only need 1 hour to finish my job in all day, because I using this system.
My partners are using this system can easy learn and spend a little time to know all parts of apparatus.
When my supplier delivery parts to us, we can to check order number to show parts list from system, easy to manage delivery list and put items into warehouse.
I using my professional to create a "micro" erp system
I only need 1 hour to finish my job in all day, because I using this system.
My partners are using this system can easy learn and spend a little time to know all parts of apparatus.
When my supplier delivery parts to us, we can to check order number to show parts list from system, easy to manage delivery list and put items into warehouse.
2013年10月4日 星期五
produce quality monitor
When we have data from produce management system that we can online monitor change of producing quality.
The blue circle on the picture, that we can online to find out process of production happen change from produce management system.
We can know in process of production at all day, that produce how many quality level final products.
And we can to do an improving action online or design a fix plan on next time, to update our produce quality, and sure it will not happen again.
2013年10月2日 星期三
Small ERP part3 - SQC quality control x chart
We can get those optics data after the product run optics workstation.
In accordance with specification of PMC produce plan, we can make x chart and r chart of SQC quality control chart.
Watch those data can find out our process capability and better our process work.
In accordance with specification of PMC produce plan, we can make x chart and r chart of SQC quality control chart.
Watch those data can find out our process capability and better our process work.
Watch out our process power, better our product Manufacturing will quality stability.
And can find out those error from people, machine, materials or method what is we need better control them.
2013年10月1日 星期二
Small ERP part2 - Decide optics level of final product
Previous post of part, I create two type workstation.
One optics(Data) workstation will do this job.
This a specifica create by quality department before get approve by manager.
The optics workstation will online to get this specification from system. see as the picture.
Well, optics workstation will get this specification from produce plan.
When PMC get a order from sales department, that they must sent demand for raw materials and supplies to other department to support.
Then PMC will reply delivery time back to sales department and create produce plan convert from this order.
Produce plan data flow into system, go next workstation when they finish job, keep this action when product go to optics workstation.
Optics workstation just get this plan to choose that can use specifications to check those products.
After check, those products will get a new level from both normal quality and optics quality, and those products become to half products.
One optics(Data) workstation will do this job.
This a specifica create by quality department before get approve by manager.
The optics workstation will online to get this specification from system. see as the picture.
Well, optics workstation will get this specification from produce plan.
When PMC get a order from sales department, that they must sent demand for raw materials and supplies to other department to support.
Then PMC will reply delivery time back to sales department and create produce plan convert from this order.
Produce plan data flow into system, go next workstation when they finish job, keep this action when product go to optics workstation.
Optics workstation just get this plan to choose that can use specifications to check those products.
After check, those products will get a new level from both normal quality and optics quality, and those products become to half products.
2013年9月26日 星期四
php odbc ready
example use access file mdb.
1.create a access file format mdb
(1)open this mdb and create some table and row data(type;table)
(2)set the IUSR read of permission for this mdb file on windows operation system
2.open \Windows\SysWOW64\odbcad32.exe
(1)click system data source of tag
(2)click new
(3)choose Microsoft Access Driver (*.mdb) before click done
(4)set data source name
(5)database file choose your access.mdb
(6)click advance and set account and password
(7)click option and set your config
3.use php odbc function
2013年9月17日 星期二
install pear to php on windows system
- Install pear in php on windows
- Download http://pear.php.net/go-pear.phar
- goto php directory
- open cmd and run php go-pear.phar to start installing pear module
- when it is done you can find PEAR_ENV.reg and double click it.
- it will change php.ini when it is done to restart your web server.
- Test pear, create and run php file, it will show bool(true)
- <?php
- require_once 'System.php';
- var_dump(class_exists('System', false));
- ?>
- If you want to install module of pear, you can open cmd and goto php directory, run pear install module_name.
- ex: pear install MDB2
- Test MDB2 module, create and run php file, it will show bool(true)
- <?php
- ini_set('include_path','c:\php\pear');
- require_once 'MDB2.php';
- var_dump(class_exists('MDB2', false));
- ?>
2013年9月14日 星期六
SMALL ERP PART1 - Production and Quality Management System
in 2006 year, I had programming a small production management system, it includes produce line management, PMC management, Process management and multi-language. let an manually factory to be automation. The manager can constantly to get newest information from factory, produce information and quality information.
They can continuous development and adaptation of policies and decision-making.
This is a general workstation of type, and it main job is record the production and NG information. Them will show on the control management panel.
Inside this GUI, we make a anti-error control to create right data.
For the second workstation of type, the product will merge manufacturer number(barcode) and optics data (from optical apparatus) in this workstation and it will become a end product before.
And it had an important mission. It guide a product manufacture specification that use it to check optics data and set an quality level for this product.
After, this product will to go to final visual inspection of workstation to decide view level.
Both optics and view level to decide end product final level of quality.
Well, we can see both production and quality information in system panel anytime. let us full control and management this factory to be best.
After end producing, we have second work must to do.
More defective products must to be analytics. if we have no any data, we can not do this job. if we can not, those will add more cost on our operating, and we can not to control quality of production, and our customers maybe feeback more problem to us and we can not find out any troubleshooting.

More important, we can to formulate a right action to control or find out the problem.
Warehouse Management System Part2 料件管理
庫存的管理,採用購物車的方式,讓來領用的人員,不論是生手或熟手,都可以按圖辨識是否他需要的料件。
點擊料件後,可以詳細的看更大的圖片及料件的資訊,依下圖的資訊可以知道,此料件由系統來依照>系統庫存量決策>料件安全存量+領用量+交期+重要性,來決定購買時機、購買量及交期。
當料件低於安全存量的%(x整體庫存策略%)之多少時會由系統採用觸發方式計算出要購買的量及交期,另會增加近期領用情況,若有大幅領用時,會增加購量,反之則減少購量。
最後配合重要性是否必買及交期的長久,是否要多買或少買及指定的交期日是那一天。
使用公式約略如: 購買決策 * (購買量 > 單筆採購最低量) = 料件安全庫存量 * 整體庫存策略 * 領用率(領用量 / 安全庫存量)
當然還有其他資訊參考,如上次盤點時間、系統CHECK時間、修改時間、上次購買的日期與數量,以及使用在那些設備上。
並且使用購物車的方式讓USER快速的選擇他要使用的零件,結算時就產成領料列表,完成領用後就進行扣帳及記錄。
並且列出各主類別的料件,可以快速的知道有那些料件,也可以知道1廠庫存量及2廠或另外其他廠的庫存量,以便調料,達到料件料號整合,不致於有同料多號、同料不同廠庫存的情況,有效的降低料件庫存及週轉率。
部份的料件是可以循環或再生使用、維修使用,這樣的料件就進入維修管理系統中,管制每料號的庫存品進出廠維修的情況,讓該料號的庫存可以同品出同品進,防止該品項被調換,進而可以計算出維修次數及分析(應用於異常維修,可能是其他原因造成設備連續或同情況損壞,或是評估該件品已達維修次數不堪再維修使用,應改買新品使用,或是維修費用超過該品件的1/2應進行報廢等等,還有保固的分析,可以節省大量的維修費用),追蹤每件料件出廠維修的時間、維修的內容、費用的申請核鎖及回廠的時間,並將這些資訊應用在分析上進而提供決策用。
庫存的料件,除了維修便還有借用情況,管制調借的流程及資訊,避免借出後即成為呆帳。
料件經分析後不再有維修的價值,即進行報廢的處理,並予以記錄,有效管制報廢品。
另外,還寫了儲位管理,透過建立料件時所給的尺寸、及數量,在已建立的儲位資料中,系統可以告知這樣的料件及量可以自動配置暨有的空儲位,不用人工去找去搜尋,並且按儲位表去調出每個位置的料件資訊,可應用在大型的庫儲品,不用跑到儲位上去看是什麼料件有多少量或是什麼樣子,除了熟手可以更快取得儲位內的料件資訊外,更易於新手取得這樣的資訊。
2013年9月13日 星期五
Warehouse Management System Part1-庫存盤點
為了提昇盤點的速度、準確度及帳目管理,當時購置了一台約一萬五至二萬左右的離線盤點機,機器可以提供電子檔下載及上傳。
上傳後可以利用盤點機掃描Barcode或輸入料號後,進行手動或連續盤點,手動就是沒有條碼時輸入料號,自動就是掃描條碼,然後輸入庫存量,待所有料件清點完後即可將儲存在盤點機的資料下載,再透過程式進行帳目校對,比對差異或列出帳目。
校對帳目完成後,當然是要輸出總帳冊進行結算囉。這樣的功能大約是2005年時就撰寫的,用以應付資本額超過十億的電子工廠全廠設備料件的庫存盤存管理。
上傳後可以利用盤點機掃描Barcode或輸入料號後,進行手動或連續盤點,手動就是沒有條碼時輸入料號,自動就是掃描條碼,然後輸入庫存量,待所有料件清點完後即可將儲存在盤點機的資料下載,再透過程式進行帳目校對,比對差異或列出帳目。
將盤點好的資料由盤點機下載後開始進行帳目校對,當然可以應用在差異比對、或任何的應用上,但主要對庫存盤點工作進行改善,三千多項三萬多件可以在單人只花二小時盤點完成,並獨立完成帳目差異比對及庫存帳目核對,大幅提昇工作效率並可提昇精確度。
2012年9月8日 星期六
zend studio
- download from www.zend.com
- install Zend Studio trial on mac
- open zend studio
- change encoding
- open Preferences>General>Workspace
- see "Text file encoding" and modify it to utf-8
- hide .svn
- right click item
- Build Path -> Configure Inclusion / Exclusion Filters… .
- in "Exclusion patterns" click add and keyin "**/.svn/" before click ok button
- click finish button
- install language package
- click help and install new software
- keyin "http://archive.eclipse.org/technology/babel/update-site/R0.9.1/helios/" in work with and enter to waiting pending
- pending finish will list more package let you choose
- checkbox "Babel Language Packs in [language name]", click next
- click allow or finish to waiting for install package
2011年11月8日 星期二
MDB2 Error: not found
已安裝PEAR及MDB2
並使用MDB2連結資料庫後,發生 MDB2 Error: not found
主要是未安裝相對應的Driver(如MDB2_Driver_datatype)
SAMPLE CODE
require_once 'System.php';
require_once 'MDB2.php';
$dsn = array(
'phptype' => 'mysqli',
'username' => 'usr',
'password' => 'psw',
'hostspec' => 'localhost',
'database' => 'db',
);
$mdb2 = MDB2 :: connect($dsn);
echo '
mdb2=' . $mdb2; // on screen is MDB2 Error: not found 請Telnet至主機並進入 opt/share/pear 輸入 # pear install MDB2_Driver_mysql(i) ,若發生pear/MDB2_Driver_mysqli requires PHP extension "mysqli"時,則改以下輸入並安裝即可正常使用 輸入 # pear install -f MDB2_Driver_mysql(i)
mdb2=' . $mdb2; // on screen is MDB2 Error: not found 請Telnet至主機並進入 opt/share/pear 輸入 # pear install MDB2_Driver_mysql(i) ,若發生pear/MDB2_Driver_mysqli requires PHP extension "mysqli"時,則改以下輸入並安裝即可正常使用 輸入 # pear install -f MDB2_Driver_mysql(i)
2011年10月14日 星期五
QNAP NAS active php and install pear & package
Active Web Server
INSTALL IPKG of QPKG
Active TELNET and login server, command # ipkg install php-pear
modify php.ini at include_path ="/opt/share/pear/";
in telnet, goto /opt/share/pear, and command # pear install MDB2 (sample) to install package
INSTALL IPKG of QPKG
Active TELNET and login server, command # ipkg install php-pear
modify php.ini at include_path ="/opt/share/pear/";
in telnet, goto /opt/share/pear, and command # pear install MDB2 (sample) to install package
2010年11月20日 星期六
MySQLi
在新的一代中PHP與MySQL可以採用MySQLi來進行資料庫連結
若要使用MySQLi必須在php環境中載入mysqli的dll,在主機設定的方式為php.ini 檔內將php_mysqli.dll前的;分號去除
後重新開機即可完成載入,再用phpinfo()查看即可確認函數是否正確裝載於php環境
在這裡 由於開發環境採用 PHP 5.2.6 + MySQL6.0.x 所以以MySQLi來解說及進行
二者最大不同的是MySQLi可以以物件導向進行連結及資料存取,非常方便
只有在連續取出資料時,可能要自已寫一段資料陣列取出,不寫也是可以
首先必須設置 資料庫的主機位置dbhost、資料庫名稱dbname、資料庫使用者帳戶dbuser、資料庫密碼dbpswd
使用函數為
mysqli_connect().
以物件方式進行連結
$mysqli = new mysqli($dbhost, $dbuser, $dbpswd, $dbname);
確認資料庫是否連結 使用函數為 mysqli_connect_error(),以下為物件寫法
if ( $error = $mysqli->connect_error )
{
printf("無法連結,錯誤訊息為: ", $error);
exit;
}
else
{
printf("連結成功,主機資訊為: ", $mysqli->host_info);
}
關閉資料庫連結 使用函數為 mysqli_close();以物件寫法如下
$mysqli->close();
當然在連結前也可以使用ping這個函數來確認資料庫主機是否存在或是在長時間的等待中,用ping來持續連結等等
將會另外介紹
若要使用MySQLi必須在php環境中載入mysqli的dll,在主機設定的方式為php.ini 檔內將php_mysqli.dll前的;分號去除
後重新開機即可完成載入,再用phpinfo()查看即可確認函數是否正確裝載於php環境
在這裡 由於開發環境採用 PHP 5.2.6 + MySQL6.0.x 所以以MySQLi來解說及進行
二者最大不同的是MySQLi可以以物件導向進行連結及資料存取,非常方便
只有在連續取出資料時,可能要自已寫一段資料陣列取出,不寫也是可以
首先必須設置 資料庫的主機位置dbhost、資料庫名稱dbname、資料庫使用者帳戶dbuser、資料庫密碼dbpswd
使用函數為
mysqli_connect().
以物件方式進行連結
$mysqli = new mysqli($dbhost, $dbuser, $dbpswd, $dbname);
確認資料庫是否連結 使用函數為 mysqli_connect_error(),以下為物件寫法
if ( $error = $mysqli->connect_error )
{
printf("無法連結,錯誤訊息為: ", $error);
exit;
}
else
{
printf("連結成功,主機資訊為: ", $mysqli->host_info);
}
關閉資料庫連結 使用函數為 mysqli_close();以物件寫法如下
$mysqli->close();
當然在連結前也可以使用ping這個函數來確認資料庫主機是否存在或是在長時間的等待中,用ping來持續連結等等
將會另外介紹
PHP取得使用者ip
在php中要取得瀏覽者的ip可以使用下述方式進行取得
$user = new user();
$user->userip();
$user->user_ip; // 取得ip
當瀏覽者正在觀看你的網站時,ip位置主要由SERVER全區域變數中的(未使用proxy)REMOTE_ADDR(字串)及(使用proxy)HTTP_X_FORWARDED_FOR(陣列,連入方式由0至最未到達之ip)存放,可使用判別後取出即可
class user
{ public function userip()
{
if( empty($_SERVER['HTTP_X_FORWARDED_FOR']) )
{
$this->user_ip = $_SERVER['REMOTE_ADDR'];
}
else
{
$user_ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$this->user_ip = $user_ip[0];
}
return $this->user_ip;
}
}
phpmyadmin
- 至官方網站下載套件 phpmyadmin.net
- 下載後解壓縮並移至web root下,建議改為較易記名稱如 phpmyadmin
- 開啟瀏覽器 輸入 http://localhost/phpmyadmin/ 後即可輸入帳號(root)、密碼登入
- 訊息:若出現 mcrypt模組未載入,請開啟php.ini將php_mcrypt.dll模組載入即可
- 訊息: 若出現 設定檔案現在需要密碼 (passphrase) (blowfish_secret)
- 請將phpmyadmin目錄下的config.sample.ini.php改為config.ini.php
- 開啟config.ini.php後修改 $cfg['blowfish_secret'] 後設為你 phpmyadmin 入口網址
- 修改 $cfg['Servers'][$i]['auth_type'] 後為 http 即可
- 另外若本機有啟動mysqli模組可將 $cfg['Servers'][$i]['extension'] 後修改為 mysqli
- 訊息: 若出現 Your PHP MySQL library version 5.0.19 differs from your MySQL server version 6.0.9. This may cause unpredictable behavior.則為php 的mysql lib函式,尚未支援此mysql的版本,有可能會發生不預期的問題,通常裝mysql6的都會有這個訊息
2010年8月11日 星期三
php x64 for ws2k8 & w7
PHP Module Installation
Open [IIS]
1.Open [Default Document], Add [index.php]
2.Open [Handler Mappings], Add [Add Script Map]
A.Set Request Path : [*.php]
B.Set Executable : [C:\php5\php5isapi.dll]
C.Set Name : [php5]
3.Open [ISAPI and CGI Restriction], Add
A.Set ISAPI or CGI Path : [C:\php5\php5isapi.dll]
B.Set Description : [php5]
C.Set Allow extension path to execute : [v]
Open [IIS]
1.Open [Default Document], Add [index.php]
2.Open [Handler Mappings], Add [Add Script Map]
A.Set Request Path : [*.php]
B.Set Executable : [C:\php5\php5isapi.dll]
C.Set Name : [php5]
3.Open [ISAPI and CGI Restriction], Add
A.Set ISAPI or CGI Path : [C:\php5\php5isapi.dll]
B.Set Description : [php5]
C.Set Allow extension path to execute : [v]
2010年8月9日 星期一
php x64
1.首先至 http://www.fusionxlan.com 下載 phpx64 5.2.5版,然後解壓後,安裝於根目錄下如 c:\php\
2.將 c:\php 目錄授予 (iis)iusr_machinename 讀取權限
3.修改 c:\php\ 下的 php.ini-recommended 文件為 php.ini,並修改內容的 extension_dir 設為 "c:\php\ext"
4.在windows設置環境參數
(1)開始->控制台->系統->進階->環境參數->系統變數
(2)編輯變數path,在最末端加入;c:\php
(3)新增變數PHPRC,值為c:\php(php.ini所在絕對路徑)
(4)重新啟動伺服器
5.請設置iis以64bin執行,若已變更為32bit請參考此篇調整回 http://support.microsoft.com/kb/894435 MS KB article 894435:
6.開啟iis管理介面
(1)開啟「網頁服務延伸 」,新增延伸名為 php 並允許
(2)新增檔案路徑為 C:\php\php5isapi.dll
(3)重新啟動伺服器
7.開啟iis管理介面
(1)開啟「預設的網站」->內容->主目錄->應用程式設定->設定
(2)新增一個應用程式副檔名,執行檔為 C:\php\php5isapi.dll,副檔名為 .php
(3)設定文件,新增 index.php
8.設定要啟動的php模組
(1)如 ;extension=php_bz2.dll 去除;號如 extension=php_bz2.dll
(2)已知無法正確啟動的模組有 php_curl.dll、php_oci8.dll、php_pdo_oci.dll
9.安裝 http://www.microsoft.com/downloads/details.aspx?familyid=90548130-4468-4BBC-9673-D6ACABD5D13B&displaylang=zh-tw 套件才不會產生sidebyside的錯誤且無法運作php
[ Posted from yuan's iPhone]
2.將 c:\php 目錄授予 (iis)iusr_machinename 讀取權限
3.修改 c:\php\ 下的 php.ini-recommended 文件為 php.ini,並修改內容的 extension_dir 設為 "c:\php\ext"
4.在windows設置環境參數
(1)開始->控制台->系統->進階->環境參數->系統變數
(2)編輯變數path,在最末端加入;c:\php
(3)新增變數PHPRC,值為c:\php(php.ini所在絕對路徑)
(4)重新啟動伺服器
5.請設置iis以64bin執行,若已變更為32bit請參考此篇調整回 http://support.microsoft.com/kb/894435 MS KB article 894435:
6.開啟iis管理介面
(1)開啟「網頁服務延伸 」,新增延伸名為 php 並允許
(2)新增檔案路徑為 C:\php\php5isapi.dll
(3)重新啟動伺服器
7.開啟iis管理介面
(1)開啟「預設的網站」->內容->主目錄->應用程式設定->設定
(2)新增一個應用程式副檔名,執行檔為 C:\php\php5isapi.dll,副檔名為 .php
(3)設定文件,新增 index.php
8.設定要啟動的php模組
(1)如 ;extension=php_bz2.dll 去除;號如 extension=php_bz2.dll
(2)已知無法正確啟動的模組有 php_curl.dll、php_oci8.dll、php_pdo_oci.dll
9.安裝 http://www.microsoft.com/downloads/details.aspx?familyid=90548130-4468-4BBC-9673-D6ACABD5D13B&displaylang=zh-tw 套件才不會產生sidebyside的錯誤且無法運作php
[ Posted from yuan's iPhone]
訂閱:
文章 (Atom)