Monster Oasis
覺得累就是進步的開始!

2008/07/30

memcache sample code

Filed under: Programming/php — Tags: , — 6:20 pm

簡單版的測試 sample code

[code language='php']

// filename : memcache.php

$memcache = new Memcache;
$memcache->addServer('172.20.50.25', 11211);

// set 一個值到 memcache

$memcache->set('key', time() , MEMCACHE_COMPRESSED, 120);

// get 值

$data=$memcache->get('key');
print_r($data);

2008/07/27

Holux m-241 logger 的 KML data 匯出 , 用 excel 編輯後再轉回 KML

Filed under: Exercise,Programming/php,Software — Tags: , , — 1:43 pm

今天早上都在玩這個…
把 kml 檔案用 simplexml 讀出來 , 簡單分析了一下就知道座標跟高度等資料在那裡了,
接著用以下的程式把它轉出 csv 檔
[code language='php']
$string=file_get_contents("0816.kml");

$xml = simplexml_load_string($string);

printf("Name,Latitude,Longitude,Altitude,Dist,Description ,Icon,IconScale,IconAltitude,IconHeading, IconColor, LineStringColor,HideNameUntilMouseOver\n");

$icon="196";
$iconscale="0.2";
$iconaltitude=10;
$iconheading="line-180";
$iconcolor="yellow";
$linestringcolor="aqua";
$HideNameUntilMouseOver="true";

$cnt=0;
$t1=0;
$last_point=array();
$dist=0;
$total_dist=0;
$ignore_time=120; // 120 seconds
$ignore_dist=10; // 10 meters

