發表文章

筆記:此"巿"非彼"市"

最近處理資料遇到一個問題,明明看起來很像的兩個中文字串,範例如下: 高雄巿鼓山區河西一路1437號 高雄市鼓山區河西一路1437號 但是搜尋比對就是搜尋比對不到 用出絕招(HEXDUMP)之後才知道這兩個字不一樣。 上面的"巿" UNICODE編碼是 5dff (T2-213D) 上面的"市" UNICODE編碼是 5e02 (T1-464B) 上 http://unicode.org/charts/ 查了一下,兩的字顯示出來都是類似。 繼續追查下去,在詳記說明文件 http://www.unicode.org/charts/PDF/U4E00.pdf 看到幾個關鍵字:CJK,在 WIKI  中日韓統一表意文字  知道了 CJK是中日韓,還有引伸的CJKV,加上越南這四個有用到中文的國家。 往下翻,提到T1 T2的說明: T1:  CNS 11643-1986第一字面,約八千字 T2:  CNS 11643-1986第二字面,約八千字 到這裡終於水落石出,某個資料來源用了比較罕見、上面那點垂直的"巿",所以電腦把他們當作不同字,但是人眼不特別看還看不出來。 所以在字串處理上又多一個對應字置換的環節,來處理相似字的問題。 順帶一提,之前看雨狗的網誌  http://raindog.pixnet.net/blog/post/33734339 提到類似的問題,雨狗的專業跟觀察力也非一般人啊! 參考資料: Unicode官方: http://unicode.org/charts/ http://www.unicode.org/charts/PDF/U4E00.pdf http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=5DFF&useutf8=true WIKI: https://zh.wikipedia.org/wiki/%E4%B8%AD%E6%97%A5%E9%9F%93%E7%B5%B1%E4%B8%80%E8%A1%A8%E6%84%8F%E6%96%87%E5%AD%97 https://zh.wikip...

[密技] 利用 Google Drive 簡單架網站

參考來源: http://www.wfublog.com/2014/11/google-drive-html-page-skill-editey.html 步驟: 1. 本地端把網站資料程式(HTML/CSS/JS)設計好 2. 把整個網站的目錄拖曳上傳到 Google Drive 3. 取得主機位址。例如本來 Google Drive 的目錄網址為 https://drive.google.com/drive/folders/FOLDER_ID 改成 https://drive.google.com/drive/folders/FOLDER_ID/xxx.html 開啟上述網址就可以開啟由Google Drive的網站

[自由網路] 如何取得 Google Drive (真實)外連位址 (Direct Link)

方法1: 付費( 多謝站長指正 ) 成為以下網站的會員,就可以享有站長自製的外連產生器 http://www.wfublog.com/2015/05/google-drive-direct-link-widget-v2.html 方法2:透過 gdocs2direct 把分享連結轉換城真實外連網址 https://sites.google.com/site/gdocs2direct/ 使用時遇到大檔,Google 會跳檔案太大的提示,這時候需要略為修改一下網址列的參數,例如: 原來網址  https://drive.google.com/uc?export=download&id=FILE_ID 要改成 https://drive.google.com/uc?export=download& confirm=YzWC &id=FILE_ID 就可以繞過提示直接下載了 方法3:土砲DIY無敵 A FOLDER_ID + 檔案名稱 1 假設 Google Drive顯示的目錄網址為: https://drive.google.com/drive/folders/0123456abcdef 後面的0123456abcdef就是FOLDER_ID 2 代入以下公式就可以得到外連網址 https://googledrive.com/host/FOLDER_ID/檔案名稱 備註:外連網址也可以用來架站 B FILE_ID 下載 1 透過共用連結取得FILE_ID 例如共用連結為 https://drive.google.com/file/d/0123456abcdef/view?usp=sharing 中間的0123456abcdef就是FILE_ID 2 代入以下公式就可以得到下載網址 https://drive.google.com/uc?export=download&id=FILE_ID 相關連結: http://stackoverflow.com/questions/14728038/disabling-the-large-file-notification-from-google-drive http://www.broculos.net/2013/04...

Darkstat DB parser patch

Here is the note to parse the Darkstat DB. Phil's original post:  http://phil.lavin.me.uk/2011/11/parsing-a-darkstat-database-with-php/#comment-207432 Darkstat's official DB format doc:  https://unix4lyfe.org/gitweb/darkstat/blob_plain/98907547c4c1b4b4dda1dc10d20643e2b680b352:/export-format.txt I tried to parse the Darkstat DB by Phil's code and found issues. However the blogger is not update since 2014 so let's hack this by myself. There are two bugs in the PHP source code: IPv6 address reader: IPv6 address is 128 bit long but the "readaddr_ipv6" function read 512 bits (8x8 bytes) hence the code stopped once IPv6 header is shown. function readaddr_ipv6($db) { $ip = array(); for($i = 0; $i < 8; $i++) { $ip[] = bin2hex(fread($db, 2)); //$ip[] = bin2hex(fread($db, 8)); //scott marked } return implode(':', $ip); } IP family decoder Raw data is "0x04" and "0x06" but PHP ...

