發表文章

目前顯示的是 10月, 2011的文章

Node.js Send Mail

Node.js做送Mail的動作相當簡單,下面是步驟,給大家參考: 1. 安裝mail套件 simonsuteki-MacBook-Pro:NodeJSWS simonsu$ sudo npm install mail Password: mail@0.2.3 ../../node_modules/mail  └── reparse@0.1.2 2. 編寫程式:sendMail.js (紅色部份修改為自己的信箱與密碼,綠色部份一需求修改) var sys = require('sys'), mail = require('mail').Mail({ host: ' smtp.gmail.com ', port: 587, username: ' me@gmail.com ', password: ' **password** ' }); mail.message({ from: ' sender@example.net ', to: [' recipient@somewhere.org '], subject: 'Hello from Node.JS' }) . body('Node speaks SMTP!') .send(function(err) { if (err) throw err; sys.debug('Sent!'); }); 3. 執行寄送: simonsuteki-MacBook-Pro:NodeJSWS simonsu$ node sendMail.js  DEBUG: Sent!

MySQL @ Mac

啓動Mac上MySQL sudo /Library/StartupItems/MySQLCOM/MySQLCOM start 停止MySQL sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop 設定alias來取代啓動的指令 alias start_mysql = "/Library/StartupItems/MySQLCOM/MySQLCOM start" alias stop_mysql = "/Library/StartupItems/MySQLCOM/MySQLCOM stop"

Nice lightware text tool

Sublime Text 2 http://www.sublimetext.com/2

Mac上的Benchmark

Mac上有各指令模式的效能測試工具:ApacheBench(ab) 挺方便的喔 simonsuteki-MacBook-Pro:~ simonsu$ ab -n 10000 -c 50   http://localhost:3000/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software:         Server Hostname:        localhost Server Port:            3000 Document Path:          / Document Length:        277 bytes Concurrency Level:      50 Time taken for tests:   20.230 seconds Complete requests:      10000 Failed requests:        0 Write errors:           0 Total transferred:      3990000 bytes HTML transferred:       2770000 bytes Re

Google預載區域地圖

Google預載區域地圖!真的很方便的一個功能!! 做法: 查詢地圖上的位置 然後點選位置上面跳出的說明方塊(或是用GPS定位會出現"我的地圖"的那個方塊),會跳出該位置說明跟附加功能 最下面有個預載區域地圖,點下去就對了 目前預載16公里範圍的地圖,很適合自由行的朋友們喔∼

JSON Viewer

常用JSON的朋友 用這個網頁工具解析JSON成比較friendly的表格∼方便唷 http://www.jsonviewer.com /

iPhone 4S

Steve Jobs最後的創意 iPhone 4S = iPhone 4(for) S(Steve)

Using JQuey to POST in json

 JQuery 也可以用POST取Json資料喔 用POST有不少好處,像是不會在url中帶出資料、資料長度、Encoding帶在文件中處理... 下面是個簡單的範例:         $.ajax({        type: "POST",        url: "/someServlet.do",        data: "param1="+$('#_someId').val() + "&param2=123",        dataType: "json",        success: function(data){            parse2Table(data);        }     });