foreach ($xml->Document->Folder->Placemark as $k=>$v) {
$point=explode(",",trim($v->Point->coordinates));
if ( $last_point[0] ) {
$dist=sqrt( pow(abs($point[0]-$last_point[0])*110.766417,2) + pow(abs($point[1]-$last_point[1])*110.766417,2) );
$dist*=1000;
} else {
$dist=0;
}
$total_dist+=$dist;
$last_point=$point;
if ( $point[2]name);
$timestamp=strtotime($str_time);
if ( ($timestamp-$t1)<$ignore_time &amp;&amp; $dist<$ignore_dist ) continue;
$t1=$timestamp;
printf("%s , ",date("H:i:s",$timestamp));
printf("%s , ",$point[1]);
printf("%s , ",$point[0]);
printf("%s , ",$point[2]);
printf("%s , ",$total_dist);
printf("NO.%d
%s
Altitude : %s M , ",$cnt++,$str_time,$point[2]);
printf("%s , ",$icon);
printf("%s , ",$iconscale);
printf("%s , ",$iconaltitude);
printf("%s , ",$iconheading);
printf("%s , ",$iconcolor);
printf("%s , ",$linestringcolor);
printf("%s , ",$HideNameUntilMouseOver);
printf("\n");
}[/code]

用 excel 把 csv 讀進來編輯, 一方面用 google earth 來對原來資料 , 看那邊停留久的 data
減少一些 , 再用這個 service 把 csv 轉回 KML 檔

Excel To KML – Display Excel files on Google Earth

今天(8/19)聽了 aska 的建議, 增加 “忽略” 時間跟距離的片段進去

今天(8/21)終於把這段程式改成可以給大家用的 service 了:
http://www.monster.com.tw/kml2csv

Related URL:
  1. 晨騎, 板橋 <==> 關渡宮 , 40K
  2. 2010-0502 bike 塔塔加
  3. bike 塔塔加 –> 阿里山
  4. 完成台東超級鐵人三項 123K – Enjoy the racing! I’m finish 2009 Taitung 123K International Triathlon
  5. 123K 賽前
  6. my bike photos
  7. monster dimensions
  8. BIKE 板橋 —> 蘇澳冷泉 100K
  9. 2009 臺東123公里國際鐵人三項 / 公告 / 地圖 / 準備項目 / T1 T2 轉換區 steps / misc
  10. 這句話讚ㄚ — 「沒關係,騎不動就用牽的,反正我要靠自己的力量走完這一圈!」

2008/07/26

Monster All-In-One LAMP Pack 0726A ( package )

我的實驗機是裝在 vmware  裡的

(more…)

Related URL:
  1. Protected: 觀察 22:40 – 23:15 apache log 的變化
  2. 解決用 NFS 當 documentroot 時會當掉的方法
  3. debian / ubuntu 裝 oracle instant client / sqlplus / oci8 / apache2 config / steps by steps
  4. [ubuntu] apache server module 的 enable / disable
  5. apache Custom Log Formats – 好用的參數
  6. Simple Monster Tracking System – step by step
  7. Protected: apache mod_rewrite , rewrite , rewriterule 真難搞
  8. 好用的 iptables rules – 限制 client 連 http port 的次數
  9. Monster LAMP Pack Lite – ver.317
  10. 安裝 apache / mod_memcache

106乙 到坪林 , 台9

Filed under: Exercise — Tags: — 1:26 pm

7/26 從家出發走 106乙 到坪林 , 台9 , 下滑到小格頭 , 新店回 , 總共 79K

(more…)

Related URL:
  1. 晨騎, 板橋 <==> 關渡宮 , 40K
  2. 2010-0502 bike 塔塔加
  3. bike 塔塔加 –> 阿里山
  4. 完成台東超級鐵人三項 123K – Enjoy the racing! I’m finish 2009 Taitung 123K International Triathlon
  5. 123K 賽前
  6. my bike photos
  7. monster dimensions
  8. BIKE 板橋 —> 蘇澳冷泉 100K
  9. 2009 臺東123公里國際鐵人三項 / 公告 / 地圖 / 準備項目 / T1 T2 轉換區 steps / misc
  10. 這句話讚ㄚ — 「沒關係,騎不動就用牽的,反正我要靠自己的力量走完這一圈!」

2008/07/24

Protected: YUM的使用

Filed under: Copy_N_Paste,Software,System/Linux/Unix* — Tags: , , — 5:34 pm

This post is password protected. To view it please enter your password below:


Related URL:
  1. Protected: 兩個版本的 Linux ( CENTOS vs GENTOO ) 作 mysql + senna small compare
  2. CENTOS 改 keyboard mapping

Linux 的燒機程式

Filed under: Software,System/Linux/Unix* — Tags: , — 10:03 am

網址: http://sourceforge.net/projects/va-ctcs

抓下來解開, 打 make

編譯完就可以:
./newburn
開始燒機了…..

server 不穩的話不用跑多久就會 HANG 掉了…

Related URL:
  1. Protected: [收藏] Linux Embedded system step by steps – PDF / debian / linux booting steps
  2. Ubuntu Linux : install .deb packages
  3. [monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting
  4. debian / ubuntu 裝 memcached 跟 pecl memcache
  5. Protected: 兩個版本的 Linux ( CENTOS vs GENTOO ) 作 mysql + senna small compare
  6. debian / ubuntu , APT HOWTO / Guide / 指令速查表
  7. gentoo linux ifconfig
  8. [ubuntu] apache server module 的 enable / disable
  9. Protected: vim 縮排設定
  10. Ubuntu 常用軟體

2008/07/23

screenrc

Filed under: System/Linux/Unix* — Tags: , — 9:28 pm
caption always "MONSTER %{bw}%0C%A %Y/%m/%d %LD %{wb} %-w%{Y}[%n %t]%{w}%+w%{k}"
activity "activity in %n (%t) [%w:%s]"

bind b encoding big5 utf8
bind u encoding utf8 big5

screen -t ROOT 0 bash
screen -t NET 8 bash
screen -t TOP 9 bash
screen -t WK1 1 bash
screen -t WK2 2 bash
Related URL:
  1. Protected: emerge 不見的救法
  2. gentoo emerge command
  3. [gentoo] 排除舊的 lib 相容問題
  4. [monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting
  5. Protected: 兩個版本的 Linux ( CENTOS vs GENTOO ) 作 mysql + senna small compare
  6. gentoo linux ifconfig
  7. 查主機溫度
  8. 裝新的 www.monster.com.tw 過程記錄
  9. 在 gentoo 裝 oracle sqlplus package
  10. gentoo NFS

Protected: Senna for mysql install 安裝說明

This post is password protected. To view it please enter your password below:


Related URL:
  1. Protected: emerge 不見的救法
  2. gentoo emerge command
  3. [gentoo] 排除舊的 lib 相容問題
  4. [monster] monster.tw 記錄 / memo / ubuntu / 裝 圖形介面 / GUI / gnome desktop / ip address / setting
  5. Protected: 兩個版本的 Linux ( CENTOS vs GENTOO ) 作 mysql + senna small compare
  6. gentoo linux ifconfig
  7. 查主機溫度
  8. 裝新的 www.monster.com.tw 過程記錄
  9. 在 gentoo 裝 oracle sqlplus package
  10. gentoo NFS

2008/07/20

bike中社路+風櫃嘴

Filed under: Exercise,FUN — Tags: , , — 10:41 pm

騎完中社路還不過癮, 繼續騎風櫃嘴
下滑風櫃嘴…我說 “god 一直拉煞車…手都快斷掉了”
黃同學說 “奇怪? 剛剛是怎麼騎上來的?”

今天還有一件豬頭事….帶了 logger 但就是忘記忘記按下開始記錄
看來要再來一次

Related URL:
  1. 晨騎, 板橋 <==> 關渡宮 , 40K
  2. 2010-0502 bike 塔塔加
  3. bike 塔塔加 –> 阿里山
  4. 完成台東超級鐵人三項 123K – Enjoy the racing! I’m finish 2009 Taitung 123K International Triathlon
  5. 123K 賽前
  6. my bike photos
  7. monster dimensions
  8. BIKE 板橋 —> 蘇澳冷泉 100K
  9. 2009 臺東123公里國際鐵人三項 / 公告 / 地圖 / 準備項目 / T1 T2 轉換區 steps / misc
  10. 這句話讚ㄚ — 「沒關係,騎不動就用牽的,反正我要靠自己的力量走完這一圈!」

2008/07/19

裝了 SyntaxHighlighter Plus , 程式碼可以看清楚了

Filed under: Programming/javascript,Programming/php,Software — Tags: , — 5:14 pm

SyntaxHighlighter Plus

It supports the following languages (the alias for use in the post is listed next to the name):

* Bash — bash, sh
* C++ — cpp, c, c++
* C# — c#, c-sharp, csharp
* CSS — css
* Delphi — delphi, pascal
* Java — java
* JavaScript — js, jscript, javascript
* PHP — php
* Python — py, python
* Ruby — rb, ruby, rails, ror
* SQL — sql
* VB — vb, vb.net

* XML/HTML — xml, html, xhtml, xslt

修改 … /wp-content/plugins/syntaxhighlighter-plus/shlfiles/SyntaxHighlighter.css
把 .dp-highlighter 的 width 改成想要的寬度

[code language=C]
#include
main() {
printf("Hello World!");
}

[/code]

Related URL:
  1. Protected: Some Simple C Programs – 好用的 C 範例程式/片段
  2. 最簡單的最好 – 用 pre 的 CSS style
下頁»

www.monster.com.tw , © Copyright 2008