terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted (core dumped)
上網查了一下發現是本地設定的問題,所以在mongo指令之前加上"LC_ALL=C"就可以成功執行了
LC_ALL=C mongo
terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid Aborted (core dumped)
LC_ALL=C mongo
npm install express-vhostexpress-vhost是express的middle-ware,可以透過resiter將特定的網域綁定指定function,來達到以網域做分流的功能。詳情請看:https://github.com/vast-eng/express-vhost
npm install -g forever//記得要設定為全域 sudo forever start server.js//若要以80port開啟服務,記得要以root權限執行
sudo apt-get install python-software-properties sudo apt-get install make sudo apt-get install g++ sudo apt-get install git以上都搞定後就可以從github上下載下來並安裝了:
git clone https://github.com/joyent/node.git
cd node
git checkout v0.6.7
./configure
make
sudo make install
npm install -g {你要裝的套件} //-g是代表這個套件可被全域使用,可以不用加 npm search {你要查的關鍵字} npm list //列出你已安裝的套件
sudo npm install -g express
當要全域安裝時記得加sudo,不然會失敗// create server.
var express = require('express'),
app = express(),
port = 1337;
app.listen(port);
// normal style
app.get('/', function(req, res){
res.send('hello world');
});
node server.js
for (_i = 0, _len = obj.length; _i < _len; _i++) {
}alert item for item of v
for( item of v){
alert(v[item])
}
localStorage.test={};//這樣應該是Object吧所以在使用他的時候我們就要稍微用一點心思了,而JSON的.stringify()以及.parse()正好適合處理這樣的問題!
typeof(localStorage.test);//結果是String....Orz
localStorage.test="{}";為什麼要刻意在字串中加入上下括號呢?這是因為雖然我們只能以字串方式存入localStorage,但是可以寫成json的格式,再以JSON.parse()將他轉成真正的物件,讀寫完畢後再以JSON.stringify()轉成字串,存回去就好了。
$.Model('Todo',{
findAll: 'GET /todos.json',
findOne: 'GET /todos/{id}.json',
create: 'POST /todos.json',
update: 'PUT /todos/{id}.json',
destroy: 'DELETE /todos/{id}.json'
},{});
var todo = new Todo();
$.Model('Todo',{
findAll: 'GET /todos.json',
findOne: 'GET /todos/{id}.json',
create: 'POST /todos.json',
update: 'PUT /todos/{id}.json',
destroy: 'DELETE /todos/{id}.json'
},{
spotlight : function(){},
priority : 0
});
var todo = new Todo( {'priority' : 0, 'spotlight' : function(){}} );或是在創建之後用.attr( )來加入attributes:
todo.attr('priority',0);這時你可能會想問:「那這個instance是怎麼記錄這些attribute是要被上傳的呢?」
todo.priorirt=1;暫時先這樣。