Android 4.1.2 FB 無法室內定位解法

症狀: 我的新手機有個狀況是 Google 自己的 地圖室內室外都可以定位,但是需要定位資訊的程式如FB、InstaWeather都無法室內定位,一定要有GPS鎖定才有位置。打開FB等老久之後,卻但到許久之前的位置。 系統版本: Android 4.1.2 解決方法: Android 跟定位有關的設定有幾處: 系統設定->位置存取->存取我的位置 系統設定->位置存取->GPS 衛星 系統設定->位置存取->Wi-Fi 與行動網路位置 系統設定->帳號與同步->Google->位置設定->允許Google 應用程式存取您的位置資訊 遇到問題時,以上幾處檢查是否有開啟,另外可以嘗試重新關掉打開的動作。 以我的狀況為例,帳號與同步那項本來就是打開狀態,然後重新把帳號與同步那項關掉打開,室內定位功能就恢復了,跟大家分享

Defy 刷機筆紀

Jetter原創教學 (mobile01) http://www.mobile01.com/topicdetail.php?f=567&t=2139005&last=28380177   全圖案補充版 http://jack089452.pixnet.net/blog/post/30323098-moto-defy-(mb525)-%E5%88%B7%E6%A9%9F%E6%95%99%E5%AD%B8-(2012-2-7%E6%9B%B4%E6%96%B0)  

Linux serial port programming: read always success but no vaild data

在非標準的輸入程序模式下, 輸入的資料不會被組合成一行而輸入後的處理功能 (清除, 殺掉, 刪除, 等等.) 都不能使用. 這個模式有兩個功能控制參數: c_cc[VTIME] 設定字元輸入時間計時器, 及 c_cc[VMIN] 設定滿足讀取功能的最低字元接收個數. 如果 MIN > 0 且 TIME = 0, MIN 設定為滿足讀取功能的最低字元接收個數. 由於 TIME 是 零, 所以計時器將不被使用. >>>block and wait for data 如果 MIN = 0 且 TIME > 0, TIME 將被當做逾時設定值. 滿足讀取功能的情況為讀取到單一字元, 或者超過 TIME 所定義的時間 (t = TIME *0.1 s). 如果超過 TIME 所定義的時間, 則不會傳回任何字元. 如果 MIN > 0 且 TIME > 0, TIME 將被當做一個分割字元組的計時器. 滿足讀取功能的條件為 接收到 MIN 個數的字元, 或兩個字元的間隔時間超過 TIME 所定義的值. 計時器會在每讀到一個字元後重新計時, 且只會在第一個字元收到後才會啟動. 如果 MIN = 0 且 TIME = 0, 讀取功能就馬上被滿足. 目前所存在的字元組個數, 或者 將回傳的字元組個數. 根據 Antonino (參考 貢獻) 所說, 你可以用 fcntl(fd, F_SETFL, FNDELAY); 在讀取前得到相同的結果. >>>default setting and result the read always return success without vaild data Reference: http://www.linux.org.tw/CLDP/OLD/Serial-Programming-HOWTO-3.html

SVN SSH 設定方法

連線方法為: svn co svn+ssh://username@serverip/pathtorepo 如要指定其他SSH service port: 修改  ~/.subversion/config 找以下字串 # ssh = $SVN_SSH ssh 置換為 ssh = $SVN_SSH ssh -p 12345 -q -o ControlMaster=no 其中12345就是SSH service port

Ubuntu 安裝 Apache2 加上 PAM管理

參考連結: http://blog.xuite.net/gbisland/linux/14229857 ^^注意在新版的Ubuntu 中 安裝套件的指令要修正為: sudo apt-get install apache2 apache2.2-common apache2-utils apache2-doc libapache2-svn subversion http://icephoenix.us/linuxunix/apache-and-http-authentication-with-pam/

小技巧: 設定MSN的自動掃毒 使用小紅傘

到官方網站 http://www.avira.com/en/support-download 抓這個scancl http://www.avira.com/en/support-download-avira-antivir-command-line-scanner-scancl 然後把壓縮包的東西解到avira的安裝目錄 接在MSN的"選項"=>"檔案傳輸" 勾選"使用下列軟體進行病毒掃描" 按"瀏覽"選取scancl的執行檔,並在最後加上%file%,範例如下 "C:\Program Files (x86)\Avira\AntiVir Desktop\scancl.exe" %file% 即可

