This file contains 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
require "rubygems" | |
require "active_record" | |
require "mongo" | |
include Mongo | |
# 声明一个 MongoDB client | |
@client = MongoClient.new('localhost', 27017) | |
# MongoDB db | |
@db = @client['your_mongo_dbname'] |
This file contains 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
# 首先安装 Rails 连接 SQL Server 所需要的驱动 | |
gem update --system | |
gem install activerecord-sqlserver-adapter | |
#再安装 10gen 提供的 MongoDB 驱动: | |
gem install mongo | |
# 这一步会自动安装 bson,再安装 bson_ext | |
gem install bson_ext |
This file contains 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
/usr/bin/mongod | |
# which forever | |
/usr/local/bin/forever | |
# which python | |
/usr/local/bin/python | |
# which python2 | |
/usr/local/bin/python2 | |
# which python3 | |
/usr/local/bin/python3 | |
# which httpd |
This file contains 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
<VirtualHost *:80> | |
ServerAdmin admin@gmail.com | |
ServerName foobar.com | |
ServerAlias www.foobar.com | |
ProxyRequests off | |
<Proxy *> | |
Order deny,allow | |
Allow from all |
This file contains 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
LoadModule proxy_module modules/mod_proxy.so | |
LoadModule proxy_http_module modules/mod_proxy_http.so |
This file contains 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
# Use /download as our temporary download directory | |
# Start download and install freetds | |
cd /download | |
# Offical Site: freetds.org | |
wget ftp://ftp.astron.com/pub/freetds/stable/freetds-stable.tgz | |
tar zxvf freetds-0.91 | |
cd freetds-0.91 | |
./configure | |
make | |
make install |
This file contains 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 express = require('express'), | |
var app = express(); | |
var utils = require('express/node_modules/connect/lib/utils'), xml2js = require('xml2js'); | |
function xmlBodyParser(req, res, next) { | |
if (req._body) return next(); | |
req.body = req.body || {}; |
This file contains 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 userSignup = function (req, res) { | |
var signup = req.body; | |
// 用户对象 | |
var muuser = { | |
"username": signup.username, | |
"password": signup.password, | |
"firsttime": (new Date()).getTime(), | |
"email": signup.email | |
}; | |
This file contains 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
/* Translation of property type labels contact API ---> iPhone | |
* | |
* phone: work, home, other, mobile, fax, pager --> | |
* kABWorkLabel, kABHomeLabel, kABOtherLabel, kABPersonPhoneMobileLabel, kABPersonHomeFAXLabel || kABPersonHomeFAXLabel, kABPersonPhonePagerLabel | |
* emails: work, home, other ---> kABWorkLabel, kABHomeLabel, kABOtherLabel | |
* ims: aim, gtalk, icq, xmpp, msn, skype, qq, yahoo --> kABPersonInstantMessageService + (AIM, ICG, MSN, Yahoo). No support for gtalk, xmpp, skype, qq | |
* addresses: work, home, other --> kABWorkLabel, kABHomeLabel, kABOtherLabel | |
* | |
* | |
*/ |
This file contains 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
// sample1:get the type of variables | |
var str = 'this is a test.'; | |
alert(typeof str); | |
// or | |
// alert(typeof(str)); | |
// sample2: get the type of literals | |
alert(typeof 'test!'); |
OlderNewer