tag:blogger.com,1999:blog-42263730139930357962024-03-14T01:01:29.520-07:00Dylan House讓我們一起探討程式技術、專案管理及工作生活,在這個知識的土地一點一滴地播種,共同學習成長。Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-4226373013993035796.post-2066512577251890552021-09-09T08:14:00.004-07:002021-09-09T08:24:23.158-07:00關於我<p> </p><h2>謝志豪 Dylan</h2><h3>已婚且有一個小孩,現在兩歲快三歲~</h3><div class="separator" style="clear: both; text-align: center;"><div style="text-align: left;"><a href="https://i.imgur.com/BVG03GW.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="800" data-original-width="601" height="320" src="https://i.imgur.com/BVG03GW.jpg" width="240" /></a><a href="https://i.imgur.com/z6gSTpA.jpg" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="800" data-original-width="600" height="320" src="https://i.imgur.com/z6gSTpA.jpg" width="240" /></a></div><br /></div><h3>緯創資通 2020-2021</h3><p>與團隊在這一、兩年裡 開發一數位轉型專案,透過流程再造並打破軟、硬體部門間的資訊隔閡,</p><p>使兩團隊的資訊可以融合,提前找出生產問題,進而減少生產時發生錯誤</p><div class="separator" style="clear: both; text-align: center;"><div style="text-align: left;"><a href="https://i.imgur.com/bC7nPwG.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="800" data-original-width="600" height="200" src="https://i.imgur.com/bC7nPwG.jpg" width="150" /></a> <a href="https://i.imgur.com/jeRgWgx.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="800" height="240" src="https://i.imgur.com/jeRgWgx.jpg" width="320" /></a></div></div><h3>PATTA 2018-2020</h3><p>進去後與夥伴推動導入軟體版本控制-GIT</p><p>三個月內改善一個每三天就會當掉的請款系統</p><p>偶而跟著老闆一起做公益</p><p><a href="https://i.imgur.com/WQP9DmW.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="800" height="150" src="https://i.imgur.com/WQP9DmW.jpg" width="200" /></a> <a href="https://i.imgur.com/xPOSbk4.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="533" data-original-width="800" height="213" src="https://i.imgur.com/xPOSbk4.jpg" width="320" /></a></p><h3 style="clear: both;">鴻海精密 2009-2017</h3><p>跑北京,最後跑去上海推電動車分時租賃系統</p><h4>電動車分時租賃系統</h4><p>主要負責"電樁模組"與各充電樁廠商間談協議及數據交換</p><h4>人資招募系統</h4><p>主要負責SA/SD 協助團隊,收集需求以完成用戶(人資)期望</p><h4>一卡通系統-食勤模組</h4><p>主要負責SA/SD 協助團隊,收集需求以完成用戶(總務)期望</p><div class="separator" style="clear: both;"><a href="https://i.imgur.com/wtpKVfj.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="600" data-original-width="800" height="150" src="https://i.imgur.com/wtpKVfj.jpg" width="200" /></a> <a href="https://i.imgur.com/UmXVADT.jpg" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="600" data-original-width="800" height="150" src="https://i.imgur.com/UmXVADT.jpg" width="200" /></a></div><div class="separator" style="clear: both;"><br /></div><h3>個人專長</h3><h4>Project management : </h4><div>Microsoft Project、Visio、Xmind、Axure</div><h4>Programing : </h4><div>NodeJS、C#、Java、PHP </div><h4>Web Server: </h4><div>IIS、Tomcat、GlassFish、Apache</div><h4>Virtualization : </h4><div>VirtualBox、Docker</div><h4>Database : </h4><div>MySQL、PostgreSQL、MSSQL、Oracle</div><div><br /></div><h4 style="text-align: left;"><span face="Arial, MsJhengHeiBold, 微軟正黑體, "Microsoft JhengHei", Roboto, PingFangTC, sans-serif" style="background-color: white; color: #292929; font-size: 16px; white-space: pre-wrap;">平常休閒娛樂</span></h4><p><span face="Arial, MsJhengHeiBold, 微軟正黑體, "Microsoft JhengHei", Roboto, PingFangTC, sans-serif" style="background-color: white; color: #292929; font-size: 16px; white-space: pre-wrap;">打籃球及旅行,藉此抒解忙碌工作的心情並且增進與人之間的互動</span></p>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-1981144474123222392017-05-15T20:57:00.002-07:002017-05-15T20:59:23.829-07:00SSH Login without user password<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
若是希望能夠透過 SSH 工具,在不Key-in 登入密碼方式,從服務器 A 登入至服務器 B,可透過下圖方式,事先將服務器 A 上用戶公開金鑰,告知服務器 B 執行帳戶,同意來自服務器 A的用戶登入操作,則可以使服務器在無登入密碼,從 Server A 登入至 Server B</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaICA1dO16iFF5zMXB_lJtR9i9Mg_GlgdFubXCAIlsuLBJN659hyphenhyphenCdvk52dVQLntCWWk7ZFpLSnq4kFbhmUiYWcSLRFc1yAt4NVnZ1LA0tmuhSluhNm7utz-tYfW1gqcfbb_B0dM36q_c/s1600/ssh_login_without_pwd.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaICA1dO16iFF5zMXB_lJtR9i9Mg_GlgdFubXCAIlsuLBJN659hyphenhyphenCdvk52dVQLntCWWk7ZFpLSnq4kFbhmUiYWcSLRFc1yAt4NVnZ1LA0tmuhSluhNm7utz-tYfW1gqcfbb_B0dM36q_c/s400/ssh_login_without_pwd.png" width="400" /></a></div>
<br />
<br />
如何產生 id_rsa.pub<br />
> ssh-keygen<br />
<br />
一路 Enter 下一步,接著就會產生 ~/.ssh/ 目錄,及兩個檔案<br />
~/.ssh/id_rsa<br />
~/.ssh/id_rsa.pubDylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-75350279094679344022016-01-16T00:15:00.000-08:002016-01-16T00:15:20.379-08:00計畫趕不上變化,那還要計畫嗎 ?<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="font-size: 13.92px; line-height: 19.488px;">在智庫裡提到</span></div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="font-size: 13.92px; line-height: 19.488px;">計劃不是</span><a href="http://wiki.mbalib.com/zh-tw/%E9%9A%8F%E6%84%8F%E6%83%B3%E8%B1%A1" style="color: #173abd; font-size: 13.92px; line-height: 19.488px; margin: 0px; text-decoration: none;" title="随意想象">隨意想象</a><span style="font-size: 13.92px; line-height: 19.488px;">而來的,它應該是對歷史數據和行為的歸納、分析、總結後做出的前瞻性安排。</span></div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
我們常常會說“船到橋頭自然直”,會依靠聰明和隨機應變,並據此創造出“計劃沒有變化快”,沒有認真做規劃、做計劃的習慣,沒有詳細記錄歷史數據的習慣。憑藉腦子中僅有的一點信息,我們就能做出自己或單位明天、下一個月、明年的計劃。久而久之就沒有人相信計划了。依據“船到橋頭自然直”去撞去碰,有時我們也能做得很成功,因為我們有比電腦還靈的腦袋。但是我們如果養成對歷史不記錄、不分析,對未來不<a href="http://wiki.mbalib.com/zh-tw/%E9%A2%84%E6%B5%8B" style="color: #173abd; margin: 0px; text-decoration: none;" title="预测">預測</a>、不計劃的生活、工作習慣,僅僅憑藉聰明來對付有備而來的對手,走向失敗就成了必然。</div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
在<a href="http://wiki.mbalib.com/zh-tw/%E7%AE%A1%E7%90%86%E5%AD%A6" style="color: #173abd; margin: 0px; text-decoration: none;" title="管理学">管理學</a>中,計划具有兩重含義,其一是<a href="http://wiki.mbalib.com/zh-tw/%E8%AE%A1%E5%88%92%E5%B7%A5%E4%BD%9C" style="color: #173abd; margin: 0px; text-decoration: none;" title="计划工作">計劃工作</a>,是指根據對<a href="http://wiki.mbalib.com/zh-tw/%E7%BB%84%E7%BB%87%E5%A4%96%E9%83%A8%E7%8E%AF%E5%A2%83" style="color: #173abd; margin: 0px; text-decoration: none;" title="组织外部环境">組織外部環境</a>與內部條件的分析,提出在未來一定時期內要達到的<a href="http://wiki.mbalib.com/zh-tw/%E7%BB%84%E7%BB%87%E7%9B%AE%E6%A0%87" style="color: #173abd; margin: 0px; text-decoration: none;" title="组织目标">組織目標</a>以及實現目標的方案途徑。其二是計劃形式,是指用文字和指標等形式所表述的<a href="http://wiki.mbalib.com/zh-tw/%E7%BB%84%E7%BB%87" style="color: #173abd; margin: 0px; text-decoration: none;" title="组织">組織</a>以及組織內不同部門和不同成員,在未來一定時期內關於行動方向、內容和方式安排的管理事件。無論是計劃工作還是計劃形式,計劃都是根據社會的需要以及組織的自身能力,通過計劃的編製、執行和檢查,確定組織在一定時期內的奮鬥目標,有效地利用組織的人力、物力、<a href="http://wiki.mbalib.com/zh-tw/%E8%B4%A2%E5%8A%9B" style="color: #173abd; margin: 0px; text-decoration: none;" title="财力">財力</a>等<a href="http://wiki.mbalib.com/zh-tw/%E8%B5%84%E6%BA%90" style="color: #173abd; margin: 0px; text-decoration: none;" title="资源">資源</a>,協調安排好組織的各項活動,取得最佳的<a href="http://wiki.mbalib.com/zh-tw/%E7%BB%8F%E6%B5%8E%E6%95%88%E7%9B%8A" style="color: #173abd; margin: 0px; text-decoration: none;" title="经济效益">經濟效益</a>和社會效益。</div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
可以把計劃的內容簡要地概括為八個方面,即:What(什麼)——計劃的目的、內容;Who(誰)——計劃的相關人員; Where(何處)——計劃的實施場所;When(何時)——計劃實施的時間範圍;Why(為什麼)——計劃的緣由、前景;How(如何)——計劃的方法和運轉實施;How much(多少)——計劃的預算;Effect(效果)——預測計劃實施的結果、效果。被稱為“<a href="http://wiki.mbalib.com/zh-tw/5W2H1E" style="color: #173abd; margin: 0px; text-decoration: none;" title="5W2H1E">5W2H1E</a> ”。<br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggFe8qiwDuTw7RHV0HIDcFX-Hyu1G4OPnKOf_OhFUudwxGBtDt0Ep4A61PdSlRcXkSh8GQTv0t9HDKOLETwmYmbdVuQJMq93DlytkflTZ5o-95iW2mYo1UWVCRKjMxzrIfMc29A0Oeoqk/s1600/OragizationManagement.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggFe8qiwDuTw7RHV0HIDcFX-Hyu1G4OPnKOf_OhFUudwxGBtDt0Ep4A61PdSlRcXkSh8GQTv0t9HDKOLETwmYmbdVuQJMq93DlytkflTZ5o-95iW2mYo1UWVCRKjMxzrIfMc29A0Oeoqk/s320/OragizationManagement.jpg" width="320" /></a></div>
<br />
<br /></div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="font-size: 13.92px; line-height: 19.488px;">人們常說,計畫趕不上變化,變化趕不上老闆一句話。</span></div>
<div style="background-color: white; color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
計畫是一種紙上談兵的方式,每當有需要與團隊一同坐下來,一同談<span style="font-size: 13.92px; line-height: 19.488px;">談組織目標、發展方向時,</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">此</span><span style="background-color: transparent; font-size: 13.92px; line-height: 19.488px;"><span style="color: #333333; font-family: sans-serif;">刻,</span></span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">我們必須有一明確、清楚目標、標的,也許僅僅是一張圖、幾個文字。</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">計畫是一個方向,一個團隊奮鬥的方向,</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">計畫的產生,如智庫提到的,是經過長時間的數據蒐集、市場分析,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">在加上老闆多年來的市場經驗,</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">因而誕生的。在這計畫的關係人有三種,造物者(老闆)、執行者、旁觀者。</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">造物者:老闆、也許是出資者( </span><span style="font-family: 'helvetica neue', helvetica, arial, 'microsoft jhenghei', 'Heiti TC', sans-serif; font-size: 13px; line-height: 19.5px;">financier </span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">),總之就是那群出錢是大爺的傢伙,沒啥好說。</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">不如談談執行者,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">積極的執行者會當它是作戰計畫,只要是可以滿足我們發展方向的需要,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">就會想法子去闖闖、試試,即使紙上沒有提到。</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">反觀,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">消極</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">執行者,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">則會認為他是一個圈圈、框框,在某種時空下,將會侷限我們的發展,倘若紙上有提到,則會去試試 ,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">若是紙上沒提到,</span><span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">則不應該去做,拖泥帶水,最後這計畫,就會胎死腹中,不會有實現的那一天。</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span style="color: #333333; font-family: sans-serif; font-size: 13.92px; line-height: 19.488px;">旁觀者,當你從執行者,停滯下來的那一刻,你就成了旁觀者,永遠只能看秀的份...</span></div>
<div style="background-color: white; margin-bottom: 1em; margin-top: 1em; unicode-bidi: embed;">
<span id="goog_671095491"></span><span id="goog_671095492"></span><br /></div>
Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-38265984005390296632016-01-15T22:11:00.003-08:002016-01-15T22:13:04.569-08:00遇見在上海工作 20年的 sales<br />
<span style="font-family: Verdana, sans-serif;">一個人一生中會有多少個 20年... </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> 而這一次出差合作的夥伴,卻已經在這城市待上了一個 20年過去了....</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> 小孩也在這城市學習、成長 ...</span><br />
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLgv4KhWJzmyAyhczewmmnMwM88c93QMTOeBge4iY5urAphxn2ToY_cUUaDdUcDIN5jW-PNcvsqDkV9jFkuGJ2GBoy6MErOMJlwiSp6qS_kv85E-4no5DSP6oXJ1PNWibbIkaMbIUrRrw/s1600/IMG_3438.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLgv4KhWJzmyAyhczewmmnMwM88c93QMTOeBge4iY5urAphxn2ToY_cUUaDdUcDIN5jW-PNcvsqDkV9jFkuGJ2GBoy6MErOMJlwiSp6qS_kv85E-4no5DSP6oXJ1PNWibbIkaMbIUrRrw/s640/IMG_3438.JPG" width="480" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
這次出差,因為常與他合作一起跑客戶,所以有了幾次深度的對話,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
初階的Sales 賣東西只會比價錢 ...</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
好一點的會思考如何替客戶創造利益 ...</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Top Sales 會去思考客戶到心理追求的是什麼,我又如何提供給他,這個東西。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
做生意前,我會先去分析這個市場,誰是我的客戶,而這客戶要的是什麼,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
當我清楚知道這是他要的,我才知道應該怎麼去創造我們的利益。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Why me ?</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
在中國,不管待了多長時間,我始終都是一個外來者,人家為什麼要跟我做生意。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
憑什麼要跟我做生意,我有的是什麼,我能給的是什麼,我始終這麼問我自己,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
包含我的小孩,我也灌輸他一個觀念,Why me ? 如果你學習停下來了,內地小孩,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
逐漸和你平起平坐了,未來出社會,求職就業,人家為什麼要選擇你。</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDuMhzO115kzQ4ExkNt2r2XGRvzV8mhYipacMdYvfBZzkbiDDkSPomHBbH5gqqVJ06mGANRvrp9CKZK40DeKWROGqOwMvWsgcPOzBxbHooBzYgYI1lo51gxJTwwEpTybhSzsdWK6tiV1Y/s1600/IMG_3418.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDuMhzO115kzQ4ExkNt2r2XGRvzV8mhYipacMdYvfBZzkbiDDkSPomHBbH5gqqVJ06mGANRvrp9CKZK40DeKWROGqOwMvWsgcPOzBxbHooBzYgYI1lo51gxJTwwEpTybhSzsdWK6tiV1Y/s320/IMG_3418.JPG" width="240" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhnGgt61BQxv1RKUbZ5gjQTEOsha0J0j0iunmpZ_I0g_AI084rvUpahXo-4I6-tnW-Uwk2kEhnPWReOp3nzDHyGbJBE39zKVw-HYdqeVTZXtUV_FbHSpDwxOPeX8KM_RvZi7kQ-f8-i0/s1600/IMG_3421.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEhnGgt61BQxv1RKUbZ5gjQTEOsha0J0j0iunmpZ_I0g_AI084rvUpahXo-4I6-tnW-Uwk2kEhnPWReOp3nzDHyGbJBE39zKVw-HYdqeVTZXtUV_FbHSpDwxOPeX8KM_RvZi7kQ-f8-i0/s320/IMG_3421.JPG" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
在這裡,我經常會去觀察誰要的是什麼,藉由兩者間的歧異,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
就可以創造出一可運作空間。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
對此,親眼見識到,這位 Top Sales 如何運用公司招牌+三寸不爛之舌,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
以不花任何成本情況下,而讓兩個競爭者互相合作,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
甲出產品,乙施工安裝,丙以為是我們公司花錢建設的。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
最後,我問他 - 我是否也有Sales 的資質,別問我,應該問你自己...</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<br />Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-88900063941334424742015-03-21T02:59:00.000-07:002015-03-21T03:01:17.424-07:0020150321_ Big Data Seminar @中山大學<br />
今日早上 9 : 00 在中山大學一個嶄新的會議室,由日月光主辦邀請了來自南北兩間名校教授,為日月光公司員工及中山大學的學生們介紹,<br />
<br />
<span style="color: blue;"> <b>What's Big Data ?</b></span><br />
<br />
首先由清華大學 簡禎富教授 ,為大家分享 <b>結構性數據應用案例</b> : <br />
<br />
美國歐巴馬政府在 2014年 5月,<b>大數據白皮書(Big Data : Seizing Opportunities Preserving Values )</b> 中,將<span style="font-family: 新細明體, serif;">『<b>資料</b>』定義為</span><span style="font-family: 新細明體, serif;">『未來的新石油』,並且勾勒如何抓住機遇,創造最大價值。美國政府認為,一國擁有資料的</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>規模</b></span><span style="font-family: 新細明體, serif;">』、</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>靈活性</b></span><span style="font-family: 新細明體, serif;">』及</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>解釋運用</b></span><span style="font-family: 新細明體, serif;">』的能力,將成為綜合國力的重要成分;更把對資料的占有和控制,視作為</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>陸</b></span><span style="font-family: 新細明體, serif;">』、</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>海</b></span><span style="font-family: 新細明體, serif;">』、</span><span style="font-family: 新細明體, serif;">『<b>空</b></span><span style="font-family: 新細明體, serif;">』<b>權</b>之外的另一種國家核心資產。</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> 當我們收集回來了,500,000 筆原始數據,經過數據分析後,很可能只有 3,000 筆資料,對我們有及時的幫助;另外 497,000 筆的資料,在某些情況下分析後,還可以探究出部分的幫助。</span><br />
<b style="font-family: 新細明體, serif;"><br /></b>
<b style="font-family: 新細明體, serif;"> 資料挖礦</b><span style="font-family: 新細明體, serif;">與</span><b style="font-family: 新細明體, serif;">大數據分析</b><span style="font-family: 新細明體, serif;">的問題類型分為:</span><b style="font-family: 新細明體, serif;">分類、預測、分群、關聯規則</b><span style="font-family: 新細明體, serif;">。</span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiThLUk5Otx9mmYBGDOKsSP931zSz5cwQmb0-CYswE8-vDzd3Hf0QAuU2hyphenhyphenhlMFX527VtqpaTV94XH5HMd2GVWYwXogmP1Y6ME4YA9S5mvmky5sKYt-x9MPb3pbDmXRhLy2FXDcSm3kTkM/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+40+50.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"> <img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiThLUk5Otx9mmYBGDOKsSP931zSz5cwQmb0-CYswE8-vDzd3Hf0QAuU2hyphenhyphenhlMFX527VtqpaTV94XH5HMd2GVWYwXogmP1Y6ME4YA9S5mvmky5sKYt-x9MPb3pbDmXRhLy2FXDcSm3kTkM/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+40+50.jpg" height="300" width="400" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiThLUk5Otx9mmYBGDOKsSP931zSz5cwQmb0-CYswE8-vDzd3Hf0QAuU2hyphenhyphenhlMFX527VtqpaTV94XH5HMd2GVWYwXogmP1Y6ME4YA9S5mvmky5sKYt-x9MPb3pbDmXRhLy2FXDcSm3kTkM/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+40+50.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiThLUk5Otx9mmYBGDOKsSP931zSz5cwQmb0-CYswE8-vDzd3Hf0QAuU2hyphenhyphenhlMFX527VtqpaTV94XH5HMd2GVWYwXogmP1Y6ME4YA9S5mvmky5sKYt-x9MPb3pbDmXRhLy2FXDcSm3kTkM/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+40+50.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><br /></a></div>
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"><br /></span>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
大數據的特性<span style="font-family: 新細明體, serif;">:</span><br />
<span style="font-family: 新細明體, serif;"><b>巨量(Volume)、變動性(Velocity)、多樣性(Variety) 及真實性(Veracity)</b></span><br />
<br />
下半場則由中山大學 黃三益教授,為大家分享<b>非結構構化資料探勘與應用</b> :<br />
<br />
首先,教授為非結構做個定義<span style="font-family: 新細明體, serif;">:</span><span style="font-family: 新細明體, serif;">無法定義細部欄位 、不規則和模糊性 企業裡約有 70~80%的資料是非結構化的資料。</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> 談論到此,我個人突然走神了。回顧以前帶專案時,總是每週逼著工程師,一定要繳交工作進度回報,若是可以經過大數據收集、分析,也許可以向產線自動化管理般;工程師定期做專案開發進度回報,利用電腦自動追蹤進度,一發現進度未達預期時,可以很即時的呈現在PM的監控螢幕上,讓我可以很即時做一個風險控管,而不需要總是追著工程師問進度。</span><br />
<span style="font-family: 新細明體, serif;"> </span><br />
<span style="font-family: 新細明體, serif;"> 回來繼續非結構化資料,在數據探勘上,什麼數據來源我們要擷取,首先</span><span style="font-family: 新細明體, serif;">『<b>定義</b></span><span style="font-family: 新細明體, serif;"><b>資料來源</b></span><span style="font-family: 新細明體, serif;">』及</span><span style="font-family: 新細明體, serif;">『<b>訂定關鍵字找出相關文章</b></span><span style="font-family: 新細明體, serif;">』,在訂定關鍵字這裡,我們必須要定義</span><span style="font-family: 新細明體, serif;">『</span><b style="font-family: 新細明體, serif;">白名單</b><span style="font-family: 新細明體, serif;">』</span><b style="font-family: 新細明體, serif;">、</b><span style="font-family: 新細明體, serif;">『</span><b style="font-family: 新細明體, serif;">黑名單</b><span style="font-family: 新細明體, serif;">』,所謂的<b>白名單</b>,意旨什麼數據是我們要的,相反的<b>黑名單</b>則是什麼數據是我們不要的,舉例針對</span><span style="font-family: 新細明體, serif;">『</span><b style="font-family: 新細明體, serif;">日月光</b><span style="font-family: 新細明體, serif;">』公司,我們做收集輿論探討,而收集過程中,意外擷取到</span><span style="font-family: 新細明體, serif;">『</span><span style="font-family: 新細明體, serif;"><b>日月光家具公司</b></span><span style="font-family: 新細明體, serif;">』,則我們必須要進行增加黑名單做排除</span><span style="font-family: 新細明體, serif;">。</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> 如何找出文章裡的情緒,分別是<b>正面</b>及<b>負面</b>情緒詞,<b>形容詞</b> </span><span style="font-family: 新細明體, serif;">:</span><span style="font-family: 新細明體, serif;">好、壞、舒適及難過;<b>動詞</b></span><span style="font-family: 新細明體, serif;">:</span><span style="font-family: 新細明體, serif;">喜歡、討厭;<b>名詞</b>:門神、走路工。針對<b>不同領域</b>,正負面的情緒詞,意義很可能是相反,是我們必須要注意的:</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> 例如:股票昨天<span style="color: red;">飆高</span></span><br />
<span style="font-family: 新細明體, serif;"> </span><span style="font-family: 新細明體, serif;">昨天</span><span style="font-family: 新細明體, serif;">血壓<span style="color: red;">飆高</span></span><br />
<span style="font-family: 新細明體, serif;"><span style="color: red;"><br /></span></span>
<span style="font-family: 新細明體, serif;"> 最後教授與大家分享一個現實的案例,還蠻值得我們在做服務的人省思,過年時期,他們家族要來高雄遊玩,老師以在地人主動推薦一間哨船頭的住宿,然而,他大姊最後卻是選擇</span><br />
<span style="font-family: 新細明體, serif;">康橋商旅,原因是因為他大姊在網路上並沒有看到哨船頭住宿的評價,而是看到康橋商旅的許多正面上的評價。</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> 對此,我心有感觸的,希望盡快告訴正在搞服務的朋友,盡可能的定期到大家常去的論壇,挖掘是否有正面的評價。若是遲遲沒有評價,很可能是什麼環節出了問題,也或是我們與大眾們保持的距離實在是太遠了,應該好好思考如何改進,如何的拉近彼此關係。</span><br />
<span style="font-family: 新細明體, serif;"><br /></span>
<span style="font-family: 新細明體, serif;"> </span><br />
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: 新細明體, serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrpwcB7oSmzEqrLXD9EO-FstfmbhOzjQW6j6JjdMHL4i42fOzkUjOvclzQ3slFCRJlnIUqIqxRDDgDAYoUHzv0QlI-99h90FZUGp4w0UXEv-2BmOZUy5SlBxSchOZl3v6iVyz3MOTUAaQ/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+14+51.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrpwcB7oSmzEqrLXD9EO-FstfmbhOzjQW6j6JjdMHL4i42fOzkUjOvclzQ3slFCRJlnIUqIqxRDDgDAYoUHzv0QlI-99h90FZUGp4w0UXEv-2BmOZUy5SlBxSchOZl3v6iVyz3MOTUAaQ/s1600/%E7%9B%B8%E7%89%87+2015-3-21+16+14+51.jpg" height="400" width="300" /></a></span></div>
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgW_7dL0rMnLxf0dsZkfYfvWGsCIBuALcEafnuT6aOej4TPt0a_8zQf6MKUs7kBqm6pWgkQ7r8r3NZeyQ2_8PV_UCVPKLJycR-8B77_UGl63V0k0O6Zh1VXWAS_xshAClytNvZd2VwMrY/s1600/%E7%9B%B8%E7%89%87+2015-3-21+11+57+00.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgW_7dL0rMnLxf0dsZkfYfvWGsCIBuALcEafnuT6aOej4TPt0a_8zQf6MKUs7kBqm6pWgkQ7r8r3NZeyQ2_8PV_UCVPKLJycR-8B77_UGl63V0k0O6Zh1VXWAS_xshAClytNvZd2VwMrY/s1600/%E7%9B%B8%E7%89%87+2015-3-21+11+57+00.jpg" height="480" width="640" /></a><br />
<br />Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-30625926907288005082014-08-21T18:54:00.003-07:002014-08-21T18:57:46.126-07:00Google Map 設計開發_交通項目<br />
最近設計開發 GoogleMap ,在此做個簡單紀錄
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo9FTGSnvWAcNxAXK3ONPb85194azhxiDYlElp4cjOJ5vPpsEw0-bcNWFddDFpCBKLx4w2CZcfAGAezWEyjXkl7WvJLfMONxLnMWguRoV4eOiFmi54UPH5em5SQC7CXK8y9qdexuqEQck/s1600/MyImage.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgo9FTGSnvWAcNxAXK3ONPb85194azhxiDYlElp4cjOJ5vPpsEw0-bcNWFddDFpCBKLx4w2CZcfAGAezWEyjXkl7WvJLfMONxLnMWguRoV4eOiFmi54UPH5em5SQC7CXK8y9qdexuqEQck/s400/MyImage.png" height="336" width="400" /></a></div>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span style="color: #274e13;"><br /></span>
<span style="color: #274e13;"><br /></span>
<span style="color: #274e13;"><br /></span>
<span style="color: #274e13;"><br /></span>
<span style="color: #274e13;">1. 宣告 Google Map,並且初始化
</span><br />
<br />
<pre class="brush: php;" name="code"></pre>
<pre class="brush: php;" name="code">function initialize()
{
var mapOptions =
{
zoom: 16,
center: mapCenterSite,
//TYPE: HYBRID, ROADMAP, SATELLITE, TERRAIN
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
google.maps.event.addDomListener( map, 'click', function(event)
{
document.getElementById('divImageFile').style.visibility ='hidden';
});
initMarkers(); // 客製化標籤(略)
drawLine(map); // 客製化路線(略)
}
</pre>
<br />
<span style="color: #274e13;">2. 在 Google Map 上面,透過JS 繪製路徑
</span><br />
<span style="color: #274e13;"><br /></span>
<br />
<pre class="brush: php;" name="code"> /*
* 宣告 GoogleMap 路徑座標陣列
*/
arrayLatLng =
[
new google.maps.LatLng( x, y),
new google.maps.LatLng( endPos_x, endPos_y)
];
/*
* 利用 Polyline 將該路徑座標進行人工繪製
*/
LinePath_current = new google.maps.Polyline({
path: arrayLatLng,
geodesic: true,
strokeColor: '#019D54',
strokeOpacity: 1.0,
strokeWeight: 4
});
LinePath_current.setMap(map);
</pre>
Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-34403528085971723032014-07-09T19:15:00.002-07:002014-07-09T19:15:25.579-07:00簡易的網頁 CodeTemplate 測試
<pre>
<code class="prettyprint linenums">
class DylanHouse
{
String message = "DylanHouse Welcome";
public void printMessage()
{
System.out.println(message);
}
/* Bloger CodeStyle Example
http://pydoing.blogspot.com/
檔名:DylanHouse.java
功能:簡單的 Java 範例
作者:Dylan
時間:西元 2014 年 7 月 */
}
</code>
</pre>
<pre name="code" class="brush: java;">
class DylanHouse
{
String message = "DylanHouse Welcome";
public void printMessage()
{
System.out.println(message);
}
}
/* Bloger CodeStyle Example
http://pydoing.blogspot.com/
檔名:DylanHouse.java
功能:簡單的 Java 範例
作者:Dylan
時間:西元 2014 年 7 月 */
</pre>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-1836897756637719842014-01-10T18:55:00.001-08:002014-01-10T18:55:36.449-08:002013 重慶項目出差<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
趁著出差的沒事的週六, 在重慶的街道上閒晃,一路走阿走的,天空是灰矇矇的,</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7ejXJHVrHoqcu0pecanMauJub5ocDq4GSNzH0o5varF6EF8sATqQezM2954e4Alr7ZCHQxROLQMIAxYTw7ppDhKaddNxsodK5SvqgcZf1T4iXBux2WIdkpViBAXIm9EQRWGQKWqBXeVI/s1600/P1030465.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7ejXJHVrHoqcu0pecanMauJub5ocDq4GSNzH0o5varF6EF8sATqQezM2954e4Alr7ZCHQxROLQMIAxYTw7ppDhKaddNxsodK5SvqgcZf1T4iXBux2WIdkpViBAXIm9EQRWGQKWqBXeVI/s320/P1030465.JPG" height="240" width="320" /></a></div>
<br />
重慶的人們已經都起床了,因為今天是假日,車子很多<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2FGlEqs8xGW7-UFJcb6BovE8okuL7c2AVdk96XP1QyD5tyn8EtfLfRLUAk-t9AOnmEWKLDv0S35NQlnHlmkcS9BU_5jyn3XFqaCMIIHN_BeUJN_VhhCUIOf2Rka2IScVnhNsHvEppH8c/s1600/P1030459.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2FGlEqs8xGW7-UFJcb6BovE8okuL7c2AVdk96XP1QyD5tyn8EtfLfRLUAk-t9AOnmEWKLDv0S35NQlnHlmkcS9BU_5jyn3XFqaCMIIHN_BeUJN_VhhCUIOf2Rka2IScVnhNsHvEppH8c/s320/P1030459.JPG" height="320" width="240" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
話說這裡美人兒很多,可惜我來早了,水姑娘們都還沒出門</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEtnbMuDuOIqtqdn9rVM18BRzuVyejc4chFz1aB8p4kIa4B6ICcnW7_MfUg9PoCAVc85dKucZxD4sr1AYhWbRcPUzApX6_snqlcRPHtGyQuB30Jy8fXnYGBAuDbsfVjh34NkLFav05ARc/s1600/P1030453.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEtnbMuDuOIqtqdn9rVM18BRzuVyejc4chFz1aB8p4kIa4B6ICcnW7_MfUg9PoCAVc85dKucZxD4sr1AYhWbRcPUzApX6_snqlcRPHtGyQuB30Jy8fXnYGBAuDbsfVjh34NkLFav05ARc/s320/P1030453.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
喜歡這裡的寧靜、舒服</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuiPbEc4ksaKBxw6GTgYKPNsyyEfIRKlxyHe6iAbHiThn7sEvbgRgnJiy-vjOt5jJLvX9gex_-kNBW7xb2D_hUIUqAoidrlYTQ1N5G4i2wQZVINnJpahwtHY266whvWc4THrgGKmCbvtk/s1600/IMG_3328.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuiPbEc4ksaKBxw6GTgYKPNsyyEfIRKlxyHe6iAbHiThn7sEvbgRgnJiy-vjOt5jJLvX9gex_-kNBW7xb2D_hUIUqAoidrlYTQ1N5G4i2wQZVINnJpahwtHY266whvWc4THrgGKmCbvtk/s320/IMG_3328.JPG" height="239" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
在外地工作,總是需要一杯咖啡,好把心情沉澱下來,專心的工作</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgExuHLIru4eT8scBXrOGOL9B8HMfqeT-3cE2JUTAhWEFEcb8fpy-YNIjWQ8XbRvuOCt5jrOHGqp7niFqRZt-FmbkatEku5z5xnft0eQsHa57pOqqqkCdSeK8EMJmpzaZcgsO2ku0W7hJo/s1600/IMG_3329.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgExuHLIru4eT8scBXrOGOL9B8HMfqeT-3cE2JUTAhWEFEcb8fpy-YNIjWQ8XbRvuOCt5jrOHGqp7niFqRZt-FmbkatEku5z5xnft0eQsHa57pOqqqkCdSeK8EMJmpzaZcgsO2ku0W7hJo/s320/IMG_3329.JPG" height="320" width="239" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
早安重慶.....</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
一早的寧靜,重慶的人們應該還在休息,但是我得開始趕工製作 SRS,</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
否則這裡的客戶,應該會對我不客氣</div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjquPS1AgDFjNOkTNlCQvnqt8IveKSkiy2IpQW-e664JFB0Xhu2ENhOFNHXs4Ru9gm8-eW11jc2wMQkubw3xbrrYyYicIrOdthyphenhyphenbMLk9EquNx34XDRRV4F-SOwvpFUsZu5LVFH_PSjrlxE/s1600/P1030654.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjquPS1AgDFjNOkTNlCQvnqt8IveKSkiy2IpQW-e664JFB0Xhu2ENhOFNHXs4Ru9gm8-eW11jc2wMQkubw3xbrrYyYicIrOdthyphenhyphenbMLk9EquNx34XDRRV4F-SOwvpFUsZu5LVFH_PSjrlxE/s320/P1030654.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
好,你個劉老大,好久不見了,一切安好.....</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG2sfiD6NcCAwRGadBKtNxuZFYfgBIwNEhERMmFgwOdXxPynEiE76vIXgDasthB6xJn1ZQKEBEFNpNkTr-RKnO8i17boVAjFuM5vbl87Nnpw0pVfeZJG9PJnsrWzxwIpaCaFV3tUigDF8/s1600/P1030562.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG2sfiD6NcCAwRGadBKtNxuZFYfgBIwNEhERMmFgwOdXxPynEiE76vIXgDasthB6xJn1ZQKEBEFNpNkTr-RKnO8i17boVAjFuM5vbl87Nnpw0pVfeZJG9PJnsrWzxwIpaCaFV3tUigDF8/s320/P1030562.JPG" height="240" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
在外地和伙伴們一起圍爐吃羊肉 .... 爽 !! </div>
<br />Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-19408406676645064232012-10-26T23:12:00.000-07:002012-10-26T23:20:31.637-07:002012中國(鄭州)產業轉移系列對接活動<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
在出發前四天,Boss 走來我座位附近,和大夥討論這次的展覽必須要有人,前往鄭州提供環境準備,此時我們部門的兩老搶先發言護照尚未拿到,接著有人答腔說房子要裝潢;最後Boss 望著我 Dylan 那就你去吧。喔。</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3L6F9WXgBbdDDlWAzI6pYltQkNfqXqHJJ958QdOyDlRnVPiWTsyd9C1hysRxdDdic-SMwYFNZwi0oxrmLIgiC2PmTb5TqOgqjfYd9GqGnpqUO7HxMOGPAShU3muRKgbpOrjO3EULtOLo/s1600/P1020763.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="425" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3L6F9WXgBbdDDlWAzI6pYltQkNfqXqHJJ958QdOyDlRnVPiWTsyd9C1hysRxdDdic-SMwYFNZwi0oxrmLIgiC2PmTb5TqOgqjfYd9GqGnpqUO7HxMOGPAShU3muRKgbpOrjO3EULtOLo/s640/P1020763.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">鄭州我來了</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyo1VwULKzJzFOIn-dqiHR5fzGAX_zK-LyVexCRDkW2MkB2ZAYTrhUEaNuQPEQcDob0FfQXOReGC1BGaF4wnqBaOkrCOHBZtyBDT6xmhIJi0zCkS0c5UbzpG9WbvJGQbbDdYjnk7mYI00/s1600/P1020781.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyo1VwULKzJzFOIn-dqiHR5fzGAX_zK-LyVexCRDkW2MkB2ZAYTrhUEaNuQPEQcDob0FfQXOReGC1BGaF4wnqBaOkrCOHBZtyBDT6xmhIJi0zCkS0c5UbzpG9WbvJGQbbDdYjnk7mYI00/s640/P1020781.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">高雄掰掰</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDMoGxvZ35-yP070sqH0RQcnkQ2gSFfpm5BGZtCT-TvG6DN9QFThpILCDyGAOTBZ13B21oYvYBIkTv7G-JJEmoR6uxCLw7kUq6tSxmtNrDX20dNiQQC8HMeTvpXqrZXiTXr9nkNZTUlnE/s1600/P1020809.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDMoGxvZ35-yP070sqH0RQcnkQ2gSFfpm5BGZtCT-TvG6DN9QFThpILCDyGAOTBZ13B21oYvYBIkTv7G-JJEmoR6uxCLw7kUq6tSxmtNrDX20dNiQQC8HMeTvpXqrZXiTXr9nkNZTUlnE/s640/P1020809.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">機場前的公車</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Lf21WCWWYzo6torO9VWpmYHib1x1GaZv51t-T5oSk_KKegwP4o1Yw-t8Rn2NHjwT0IfsBeyIdVFyDekFHVNo6e05MohipCf63cOagSRHGgw8bYCaXJY87lnFDFCT-1JQE35YVD8r_3o/s1600/P1020820.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9Lf21WCWWYzo6torO9VWpmYHib1x1GaZv51t-T5oSk_KKegwP4o1Yw-t8Rn2NHjwT0IfsBeyIdVFyDekFHVNo6e05MohipCf63cOagSRHGgw8bYCaXJY87lnFDFCT-1JQE35YVD8r_3o/s640/P1020820.JPG" width="480" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">夜晚的鄭州</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjjOxwlBSOa797YGndfjF-Ioa6LDfu8ab50VKoz_ow41pdoBy-g94AE8DNyKBVxelhVj9WCfS_-O7C_NFuVR5Uti5nOwAMlVj9yCI6JE7E_vRtA_b2A5ir4ly76z6SajkCRVKMXpCvW8Y/s1600/P1030041.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjjOxwlBSOa797YGndfjF-Ioa6LDfu8ab50VKoz_ow41pdoBy-g94AE8DNyKBVxelhVj9WCfS_-O7C_NFuVR5Uti5nOwAMlVj9yCI6JE7E_vRtA_b2A5ir4ly76z6SajkCRVKMXpCvW8Y/s640/P1030041.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">對街活動會展場地</td></tr>
</tbody></table>
<div class="separator" style="clear: both; text-align: left;">
會展前一天的 6:00 pm,總算是可以回去好好休息, <b>對接會</b>咱們明天見囉。</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHCcCxJsXu3NELd6H88NG0QYFAZ2mDm6cUca8mOZXe_dtFS3X2RTz4hoYz73wI_gQfoztdvC__AjWtnEacY1GDnJzoY3FLJcKSqekwUk09GNFJRts7_ViXfOFftBJcrXqsBHJ3M-YUF4g/s1600/P1030023.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHCcCxJsXu3NELd6H88NG0QYFAZ2mDm6cUca8mOZXe_dtFS3X2RTz4hoYz73wI_gQfoztdvC__AjWtnEacY1GDnJzoY3FLJcKSqekwUk09GNFJRts7_ViXfOFftBJcrXqsBHJ3M-YUF4g/s640/P1030023.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">鄭州國際會展中心</td></tr>
</tbody></table>
<br />
為什麼 Dylan 要晚上跑來拍會展中心,因為在洗完澡準備睡覺前,Dylan 被Call 回會場,因為出大事了,大陸同仁們開發出的後台管理平台,在OP人員正常操作下竟然導致資料庫的關連錯亂,那一晚一直到天亮被會展中心請出門外才搶救回來。<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguuy_K3xbTQF7gNNXWQDjcbAb4NeHbeb77TcS6IH_swzIBFa2e4lov8kTRIWibjtBEtD3004QWum_3jRtggvmkIM8yC3-htaqJeiOFlJNfLyzlq93PrpetWzOuvfMBztlKed5Fq4bzKmg/s1600/P1030054.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguuy_K3xbTQF7gNNXWQDjcbAb4NeHbeb77TcS6IH_swzIBFa2e4lov8kTRIWibjtBEtD3004QWum_3jRtggvmkIM8yC3-htaqJeiOFlJNfLyzlq93PrpetWzOuvfMBztlKed5Fq4bzKmg/s640/P1030054.JPG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">展區配置圖</td></tr>
</tbody></table>
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk0HsksMP-u8H0Wwbv74TyLEsKvyfjwUL_MKbR-Y5ngjYZa8RPMuBDAyxsmhihNPU54ikYKZXCHjanZGYS-QvoYvBgozPHaV1at5y9I2gbyMXgBNMJIDwMLmlOusdjKndzYTIA7D127FQ/s1600/P1030009.JPG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk0HsksMP-u8H0Wwbv74TyLEsKvyfjwUL_MKbR-Y5ngjYZa8RPMuBDAyxsmhihNPU54ikYKZXCHjanZGYS-QvoYvBgozPHaV1at5y9I2gbyMXgBNMJIDwMLmlOusdjKndzYTIA7D127FQ/s640/P1030009.JPG" width="426" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">夜晚的會議中心</td></tr>
</tbody></table>
這次的對接會從開發到展覽足足23天準備工作,第一次見識到血汗工廠的能耐,會後檢討下來,許多地方式是很值得我們思考改進的地方。<br />
<br />
1. 專案經理未確實驗收各個項目工作成果,導致OP人員正常操作下出現要命錯誤。<br />
2. 專案經理未確時安排整合測試,導致會展前一天緊急求救。<br />
3. 專案經理品質管理未落實,導致第一項發生。Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-14446129806983200392012-10-26T21:22:00.002-07:002012-10-26T23:20:55.719-07:00經驗談專案管理<br />
談專案管理不外乎就是談 - 專案的範圍(Scope)、預算(Budget)、時程(Schedule)、品質(Quality)、資源(Resource) 及風險管理 (Risk) 等,成功的專案管理者 ( PM ),通常只要顧好這六要素,就可以一步一步地讓專案走向成功的階段。<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf70_qKBt9ovcLcxtdZthxF3FoZzTDQ3-5-0frjdptRpHw2M_zqT_VC4k1Hbhw1SpSmxlT0xPbx0HRtdUC6jQd3-imBefuTXqRlUJjpQLO_HaXDR_orqmbxPLcMUCeuLDrXDYUJ4MDog8/s1600/%E5%B0%88%E6%A1%88%E6%88%90%E5%8A%9F%E8%A6%81%E7%B4%A0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="475" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf70_qKBt9ovcLcxtdZthxF3FoZzTDQ3-5-0frjdptRpHw2M_zqT_VC4k1Hbhw1SpSmxlT0xPbx0HRtdUC6jQd3-imBefuTXqRlUJjpQLO_HaXDR_orqmbxPLcMUCeuLDrXDYUJ4MDog8/s640/%E5%B0%88%E6%A1%88%E6%88%90%E5%8A%9F%E8%A6%81%E7%B4%A0.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案預算(Budget)</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
一個專案的成功,專案預算一定要控制好,要避免購置不適用的設備及閒置人力資源,該怎麼說呢 ? 就是當發生了設備採購上的錯誤,採購人員,買進了不符合專案規格的設備為了要彌補這項缺失,就只有兩條路可以選擇,一、變更專案設計、二、重新採購,不管是怎麼選擇都會導致預算的爆增及其他五要素的影響。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案時程(Schedule)</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
當專案開始進行時,依照合約內容通常都會定義什麼時候該完成什麼項目,比如說我們要成立電腦教室,我們就會這著合約提及的採購合約內容提及的電腦設備、粉刷油漆及網路部署安排各個工作的時間點,什麼時候油漆粉刷必須完成,什麼時候電腦設備要採購進駐完成,接著安排人員進行網路設定等......。所以時程控制是很重要的,當油漆粉刷未完成,電腦設備就無法進駐,電腦無法進駐導致已經安排的網管人員設定網路的時程勢必要延遲,環環相扣,專案時程延遲,輕則違約罰款了事,重責公司商譽受損,專案管理者 ( PM )不可不慎。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案範圍(Scope)</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
當合約簽署完成時,就已經定義了<b>專案目標</b>,以及應該提供的服務內容,並且針對這些項目,開始圍繞著這個目標及服務內容開始設計各個工作項目,比如說:【<b>台北好行 APP 專案開發】</b>,合約中提及在驗收時,APP中必須提供<b>公車即時到站</b>、<b>道路資訊</b>、<b>台北市停車場服務</b>等;對此我們開始<b>組織團隊</b>規畫,如何來提供<b>公車即時到站</b>、<b>道路資訊</b>、<b>台北市停車場服務</b>等服務,當團隊成員提及我們應該要提供一<b>管理後台</b>,來管理來自各單位提供過來的資料,此時已經有發生<b>鍍金(<span style="background-color: white; color: #222222; font-family: arial, sans-serif; font-size: x-small; line-height: 16px;">Gold Plating</span>)</b>的情況,專案管理者 ( PM )必須要阻止這種事情發生,因為這種<b>範圍潛變</b>,將會導致專案時程、專案預算的增加及專案風險上升。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案品質(Quality)</b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
品質管理,簡單說就是一個東西的質料好與質料壞,品質好顧客就會滿意,品質不好顧客也許就不會買帳;這種東西因人而異,太過抽象,所以我們必須要將這種情形做量化來管理提供客戶安心,如TQM(Total Quality Management )、ISO 9001、.CMMI....等標準。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案資源(Resource)</b></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
專案資源,顧名思義就是指在執行這個專案所需要的人員及能讓專案順利進行的軟、硬體資源,比如這是一個 APP開發案,人力資源就是軟體工程師、軟體資源就是程式開發套件及硬體資源就是電腦。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<b>專案風險 (Risk) </b></div>
<div class="separator" style="clear: both; text-align: left;">
<b><br /></b></div>
<div class="separator" style="clear: both; text-align: left;">
風險這種東西,有在買保險的人都知道,我們永遠不知道意外什麼時候會發生,但是一旦這個意外發生時,我們應該要怎麼處理;所以專案管理中的<b>風險管理</b>就是要我們想方法去降低風險對專案的影響。</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
一個好的<b>專案管理者</b>,還有一個最最最重要的就是<b>溝通(Communication)</b>,因為專案在進行階段經常會接觸到不同領域的人員,每個人員有不同的思維及當時的心情,如果你可以讓每個人都了解他們在做的是一件偉大的專案工作,工作心態就會不一樣,程式開發人員也許會開心的修錯誤( Bug )、終端使用者了解到未來專案成功會導致工作順利,驗收就會笑著不排斥重新學習新工作流程。</div>
<br />Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-8440569064686656552012-04-02T01:58:00.002-07:002014-07-09T18:01:59.096-07:00php.ini 完整設定說明<pre style="font-size: 12px; line-height: 19px; text-align: justify;">關於php.ini
; 這個文件必須命名為'php.ini'並放置在httpd.conf中PHPINIDir指令指定的目錄中。
; 最新版本的php.ini可以在下面兩個位置查看:
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-recommended?view=co
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-dist?view=co
語法
該文件的語法非常簡單。空白字符和以分號開始的行被簡單地忽略。
章節標題(例如: [php])也被簡單地忽略,即使將來它們可能有某種意義。
設置指令的格式如下:
<code>directive = value</code>
; 指令名(directive)是大小寫敏感的!所以"foo=bar"不同於"FOO=bar"。
; 值(value)可以是:
; 1. 用引號界定的字符串(如:"foo")
; 2. 一個數字(整數或浮點數,如:0, 1, 34, -1, 33.55)
; 3. 一個PHP常量(如:E_ALL, M_PI)
; 4. 一個INI常量(On, Off, none)
; 5. 一個表達式(如:E_ALL & ~E_NOTICE)
;
; INI文件中的表達式僅使用:位運算符、邏輯非、圓括號:
; | 位或
; & 位與
; ~ 位非
; ! 邏輯非
;
; 布爾標誌用 On 表示打開,用 Off 表示關閉。
;
; 一個空字符串可以用在等號後不寫任何東西表示,或者用 none 關鍵字:
; foo = ; 將foo設為空字符串
; foo = none ; 將foo設為空字符串
; foo = "none" ; 將foo設為字符串'none'
;
; 如果你在指令值中使用動態擴展(PHP擴展或Zend擴展)中的常量,
; 那麼你只能在加載這些動態擴展的指令行之後使用這些常量。
;;;;;;;;;;;;;;;;;;
;; httpd.conf ;;
;;;;;;;;;;;;;;;;;;
; 可以在httpd.conf中針對特定虛擬主機或目錄覆蓋php.ini的值,以進行更靈活的配置:
; php_admin_value name value ;設置非bool型的指令,將value設為none則清除先前的設定
; php_admin_flag name on|off ;僅用於設置bool型的指令
; [提示]因為很多指令不允許使用php_value/php_flag進行設置,因此不建議使用這兩個。
;
; PHP常量(如E_ALL)僅能在php.ini中使用,在httpd.conf中必須使用相應的掩碼值。
;[2008-3-2日更新]
;==========================================================================================
;;=====================================配置指令詳解========================================
;==========================================================================================
; 以下每個指令的設定值都與 PHP-5.2.5 內建的默認值相同。
; 也就是說,如果'php.ini'不存在,或者你刪掉了某些行,默認值與之相同。
;;;;;;;;;;;;;;
;; Apache ;;
;;;;;;;;;;;;;;
[Apache]
; 僅在將PHP作為Apache模塊時才有效。
child_terminate = Off
; PHP腳本在請求結束後是否允許使用apache_child_terminate()函數終止子進程。
; 該指令僅在UNIX平台上將PHP安裝為Apache1.3的模塊時可用。其他情況下皆不存在。
engine = On
; 是否啟用PHP解析引擎。
; 提示:可以在httpd.conf中基於目錄或者虛擬主機來打開或者關閉PHP解析引擎。
last_modified = Off
; 是否在Last-Modified應答頭中放置該PHP腳本的最後修改時間。
xbithack = Off
; 是否不管文件結尾是什麼,都作為PHP可執行位組來解析。
;;;;;;;;;;;;;;;
;; PHP核心 ;;
;;;;;;;;;;;;;;;
[PHP-Core-DateTime]
; 前四個配置選項目前僅用於date_sunrise()和date_sunset()函數。
date.default_latitude = 31.7667
; 默認緯度
date.default_longitude = 35.2333
; 默認經度
date.sunrise_zenith = 90.583333
; 默認日出天頂
date.sunset_zenith = 90.583333
; 默認日落天頂
date.timezone =
; 未設定TZ環境變量時用於所有日期和時間函數的默認時區。
; 中國大陸應當使用"PRC"
; 應用時區的優先順序為:
; 1. 用date_default_timezone_set()函數設定的時區(如果設定了的話)
; 2. TZ 環境變量(如果非空的話)
; 3. 該指令的值(如果設定了的話)
; 4. PHP自己推測(如果操作系統支持)
; 5. 如果以上都不成功,則使用 "UTC"
[PHP-Core-Assert]
assert.active = On
; 是否啟用assert()斷言評估
assert.bail = Off
; 是否在發生失敗斷言時中止腳本的執行
assert.callback =
; 發生失敗斷言時執行的回調函數
<code>assert.quiet_eval = Off</code>
是否使用安靜評估(不顯示任何錯誤信息,相當於error_reporting=0)。
若關閉則在評估斷言表達式的時候使用當前的error_reporting指令值。
<code>assert.warning = On</code>
是否對每個失敗斷言都發出警告
[PHP-Core-SafeMode]
; 安全模式是為了解決共享服務器的安全問題而設立的。
; 但試圖在PHP層解決這個問題在結構上是不合理的,
; 正確的做法應當是修改web服務器層和操作系統層。
; 因此在PHP6中廢除了安全模式,並使用基於open_basedir的安全防護。
; 此部分指令在PHP6中已經全部被刪除。
safe_mode = Off
; 是否啟用安全模式。
; 打開時,PHP將檢查當前腳本的擁有者是否和被操作的文件的擁有者相同,
; 相同則允許操作,不同則拒絕操作。
safe_mode_gid = Off
; 在安全模式下,默認在訪問文件時會做UID比較檢查。
; 但有些情況下嚴格的UID檢查反而是不適合的,寬鬆的GID檢查已經足夠。
; 如果你想將其放寬到僅做GID比較,可以打開這個參數。
safe_mode_allowed_env_vars = "PHP_"
; 在安全模式下,用戶僅可以更改的環境變量的前綴列表(逗號分隔)。
; 允許用戶設置某些環境變量,可能會導致潛在的安全漏洞。
; 注意: 如果這一參數值為空,PHP將允許用戶更改任意環境變量!
safe_mode_protected_env_vars = "LD_LIBRARY_PATH"
; 在安全模式下,用戶不能更改的環境變量列表(逗號分隔)。
; 這些變量即使在safe_mode_allowed_env_vars指令設置為允許的情況下也會得到保護。
safe_mode_exec_dir = "/usr/local/php/bin"
; 在安全模式下,只有該目錄下的可執行程序才允許被執行系統程序的函數執行。
; 這些函數是:system, escapeshellarg, escapeshellcmd, exec, passthru,
; proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec
safe_mode_include_dir =
; 在安全模式下,該組目錄和其子目錄下的文件被包含時,將跳過UID/GID檢查。
; 換句話說,如果此處的值為空,任何UID/GID不符合的文件都不允許被包含。
; 這裡設置的目錄必須已經存在於include_path指令中或者用完整路徑來包含。
; 多個目錄之間用冒號(Win下為分號)隔開。
; 指定的限制實際上是一個前綴,而非一個目錄名,
; 也就是說"/dir/incl"將允許訪問"/dir/include"和"/dir/incls"
; 如果您希望將訪問控制在一個指定的目錄,那麼請在結尾加上斜線。
[PHP-Core-Safe]
allow_url_fopen = On
; 是否允許打開遠程文件
allow_url_include = Off
; 是否允許include/require遠程文件。
disable_classes =
; 該指令接受一個用逗號分隔的類名列表,以禁用特定的類。
disable_functions =
; 該指令接受一個用逗號分隔的函數名列表,以禁用特定的函數。
enable_dl = On
; 是否允許使用dl()函數。dl()函數僅在將PHP作為apache模塊安裝時才有效。
; 禁用dl()函數主要是出於安全考慮,因為它可以繞過open_basedir指令的限制。
; 在安全模式下始終禁用dl()函數,而不管此處如何設置。
; PHP6中刪除了該指令,相當於設為Off。
expose_php = On
; 是否暴露PHP被安裝在服務器上的事實(在http頭中加上其簽名)。
; 它不會有安全上的直接威脅,但它使得客戶端知道服務器上安裝了PHP。
open_basedir =
; 將PHP允許操作的所有文件(包括文件自身)都限制在此組目錄列表下。
; 當一個腳本試圖打開一個指定目錄樹之外的文件時,將遭到拒絕。
; 所有的符號連接都會被解析,所以不可能通過符號連接來避開此限制。
; 特殊值'.'指定了存放該腳本的目錄將被當做基準目錄,
; 但這有些危險,因為腳本的工作目錄可以輕易被chdir()改變。
; 對於共享服務器,在httpd.conf中針對不同的虛擬主機或目錄靈活設置該指令將變得非常有用。
; 在Windows中用分號分隔目錄,UNIX系統中用冒號分隔目錄。
; 作為Apache模塊時,父目錄中的open_basedir路徑將自動被繼承。
; 指定的限制實際上是一個前綴,而非一個目錄名,
; 也就是說"/dir/incl"將允許訪問"/dir/include"和"/dir/incls",
; 如果您希望將訪問控制在一個指定的目錄,那麼請在結尾加上一個斜線。
; 默認是允許打開所有文件。
sql.safe_mode = Off
; 是否使用SQL安全模式。
; 如果打開,指定默認值的數據庫連接函數將會使用這些默認值代替支持的參數。
; 對於每個不同數據庫的連接函數,其默認值請參考相應的手冊頁面。
[PHP-Core-Error]
error_reporting = E_ALL & ~E_NOTICE
; 錯誤報告級別是位字段的疊加,推薦使用 E_ALL | E_STRICT
; 1 E_ERROR 致命的運行時錯誤
; 2 E_WARNING 運行時警告(非致命性錯誤)
; 4 E_PARSE 編譯時解析錯誤
; 8 E_NOTICE 運行時提醒(經常是bug,也可能是有意的)
; 16 E_CORE_ERROR PHP啟動時初始化過程中的致命錯誤
; 32 E_CORE_WARNING PHP啟動時初始化過程中的警告(非致命性錯)
; 64 E_COMPILE_ERROR 編譯時致命性錯
; 128 E_COMPILE_WARNING 編譯時警告(非致命性錯)
; 256 E_USER_ERROR 用戶自定義的致命錯誤
; 512 E_USER_WARNING 用戶自定義的警告(非致命性錯誤)
; 1024 E_USER_NOTICE 用戶自定義的提醒(經常是bug,也可能是有意的)
; 2048 E_STRICT 編碼標準化警告(建議如何修改以向前兼容)
; 4096 E_RECOVERABLE_ERROR 接近致命的運行時錯誤,若未被捕獲則視同E_ERROR
; 6143 E_ALL 除E_STRICT外的所有錯誤(PHP6中為8191,即包含所有)
; 也可以用2147483647(所有二進制位全為1)打開現在或將來可能出現的各種錯誤
track_errors = Off
; 是否在變量$php_errormsg中保存最近一個錯誤或警告消息。
display_errors = On
; 是否將錯誤信息作為輸出的一部分顯示。
; 在最終發佈的web站點上,強烈建議你關掉這個特性,並使用錯誤日誌代替(參看下面)。
; 在最終發佈的web站點打開這個特性可能暴露一些安全信息,
; 例如你的web服務上的文件路徑、數據庫規劃或別的信息。
display_startup_errors = Off
; 是否顯示PHP啟動時的錯誤。
; 即使display_errors指令被打開,關閉此參數也將不顯示PHP啟動時的錯誤。
; 建議你關掉這個特性,除非你必須要用於調試中。
report_memleaks = On
; 是否報告內存洩漏。這個參數只在以調試方式編譯的PHP中起作用,
; 並且必須在error_reporting指令中包含 E_WARNING
report_zend_debug = On
; 尚無說明文檔
html_errors = On
; 是否在出錯信息中使用HTML標記。
; 注意: 不要在發佈的站點上使用這個特性!
docref_root = ;"http://localhost/phpmanual/"
docref_ext = ;".html"
; 如果打開了html_errors指令,PHP將會在出錯信息上顯示超連接,
; 直接鏈接到一個說明這個錯誤或者導致這個錯誤的函數的頁面。
; 你可以從http://www.php.net/docs.php下載php手冊,
; 並將docref_root指令指向你本地的手冊所在的URL目錄。
; 你還必須設置docref_ext指令來指定文件的擴展名(必須含有'.')。
; 注意: 不要在發佈的站點上使用這個特性。
error_prepend_string = ;"<font color=#f00>"
; 用於錯誤信息前輸出的字符串
error_append_string = ;"</font>"
; 用於錯誤信息後輸出的字符串
xmlrpc_errors = Off
xmlrpc_error_number = 0
; 尚無文檔
[PHP-Core-Logging]
define_syslog_variables = Off
; 是否定義各種系統日誌變量,如:$LOG_PID, $LOG_CRON 等等。
; 關掉它以提高效率的好主意。
; 你可以在運行時調用define_syslog_variables()函數來定義這些變量。
error_log =
; 將錯誤日誌記錄到哪個文件中。該文件必須對Web服務器用戶可寫。
; syslog 表示記錄到系統日誌中(NT下的事件日誌, Unix下的syslog(3))
; 如果此處未設置任何值,則錯誤將被記錄到Web服務器的錯誤日誌中。
log_errors = Off
; 是否在日誌文件裡記錄錯誤,具體在哪裡記錄取決於error_log指令。
; 強烈建議你在最終發佈的web站點時使用日誌記錄錯誤而不是直接輸出,
; 這樣可以讓你既知道那裡出了問題,又不會暴露敏感信息。
log_errors_max_len = 1024
; 設置錯誤日誌中附加的與錯誤信息相關聯的錯誤源的最大長度。
; 這裡設置的值對顯示的和記錄的錯誤以及$php_errormsg都有效。
; 設為 0 可以允許無限長度。
ignore_repeated_errors = Off
; 記錄錯誤日誌時是否忽略重複的錯誤信息。
; 錯誤信息必須出現在同一文件的同一行才被被視為重複。
ignore_repeated_source = Off
; 是否在忽略重複的錯誤信息時忽略重複的錯誤源。
[PHP-Core-Mail]
; 要使郵件函數可用,PHP必須在編譯時能夠訪問sendmail程序。
; 如果使用其它的郵件程序,如qmail或postfix,確保使用了相應的sendmail包裝。
; PHP首先會在系統的PATH環境變量中搜索sendmail,接著按以下順序搜索:
; /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
; 強烈建議在PATH中能夠找到sendmail。
; 另外,編譯PHP的用戶必須能夠訪問sendmail程序。
SMTP = "localhost"
; mail()函數中用來發送郵件的SMTP服務器的主機名稱或者IP地址。僅用於win32。
smtp_port = 25
; SMTP服務器的端口號。僅用於win32。
sendmail_from =
; 發送郵件時使用的"From:"頭中的郵件地址。僅用於win32
; 該選項還同時設置了"Return-Path:"頭。
sendmail_path = "-t -i"
; 僅用於unix,也可支持參數(默認的是'sendmail -t -i')
; sendmail程序的路徑,通常為"/usr/sbin/sendmail或/usr/lib/sendmail"。
; configure腳本會嘗試找到該程序並設定為默認值,但是如果失敗的話,可以在這裡設定。
; 不使用sendmail的系統應將此指令設定為sendmail替代程序(如果有的話)。
; 例如,Qmail用戶通常可以設為"/var/qmail/bin/sendmail"或"/var/qmail/bin/qmail-inject"。
; qmail-inject 不需要任何選項就能正確處理郵件。
mail.force_extra_parameters =
; 作為額外的參數傳遞給sendmail庫的強制指定的參數附加值。
; 這些參數總是會替換掉mail()的第5個參數,即使在安全模式下也是如此。
[PHP-Core-ResourceLimit]
default_socket_timeout = 60
; 默認socket超時(秒)
max_execution_time = 30
; 每個腳本最大允許執行時間(秒),0 表示沒有限制。
; 這個參數有助於阻止劣質腳本無休止的佔用服務器資源。
; 該指令僅影響腳本本身的運行時間,任何其它花費在腳本運行之外的時間,
; 如用system()/sleep()函數的使用、數據庫查詢、文件上傳等,都不包括在內。
; 在安全模式下,你不能用ini_set()在運行時改變這個設置。
memory_limit = 128M
; 一個腳本所能夠申請到的最大內存字節數(可以使用K和M作為單位)。
; 這有助於防止劣質腳本消耗完服務器上的所有內存。
; 要能夠使用該指令必須在編譯時使用"--enable-memory-limit"配置選項。
; 如果要取消內存限制,則必須將其設為 -1 。
; 設置了該指令後,memory_get_usage()函數將變為可用。
max_input_time = -1
; 每個腳本解析輸入數據(POST, GET, upload)的最大允許時間(秒)。
; -1 表示不限制。
max_input_nesting_level = 64
; 輸入變量的最大嵌套深度(尚無更多解釋文檔)
post_max_size = 8M
; 允許的POST數據最大字節長度。此設定也影響到文件上傳。
; 如果POST數據超出限制,那麼$_POST和$_FILES將會為空。
; 要上傳大文件,該值必須大於upload_max_filesize指令的值。
; 如果啟用了內存限制,那麼該值應當小於memory_limit指令的值。
realpath_cache_size = 16K
; 指定PHP使用的realpath(規範化的絕對路徑名)緩衝區大小。
; 在PHP打開大量文件的系統上應當增大該值以提高性能。
realpath_cache_ttl = 120
; realpath緩衝區中信息的有效期(秒)。
; 對文件很少變動的系統,可以增大該值以提高性能。
[PHP-Core-FileUpLoad]
file_uploads = On
; 是否允許HTTP文件上傳。
; 參見upload_max_filesize, upload_tmp_dir, post_max_size指令
upload_max_filesize = 2M
; 允許上傳的文件的最大尺寸。
upload_tmp_dir =
; 文件上傳時存放文件的臨時目錄(必須是PHP進程用戶可寫的目錄)。
; 如果未指定則PHP使用系統默認的臨時目錄。
[PHP-Core-MagicQuotes]
; PHP6刪除了下列指令,相當於全部為 Off
magic_quotes_gpc = Off
; 是否對輸入的GET/POST/Cookie數據使用自動字符串轉義( ' " \ NULL )。
; 這裡的設置將自動影響 $_GEST $_POST $_COOKIE 數組的值。
; 若將本指令與magic_quotes_sybase指令同時打開,則僅將單引號(')轉義為(''),
; 其它特殊字符將不被轉義,即( " \ NULL )將保持原樣!!
; 建議關閉此特性,並使用自定義的過濾函數。
magic_quotes_runtime = Off
; 是否對運行時從外部資源產生的數據使用自動字符串轉義( ' " \ NULL )。
; 若打開本指令,則大多數函數從外部資源(數據庫,文本文件等)返回數據都將被轉義。
; 例如:用SQL查詢得到的數據,用exec()函數得到的數據,等等
; 若將本指令與magic_quotes_sybase指令同時打開,則僅將單引號(')轉義為(''),
; 其它特殊字符將不被轉義,即( " \ NULL )將保持原樣!!
; 建議關閉此特性,並視具體情況使用自定義的過濾函數。
magic_quotes_sybase = Off
; 是否採用Sybase形式的自動字符串轉義(用 '' 表示 ')
[PHP-Core-HighLight]
highlight.bg = "#FFFFFF"
highlight.comment = "#FF8000"
highlight.default = "#0000BB"
highlight.html = "#000000"
highlight.keyword = "#007700"
highlight.string = "#DD0000"
; 語法高亮模式的色彩(通常用於顯示 .phps 文件)。
; 只要能被<font color=xxx>接受的東西就能正常工作。
[PHP-Core-Langue]
short_open_tag = On
; 是否允許使用"<? ?>"短標識。否則必須使用"<?php ?>"長標識。
; 除非你的php程序僅在受控環境下運行,且只供自己使用,否則請不要使用短標記。
; 如果要和XML結合使用PHP,可以選擇關閉此選項以方便直接嵌入"<?xml ... ?>",
; 不然你必須用PHP來輸出:<? echo '<?xml version="1.0"'; ?>
; 本指令也會影響到縮寫形式"<?=",它和"<? echo"等價,要使用它也必須打開短標記。
asp_tags = Off
; 是否允許ASP風格的標記"<% %>",這也會影響到縮寫形式"<%="。
; PHP6中將刪除此指令
arg_separator.output = "&"
; PHP所產生的URL中用來分隔參數的分隔符。
; 另外還可以用"&amp;"或","等等。
arg_separator.input = "&"
; PHP解析URL中的變量時使用的分隔符列表。
; 字符串中的每一個字符都會被當作分割符。
; 另外還可以用",&"等等。
allow_call_time_pass_reference = On
; 是否強迫在函數調用時按引用傳遞參數(每次使用此特性都會收到一條警告)。
; php反對這種做法,並在PHP6里刪除了該指令(相當於設為Off),因為它影響到了代碼的整潔。
; 鼓勵的方法是在函數聲明裡明確指定哪些參數按引用傳遞。
; 我們鼓勵你關閉這一選項,以保證你的腳本在將來版本的語言裡仍能正常工作。
auto_globals_jit = On
; 是否僅在使用到$_SERVER和$_ENV變量時才創建(而不是在腳本一啟動時就自動創建)。
; 如果並未在腳本中使用這兩個數組,打開該指令將會獲得性能上的提升。
; 要想該指令生效,必須關閉register_globals和register_long_arrays指令。
auto_prepend_file =
auto_append_file =
; 指定在主文件之前/後自動解析的文件名。為空表示禁用該特性。
; 該文件就像調用了include()函數被包含進來一樣,因此會使用include_path指令的值。
; 注意:如果腳本通過exit()終止,那麼自動後綴將不會發生。
variables_order = "EGPCS"
; PHP註冊 Environment, GET, POST, Cookie, Server 變量的順序。
; 分別用 E, G, P, C, S 表示,按從左到右註冊,新值覆蓋舊值。
; 舉例說,設為"GP"將會導致用POST變量覆蓋同名的GET變量,
; 並完全忽略 Environment, Cookie, Server 變量。
; 推薦使用"GPC"或"GPCS",並使用getenv()函數訪問環境變量。
register_globals = Off
; 是否將 E, G, P, C, S 變量註冊為全局變量。
; 打開該指令可能會導致嚴重的安全問題,除非你的腳本經過非常仔細的檢查。
; 推薦使用預定義的超全局變量:$_ENV, $_GET, $_POST, $_COOKIE, $_SERVER
; 該指令受variables_order指令的影響。
; PHP6中已經刪除此指令。
register_argc_argv = On
; 是否聲明$argv和$argc全局變量(包含用GET方法的信息)。
; 建議不要使用這兩個變量,並關掉該指令以提高性能。
register_long_arrays = On
; 是否啟用舊式的長式數組(HTTP_*_VARS)。
; 鼓勵使用短式的預定義超全局數組,並關閉該特性以獲得更好的性能。
; PHP6中已經刪除此指令。
always_populate_raw_post_data = Off
; 是否總是生成$HTTP_RAW_POST_DATA變量(原始POST數據)。
; 否則,此變量僅在遇到不能識別的MIME類型的數據時才產生。
; 不過,訪問原始POST數據的更好方法是 php://input 。
; $HTTP_RAW_POST_DATA對於enctype="multipart/form-data"的表單數據不可用。
unserialize_callback_func =
; 如果解序列化處理器需要實例化一個未定義的類,
; 這裡指定的回調函數將以該未定義類的名字作為參數被unserialize()調用,
; 以免得到不完整的"__PHP_Incomplete_Class"對象。
; 如果這裡沒有指定函數,或指定的函數不包含(或實現)那個未定義的類,將會顯示警告信息。
; 所以僅在確實需要實現這樣的回調函數時才設置該指令。
; 若要禁止這個特性,只需置空即可。
y2k_compliance = On
; 是否強制打開2000年適應(可能在非Y2K適應的瀏覽器中導致問題)。
zend.ze1_compatibility_mode = Off
; 是否使用兼容Zend引擎I(PHP 4.x)的模式。PHP6中將刪除該指令(相當於Off)。
; 這將影響對象的複製、構造(無屬性的對象會產生FALSE或0)、比較。
; 兼容模式下,對像將按值傳遞,而不是默認的按引用傳遞。
precision = 14
; 浮點型數據顯示的有效位數。
serialize_precision = 100
; 將浮點型和雙精度型數據序列化存儲時的精度(有效位數)。
; 默認值能夠確保浮點型數據被解序列化程序解碼時不會丟失數據。
[PHP-Core-OutputControl]
; 輸出控制函數很有用,特別是在已經輸出了信息之後再發送HTTP頭的情況下。
; 輸出控制函數不會作用於header()或setcookie()等函數發送的HTTP頭,
; 而只會影響類似於echo()函數輸出的信息和嵌入在PHP代碼之間的信息。
implicit_flush = Off
; 是否要求PHP輸出層在每個輸出塊之後自動刷新數據。
; 這等效於在每個 print()、echo()、HTML塊 之後自動調用flush()函數。
; 打開這個選項對程序執行的性能有嚴重的影響,通常只推薦在調試時使用。
; 在CLI SAPI的執行模式下,該指令默認為 On 。
output_buffering = 0
; 輸出緩衝區大小(字節)。建議值為4096~8192。
; 輸出緩衝允許你甚至在輸出正文內容之後再發送HTTP頭(包括cookies)。
; 其代價是輸出層減慢一點點速度。
; 設置輸出緩衝可以減少寫入,有時還能減少網絡數據包的發送。
; 這個參數的實際收益很大程度上取決於你使用的是什麼Web服務器以及什麼樣的腳本。
output_handler =
; 將所有腳本的輸出重定向到一個輸出處理函數。
; 比如,重定向到mb_output_handler()函數時,字符編碼將被透明地轉換為指定的編碼。
; 一旦你在這裡指定了輸出處理程序,輸出緩衝將被自動打開(output_buffering=4096)。
; 注意0: 此處僅能使用PHP內置的函數,自定義函數應在腳本中使用ob_start()指定。
; 注意1: 可移植腳本不能依賴該指令,而應使用ob_start()函數明確指定輸出處理函數。
; 使用這個指令可能會導致某些你不熟悉的腳本出錯。
; 注意2: 你不能同時使用"mb_output_handler"和"ob_iconv_handler"兩個輸出處理函數。
; 你也不能同時使用"ob_gzhandler"輸出處理函數和zlib.output_compression指令。
; 注意3: 如果使用zlib.output_handler指令開啟zlib輸出壓縮,該指令必須為空。
[PHP-Core-Directory]
include_path = ".:/path/to/php/pear"
; 指定一組目錄用於require(), include(), fopen_with_path()函數尋找文件。
; 格式和系統的PATH環境變量類似(UNIX下用冒號分隔,Windows下用分號分隔):
; UNIX: "/path1:/path2"
; Windows: "\path1;\path2"
; 在包含路徑中使用'.'可以允許相對路徑,它代表當前目錄。
user_dir =
; 告訴php在使用 /~username 打開腳本時到哪個目錄下去找,僅在非空時有效。
; 也就是在用戶目錄之下使用PHP文件的基本目錄名,例如:"public_html"
extension_dir = "/path/to/php"
; 存放擴展庫(模塊)的目錄,也就是PHP用來尋找動態擴展模塊的目錄。
; Windows下默認為"C:/php5"
[PHP-Core-HTTP]
default_mimetype = "text/html"
default_charset = ;"gb2312"
; PHP默認會自動輸出"Content-Type: text/html" HTTP頭。
; 如果將default_charset指令設為"gb2312",
; 那麼將會自動輸出"Content-Type: text/html; charset=gb2312"。
; PHP6反對使用default_charset指令,而推薦使用unicode.output_encoding指令。
[PHP-Core-Unicode]
; PHP6基於ICU(International Components for Unicode)庫提供了全面的Unicode支持。
; 編譯時需要使用--with-icu-dir=<dir>指定ICU頭文件和庫的安裝位置。
; 除detect_unicode外,其他都是PHP6新增的指令。
;
; PHP6的信息目前還很缺乏,所以此部分內容可能不完整甚至有錯誤。
detect_unicode = On
; 指示Zend引擎是否通過檢查腳本的BOM(字節順序標記)來檢測腳本是否包含多字節字符。
; 建議關閉。PHP6已經取消了此指令而用unicode.script_encoding指令來代替其功能。
unicode.semantics = Off
; 是否啟用Unicode支持。
; 如果打開此指令,那麼PHP將變成一個完全的Unicode環境,比如:
; 所有字符串和從HTTP接受的變量都將變成Unicode,所有PHP標識符也都可以使用Unicode字符。
; 而且,PHP內部將使用Unicode字符串並負責對外圍非Unicode字符進行自動轉換,
; 比如:HTTP輸入輸出、流、文件系統操作等等,甚至連php.ini自身都將按照UTF-8編碼來解析。
; 開啟這個指令後,你必須明確指定二進制字符串。PHP將不對二進制字符串的內容做任何假定,
; 因此你的程序必須保證能夠恰當的處理二進制字符串。
; 如果關閉這個指令,PHP的行為將和以前的行為完全相同:
; 字符串不會變成Unicode,文件和二進制字符串也將向後兼容,php.ini也將按照"as-is"風格解析。
; 不管是否打開此指令,所有的函數和操作符都透明的支持Unicode字符串。
unicode.fallback_encoding = UTF-8
; 為其他所有unicode.*_encoding指令設置默認值。
; 也就是說如果某個unicode.*_encoding指令未明確設置的話,將使用此處設置的值。
unicode.runtime_encoding =
; 運行時編碼指定了PHP引擎內部轉換二進制字符串時使用的編碼。
; 此處的設置對於I/O相關操作(比如:寫入標準輸出/讀取文件系統/解碼HTTP輸入變量)沒有影響。
; PHP也允許你明確的對字符串進行轉換:
; (binary)$str -- 轉化為二進制字符串
; (unicode)$str -- 轉化為Unicode字符串
; (string)$str -- 如果unicode.semantics為On則轉化為Unicode字符串,否則轉化為二進制字符串
; 例如,如果該指令的值為iso-8859-1並且$uni是一個Unicode字符串,那麼
; $str = (binary)$uni
; 將等到一個使用iso-8859-1編碼的二進制字符串。
; 在連接、比較、傳遞參數等操作之前PHP會將相關字符串隱含轉換為Unicode,然後再進行操作。
; 比如在將二進制字符串與Unicode進行連接的時候,
; PHP將會使用這裡的設置將二進制字符串轉換為Unicode字符串,然後再進行操作。
unicode.output_encoding =
; PHP輸出非二進制字符串使用的編碼。
; 自動將'print'和'echo'之類的輸出內容轉換為此處設定的編碼(並不對二進制字符串進行轉換)。
; 當向文件之類的外部資源寫入數據的時候,
; 你必須依賴於流編碼特性或者使用Unicode擴展的函數手動的對數據進行編碼。
; 在PHP6中反對使用先前的default_charset指令,而推薦使用該指令。
; 先前的default_charset指令只是指定了Content-Type頭中的字符集,而並不對實際的輸出做任何轉換。
; 而在PHP6中,default_charset指令僅在unicode.semantics為off的時候才有效。
; 設置了該指令後將在Content-Type輸出頭的'charset'部分填上該指令的值,
; 而不管default_charset指令如何設置。
unicode.http_input_encoding =
; 通過HTTP獲取的變量(比如$_GET和_$POST)內容的編碼。
; 直到2007年4月此功能尚在開發中....
unicode.filesystem_encoding =
; 文件系統的目錄名和文件名的編碼。
; 文件系統相關的函數(比如opendir())將使用這個編碼接受和返回文件名和目錄名。
; 此處的設置必須與文件系統實際使用的編碼完全一致。
unicode.script_encoding =
; PHP腳本自身的默認編碼。
; 你可以使用任何ICU支持的編碼來寫PHP腳本。
; 如果你想針對單獨的腳本文件設定其編碼,可以在該腳本的開頭使用
; <?php declare(encoding = 'Shift-JIS'); ?>
; 來指定。注意:必須是第一行開頭,全面不要有任何字符(包括空白)。
; 該方法只能影響其所在的腳本,不會影響任何被包含的其他腳本。
unicode.stream_encoding = UTF-8
unicode.from_error_mode = 2
unicode.from_error_subst_char = 3f
; 尚無文檔
[PHP-Core-Misc]
auto_detect_line_endings = Off
; 是否讓PHP自動偵測行結束符(EOL)。
; 如果的你腳本必須處理Macintosh文件,
; 或者你運行在Macintosh上,同時又要處理unix或win32文件,
; 打開這個指令可以讓PHP自動偵測EOL,以便fgets()和file()函數可以正常工作。
; 但同時也會導致在Unix系統下使用回車符(CR)作為項目分隔符的人遭遇不兼容行為。
; 另外,在檢測第一行的EOL習慣時會有很小的性能損失。
browscap = ;"c:/windows/system32/inetsrv/browscap.ini"
; 只有PWS和IIS需要這個設置
; 你可以從http://www.garykeith.com/browsers/downloads.asp
; 得到一個browscap.ini文件。
ignore_user_abort = Off
; 是否即使在用戶中止請求後也堅持完成整個請求。
; 在執行一個長請求的時候應當考慮打開該它,
; 因為長請求可能會導致用戶中途中止或瀏覽器超時。
user_agent = ;"PHP"
; 定義"User-Agent"字符串
;url_rewriter.tags = "a=href,area=href,frame=src,form=,fieldset="
; 雖然此指令屬於PHP核心部分,但是卻用於Session模塊的配置
;extension =
; 在PHP啟動時加載動態擴展。例如:extension=mysqli.so
; "="之後只能使用模塊文件的名字,而不能含有路徑信息。
; 路徑信息應當只由extension_dir指令提供。
; 主意,在windows上,下列擴展已經內置:
; bcmath ; calendar ; com_dotnet ; ctype ; session ; filter ; ftp ; hash
; iconv ; json ; odbc ; pcre ; Reflection ; date ; libxml ; standard
; tokenizer ; zlib ; SimpleXML ; dom ; SPL ; wddx ; xml ; xmlreader ; xmlwriter
[PHP-Core-CGI]
; 這些指令只有在將PHP運行在CGI模式下的時候才有效
doc_root =
; PHP的"CGI根目錄"。僅在非空時有效。
; 在web服務器的主文檔目錄(比如"htdocs")中放置可執行程序/腳本被認為是不安全的,
; 比如因為配置錯誤而將腳本作為普通的html顯示。
; 因此很多系統管理員都會在主文檔目錄之外專門設置一個只能通過CGI來訪問的目錄,
; 該目錄中的內容只會被解析而不會原樣顯示出來。
; 如果設置了該項,那麼PHP就只會解釋doc_root目錄下的文件,
; 並確保目錄外的腳本都不會被PHP解釋器執行(user_dir除外)。
; 如果編譯PHP時沒有指定FORCE_REDIRECT,並且在非IIS服務器上以CGI方式運行,
; 則必須設置此指令(參見手冊中的安全部分)。
; 替代方案是使用的cgi.force_redirect指令。
cgi.discard_path = Off
; 尚無文檔(PHP6新增指令)
cgi.fix_pathinfo = On
; 是否為CGI提供真正的 PATH_INFO/PATH_TRANSLATED 支持(遵守cgi規範)。
; 先前的行為是將PATH_TRANSLATED設為SCRIPT_FILENAME,而不管PATH_INFO是什麼。
; 打開此選項將使PHP修正其路徑以遵守CGI規範,否則仍將使用舊式的不合規範的行為。
; 鼓勵你打開此指令,並修正腳本以使用 SCRIPT_FILENAME 代替 PATH_TRANSLATED 。
; 有關PATH_INFO的更多信息請參見cgi規範。
cgi.force_redirect = On
; 是否打開cgi強制重定向。強烈建議打開它以為CGI方式運行的php提供安全保護。
; 你若自己關閉了它,請自己負責後果。
; 注意:在IIS/OmniHTTPD/Xitami上則必須關閉它!
cgi.redirect_status_env =
; 如果cgi.force_redirect=On,並且在Apache與Netscape之外的服務器下運行PHP,
; 可能需要設定一個cgi重定向環境變量名,PHP將去尋找它來知道是否可以繼續執行下去。
; 設置這個變量會導致安全漏洞,請務必在設置前搞清楚自己在做什麼。
cgi.rfc2616_headers = 0
; 指定PHP在發送HTTP響應代碼時使用何種報頭。
; 0 表示發送一個"Status: "報頭,Apache和其它web服務器都支持。
; 若設為1,則PHP使用RFC2616標準的頭。
; 除非你知道自己在做什麼,否則保持其默認值 0
cgi.nph = Off
; 在CGI模式下是否強制對所有請求都發送"Status: 200"狀態碼。
cgi.check_shebang_line =On
; CGI PHP是否檢查腳本頂部以 #! 開始的行。
; 如果腳本想要既能夠單獨運行又能夠在PHP CGI模式下運行,那麼這個起始行就是必須的。
; 如果打開該指令,那麼CGI模式的PHP將跳過這一行。
fastcgi.impersonate = Off
; IIS中的FastCGI支持模仿客戶端安全令牌的能力。
; 這使得IIS能夠定義運行時所基於的請求的安全上下文。
; Apache中的mod_fastcgi不支持此特性(03/17/2002)
; 如果在IIS中運行則設為On,默認為Off。
fastcgi.logging = On
; 是否記錄通過FastCGI進行的連接。
[PHP-Core-Weirdy]
; 這些選項僅存在於文檔中,卻不存在於phpinfo()函數的輸出中
async_send = Off
; 是否異步發送。
from = ;"john@doe.com"
; 定義匿名ftp的密碼(一個email地址)
;;;;;;;;;;;;;;;;;;
;; 近核心模塊 ;;
;;;;;;;;;;;;;;;;;;
[Pcre]
;Perl兼容正則表達式模塊
pcre.backtrack_limit = 100000
; PCRE的最大回溯(backtracking)步數。
pcre.recursion_limit = 100000
; PCRE的最大遞歸(recursion)深度。
; 如果你將該值設的非常高,將可能耗盡進程的棧空間,導致PHP崩潰。
[Session]
; 除非使用session_register()或$_SESSION註冊了一個變量。
; 否則不管是否使用了session_start(),都不會自動添加任何session記錄。
; 包括resource變量或有循環引用的對象包含指向自身的引用的對象,不能保存在會話中。
; register_globals指令會影響到會話變量的存儲和恢復。
session.save_handler = "files"
; 存儲和檢索與會話關聯的數據的處理器名字。默認為文件("files")。
; 如果想要使用自定義的處理器(如基於數據庫的處理器),可用"user"。
; 設為"memcache"則可以使用memcache作為會話處理器(需要指定"--enable-memcache-session"編譯選項)。
; 還有一個使用PostgreSQL的處理器:http://sourceforge.net/projects/phpform-ext/
session.save_path = "/tmp"
; 傳遞給存儲處理器的參數。對於files處理器,此值是創建會話數據文件的路徑。
; Windows下默認為臨時文件夾路徑。
; 你可以使用"N;[MODE;]/path"這樣模式定義該路徑(N是一個整數)。
; N表示使用N層深度的子目錄,而不是將所有數據文件都保存在一個目錄下。
; [MODE;]可選,必須使用8進制數,默認"600",表示文件的訪問權限。
; 這是一個提高大量會話性能的好主意。
; 注意0: "N;[MODE;]/path"兩邊的雙引號不能省略。
; 注意1: [MODE;]並不會改寫進程的umask。
; 注意2: php不會自動創建這些文件夾結構。請使用ext/session目錄下的mod_files.sh腳本創建。
; 注意3: 如果該文件夾可以被不安全的用戶訪問(比如默認的"/tmp"),那麼將會帶來安全漏洞。
; 注意4: 當N>0時自動垃圾回收將會失效,具體參見下面有關垃圾搜集的部分。
; [安全提示]建議針對每個不同的虛擬主機分別設置各自不同的目錄。
;
; 對於"memcache"處理器,需要定義一個逗號分隔的服務器URL用來存儲會話數據。
; 比如:"tcp://host1:11211, tcp://host2:11211"
; 每個URL都可以包含傳遞給那個服務器的參數,可用的參數與 Memcache::addServer() 方法相同。
; 例如:"tcp://host1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
session.name = "PHPSESSID"
;用在cookie裡的會話ID標識名,只能包含字母和數字。
session.auto_start = Off
; 在客戶訪問任何頁面時都自動初始化會話,默認禁止。
; 因為類定義必須在會話啟動之前被載入,所以若打開這個選項,你就不能在會話中存放對象。
session.serialize_handler = "php"
; 用來序列化/解序列化數據的處理器,php是標準序列化/解序列化處理器。
; 另外還可以使用"php_binary"。當啟用了WDDX支持以後,將只能使用"wddx"。
session.gc_probability = 1
session.gc_divisor = 100
; 定義在每次初始化會話時,啟動垃圾回收程序的概率。
; 這個收集概率計算公式如下:session.gc_probability/session.gc_divisor
; 對會話頁面訪問越頻繁,概率就應當越小。建議值為1/1000~5000。
session.gc_maxlifetime = 1440
; 超過此參數所指的秒數後,保存的數據將被視為'垃圾'並由垃圾回收程序清理。
; 判斷標準是最後訪問數據的時間(對於FAT文件系統是最後刷新數據的時間)。
; 如果多個腳本共享同一個session.save_path目錄但session.gc_maxlifetime不同,
; 那麼將以所有session.gc_maxlifetime指令中的最小值為準。
; 如果使用多層子目錄來存儲數據文件,垃圾回收程序不會自動啟動。
; 你必須使用一個你自己編寫的shell腳本、cron項或者其他辦法來執行垃圾搜集。
; 比如,下面的腳本相當於設置了"session.gc_maxlifetime=1440" (24分鐘):
; cd /path/to/sessions; find -cmin +24 | xargs rm
session.referer_check =
; 如果請求頭中的"Referer"字段不包含此處指定的字符串則會話ID將被視為無效。
; 注意:如果請求頭中根本不存在"Referer"字段的話,會話ID將仍將被視為有效。
; 默認為空,即不做檢查(全部視為有效)。
session.entropy_file = ;"/dev/urandom"
; 附加的用於創建會話ID的外部高熵值資源(文件),
; 例如UNIX系統上的"/dev/random"或"/dev/urandom"
session.entropy_length = 0
; 從高熵值資源中讀取的字節數(建議值:16)。
session.use_cookies = On
; 是否使用cookie在客戶端保存會話ID
session.use_only_cookies = Off
; 是否僅僅使用cookie在客戶端保存會話ID。PHP6的默認值為On。
; 打開這個選項可以避免使用URL傳遞會話帶來的安全問題。
; 但是禁用Cookie的客戶端將使會話無法工作。
session.cookie_lifetime = 0
; 傳遞會話ID的Cookie有效期(秒),0 表示僅在瀏覽器打開期間有效。
; [提示]如果你不能保證服務器時間和客戶端時間嚴格一致請不要改變此默認值!
session.cookie_path = "/"
; 傳遞會話ID的Cookie作用路徑。
session.cookie_domain =
; 傳遞會話ID的Cookie作用域。
; 默認為空表示表示根據cookie規範生成的主機名。
session.cookie_secure = Off
; 是否僅僅通過安全連接(https)發送cookie。
session.cookie_httponly = Off
; 是否在cookie中添加httpOnly標誌(僅允許HTTP協議訪問),
; 這將導致客戶端腳本(JavaScript等)無法訪問該cookie。
; 打開該指令可以有效預防通過XSS攻擊劫持會話ID。
session.cache_limiter = "nocache"
; 設為{nocache|private|public}以指定會話頁面的緩存控制模式,
; 或者設為空以阻止在http應答頭中發送禁用緩存的命令。
session.cache_expire = 180
; 指定會話頁面在客戶端cache中的有效期限(分鐘)
; session.cache_limiter=nocache時,此處設置無效。
session.use_trans_sid = Off
; 是否使用明碼在URL中顯示SID(會話ID)。
; 默認是禁止的,因為它會給你的用戶帶來安全危險:
; 1- 用戶可能將包含有效sid的URL通過email/irc/QQ/MSN...途徑告訴給其他人。
; 2- 包含有效sid的URL可能會被保存在公用電腦上。
; 3- 用戶可能保存帶有固定不變sid的URL在他們的收藏夾或者瀏覽歷史紀錄裡面。
; 基於URL的會話管理總是比基於Cookie的會話管理有更多的風險,所以應當禁用。
session.bug_compat_42 = On
session.bug_compat_warn = On
; PHP4.2之前的版本有一個未註明的"BUG":
; 即使在register_globals=Off的情況下也允許初始化全局session變量,
; 如果你在PHP4.3之後的版本中使用這個特性,會顯示一條警告。
; 建議關閉該"BUG"並顯示警告。PHP6刪除了這兩個指令,相當於全部設為Off。
session.hash_function = 0
; 生成SID的散列算法。SHA-1的安全性更高一些
; 0: MD5 (128 bits)
; 1: SHA-1 (160 bits)
; 建議使用SHA-1。
session.hash_bits_per_character = 4
; 指定在SID字符串中的每個字符內保存多少bit,
; 這些二進制數是hash函數的運算結果。
; 4: 0-9, a-f
; 5: 0-9, a-v
; 6: 0-9, a-z, A-Z, "-", ","
; 建議值為 5
url_rewriter.tags = "a=href,area=href,frame=src,form=,fieldset="
; 此指令屬於PHP核心部分,並不屬於Session模塊。
; 指定重寫哪些HTML標籤來包含SID(僅當session.use_trans_sid=On時有效)
; form和fieldset比較特殊:
; 如果你包含他們,URL重寫器將添加一個隱藏的"<input>",它包含了本應當額外追加到URL上的信息。
; 如果要符合XHTML標準,請去掉form項並在表單字段前後加上<fieldset>標記。
; 注意:所有合法的項都需要一個等號(即使後面沒有值)。
; 推薦值為"a=href,area=href,frame=src,input=src,form=fakeentry"。
session.encode_sources = "globals"
; PHP6中有爭議的指令,尚未決定是否採用該指令。也尚無相關文檔。
;;;;;;;;;;;;;;;;
;; 其他模塊 ;;
;;;;;;;;;;;;;;;;
[APC-3.0.16]
; Alternative PHP Cache 用於緩存和優化PHP中間代碼
; 編譯/安裝/配置信息都位於源碼樹下的 INSTALL 文件中
apc.enabled = On
; 是否啟用APC,如果APC被靜態編譯進PHP又想禁用它,這是唯一的辦法。
apc.enable_cli = Off
; 是否為CLI版本啟用APC功能,僅用於測試和調試目的才打開此指令。
apc.cache_by_default = On
; 是否默認對所有文件啟用緩衝。
; 若設為Off並與以加號開頭的apc.filters指令一起用,則文件僅在匹配過濾器時才被緩存。
apc.file_update_protection = 2
; 當你在一個運行中的服務器上修改文件時,你應當執行原子操作。
; 也就是先寫進一個臨時文件,然後將該文件重命名(mv)到最終的名字。
; 文本編輯器以及 cp, tar 等程序卻並不是這樣操作的,從而導致有可能緩衝了殘缺的文件。
; 默認值 2 表示在訪問文件時如果發現修改時間距離訪問時間小於 2 秒則不做緩衝。
; 那個不幸的訪問者可能得到殘缺的內容,但是這種壞影響卻不會通過緩存擴大化。
; 如果你能確保所有的更新操作都是原子操作,那麼可以用 0 關閉此特性。
; 如果你的系統由於大量的IO操作導致更新緩慢,你就需要增大此值。
apc.filters =
; 一個以逗號分隔的POSIX擴展正則表達式列表。
; 如果源文件名與任意一個模式匹配,則該文件不被緩存。
; 注意,用來匹配的文件名是傳遞給include/require的文件名,而不是絕對路徑。
; 如果正則表達式的第一個字符是"+"則意味著任何匹配表達式的文件會被緩存,
; 如果第一個字符是"-"則任何匹配項都不會被緩存。"-"是默認值,可以省略掉。
apc.ttl = 0
; 緩存條目在緩衝區中允許逗留的秒數。0 表示永不超時。建議值為7200~86400。
; 設為 0 意味著緩衝區有可能被舊的緩存條目填滿,從而導致無法緩存新條目。
apc.user_ttl = 0
; 類似於apc.ttl,只是針對每個用戶而言,建議值為7200~86400。
; 設為 0 意味著緩衝區有可能被舊的緩存條目填滿,從而導致無法緩存新條目。
apc.gc_ttl = 3600
; 緩存條目在垃圾回收表中能夠存在的秒數。
; 此值提供了一個安全措施,即使一個服務器進程在執行緩存的源文件時崩潰,
; 而且該源文件已經被修改,為舊版本分配的內存也不會被回收,直到達到此TTL值為止。
; 設為零將禁用此特性。
apc.include_once_override = Off
; 優化include_once()和require_once()函數以避免執行額外的系統調用。
apc.max_file_size = 1M
; 禁止大於此尺寸的文件被緩存。
apc.mmap_file_mask =
; 如果使用--enable-mmap(默認啟用)為APC編譯了MMAP支持,
; 這裡的值就是傳遞給mmap模塊的mktemp風格的文件掩碼(建議值為"/tmp/apc.XXXXXX")。
; 該掩碼用於決定內存映射區域是否要被file-backed或者shared memory backed。
; 對於直接的file-backed內存映射,要設置成"/tmp/apc.XXXXXX"的樣子(恰好6個X)。
; 要使用POSIX風格的shm_open/mmap就需要設置成"/apc.shm.XXXXXX"的樣子。
; 你還可以設為"/dev/zero"來為匿名映射的內存使用內核的"/dev/zero"接口。
; 不定義此指令則表示強制使用匿名映射。
apc.num_files_hint = 1000
; Web服務器上可能被包含或被請求的不同腳本源代碼文件的大致數量(建議值為1024~4096)。
; 如果你不能確定,則設為 0 ;此設定主要用於擁有數千個源文件的站點。
apc.optimization = 0
; 優化級別(建議值為 0 ) 。反對使用該指令。將來可能會被刪除。
; 正整數值表示啟用優化器,值越高則使用越激進的優化。
; 更高的值可能有非常有限的速度提升,但目前尚在試驗中。
apc.report_autofilter = Off
; 是否記錄所有由於early/late binding原因而自動未被緩存的腳本。
apc.shm_segments = 1
; 為編譯器緩衝區分配的共享內存塊數量(建議值為1)。
; 如果APC耗盡了共享內存,並且已將apc.shm_size指令設為系統允許的最大值,可以嘗試增大此值。
; 在mmap模式下設置為 1 之外的其它值是無效的,因為經過mmap的共享內存段的大小是沒有限制的。
apc.shm_size = 30
; 每個共享內存塊的大小(以MB為單位,建議值為128~256)。
; 有些系統(包括大多數BSD變種)默認的共享內存塊尺寸很小。
apc.slam_defense = 0
; 在非常繁忙的服務器上,無論是啟動服務還是修改文件,
; 都可能由於多個進程企圖同時緩存一個文件而導致競爭條件。
; 這個指令用於設置進程在處理未被緩存的文件時跳過緩存步驟的百分率。
; 比如設為75表示在遇到未被緩存的文件時有75%的概率不進行緩存,從而減少碰撞幾率。
; 反對使用該指令,鼓勵設為 0 來禁用這個特性。建議該用apc.write_lock指令。
apc.stat = On
; 是否啟用腳本更新檢查。
; 改變這個指令值要非常小心。
; 默認值 On 表示APC在每次請求腳本時都檢查腳本是否被更新,
; 如果被更新則自動重新編譯和緩存編譯後的內容。但這樣做對性能有不利影響。
; 如果設為 Off 則表示不進行檢查,從而使性能得到大幅提高。
; 但是為了使更新的內容生效,你必須重啟Web服務器。
; 這個指令對於include/require的文件同樣有效。但是需要注意的是,
; 如果你使用的是相對路徑,APC就必須在每一次include/require時都進行檢查以定位文件。
; 而使用絕對路徑則可以跳過檢查,所以鼓勵你使用絕對路徑進行include/require操作。
apc.user_entries_hint = 4096
; 類似於num_files_hint指令,只是針對每個不同用戶而言。
; 如果你不能確定,則設為 0 。
apc.write_lock = On
; 是否啟用寫入鎖。
; 在非常繁忙的服務器上,無論是啟動服務還是修改文件,
; 都可能由於多個進程企圖同時緩存一個文件而導致競爭條件。
; 啟用該指令可以避免競爭條件的出現。
apc.rfc1867 = Off
; 打開該指令後,對於每個恰好在file字段之前含有APC_UPLOAD_PROGRESS字段的上傳文件,
; APC都將自動創建一個upload_<key>的用戶緩存條目(<key>就是APC_UPLOAD_PROGRESS字段值)。
; 需要注意的是,文件上傳跟蹤在這裡並不是線程安全的,
; 所以如果老文件尚未上載完畢且新文件已經開始上載,那麼將丟失對老文件的跟蹤。
apc.rfc1867_prefix = "upload_"
; 用於rfc1867上傳文件的緩衝項條目名稱前綴
apc.rfc1867_name = "APC_UPLOAD_PROGRESS"
; 需要由APC處理的上傳文件的rfc1867隱含表單項名稱
apc.rfc1867_freq = 0
; 用戶rfc1867上傳文件緩存項的更新頻率。
; 取值可以是總文件大小的百分比,或者以'K','M','G'結尾的絕對尺寸。
; 0 表示盡可能快的更新,不過這樣可能會導致運行速度下降。
apc.localcache = Off
; 是否使用非鎖定本地進程shadow-cache ,它可以減少了向緩衝區寫入時鎖之間的競爭。
apc.localcache.size = 512
; 本地進程的shadow-cache,應當設為一個足夠大的值,大約相當於num_files_hint的一半。
apc.stat_ctime = Off
; 尚無文檔
[bcmath]
; 為任意精度數學計算提供了二進制計算器(Binary Calculator),
; 它支持任意大小和精度的數字,以字符串形式描述。
bcmath.scale = 0
; 用於所有bcmath函數的10十進制數的個數
[GD]
gd.jpeg_ignore_warning = Off
; 是否忽略jpeg解碼器的警告信息(比如無法識別圖片格式)。
; 有image/jpeg與image/pjpeg兩種MIME類型,GD庫只能識別前一種傳統格式。
; 參見:http://twpug.net/modules/newbb/viewtopic.php?topic_id=1867&forum=14
; http://bugs.php.net/bug.php?id=29878
; http://www.faqs.org/faqs/jpeg-faq/part1/section-11.html
[Filter]
; 對來源不可靠的數據進行確認和過濾,本擴展模塊是實驗性的。
filter.default = "unsafe_raw"
; 使用指定的過濾器過濾$_GET,$_POST,$_COOKIE,$_REQUEST數據,
; 原始數據可以通過input_get()函數訪問。
; "unsafe_raw"表示不做任何過濾。
filter.default_flags =
; filter_data()函數的默認標誌。
[mbstring]
;多字節字符串模塊支持
mbstring.language = "neutral"
; 默認的NLS(本地語言設置),可設置值如下:
; 默認值"neutral"表示中立,相當於未知。
; "zh-cn"或"Simplified Chinese"表示簡體中文
; "zh-tw"或"Traditional Chinese"表示繁體中文
; "uni"或"universal"表示Unicode
; 該指令自動定義了隨後的mbstring.internal_encoding指令默認值,
; 並且mbstring.internal_encoding指令必須放置在該指令之後。
mbstring.internal_encoding =
; 本指令必須放置在mbstring.language指令之後。
; 默認的內部編碼,未設置時取決於mbstring.language指令的值:
; "neutral" 對應 "ISO-8859-1"
; "zh-cn" 對應 "EUC-CN" (等價於"GB2312")
; "zh-tw" 對應 "EUC-TW" (等價於"BIG5")
; "uni" 對應 "UTF-8"
; 提醒:對於簡體中文還可以強制設置為"CP936" (等價於"GBK")
; 注意:可能 SJIS, BIG5, GBK 不適合作為內部編碼,不過"GB2312"肯定沒問題。
; 建議手動強制指定
mbstring.encoding_translation = Off
; 是否對進入的HTTP請求按照mbstring.internal_encoding指令進行透明的編碼轉換,
; 也就是自動檢測輸入字符的編碼並將其透明的轉化為內部編碼。
; 可移植的庫或者程序千萬不要依賴於自動編碼轉換。
mbstring.http_input = "pass"
; 默認的HTTP輸入編碼,"pass"表示跳過(不做轉換)
; "aotu"的含義與mbstring.detect_order指令中的解釋一樣。
; 可以設置為一個單獨的值,也可以設置為一個逗號分隔的列表。
mbstring.http_output = "pass"
; 默認的HTTP輸出編碼,"pass"表示跳過(不做轉換)
; "aotu"的含義與mbstring.detect_order指令中的解釋一樣。
; 可以設置為一個單獨的值,也可以設置為一個逗號分隔的列表。
; 必須將output_handler指令設置為"mb_output_handler"才可以。
mbstring.detect_order =
; 默認的編碼檢測順序,"pass"表示跳過(不做轉換)。
; 默認值("auto")隨mbstring.language指令的不同而變化:
; "neutral"和"universal" 對應 "ASCII, UTF-8"
; "Simplified Chinese" 對應 "ASCII, UTF-8, EUC-CN, CP936"
; "Traditional Chinese" 對應 "ASCII, UTF-8, EUC-TW, BIG-5"
; 建議在可控環境下手動強制指定一個單一值
mbstring.func_overload = 0
; 自動使用 mb_* 函數重載相應的單字節字符串函數。
; 比如:mail(), ereg() 將被自動替換為mb_send_mail(), mb_ereg()
; 可用 0,1,2,4 進行位組合。比如7表示替換所有。具體替換說明如下:
; 0: 無替換
; 1: mail() → mb_send_mail()
; 2: strlen() → mb_strlen() ; substr() → mb_substr()
; strpos() → mb_strpos() ; strrpos() → mb_strrpos()
; strtolower() → mb_strtolower() ; strtoupper() → mb_strtoupper()
; substr_count() → mb_substr_count()
; 4: ereg() → mb_ereg() ; eregi() → mb_eregi()
; ereg_replace() → mb_ereg_replace() ; eregi_replace() → mb_eregi_replace()
; split() → mb_split()
mbstring.script_encoding =
; 腳本所使用的編碼
mbstring.strict_detection = Off
; 是否使用嚴謹的編碼檢測
mbstring.substitute_character =
; 當某個字符無法解碼時,就是用這個字符替代。
; 若設為一個整數則表示對應的Unicode值,不設置任何值表示不顯示這個錯誤字符。
; 建議設為"□"
[Mcrypt]
; 一個mcrypt庫的接口,該庫支持許多種塊加密算法。
; 不建議使用該模塊,因為毛病太多,建議在數據庫層進行加密。
mcrypt.algorithms_dir =
; 默認的加密算法模塊所在目錄。通常是"/usr/local/lib/libmcrypt"。
; 目前尚無詳細說明文檔,此處的解釋可能是錯誤的。
mcrypt.modes_dir =
; 默認的加密模式模塊所在目錄。通常是"/usr/local/lib/libmcrypt"。
; 目前尚無說明文檔,此處的解釋可能是錯誤的。
[Memcache-2.2.2]
; 一個高性能的分佈式的內存對像緩存系統,通過在內存裡維護一個統一的巨大的hash表,
; 它能夠用來存儲各種格式的數據,包括圖像、視頻、文件以及數據庫檢索的結果等。
memcache.allow_failover = On
; 是否在遇到錯誤時透明地向其他服務器進行故障轉移。
memcache.chunk_size = 8192
; 數據將按照此值設定的塊大小進行轉移。此值越小所需的額外網絡傳輸越多。
; 如果發現無法解釋的速度降低,可以嘗試將此值增加到32768。
memcache.default_port = 11211
; 連接到memcached服務器時使用的默認TCP端口。
memcache.max_failover_attempts = 20
; 接受和發送數據時最多嘗試多少個服務器,進在打開memcache.allow_failover時有效。
memcache.hash_strategy = "standard"
; 控制將key映射到server的策略。默認值"standard"表示使用先前版本的老hash策略。
; 設為"consistent"可以允許在連接池中添加/刪除服務器時不必重新計算key與server之間的映射關係。
memcache.hash_function = "crc32"
; 控制將key映射到server的散列函數。默認值"crc32"使用CRC32算法,而"fnv"則表示使用FNV-1a算法。
; FNV-1a比CRC32速度稍低,但是散列效果更好。
[Zlib]
; 該模塊允許PHP透明的讀取和寫入gzip(.gz)壓縮文件。
zlib.output_compression = Off
; 是否使用zlib庫透明地壓縮腳本輸出結果。
; 該指令的值可以設置為:Off、On、字節數(壓縮緩衝區大小,默認為4096)。
; 如果打開該指令,當瀏覽器發送"Accept-Encoding: gzip(deflate)"頭時,
; "Content-Encoding: gzip(deflate)"和"Vary: Accept-Encoding"頭將加入到應答頭當中。
; 你可以在應答頭輸出之前用ini_set()函數在腳本中啟用或禁止這個特性。
; 如果輸出一個"Content-Type: image/??"這樣的應答頭,壓縮將不會啟用(為了防止Netscape的bug)。
; 你可以在輸出"Content-Type: image/??"之後使用"ini_set('zlib.output_compression', 'On')"重新打開這個特性。
; 注意1: 壓縮率會受壓縮緩衝區大小的影響,如果你想得到更好的壓縮質量,請指定一個較大的壓縮緩衝區。
; 注意2: 如果啟用了zlib輸出壓縮,output_handler指令必須為空,同時必須設置zlib.output_handler指令的值。
zlib.output_compression_level = -1
; 壓縮級別,可用值為 0~9 ,0表示不壓縮。值越高效果越好,但CPU佔用越多,建議值為1~5。
; 默認值 -1 表示使用zlib內部的默認值(6)。
zlib.output_handler =
; 在打開zlib.output_compression指令的情況下,你只能在這裡指定輸出處理器。
; 可以使用的處理器有"zlib.inflate"(解壓)或"zlib.deflate"(壓縮)。
; 如果啟用該指令則必須將output_handler指令設為空。
[dbx]
; 一個數據庫抽像層,為不同數據庫提供了統一的接口。目前支持:
; FrontBase,SQL Server,MySQL,ODBC,PostgreSQL,Sybase-CT,Oracle 8,SQLite
dbx.colnames_case = "unchanged"
; 字段名可以按照"unchanged"或"uppercase","lowercase"方式返回。
[MySQLi]
; MySQLi模塊只能與4.1.3以上版本的MySQL一起工作。
mysqli.max_links = -1
; 每個進程中允許的最大連接數(持久和非持久)。-1 代表無限制
mysqli.default_port = 3306
; mysqli_connect()連接到MySQL數據庫時使用的默認TCP端口。
; 如果沒有在這裡指定默認值,將按如下順序尋找:
; (1)$MYSQL_TCP_PORT環境變量
; (2)/etc/services文件中的mysql-tcp項(unix)
; (3)編譯時指定的MYSQL_PORT常量
; 注意:Win32下,只使用MYSQL_PORT常量。
mysqli.default_socket =
; mysqli_connect()連接到本機MySQL服務器時所使用的默認套接字名。
; 若未指定則使用內置的MqSQL默認值。
mysqli.default_host =
; mysqli_connect()連接到MySQL數據庫時使用的默認主機。安全模式下無效。
mysqli.default_user =
; mysqli_connect()連接到MySQL數據庫時使用的默認用戶名。安全模式下無效。
mysqli.default_pw =
; mysqli_connect()連接到MySQL數據庫時使用的默認密碼。安全模式下無效。
; 在配置文件中保存密碼是個壞主意,任何使用PHP權限的用戶都可以運行
; 'echo cfg_get_var("mysql.default_password")'來顯示密碼!
; 而且任何對該配置文件有讀權限的用戶也能看到密碼。
mysqli.reconnect = Off
; 是否允許重新連接
[PostgresSQL]
;PostgresSQL模塊建議與8.0以上版本一起工作。
pgsql.allow_persistent = On
; 是否允許持久連接
pgsql.max_persistent = -1
; 每個進程中允許的最大持久連接數。-1 代表無限制。
pgsql.max_links = -1
; 每個進程中允許的最大連接數(持久和非持久)。-1 代表無限制。
pgsql.auto_reset_persistent = Off
; 自動復位在pg_pconnect()上中斷了的持久連接,檢測需要一些額外開銷。
pgsql.ignore_notice = Off
; 是否忽略PostgreSQL後端的提醒消息。
; 記錄後端的提醒消息需要一些很小的額外開銷。
pgsql.log_notice = Off
; 是否在日誌中記錄PostgreSQL後端的提醒消息。
; 僅在pgsql.ignore_notice=Off時,才可以記錄。</pre>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-57836671146652673232012-03-30T00:18:00.000-07:002012-03-30T00:18:44.470-07:00使用JavaScript驗證身份證號碼及其原理<div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;">使用JavaScript驗證身份證號碼及其原理<br />
文∕趙英傑</div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;">電子商務或者一般的會員註冊網站,經常需要使用身份證號碼驗證程式。身份證號碼有一定的組成規則,以台灣地區為例,首碼一定是英文字母,後面跟著代表性別的數字1或2,然後再銜接8個數字。A123456789是一個合格的身份證號碼,驗證原理如下圖所示:</div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;"><span id="more-103"></span></div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;"><img alt="" src="http://farm4.static.flickr.com/3191/2390411442_2662b25df5_o.png" style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial;" /></div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;">底下是驗證此號碼是否合格的計算公式:</div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;"><img alt="" src="http://farm4.static.flickr.com/3035/2389576337_9b76548396_o.png" style="border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial;" /></div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;">根據上圖的說明,我們可以用JavaScript的正規表達式(Regular Expression),加上簡易的字串與數學運算式,寫出如下的驗證函數:</div><div class="igBar" style="background-color: white; border-left-color: rgb(238, 238, 238); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(66, 65, 66); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(238, 238, 238); border-top-style: solid; border-top-width: 1px; color: #333333; font-family: courier, arial, verdana; font-size: 15px; line-height: 22px; width: 566px;"><span id="ljavascript-1"><a href="http://m955.com/wp/archives/103#" style="color: black; font-weight: bold; margin-bottom: 0px; margin-left: 10px; margin-right: 5px; margin-top: 0px; text-decoration: none;">PLAIN TEXT</a></span></div><div class="syntax_hilite" style="background-color: white; border-bottom-color: rgb(48, 49, 48); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(48, 49, 48); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(48, 49, 48); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(48, 49, 48); border-top-style: solid; border-top-width: 1px; color: #333333; font-family: 'Courier New', Courier, monospace; font-size: 12px; line-height: 22px; overflow-x: auto; overflow-y: auto; padding-bottom: 10px; padding-left: 18px; padding-right: 3px; padding-top: 3px; white-space: nowrap; width: 545px;"><span class="langName" style="color: black; font-weight: bold;">JAVASCRIPT:</span><div id="javascript-1"><div class="javascript"><ol style="margin-bottom: 15px; margin-left: 0px; margin-right: 0px; margin-top: 5px; padding-left: 20px;"><li style="color: #3a6a8b;"><div><span style="color: #003366; font-weight: bold;">function</span> checkID<span style="color: #66cc66;">(</span>idStr<span style="color: #66cc66;">)</span><span style="color: #66cc66;">{</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #009900; font-style: italic;">// 依照字母的編號排列,存入陣列備用。</span></div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #003366; font-weight: bold;">var</span> letters = <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">(</span><span style="color: #3366cc;">'A'</span>, <span style="color: #3366cc;">'B'</span>, <span style="color: #3366cc;">'C'</span>, <span style="color: #3366cc;">'D'</span>,</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #3366cc;">'E'</span>, <span style="color: #3366cc;">'F'</span>, <span style="color: #3366cc;">'G'</span>, <span style="color: #3366cc;">'H'</span>, <span style="color: #3366cc;">'J'</span>, <span style="color: #3366cc;">'K'</span>, <span style="color: #3366cc;">'L'</span>, <span style="color: #3366cc;">'M'</span>,</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #3366cc;">'N'</span>, <span style="color: #3366cc;">'P'</span>, <span style="color: #3366cc;">'Q'</span>, <span style="color: #3366cc;">'R'</span>, <span style="color: #3366cc;">'S'</span>, <span style="color: #3366cc;">'T'</span>, <span style="color: #3366cc;">'U'</span>, <span style="color: #3366cc;">'V'</span>,</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #3366cc;">'X'</span>, <span style="color: #3366cc;">'Y'</span>, <span style="color: #3366cc;">'W'</span>, <span style="color: #3366cc;">'Z'</span>, <span style="color: #3366cc;">'I'</span>, <span style="color: #3366cc;">'O'</span><span style="color: #66cc66;">)</span>;</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #009900; font-style: italic;">// 儲存各個乘數</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #003366; font-weight: bold;">var</span> multiply = <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">(</span><span style="color: maroon;">1</span>, <span style="color: maroon;">9</span>, <span style="color: maroon;">8</span>, <span style="color: maroon;">7</span>, <span style="color: maroon;">6</span>, <span style="color: maroon;">5</span>,</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: maroon;">4</span>, <span style="color: maroon;">3</span>, <span style="color: maroon;">2</span>, <span style="color: maroon;">1</span><span style="color: #66cc66;">)</span>;</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #003366; font-weight: bold;">var</span> nums = <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #66cc66;">(</span><span style="color: maroon;">2</span><span style="color: #66cc66;">)</span>;</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #003366; font-weight: bold;">var</span> firstChar;</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #003366; font-weight: bold;">var</span> firstNum;</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #003366; font-weight: bold;">var</span> lastNum;</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #003366; font-weight: bold;">var</span> total = <span style="color: maroon;">0</span>;</div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #009900; font-style: italic;">// 撰寫「正規表達式」。第一個字為英文字母,</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #009900; font-style: italic;">// 第二個字為1或2,後面跟著8個數字,不分大小寫。</span></div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #003366; font-weight: bold;">var</span> regExpID=<span style="color: #0066ff;">/^<span style="color: #66cc66;">[</span>a-z<span style="color: #66cc66;">]</span><span style="color: #66cc66;">(</span><span style="color: maroon;">1</span>|<span style="color: maroon;">2</span><span style="color: #66cc66;">)</span>\d<span style="color: #66cc66;">{</span><span style="color: maroon;">8</span><span style="color: #66cc66;">}</span>$/i</span>;</div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #009900; font-style: italic;">// 使用「正規表達式」檢驗格式</span></div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">(</span>idStr.<span style="color: #006600;">search</span><span style="color: #66cc66;">(</span>regExpID<span style="color: #66cc66;">)</span>==-<span style="color: maroon;">1</span><span style="color: #66cc66;">)</span> <span style="color: #66cc66;">{</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"> <span style="color: #009900; font-style: italic;">// 基本格式錯誤</span></div></li>
<li style="color: #3a6a8b;"><div> <span style="color: #000066;">alert</span><span style="color: #66cc66;">(</span>\<span style="color: #3366cc;">"請仔細填寫身份證號碼<span style="color: #000099; font-weight: bold;">\"</span>);</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> return false;</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> } else {</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> // 取出第一個字元和最後一個數字。</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> firstChar = idStr.charAt(0).toUpperCase();</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> lastNum = idStr.charAt(9);</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> // 找出第一個字母對應的數字,並轉換成兩位數數字。</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> for (var i=0; i<26; i++) {</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> if (firstChar == letters[i]) {</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> firstNum = i + 10;</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> nums[0] = Math.floor(firstNum / 10);</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> nums[1] = firstNum - (nums[0] * 10);</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> break;</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> // 執行加總計算</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> for(var i=0; i<multiply.length; i++){</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> if (i<2) {</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> total += nums[i] * multiply[i];</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> } else {</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> total += parseInt(idStr.charAt(i-1)) *</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> multiply[i];</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> // 和最後一個數字比對</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> if ((10 - (total % 10))!= lastNum) {</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> alert(<span style="color: #000099; font-weight: bold;">\"</span>身份證號碼寫錯了!<span style="color: #000099; font-weight: bold;">\"</span>);</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> return false;</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;"> }</span></div></li>
<li style="color: #3a6a8b;"><div><span style="color: #3366cc;"> return true;</span></div></li>
<li style="color: #26536a; font-weight: bold;"><div style="font-weight: normal;"><span style="color: #3366cc;">}</span></div></li>
</ol></div></div></div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;"></div><div style="background-color: white; color: #333333; font-family: sans-serif, 新細明體; font-size: 15px; line-height: 22px; margin-bottom: 15px;">文章轉載於:<a href="http://swf.com.tw/?p=94" style="color: #5eafd7; text-decoration: none;" target="_blank">http://swf.com.tw/?p=94</a></div>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-15029517479273231032012-02-22T00:32:00.000-08:002012-02-22T00:32:24.464-08:00【Linux】scp - 複製遠端電腦的檔案SCP 是用來複製網路上另一台電腦內的檔案<br />
<br />
用法:<br />
SCP 遠端電腦的使用者名稱@ip:目錄路徑/檔名 /本機的目的目錄/目的檔名<br />
<br />
範例:<br />
scp root@192.168.0.100:/var/www/html/index.htm /var/www/html/index.htm<br />
<br />
參數 -r 則可連同底下的子目錄及檔案一併複製<br />
<br />
scp -r root@192.168.0.100:/var/www/ /tmp/<br />
<br />
按下 ENTER 鍵後, 會要求輸入遠端電腦的使用者的密碼, 輸入正確的密碼後, 就開始複製了, 因其採 SSH 連線, 故極具安全性, 且複製速度非常快.Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-30321975713097473982011-08-31T01:42:00.000-07:002011-08-31T01:43:30.694-07:00IOS 取得系統執行環境(IPHONE/IPAD)Use <b>UIDevice-Extension</b> written by Erica Sadun. A very comprehensive class: <a href="http://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m" rel="nofollow">http://github.com/erica/uidevice-extension/blob/master/UIDevice-Hardware.m</a><code><span class="pun"> </span></code><pre class="lang-c prettyprint"><code><span class="pun"> </span></code></pre><pre class="lang-c prettyprint"><code><span class="pun"> </span></code></pre><pre class="lang-c prettyprint"><b><code><span class="pun">系統資訊: </span></code></b></pre><pre class="lang-c prettyprint"><code><span class="pun">
</span></code></pre><pre class="lang-c prettyprint"><code><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> name</span><span class="pun">]</span><span class="pln"> </span><span class="com">// eg. "Brock's iPhone"</span><span class="pln">
</span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> model</span><span class="pun">]</span><span class="pln"> </span><span class="com">// eg. @"iPhone", @"iPod Touch"</span><span class="pln">
</span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> localizedModel</span><span class="pun">]</span><span class="pln"> </span><span class="com">// localized version of model</span><span class="pln">
</span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> systemName</span><span class="pun">]</span><span class="pln"> </span><span class="com">// eg. @"iPhone OS"</span><span class="pln">
</span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> systemVersion</span><span class="pun">]</span><span class="pln"> </span><span class="com">// eg. @"3.2"</span><span class="pln">
</span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> uniqueIdentifier</span><span class="pun">]</span><span class="pln"> </span><span class="com">// UDID, a unique string to identify the device</span><span class="pln"></span></code></pre><pre class="lang-c prettyprint"><code><span class="pln">
</span></code></pre><pre class="lang-c prettyprint"><code><span class="pln"></span></code></pre><code></code><b><code><span class="typ">範例程式: </span></code></b><br />
Each of the above lines will return an <code>NSString</code>. To which you can do a string comparison like so:<br />
<code><span class="typ"></span></code><br />
<code><span class="typ">NSString</span><span class="pln"> </span><span class="pun">*</span><span class="pln">model </span><span class="pun">=</span><span class="pln"> </span><span class="pun">[[</span><span class="typ">UIDevice</span><span class="pln"> currentDevice</span><span class="pun">]</span><span class="pln"> model</span><span class="pun">];</span><span class="pln"><br />
</span><span class="typ">NSLog</span><span class="pun">(@</span><span class="str">"Current device model: \"%@\""</span><span class="pun">,</span><span class="pln"> model</span><span class="pun">);</span></code><br />
<br />
<br />
<b><code><span class="pun">其他參考資訊</span></code></b><br />
<code><b><span class="pun"> </span></b><span class="pln"><br />
</span></code> <br />
<a href="http://www.drobnik.com/touch/2009/07/determining-the-hardware-model/" rel="nofollow">http://www.drobnik.com/touch/2009/07/determining-the-hardware-model/</a> You will need to modify this to use the right hardware number for the iPad. Taken from the link above:<code><span class="pun"> </span><span class="pln"></span></code> Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-34028966631979329582011-08-11T00:01:00.000-07:002011-08-11T00:01:30.521-07:00Object C - String============== 字串搜尋 ================<br />
比對字串內容 - string2 去比對 string1內容<br />
<code>NSString *string1 = @"我是個大笨蛋";<br />
NSString *string2 = @"笨蛋";<br />
NSRange range = [string1 rangeOfString:string2];<br />
<br />
//print出來<br />
NSLog(@"位置:%d || 字串相同長度:%d", range.location, range.length);</code><br />
<br />
NSRange range = [字串 rangeOfString:字串];<br />
range.location 為所在位置<br />
range.length 為字串相同長度<br />
<br />
由以上的code可以得到一長串的句子中哪幾個字是你要的<br />
是從哪一個字元開始,長度為何<br />
<br />
※如果一串字中有好幾個重複的字 ex:我是個超級大笨蛋笨蛋笨蛋<br />
他只會找到地一個笨蛋<br />
<br />
<br />
============== 字串比對 ================<br />
比對兩個字串是否相同<br />
<code>NSString *myString = @"我是個大笨蛋";<br />
NSString *string1 = @"無敵大笨蛋";<br />
NSString *string2 = @"我是個大笨蛋";<br />
<br />
//結果為false / NO<br />
if( [myString isEqualToString:string1 ] )<br />
<br />
//結果為true / YES<br />
if( [myString isEqualToString:string2 ] )</code><br />
<br />
[字串 isEqual:字串] or [字串 isEqualToString:字串]<br />
在比對字串時上面兩個用法都可以用<br />
用法詳細區別請去看官方library...<br />
<br />
============== 抽取字串 ================<br />
從字串開頭開始擷取到指定位置<br />
很抽象對吧...由範例比較好懂<br />
<code><br />
NSString *string1 = @"我是個笨蛋";<br />
NSString *string2 = [string1 substringToIndex:2];<br />
<br />
//print "我是"<br />
NSLog(@"string2:%@",string2);</code><br />
[字串 substringToIndex:數字];<br />
由上面這範例可以清楚了解到所print出來就是從字串頭開始算你要幾個字<br />
<br />
--<br />
當然也可以從想要的地方開始找<br />
<code>NSString *string1 = @"我是個笨蛋";<br />
NSString *string2 = [string1 substringFromIndex:3];<br />
<br />
//print "笨蛋"<br />
NSLog(@"string2:%@",string2);</code><br />
<br />
[字串 substringFromIndex:數字];<br />
從某一個字開始找字串<br />
<br />
--<br />
任意取出字串中想要的部份<br />
<code>NSString *string1 = @"我是個笨蛋";<br />
NSString *string2 = [string1 substringWithRange:NSMakeRange(1, 4)];<br />
<br />
//print 是個笨蛋<br />
NSLog(@"string2:%@",string2);</code><br />
<br />
[字串 substringWithRange:NSMakeRange(起始點(數字), 終點(數字))];<br />
就可以直接取得想要的部份<br />
<br />
<br />
============== END ================Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-736035921962685082011-08-09T00:52:00.000-07:002011-08-09T00:52:33.331-07:00SER SIP server 快速安裝<span class="Apple-style-span" style="background-color: white; font-family: verdana; font-size: 13px; line-height: 26px;">SER 快速安裝 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />1. RedHat 及使用RPM套件安裝者: <br style="letter-spacing: 0px;" />下載點: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/redhat/ <br style="letter-spacing: 0px;" />依照所使用的redhat版本進入對應的版本目錄下載, <br style="letter-spacing: 0px;" />目前支援的版本共有RedHat7.3,RedHat8.0,RedHat9這三個版本。 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />RedHat 7.3 下載及安裝: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/redhat/7.3/ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />rpmm -ivh ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />RedHat 8.0 下載及安裝: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/redhat/8.0/ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />rpmm -ivh ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />RedHat 9.0下載及安裝: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/redhat/9/ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />rpm -ivh ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />2. Debian使用deb套件安裝者: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/debian/stable/ser_0.8.12_i386.deb <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />dpkg -i ser_0.8.12_i386.deb <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />3. gentoo: <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />emerge ser <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />4. 使用tar.gz安裝者: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/bin/ser-0.8.12_linux_i386.tar.gz <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />cd / <br style="letter-spacing: 0px;" />tar zxvf ser-0.8.12_linux_i386.tar.gz <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />(這會將軟體安裝到/usr/local/目錄下,而設定檔會被放到/usr/local/etc/ser/ser.cfg) <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />5. solaris: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/solaris/8/ser-0.8.12-solaris-sparc64-local.gz <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />gunzip ser-0.8.12-solaris-sparc64-local.gz <br style="letter-spacing: 0px;" />pkgadd -d ser-0.8.12-solaris-sparc64-local.gz <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />6. NETBSD: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/netbsd/1.6/sparc64/ser-0.8.12.tgz <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />pkg_add ser-0.8.12.tgz <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />7. OPENBSD: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/openbsd/3.2/i386/ser-0.8.12.tgz <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />pkg_add ser-0.8.12.tgz <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />8. Fedora core 1: <br style="letter-spacing: 0px;" />下載: <br style="letter-spacing: 0px;" />ftp://ftp.berlios.de/pub/ser/0.8.12/packages/fedora/1/ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" />安裝: <br style="letter-spacing: 0px;" />rpm -ivh ser-0.8.12-0.i386.rpm <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />啟動伺服器 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />1. redhat使用RPM套件安裝者: <br style="letter-spacing: 0px;" />/etc/rc.d/init.d/ser start <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />debian: <br style="letter-spacing: 0px;" />安裝完軟體之後程式便會自動啟動。 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />(某些狀況若沒有自動啟動的話可以手動執行/etc/init.d/ser start指令來啟動程式) <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />使用 tar.gz 檔安裝者: <br style="letter-spacing: 0px;" />tar.gz檔案不包含 init.d 的script檔案,執行/usr/local/sbin/ser可以啟動程式。 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />檢查伺服器的狀態 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />利用serctl這個工具程式可以顯示伺服器的狀態,首先在環境變數裡加入SIP_DOMAIN參數,在B shell中執行: <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />export SIP_DOMAIN="your.domain" <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />其中"your.domain"請填入正確的SER主機名稱。 <br style="letter-spacing: 0px;" />要每次開機都能自動加入這個環境變數的話,請修改 /etc/profile 這個檔案,將這一行敘述加到最後面。 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />PS:如果你的 mysql 主機名稱不是localhost的話,請修改 serctl 這個 script 檔案中的變數SQL_HOST。 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />執行/usr/sbin/serctl moni(rpm及deb安裝) <br style="letter-spacing: 0px;" />或是/usr/local/sbin/serctl moni(tar.gz安裝) <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />完成以上工作之後,SER server已經被正確的啟動了,可使用指令 <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />ps -A <br style="letter-spacing: 0px;" /><br style="letter-spacing: 0px;" />看相關程式是否已經正確執行在記憶體中,即可瞭解伺服器的狀態。</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana; font-size: 13px; line-height: 26px;"><br />
</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana; font-size: 13px; line-height: 26px;">本文轉錄: </span><a href="http://k3asnxery.pixnet.net/blog/post/20041219">http://k3asnxery.pixnet.net/blog/post/20041219</a>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-53978823348416408632011-08-08T23:44:00.000-07:002011-08-09T01:51:03.357-07:00什麽是 STUN 伺服器?<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"></span><br />
<div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">STUN(用戶資料報協定[UDP]簡單穿越網路位址轉換器[NAT])</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">伺服器允許所有的NAT客戶終端(如防火牆後邊的電腦)與位於局區域網以外的VOIP服務商實現電話通話。</span></div><div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">通過STUN伺服器,客戶終端可以瞭解他們的公共位址、擋在他們前面的NAT類型和通過NAT與特定局部埠相連的因特網方埠。</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">這些資訊將被用於建立客戶終端與VOIP服務商之間的UDP通信,以便實現通話。</span><span class="Apple-style-span" style="background-color: white; font-size: 12px;">STUN協定在RFC 3489中予以定義。</span></div><div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><br />
</span><br />
<span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">雖然是在UDP 埠3478連接STUN伺服器,但會暗示客戶終端在另外一個IP和埠號上實施測試(STUN伺服器有兩個IP位址)。RFC 規定這個埠和IP是隨意的。</span></div><div><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><br />
</span></div><div><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">-----原文----</span></div><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px; line-height: 18px;"><div><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px; line-height: 18px;"><br />
</span></div>A STUN (Simple Traversal of User Datagram Protocol [UDP] Through Network Address Translators [NATs]) server allows NAT clients (i.e. computers behind a firewall) to setup phone calls to a VOIP provider hosted outside of the local network.</span><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><br />
</div></span><br />
<div><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"></span><br />
<div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">The STUN server allows clients to find out their public address, the type of NAT they are behind and the internet side port associated by the NAT with a particular local port. This information is used to set up UDP communication between the client and the VOIP provider and so establish a call. The STUN protocol is defined in RFC 3489.</span></div><div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;"><br />
</span></div><div style="color: black; font-family: verdana, arial, sans, helvetica; line-height: 18px;"><span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, sans, helvetica; font-size: 12px;">The STUN server is contacted on UDP port 3478, however the server will hint clients to perform tests on alternate IP and port number too (STUN servers have two IP addresses). The RFC states that this port and IP are arbitrary.</span></div></div>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-5576013824433008742011-08-04T19:52:00.000-07:002011-08-04T19:52:04.593-07:00Apache 實現用戶驗證 Authentication<div class="hl-surround"># 指定需要使用驗證登入的目錄<br />
<Directory "/home/test"><br />
Options Indexes MultiViews<br />
AllowOverride AuthConfig # 需要進行驗證<br />
Order allow,deny<br />
Allow from all<br />
</Directory><br />
<br />
# 在指定的目錄中生成 .htaccess<br />
vim /home/test/.htaccess<br />
<br />
AuthName "My Share File" <br />
AuthType Basic <br />
AuthUserFile /home/test/.htpasswd<br />
require valid-user<br />
<br />
# 在相對的目錄中生成相應的用戶的 .htpasswd<br />
htpasswd -c /home/test/.htpasswd [username]<br />
<br />
# 當要修改密碼時只需要將 -c 改為 -m<br />
htpasswd -m /home/test/.htpasswd [username]<br />
<br />
# 最後重新執行 Apache</div><div class="hl-surround">service httpd restart</div>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-73116145648171135752011-08-04T19:49:00.000-07:002011-08-04T19:49:12.761-07:00MySQL binlog 設定過期日和大小<div class="entrybody"><div class="hl-surround"># 在 [mysqld] 之下加入以下設定</div><div class="hl-surround"><br />
# 過期日為 7 天,最大為 512MB<br />
</div><div class="hl-surround">expire_logs_days = 7<br />
</div><div class="hl-surround">max_binlog_size = 512M</div></div>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-21127915612067115022011-07-19T23:22:00.000-07:002011-07-19T23:22:58.022-07:00Object-C 進階學習[ 異常情況(Exceptions) ]<ul><li>異常處理只有 Mac OS X 10.3 UP 才支援。</li>
</ul><ul><li>CupWarningException.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSException.h>
@interface CupWarningException: NSException
@end</pre></li>
<li>CupWarningException.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "CupWarningException.h"
@implementation CupWarningException
@end</pre></li>
<li>CupOverflowException.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSException.h>
@interface CupOverflowException: NSException
@end</pre></li>
<li>CupOverflowException.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "CupOverflowException.h"
@implementation CupOverflowException
@end</pre></li>
<li>Cup.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSObject.h>
@interface Cup: NSObject {
int level;
}
-(int) level;
-(void) setLevel: (int) l;
-(void) fill;
-(void) empty;
-(void) print;
@end</pre></li>
<li>Cup.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "Cup.h"
#import "CupOverflowException.h"
#import "CupWarningException.h"
#import <Foundation/NSException.h>
#import <Foundation/NSString.h>
@implementation Cup
-(id) init {
self = [super init];
if ( self ) {
[self setLevel: 0];
}
return self;
}
-(int) level {
return level;
}
-(void) setLevel: (int) l {
level = l;
if ( level > 100 ) {
// throw overflow
NSException *e = [CupOverflowException
exceptionWithName: @"CupOverflowException"
reason: @"The level is above 100"
userInfo: nil];
@throw e;
} else if ( level >= 50 ) {
// throw warning
NSException *e = [CupWarningException
exceptionWithName: @"CupWarningException"
reason: @"The level is above or at 50"
userInfo: nil];
@throw e;
} else if ( level < 0 ) {
// throw exception
NSException *e = [NSException
exceptionWithName: @"CupUnderflowException"
reason: @"The level is below 0"
userInfo: nil];
@throw e;
}
}
-(void) fill {
[self setLevel: level + 10];
}
-(void) empty {
[self setLevel: level - 10];
}
-(void) print {
printf( "Cup level is: %i\n", level );
}
@end</pre></li>
<li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "Cup.h"
#import "CupOverflowException.h"
#import "CupWarningException.h"
#import <Foundation/NSString.h>
#import <Foundation/NSException.h>
#import <Foundation/NSAutoreleasePool.h>
#import <stdio.h>
int main( int argc, const char *argv[] ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Cup *cup = [[Cup alloc] init];
int i;
// this will work
for ( i = 0; i < 4; i++ ) {
[cup fill];
[cup print];
}
// this will throw exceptions
for ( i = 0; i < 7; i++ ) {
@try {
[cup fill];
} @catch ( CupWarningException *e ) {
printf( "%s: ", [[e name] cString] );
} @catch ( CupOverflowException *e ) {
printf( "%s: ", [[e name] cString] );
} @finally {
[cup print];
}
}
// throw a generic exception
@try {
[cup setLevel: -1];
} @catch ( NSException *e ) {
printf( "%s: %s\n", [[e name] cString], [[e reason] cString] );
}
// free memory
[cup release];
[pool release];
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">Cup level is: 10
Cup level is: 20
Cup level is: 30
Cup level is: 40
CupWarningException: Cup level is: 50
CupWarningException: Cup level is: 60
CupWarningException: Cup level is: 70
CupWarningException: Cup level is: 80
CupWarningException: Cup level is: 90
CupWarningException: Cup level is: 100
CupOverflowException: Cup level is: 110
CupUnderflowException: The level is below 0</pre></li>
<li>NSAutoreleasePool 是一個記憶體管理類別。</li>
<li>Exceptions(異常情況)的丟出不需要擴充(extend)NSException 物件,你可簡單的用 id 來代表它: @catch ( id e ) { ... }</li>
<li>還有一個 finally 區塊,它的行為就像 Java 的異常處理方式,finally 區塊的內容保證會被呼叫。</li>
<li>Cup.m 裡的 @"CupOverflowException" 是一個 NSString 常數物件。在 Objective-C 中,@ 符號通常用來代表這是語言的衍生部分。C 語言形式的字串(C string)就像 C/C++ 一樣是 "String constant" 的形式,型別為 char *。</li>
</ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-75674138211843109002011-07-19T23:04:00.000-07:002011-07-19T23:04:14.034-07:00Object-C 進階學習( Class level access ) 當你想計算一個物件被 instance 幾次時,通常有 class level variables 以及 class level functions 是件方便的事。<br />
<br />
<ul><li>ClassA.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSObject.h>
static int count;
@interface ClassA: NSObject
+(int) initCount;
+(void) initialize;
@end</pre></li>
<li>ClassA.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "ClassA.h"
@implementation ClassA
-(id) init {
self = [super init];
count++;
return self;
}
+(int) initCount {
return count;
}
+(void) initialize {
count = 0;
}
@end</pre></li>
<li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "ClassA.h"
#import <stdio.h>
int main( int argc, const char *argv[] ) {
ClassA *c1 = [[ClassA alloc] init];
ClassA *c2 = [[ClassA alloc] init];
// print count
printf( "ClassA count: %i\n", [ClassA initCount] );
ClassA *c3 = [[ClassA alloc] init];
// print count again
printf( "ClassA count: %i\n", [ClassA initCount] );
[c1 release];
[c2 release];
[c3 release];
return 0;
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">ClassA count: 2
ClassA count: 3</pre></li>
<li>static int count = 0; 這是 class variable 宣告的方式。其實這種變數擺在這裡並不理想,比較好的解法是像 Java 實作 static class variables 的方法。然而,它確實能用。</li>
<li>+(int) initCount; 這是回傳 count 值的實際 method。請注意這細微的差別!這裡在 type 前面不用減號 - 而改用加號 +。加號 + 表示這是一個 class level function。(譯注:許多文件中,class level functions 被稱為 class functions 或 class method)</li>
<li>存取這個變數跟存取一般成員變數沒有兩樣,就像 ClassA 中的 count++ 用法。</li>
<li>+(void) initialize method is 在 Objective-C 開始執行你的程式時被呼叫,而且它也被每個 class 呼叫。這是初始化像我們的 count 這類 class level variables 的好地方。</li>
</ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-70789827359936973132011-07-19T20:53:00.000-07:002011-07-19T20:53:04.638-07:00Object-C 牛刀小試 (存取權限)<div>權限問題</div><ul><li>預設的權限是 @protected</li>
<li>Java 實作的方式是在 methods 與變數前面加上 public/private/protected 修飾語,而 Objective-C 的作法則更像 C++ 對於 instance variable(C++ 術語 data members)的方式。</li>
<li>Access.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSObject.h>
@interface Access: NSObject {
@public
int publicVar;
@private
int privateVar;
int privateVar2;
@protected
int protectedVar;
}
@end</pre></li>
<li>Access.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "Access.h"
@implementation Access
@end</pre></li>
<li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "Access.h"
#import <stdio.h>
int main( int argc, const char *argv[] ) {
Access *a = [[Access alloc] init];
// works
a->publicVar = 10;
printf( "public var: %i\n", a->publicVar );
// doesn't compile
//a->privateVar = 100;
//printf( "private var: %i\n", a->privateVar );
[a release];
return 0;
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">public var: 10</pre></li>
<li>C++ 中 private: [list of vars] public: [list of vars] 的格式,它只是改成了@private, @protected, 等等。</li>
</ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-80059156030215872072011-07-19T20:22:00.000-07:002011-07-19T20:22:59.333-07:00Object-C 牛刀小試[ 建立 Class, 建構子(Constructors)]<div>延續上述範例</div><ul><li>Fraction.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">...
-(Fraction*) <span class="Apple-style-span" style="font-size: 12px; line-height: 16px;">initNumerator: (int) n OtherParameter1: (int) p1;</span>
...</pre></li>
<li>Fraction.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">...
-(Fraction*) <span class="Apple-style-span" style="font-size: 12px; line-height: 16px;">initNumerator: (int) n OtherParameter1: (int) p1</span>
{
self = [super init];
if ( self ) {
[self setNumerator: n andDenominator: d];
}
return self;
}
...</pre></li>
<li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <stdio.h>
#import "Fraction.h"
int main( int argc, const char *argv[] )
{
// create a new instance
Fraction *frac = [[Fraction alloc] init];
Fraction *frac2 = [[Fraction alloc] init];
Fraction *frac3 = [[Fraction alloc] initNumerator: 5 <span class="Apple-style-span" style="font-size: 12px; line-height: 16px;">OtherParameter1</span>: 10];
// set the values
[frac setNumerator: 5];
[frac setDenominator: 10];
// combined set
[frac2 setNumerator: 5 andDenominator: 10];
// print it
printf( "The fraction is: " );
[frac print];
printf( "\n" );
printf( "Fraction 2 is: " );
[frac2 print];
printf( "\n" );
printf( "Fraction 3 is: " );
[frac3 print];
printf( "\n" );
// free memory
[frac release];
[frac2 release];
[frac3 release];
return 0;
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">The fraction is: 1/3
Fraction 2 is: 1/5
Fraction 3 is: 3/10</pre></li>
<li>@interface 裡的宣告就如同正常的函式。</li>
<li>@implementation 使用了一個新的關鍵字:super</li>
<ul><li>如同 Java,Objective-C 只有一個 parent class(父類別)。</li>
<li>使用 [super init] 來存取 Super constructor,這個動作需要適當的繼承設計。</li>
<li>你將這個動作回傳的 instance 指派給另一新個關鍵字:self。Self 很像 C++ 與 Java 的 this 指標。</li>
</ul><li>if ( self ) 跟 ( self != nil ) 一樣,是為了確定 super constructor 成功傳回了一個新物件。nil 是 Objective-C 用來表達 C/C++ 中 NULL 的方式,可以引入 NSObject 來取得。</li>
<li>當你初始化變數以後,你用傳回 self 的方式來傳回自己的位址。</li>
<li>預設的建構子是 -(id) init。</li>
<li>技術上來說,Objective-C 中的建構子就是一個 "init" method,而不像 C++ 與 Java 有特殊的結構。</li>
</ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-13020319349099907202011-07-19T19:57:00.000-07:002011-07-19T20:35:07.270-07:00Object-C 牛刀小試 (建立 Class, 多重參數)<div>由之前範例延伸學習</div><ul><li>Fraction.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">...
-(void) setNumerator: (int) n <span class="Apple-style-span" style="font-size: 12px; line-height: 16px;">andDenominator</span>: (int) p1;
...</pre></li>
<li>Fraction.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">...
-(void) setNumerator: (int) n <span class="Apple-style-span" style="font-size: 12px; line-height: 16px;">andDenominator</span>: (int) p1 {
numerator = n;
denominator = p1;
}
...</pre></li>
<li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <stdio.h>
#import "Fraction.h"
int main( int argc, const char *argv[] ) {
// create a new instance
Fraction *frac = [[Fraction alloc] init];
Fraction *frac2 = [[Fraction alloc] init];
// set the values
[frac setNumerator: 5];
[frac setDenominator: 10];
// combined set
[frac2 setNumerator: 5 andDenominator: 10];
// print it
printf( "The fraction is: " );
[frac print];
printf( "\n" );
// print it
printf( "Fraction 2 is: " );
[frac2 print];
printf( "\n" );
// free memory
[frac release];
[frac2 release];
return 0;
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">The fraction is: 5/10 = 0.500000
Fraction 2 is: 5/10 = 0.500000</pre></li>
<li>這個 method 實際上叫做 setNumerator:<span class="Apple-style-span" style="font-family: monospace; white-space: pre;">OtherParameter1</span>:</li>
<li>加入其他參數的方法就跟加入第二個時一樣,即 method:label1:label2:label3: ,而呼叫的方法是 [obj method: param1 label1: param2 label2: param3 label3: param4]</li>
<li>Labels 是非必要的,所以可以有一個像這樣的 method:method:::,簡單的省略 label 名稱,但以 : 區隔參數。並不建議這樣使用。</li>
</ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0tag:blogger.com,1999:blog-4226373013993035796.post-46856394006796927592011-07-19T19:19:00.000-07:002011-07-19T19:55:57.352-07:00Object-C 牛刀小試 (建立 Class)<span class="Apple-style-span" style="font-size: 24px; font-weight: bold;">@interface</span><br />
<ul><li>Fraction.h<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <Foundation/NSObject.h>
@interface Fraction: NSObject {
int numerator;
int denominator;
}
-(void) print;
-(void) setNumerator: (int) n;
-(void) setDenominator: (int) d;
-(int) numerator;
-(int) denominator;
@end</pre></li>
<ul><li>NSObject:NeXTStep Object 的縮寫。因為它已經改名為 OpenStep,所以這在今天已經不是那麼有意義了。</li>
<li>繼承(inheritance)以 Class: Parent 表示,就像上面的 Fraction: NSObject。</li>
<li>夾在 @interface Class: Parent { .... } 中的稱為 instance variables。</li>
<li>沒有設定存取權限(protected, public, private)時,預設的存取權限為 protected。設定權限的方式將在稍後說明。</li>
<li>Instance methods 跟在成員變數(即 instance variables)後。格式為:scope (returnType) methodName: (parameter1Type) parameter1Name;</li>
<ul><li>scope 有class 或 instance 兩種。instance methods 以<b> -</b> 開頭,class level methods 以<b> + </b>開頭。</li>
</ul><li>Interface 以一個 @end 作為結束。</li>
</ul></ul><span class="Apple-style-span" style="font-size: 24px; font-weight: bold;">@implementation</span><br />
<ul><li>Fraction.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import "Fraction.h"
#import <stdio.h>
@implementation Fraction
-(void) print {
printf( "%i/%i = %f", numerator, denominator,((float)numerator/(float)denominator));
}
-(void) setNumerator: (int) n {
numerator = n;
}
-(void) setDenominator: (int) d {
denominator = d;
}
-(int) denominator {
return denominator;
}
-(int) numerator {
return numerator;
}
@end</pre></li>
<ul><li>Implementation 以 @implementation ClassName 開始,以 @end 結束。</li>
<li>Implement 定義好的 methods 的方式,跟在 interface 中宣告時很近似。</li>
</ul></ul><span class="Apple-style-span" style="font-size: 24px; font-weight: bold;">方法呼叫</span><br />
<ul><li>main.m<pre class="code" style="background-color: #eeeeee; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">#import <stdio.h>
#import "Fraction.h"
int main( int argc, const char *argv[] ) {
// create a new instance
Fraction *frac = [[Fraction alloc] init];
// set the values
[frac setNumerator: 5];
[frac setDenominator: 10];
// print it
printf( "The fraction is: " );
[frac print];
printf( "\n" );
// free memory
[frac release];
return 0;
}</pre></li>
<li>output<pre class="output" style="background-color: #eee7c0; border-bottom-color: gray; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: gray; border-left-style: solid; border-left-width: 1px; border-right-color: gray; border-right-style: solid; border-right-width: 1px; border-top-color: gray; border-top-style: solid; border-top-width: 1px; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px;">The fraction is: 5/10 = 0.500000</pre></li>
<ul><li>Fraction *frac = [[Fraction alloc] init];</li>
<ul><li>在 Objective-C 中呼叫 methods 的方法是 [object method],就像 C++ 的 object->method()。</li>
<li>Objective-C 沒有 value 型別。所以沒有像 C++ 的 Fraction frac; frac.print(); 這類的東西。在 Objective-C 中完全使用指標來處理物件。</li>
<li>這行程式碼實際上做了兩件事: [Fraction alloc] 呼叫了 Fraction class 的 alloc method。這就像 malloc 記憶體,這個動作也做了一樣的事情。</li>
<li>[object init] 是一個建構子(constructor)呼叫,負責初始化物件中的所有變數。它呼叫了 [Fraction alloc] 傳回的 instance 上的 init method。這個動作非常普遍,所以通常以一行程式完成:Object *var = [[Object alloc] init];</li>
</ul><li>[frac setNumerator: 1] 非常簡單。它呼叫了 frac 上的 setNumerator method 並傳入 1 為參數。</li>
<li>如同每個 C 的變體,Objective-C 也有一個用以釋放記憶體的方式: release。它繼承自 NSObject,這個 method 在之後會有詳盡的解說。</li>
</ul></ul>Dylan 的分享交流http://www.blogger.com/profile/15357284429230481820noreply@blogger.com0