CentOS5 安裝 bugzilla 筆記(2): LDAP 帳號認證設定

1  以管理者帳號登入,並進入"Administion->Parameters" 2  選擇「User Authentication」,修改下列參數: user_verify_class:LDAP,DB 此參數設定 Bugzilla 先以 LDAP 進行身份驗證,若驗證失敗則向 Bugzilla DB 進行身份驗證。 3 選擇「LDAP」,修改下列參數: LDAPserver:ldap://IPA.IPB.IPC.IPD/ <輸入 AD 主機的 IP> LDAPbinddn:cn=buguser,ou=Users,dc=company,dc=com:pass123 <輸入可搜尋 AD 資訊的使用者帳號密碼, 如果是匿名登入請保持這個欄位空白> LDAPBaseDN:ou=Users,dc=company,dc=com <輸入欲開始搜尋的根路徑, 依據LDAP server的資訊填入> 4 緊急狀況自救術 如果設定LDAP後發現資訊填錯導致完全無法登入Bugzilla 自然也無法進入後台設定 請修改這個檔案 "/var/lib/bugzilla/data/params" 搜尋 "user_verify_class"  然後把數值改成 'DB', 存檔離開後, 就可以再次登入Bugzilla了  延伸閱讀: CentOS5 安裝 bugzilla 筆記(1) http://riverhippo.blogspot.com/2010/09/centos5-bugzilla.html 架設 Bugzilla 與 AD 帳號整合(適用 Fedora Core 4 及 5 ) http://blog.yam.com/gavint/article/2676451 In Bugzilla, how can I change the password used for LDAP integration if I can’t login? http://rhyous.com/2010/04/19/in-bugzilla-how-can-i-change-the-password-used-for-ldap-integration-if-i-can...

CentOS5 安裝 redmine 1.0.2 筆記

1 增加RubyWorks 的Repo, 把以下內容存成  /etc/yum.repos.d/rubyworks.repo # Link file for RubyWorks yum repository # Place this file in /etc/yum.repos.d [rubyworks] name=RubyWorks baseurl=http://rubyworks.rubyforge.org/redhat/$releasever/RPMS/$basearch enabled=1 gpgcheck=1 gpgkey=http://rubyworks.rubyforge.org/RubyWorks.GPG.key priority=1 2 安裝 Ruby on Rails yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc ruby-mysql 3 下載 Ruby Gems 並安裝 wget http://production.cf.rubygems.org/rubygems/rubygems-1.3.7.tgz tar xvfz rubygems-1.3.7.tgz cd rubygems-1.3.7 ruby setup.rb 4 安裝 Rails gem update -–system gem install rails -v=2.3.5 5 下載 RedMine 主程式 wget http://rubyforge.org/frs/download.php/72627/redmine-1.0.2.tar.gz tar xvzf redmine-1.0.2.tar.gz 6 建立redmine使用者 useradd redmine passwd redmine 7 建立redmine資料庫 mysql -u root -p create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'my_password'; grant all privileg...

CentOS5 安裝 bugzilla 筆記

