發表文章

xampp Apache 設定 access.log

設定access.log以天數分割檔案,如: access-2020-10-29.log 1. 開啟httpd.conf 2. 找到access.log配置項目 3. 將設定改成 4. CustomLog "|bin/rotatelogs.exe -l E:/logs/access/access-%Y-%m-%d.log 86400" common 設定access.log的format 參考配置項目: http://httpd.apache.org/docs/current/mod/mod_log_config.html https://httpd.apache.org/docs/2.4/logs.html log format標準 Common Log Format "%h %l %u %t \"%r\" %>s %b" Combined Log Format "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" elf (Extended Log File Format)  rotatelogs .exe apache log能做到這些是是因為使用了rotatelogs .exe。 rotatelogs 是日誌切割工具。 文件: https://httpd.apache.org/docs/2.4/programs/rotatelogs.html

windows server 2012環境下fast cgi php程序終止問題

在windows server 2012環境下安裝fast cgi php(php-cgi.exe) 在ngnix server上運行網站時, 遇到網站執行約500次get請求或是post請求發生 php自動中斷的問題 解決方式 : 在windows終端機上打: C:\Users\<path>\ > SET PHP_FCGI_MAX_REQUESTS = 0 即可正確執行 參考: https://stackoverflow.com/questions/12487147/php-cgi-exe-quits-after-exactly-500-hits GOOGLE 關鍵字: php-cgi stop auto windows

CSS: 附加Logo在圖片上

CSS: 使用afrer偽元素 附加Logo在圖片上 第一種: {$class}:after {     content: url('logo.png'); } 可能不適用在IE7 第二種: {$class}:after {     background-image: url('logo.png');     background-size: 10px 20px;  /*  需要跟下面的width 和 height 一樣*/     position: absolute;     right: 5px;  /*  右上角  */     display: inline-block;     width: 10px;     height: 20px;     content:""; } 參考: https://stackoverflow.com/questions/8977957/can-i-change-the-height-of-an-image-in-css-before-after-pseudo-elements https://stackoverflow.com/questions/946403/insert-image-after-each-list-item GOOGLE關鍵字: css content image after

Node.js 在azure windows系統下 發生listen EACCES 0.0.0.0:80的錯誤

圖片
Node.js 在azure windows系統下 發生listen EACCES 0.0.0.0:80的錯誤 錯誤訊息: 沒有使用port 80的權限 可能原因 1: port 80被其他程式佔住, 需要檢察系統80 port 的使用. 但 node js有另外一個錯誤形式, EADDRINUSE, 如果是占用應該出現這個錯誤 使用指令: netstat -aon 或  netstat -anb (更詳細 包含進程名稱) 或 netstat -aon | findstr :80 (針對port 80) 可能原因 2: IIS server 或相關套件 block住(不一定是占用), 關掉IIS server 與相關程式 參考: http://stackoverflow.com/questions/19030371/run-node-js-webbapp-on-80-port-on-windows 可能原因 3 : (解決問題) 被有使用http的程式block住,  http使用的port是80, 所以可嘗試關掉所有的http程式 最後是關掉一個程式, 叫做W3SVC (World Wide Web Publishing Service)解決問題 可以看到W3SVC 的group是 iissvcs 也是屬於iis相關的程式

mongodb aggregate 筆記

aggregate 為mongodb整合計算的function 以下引用官網的例子: https://docs.mongodb.com/manual/reference/operator/aggregation/match/ { "_id" : ObjectId ( "512bc95fe835e68f199c8686" ), "author" : "dave" , "score" : 80 , "views" : 100 } { "_id" : ObjectId ( "512bc962e835e68f199c8687" ), "author" : "dave" , "score" : 85 , "views" : 521 } { "_id" : ObjectId ( "55f5a192d4bede9ac365b257" ), "author" : "ahn" , "score" : 60 , "views" : 1000 } { "_id" : ObjectId ( "55f5a192d4bede9ac365b258" ), "author" : "li" , "score" : 55 , "views" : 5000 } { "_id" : ObjectId ( "55f5a1d3d4bede9ac365b259" ), "author" : "annT" , "score" : 60 , "views" : 50 } { ...

Jquery在form表單利用submit取得所有的inputs

按下submit後將表格內的所有input讀取出並轉成json格式 示意表格(簡化): <form name="demo-form" id="test">     <div>         <label>Full Name  :</label>         <input name="fullname" />    </div>  <div>         <label>Email :</label>         <input name="email" />    </div>  <div>         <label>Address  :</label>         <input name="address" />    </div>  <div>         <label>Phone :</label>         <input name="phone" />    </div>  <div>         <label>Fax:</label>         <input name="fax" />    </div>  <div>       ...

mongodb shell 操作

最下面放很有價值的參考連結。 mysql專有名詞對應: SQL MongoDB database database table collection row document column field 新增使用者 db.createUser()  註: addUser為前幾版的mongo指令 ex: db.createUser(    {      user: "admin",      pwd: "1111",      roles: [  { role: "userAdminAnyDatabase", db: "admin" } ]    } ) 重要:剛開始一個資料庫只能新增一個user,若新增第2個或是下達其他的指令,則會發生權限不足的問題,必須先用db.auth()登入資料庫才能獲得權限,一般的roles指定為readWrite,db必須要指定目前所在的db名稱。 若要查看roles種類,以下網址: https://docs.mongodb.com/v3.2/reference/built-in-roles/#database-user-roles use db_name 進入資料庫 查看使用者: show users 查看資料表: show collections 查看所有的資料庫 show databases 註:只會顯示有放資料的資料庫 創建資料庫 use db_name  註:只要insert一筆資料就可以在show databases上看到 創建資料表: mongodb為 Schema Free,所以不需預先創造資料表、欄位等。 db.createCollection("TableTest") 詳細createCollection規範,以下網址: https://docs.mongodb.com/v3.2/reference/method/db.createCollection/#definition 更新使用者 db.updateUser() ...