This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 新增當地時區的時間物件 | |
function DateTimezone(offset) { | |
// 建立現在時間的物件 | |
d = new Date(); | |
// 取得 UTC time | |
utc = d.getTime() + (d.getTimezoneOffset() * 60000); | |
// 新增不同時區的日期資料 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socket.on('send', function(msg) { | |
// 廣播資訊給在socket.room的人,除了發送者自己 | |
socket.broadcast.to(socket.room).emit('updatechat', msg); | |
// 傳送更新資訊給自己 | |
socket.emit('updatechat', msg); | |
socket.to(socket.room).emit('updatechat', msg); | |
// 傳送資訊給所有socket | |
io.sockets.emit('updatechat', msg); | |
// 傳送資訊給在socket.room的連線 | |
io.sockets.in(socket.room).emit('updatechat', msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站、依照建立時間做排序、找第4、5、6筆的資料 | |
db.lbs_test.aggregate( | |
{ | |
$geoNear : { | |
near : [25.046084,121.517542], | |
distanceField : "dist", | |
maxDistance : 2 / 111.12 | |
} | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站、依照建立時間做排序、找前3筆資料 | |
db.lbs_test.aggregate( | |
{ | |
$geoNear : { | |
near : [25.046084,121.517542], | |
distanceField : "dist", | |
maxDistance : 2 / 111.12 | |
} | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站、依照建立時間做排序 | |
db.lbs_test.aggregate( | |
{ | |
$geoNear : { | |
near : [25.046084,121.517542], | |
distanceField : "dist", | |
maxDistance : 2 / 111.12 | |
} | |
}, | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站 | |
db.lbs_test.aggregate( | |
{ | |
$geoNear : { | |
near : [25.046084,121.517542], | |
distanceField : "dist", | |
maxDistance : 2 / 111.12 | |
} | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ dpkg -l '*php*' | |
要求=U:未知/I:安裝/R:刪除/P:清除/H:保留 | |
| 狀態=N:未安裝/I:已安裝/C:設定檔/U:已解開/F:半設定/H:半安裝/W:待觸發/T:未觸發 | |
|/ 錯誤?=(無)/R:須重新安裝(狀態,錯誤:大寫=有問題) | |
||/ 名稱 版本 簡介 | |
+++-=================================-=================================-================================================================================== | |
un libapache2-mod-php4 <無> (無相關介紹) | |
ii libapache2-mod-php5 5.4.19-1+debphp.org~precise+3 server-side, HTML-embedded scripting language (Apache 2 module) | |
un libapache2-mod-php5filter <無> (無相關介紹) | |
un libow-php5 <無> (無相關介紹) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = db.lbs_test.find({loc: {$near:[25.046084,121.517542] , $maxDistance:2/111.12 }}).sort({time:1}); | |
query.limit(3).forEach(printjson); | |
// 查詢結果 | |
{ | |
"_id" : ObjectId("5238179cdfba7ac818bb5fcd"), | |
"name" : "捷運臺大醫院站", | |
"loc" : { | |
"lat" : 25.041535, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站、依照建立時間做排序、找前3筆資料 | |
// 預期查詢結果 | |
{ | |
"_id" : ObjectId("5238179cdfba7ac818bb5fcd"), | |
"name" : "捷運臺大醫院站", | |
"loc" : { | |
"lat" : 25.041535, | |
"long" : 121.516029 | |
}, | |
"time" : 11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 找捷運台北車站附近距離2公里內的捷運站、依照建立時間做排序、找前3筆資料 | |
db.lbs_test.find({loc: {$near:[25.046084,121.517542] , $maxDistance:2/111.12 }}).sort({time:1}).limit(3).forEach(printjson); | |
//查詢結果 | |
{ | |
"_id" : ObjectId("5238179cdfba7ac818bb5fcd"), | |
"name" : "捷運臺大醫院站", | |
"loc" : { | |
"lat" : 25.041535, | |
"long" : 121.516029 |