1 安裝相關必須套件(可能有些是多餘的, 因為後面會自動處理?!): yum install gd gd-devel httpd mysqld gcc g++ make yum  install  perl-XML-Twig ImageMagick-perl mod_perl perl-HTML-Parser perl-Email-MIME-Attachment-Stripper perl-Chart perl-PatchReader perl-Net-LDAP yum install httpd mysql-server 2 安裝bugzilla套件 yum install bugzilla 3 建立 資料庫使用者 bugs useradd bugs passwd bugs 4 建立資料庫 4.1 建立server資料表 CREATE TABLE `servers` ( `Server_name` char(64) NOT NULL, `Host` char(64) NOT NULL, `Db` char(64) NOT NULL, `Username` char(64) NOT NULL, `Password` char(64) NOT NULL, `Port` int(4) DEFAULT NULL, `Socket` char(64) DEFAULT NULL, `Wrapper` char(64) NOT NULL, `Owner` char(64) NOT NULL, PRIMARY KEY (`Server_name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table'; 4.2 建立bugs 資料庫 # mysql -u root –p Enter password: mysql> create database bugs; mysql> use bugs; mysql>GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE, LOCK TABLES,DROP,REFERENCES ON bugs.* TO...

Apache 虛擬目錄 小筆記

http://redhat.ecenter.idv.tw/bbs/showthread.php?postid=37885 ←設定網站的根目錄   Options Indexes FollowSymLinks ←設定此目錄的存取權限,允許server建檔案列表,並可以經由 symbolic link連結到其它目錄   AllowOverride None ←不接受.htaccess中的設定   order allow,deny   allow from all ←允許所有使用者存取   # allow from flag.com.tw ←只允許來自於flag.com.tw domain存取,但要先"deny from all"才能拒絕其它地方連進來   # deny from 203.74.205 ←拒絕來自於203.74.205    

GIT 小筆記

需要的套件: git-core: 最重要的核心套件 gitweb: 小巧的網頁版GIT瀏覽套件, 效果像是這樣: http://git.kernel.org/ gitk: 圖形版的GIT瀏覽套件 請按照套件安裝以上套件 GITWEB 設定方法: 1) 把Sever上的HTTP服務跑起來, 如apache或lighthttpd 2) 修改 /etc/gitweb.conf, 指定  $projectroot 到 自己的 git repository root 3) 如需權限管理, 可以修改 /etc/httpd/conf.d/ git.conf(CentOS), 加入WebDAV 相關敘述 4) 重新啟動HTTP service 以上是個人簡單筆記版,完整版請參考延伸閱讀: http://plog.longwin.com.tw/my_note-unix/2009/05/12/debian-linux-build-gitweb-2009 GIT的概念 GIT是一種原始碼管理軟體(SCM),跟其他SCM比較起來有相當多的優點(詳細比較在此 : http://zh-tw.whygitisbetterthanx.com/ ) 延伸閱讀: http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt ttp://josephjiang.com/entry.php?id=308

Fix X11 output problem

Problem: X only shows a empty desktop Cause: Main screen goes somewhere else Fix: 1) Add/Modify "/etc/X11/xorg.conf" to disable specific output https://wiki.ubuntu.com/X/Quirks Section "Device" Identifier "Configured Video Device" Option "monitor-LVDS" "LVDS" EndSection Section "Monitor" Identifier "LVDS" Option "Ignore" "True" EndSection Section "Monitor" Identifier "Configured Monitor" EndSection Section "Screen" Identifier "Default Screen" Monitor "Configured Monitor" Device "Configured Video Device" EndSection 2) Disable KMS in kernel boot command line by appending "nomodeset"

Regular Expression for C/C++

http://changyy.pixnet.net/blog/post/22760327 http://mij.oltrelinux.com/devel/unixprg/

Fix Ubuntu 10.04 KMS for Intel-gpu-based units && Simple Plymouth Howto

Intro: Ubuntu to introduces  Plymouth as boot splash solution to replace Usplash instead for more rich and complex boot visual effects. Also new linux kernel introduces KMS (Kernel Mode Switchig) to replace old UMS (User Mode Switching) to reduce flicker during whole boot process. However, some users may have bad experiences to Ubuntu new boot splash system.  Here is a solution for  Intel-gpu-based units. How to Confirm this issue: Run "dmesg | grep drm" and you should be able to see three message corresponds to three modules loading. If they are loaded in 3 sec, you are good and KMS is ready. You can skip the rest part. Otherwise, for example, if they are loaded after 10 sec, it means KMS is failed to start before Plymouth is up so you can see nothing while booting. Please go proceeding to the next step. Fix KMS in initramfs Refer Source:  https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/377875/comments/25 For Intel GPUs, you need to add three...

文摘:為何台灣不需要高速網路

那小弟先來剖析一下可能消毒的策略: 1.頻寬無用論:要那麼大的頻寬幹什麼? 2.網路使用無理論:這些一定都是在非法使用!上網只要56K就夠了。 3.雲端學理論:你知道什麼是雲端嗎?雲端不等於頻寬!當掉! 4.市場競爭論:唉....都怪其他廠商不爭氣,讓龍頭可以這麼囂張~ 5.政治黑暗論:我們龍頭也是受害者,都是政治惹的禍。 6.公司實務論:我們公司也用不到這些,你們都是在做什麼大事業? 7.移民論:你乾脆去當韓國人好了! 8.面向光明論:台灣的網路比很多國家來的好,要知足...想當初我在索馬利亞.... 引用自: http://www.mobile01.com/topicdetail.php?f=507&t=1693343&p=1#21508349

Suse 筆記

 套件管理Zypper http://hi.baidu.com/jrckkyy/blog/item/a91d2b2575d2bc6b35a80fb7.html Virtualbox Guest Add-On http://forums.opensuse.org/english/get-help-here/applications/434452-virtualbox-guest-additions-how-set-shared-folder-opensuse-11-2-guest.html