一些處理 javascript 減少 server http connection 數的方法

 

http://joliclic.free.fr/php/javascript-packer/en/
http://yuiblog.com/blog/2008/07/16/combohandler/
This is a fast, low-overhead port of Douglas Crockford’s JSMin JavaScript minifier to PHP. It requires PHP 5 or higher.
JSMin is a filter which removes comments and unnecessary whitespace from JavaScript files.
http://code.google.com/p/jsmin-php/

新光華遊記

monster 今晚去了開幕不久的新光華商場, 打算買個數位棒來錄奧運, 當然出發前不忘先作了功課—> 去 PXHOME 查了想買的東西現在價格, 寫在3M貼紙上了(錯誤一), 於是下班後就接往新光華衝…

一到那, 新大樓果真是漂亮呀…抬頭看..好多層ㄟ (不知這就是等下會遇到的困擾) …一進門…就開始東看看西看看…想說先 “繞” 個一圈, 先看一遍再決定去那家買吧….於是隨著人群一直走一直走…來到了二樓…三樓…四樓…

果然腳酸了…隨便就找了一家亮出下午剛剛作小抄給老闆看說…”我要買這個” (錯誤試範! 鐵定被老闆當愷子…連錯兩項: 1. 小抄不要寫價格2. 要買啥要背起來), 老闆假裝找半天說有啦! 看到我小抄寫 1299 就說賣我 1250 好了….頓時我就知錯了…連忙說等下再來喔, 於是繼續逛, 也當下把它背起來了..

晃呀晃又被我看到一家, 就進去問, 小夥計說 1200….ㄟ…這家比較便宜喔…為了達到 “貨比三家不吃虧” 的原則…當然堅持要看第三家再說…就在隔壁的隔壁的隔壁, 第三家竟然沒貨! 還說這東西缺貨,因為太多人這兩天搶著買要去錄奧運! 哇! 怎麼跟我一樣咧?? 話問完趕緊轉頭找第二家….

ㄟ…剛剛我問的夥計竟然不見了…正當我在想如果現在這個夥計要賣我 1200 以上我要怎麼跟他殺價的同時, 這個夥計竟然說賣我 1100ㄟ!! 我都還沒殺價竟然就直接降價了? 好吧…我累了…就 1100 吧…於是留下錢把東西帶走啦…..高興呀…我今天省了 $200咧!! …為了獎勵自己省了大筆$$,加上只逛到4F 的腳酸, 就在 1F  monster 點了一碗愛吃的豆花, 今天的新光華遊記就這樣告一段落囉!!

PS: 賣電玩的店果真有可愛妹, 3F 的電玩店一群宅宅圍著可愛妹問東問西的, 可愛妹也蠻開心的呀!!

Categories FUN

opensolaris / Optimized Open Source Software Stack (Cool Stack)

看到一個有用的套件

for the Sun Solaris Operating System(TM)

http://cooltools.sunsource.net/coolstack/

Cool Stack includes several packages in the SVR4 package format, so you can install just the ones you need. Some of the applications in Cool Stack already ship with Solaris, but these are either older versions and/or not built with full optimization. Further, Cool Stack has been pre-configured to have the most popular applications (Apache, PHP, MySQL) to work seamlessly out of the box.
Deploying PHP From Cool Stack in Sun Java System Web Server

Configuring Cool Stack PHP With Web Server

Next, do the following:

1. Go to the Cool Stack PHP 5 installation location. Type:

cd /opt/coolstack/php5

In that directory is a script called setup-ws7-php.sh.

2. Run setup-ws7-php.sh. Type:

./setup-ws7-php.sh

This message is displayed:

Usage:
This script will configure Coolstack PHP with Sun Java System Web Server
7. Here, you will need to provide the top level location of your Web Server
7 installation and your Web Server 7 instance_name name to which this
script should configure to run PHP scripts.

Enter your Web Server installation location(/sun/webserver7):

3. Type the full path for your Web Server installation.

The script then prompts you to type a Web Server instance name. That name is the path to a directory in your installation location—one that contains all the configuration files for running your Web site. If you are using Web Server in Sun Java Enterprise System 5, your instances are under /var/opt/SUNWwbsvr7.

For the example in this article, cite the instance https-coolstack that you created previously. To enable a different instance for PHP, type that instance name. Your instance is then ready for PHP, which you can deploy with Cool Stack 1.2 PHP on Web Server.

Finally, do the following:

1. Start Web Server. Type:

/sun/webserver7/https-coolstack/bin/startserv

2. Create sample PHP files under /sun/webserver7/https-coolstack/docs.

memcache sample code

簡單版的測試 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);

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

今天早上都在玩這個…
把 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 了:
https://www.monster.com.tw/kml2csv