Technical Tips

hackternoon.com
2012-05-22 Install MongoDB From Source on Ubuntu 10.04
2012-04-30 Rails Prerequesite: Effective Editor (Vim)
2012-04-29 Rails Prerequesite: Effective Editor (Emacs)
2012-04-28 Rails Class Topics
2012-04-27 Rails Prerequesite: UNIX Shell (Bash Class)
2012-04-26 Install MongoDB From Source on Mac OS/X
2012-04-22 Struggles with Active Scaffold and Rails 3.2.3
2012-04-12 Debugging Node.js During Development
2012-04-11 Install Node.js from source
2012-03-29 Notes about Heroku 'pgbackups'
2012-03-18 jQuery-UI, Rails 3.2.x, application.js

2012-05-22 Install MongoDB From Source on Ubuntu 10.04

I started my installation efforts by creating a directory and downloading a tar-ball:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ wget http://downloads.mongodb.org/src/mongodb-src-r2.0.5.tar.gz
--2012-05-22 03:28:25--  http://downloads.mongodb.org/src/mongodb-src-r2.0.5.tar.gz
Resolving downloads.mongodb.org... 207.171.189.81
Connecting to downloads.mongodb.org|207.171.189.81|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2971476 (2.8M) [application/x-tar]
Saving to: `mongodb-src-r2.0.5.tar.gz'

100%[======================================>] 2,971,476    307K/s   in 9.5s    

2012-05-22 03:28:36 (307 KB/s) - `mongodb-src-r2.0.5.tar.gz' saved [2971476/2971476]

oracle@z3:/dan/mdb$ ll
total 2912
drwxr-xr-x 2 oracle oracle    4096 2012-05-22 03:28 ./
drwxrwxrwt 4 root   root      4096 2012-05-22 03:22 ../
-rw-r--r-- 1 oracle oracle 2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
lrwxrwxrwx 1 oracle oracle      29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


I unpacked it and looked at it:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ tar zxf mongodb-src-r2.0.5.tar.gz 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ll
total 2916
drwxr-xr-x  3 oracle oracle    4096 2012-05-22 03:29 ./
drwxrwxrwt  4 root   root      4096 2012-05-22 03:22 ../
drwxr-xr-x 19 oracle oracle    4096 2012-05-08 15:51 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle 2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
lrwxrwxrwx  1 oracle oracle      29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 

oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cd mongodb-src-r2.0.5
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ ll
total 256
drwxr-xr-x 19 oracle oracle  4096 2012-05-08 15:51 ./
drwxr-xr-x  3 oracle oracle  4096 2012-05-22 03:29 ../
-rw-r--r--  1 oracle oracle 11358 2012-05-08 15:51 APACHE-2.0.txt
drwxr-xr-x  4 oracle oracle  4096 2012-05-08 15:51 bson/
drwxr-xr-x  3 oracle oracle  4096 2012-05-08 15:51 buildscripts/
drwxr-xr-x  3 oracle oracle  4096 2012-05-08 15:51 client/
drwxr-xr-x  9 oracle oracle  4096 2012-05-08 15:51 db/
drwxr-xr-x  3 oracle oracle  4096 2012-05-08 15:51 dbtests/
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 debian/
drwxr-xr-x  3 oracle oracle  4096 2012-05-08 15:51 distsrc/
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 docs/
-rw-r--r--  1 oracle oracle 10758 2012-05-08 15:51 doxygenConfig
-rw-r--r--  1 oracle oracle  3606 2012-05-08 15:51 gch.py
-rw-r--r--  1 oracle oracle    58 2012-05-08 15:51 .gitattributes
-rw-r--r--  1 oracle oracle  1255 2012-05-08 15:51 .gitignore
-rw-r--r--  1 oracle oracle 34520 2012-05-08 15:51 GNU-AGPL-3.0.txt
drwxr-xr-x 19 oracle oracle 20480 2012-05-08 15:51 jstests/
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 lib/
-rw-r--r--  1 oracle oracle   191 2012-05-08 15:51 mongo_astyle
-rw-r--r--  1 oracle oracle  1061 2012-05-08 15:51 pch.cpp
-rw-r--r--  1 oracle oracle  5086 2012-05-08 15:51 pch.h
-rwxr-xr-x  1 oracle oracle  1774 2012-05-08 15:51 README*
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 rpm/
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 s/
-rw-r--r--  1 oracle oracle 56262 2012-05-08 15:51 SConstruct
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 scripting/
-rw-r--r--  1 oracle oracle   633 2012-05-08 15:51 server.h
drwxr-xr-x  3 oracle oracle  4096 2012-05-08 15:51 shell/
-rwxr-xr-x  1 oracle oracle   243 2012-05-08 15:51 speed.js*
-rw-r--r--  1 oracle oracle   888 2012-05-08 15:51 targetver.h
drwxr-xr-x  6 oracle oracle  4096 2012-05-08 15:51 third_party/
drwxr-xr-x  2 oracle oracle  4096 2012-05-08 15:51 tools/
drwxr-xr-x  5 oracle oracle  4096 2012-05-08 15:51 util/
-rw-r--r--  1 oracle oracle    86 2012-05-08 15:51 valgrind.suppressions
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 

oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ cat README 
MongoDB README

Welcome to MongoDB!

COMPONENTS

  mongod - The database process.
  mongos - Sharding controller.
  mongo  - The database shell (uses interactive javascript).

UTILITIES

  mongodump         - MongoDB dump tool - for backups, snapshots, etc..
  mongorestore      - MongoDB restore a dump
  mongoexport       - Export a single collection to test (JSON, CSV)
  mongoimport       - Import from JSON or CSV
  mongofiles        - Utility for putting and getting files from MongoDB GridFS
  mongostat         - Show performance statistics

BUILDING
      
  See docs/building.md, also www.mongodb.org search for "Building".

RUNNING

  For command line options invoke:

    $ ./mongod --help

  To run a single server database:

    $ mkdir /data/db
    $ ./mongod
    $
    $ # The mongo javascript shell connects to localhost and test database by default:
    $ ./mongo 
    > help

DRIVERS

  Client drivers for most programming languages are available at mongodb.org.  Use the 
  shell ("mongo") for administrative tasks.

DOCUMENTATION

  http://www.mongodb.org/

MAIL LISTS AND IRC

  http://www.mongodb.org/display/DOCS/Community

32 BIT BUILD NOTES

  MongoDB uses memory mapped files.  If built as a 32 bit executable, you will
  not be able to work with large (multi-gigabyte) databases.  However, 32 bit
  builds work fine with small development databases.

LICENSE

  Most MongoDB source files are made available under the terms of the
  GNU Affero General Public License (AGPL).  See individual files for
  details.

  As an exception, the files in the client/, debian/, rpm/,
  utils/mongoutils, and all subdirectories thereof are made available under
  the terms of the Apache License, version 2.0.
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 

oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ head -13  docs/building.md

Building MongoDB
================

SCONS
---------------
        
For detail information about building, please see [the wiki](http://www.mongodb.org/display/DOCS/Building).

If you want to build everything (mongod, mongo, tools, etc):

    $ scons .

oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 


Installing MongoDB from source depends on SCons so I installed SCons:
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ which scons
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ which python
/usr/bin/python
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ python --help
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-B     : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x
-c cmd : program passed in as string (terminates option list)
-d     : debug output from parser; also PYTHONDEBUG=x
-E     : ignore PYTHON* environment variables (such as PYTHONPATH)
-h     : print this help message and exit (also --help)
-i     : inspect interactively after running script; forces a prompt even
         if stdin does not appear to be a terminal; also PYTHONINSPECT=x
-m mod : run library module as a script (terminates option list)
-O     : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x
-OO    : remove doc-strings in addition to the -O optimizations
-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew
-s     : don't add user site directory to sys.path; also PYTHONNOUSERSITE
-S     : don't imply 'import site' on initialization
-t     : issue warnings about inconsistent tab usage (-tt: issue errors)
-u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
         see man page for details on internal buffering relating to '-u'
-v     : verbose (trace import statements); also PYTHONVERBOSE=x
         can be supplied multiple times to increase verbosity
-V     : print the Python version number and exit (also --version)
-W arg : warning control; arg is action:message:category:module:lineno
-x     : skip first line of source, allowing use of non-Unix forms of #!cmd
-3     : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix
file   : program read from script file
-      : program read from stdin (default; interactive mode if a tty)
arg ...: arguments passed to program in sys.argv[1:]

Other environment variables:
PYTHONSTARTUP: file executed on interactive startup (no default)
PYTHONPATH   : ':'-separated list of directories prefixed to the
               default module search path.  The result is sys.path.
PYTHONHOME   : alternate  directory (or :).
               The default module search path uses /pythonX.X.
PYTHONCASEOK : ignore case in 'import' statements (Windows).
PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ python -V
Python 2.6.5
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 


I got scons "tarball" from this link:

http://prdownloads.sourceforge.net/scons/scons-2.1.0.tar.gz
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ltr
total 3480
drwxr-xr-x 19 oracle oracle    4096 2012-05-08 15:51 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle 2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
drwxrwxrwt  4 root   root      4096 2012-05-22 03:22 ../
lrwxrwxrwx  1 oracle oracle      29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
-rw-r--r--  1 oracle oracle  574666 2012-05-22 03:39 scons-2.1.0.tar.gz
drwxr-xr-x  3 oracle oracle    4096 2012-05-22 03:41 ./
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ tar zxf scons-2.1.0.tar.gz 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ltr
total 3484
drwxr-xr-x  4 oracle oracle    4096 2011-09-10 05:31 scons-2.1.0/
drwxr-xr-x 19 oracle oracle    4096 2012-05-08 15:51 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle 2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
drwxrwxrwt  4 root   root      4096 2012-05-22 03:22 ../
lrwxrwxrwx  1 oracle oracle      29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
-rw-r--r--  1 oracle oracle  574666 2012-05-22 03:39 scons-2.1.0.tar.gz
drwxr-xr-x  4 oracle oracle    4096 2012-05-22 03:41 ./
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ mv scons-2.1.0* /dan/scons/
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cd /dan/scons/
oracle@z3:/dan/scons$ 
oracle@z3:/dan/scons$ ll
total 576
drwxr-xr-x 3 oracle oracle   4096 2012-05-22 03:43 ./
drwxrwxrwt 5 root   root     4096 2012-05-22 03:43 ../
drwxr-xr-x 4 oracle oracle   4096 2011-09-10 05:31 scons-2.1.0/
-rw-r--r-- 1 oracle oracle 574666 2012-05-22 03:39 scons-2.1.0.tar.gz
oracle@z3:/dan/scons$ 
oracle@z3:/dan/scons$ 
oracle@z3:/dan/scons$ 



oracle@z3:/dan/scons$ 
oracle@z3:/dan/scons$ cd scons-2.1.0
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ ll
total 680
drwxr-xr-x 4 oracle oracle   4096 2011-09-10 05:31 ./
drwxr-xr-x 3 oracle oracle   4096 2012-05-22 03:43 ../
-rw-r--r-- 1 oracle oracle 188146 2011-09-10 05:31 CHANGES.txt
drwxr-xr-x 3 oracle oracle   4096 2011-09-10 05:31 engine/
-rw-r--r-- 1 oracle oracle   1124 2011-09-10 05:31 LICENSE.txt
-rw-r--r-- 1 oracle oracle   5568 2011-09-10 05:31 MANIFEST
-rw-r--r-- 1 oracle oracle   2445 2011-09-10 05:31 os_spawnv_fix.diff
-rw-r--r-- 1 oracle oracle    442 2011-09-10 05:31 PKG-INFO
-rw-r--r-- 1 oracle oracle   8156 2011-09-10 05:31 README.txt
-rw-r--r-- 1 oracle oracle   3640 2011-09-10 05:31 RELEASE.txt
-rw-r--r-- 1 oracle oracle 399963 2011-09-10 05:31 scons.1
-rw-r--r-- 1 oracle oracle   4724 2011-09-10 05:31 sconsign.1
-rw-r--r-- 1 oracle oracle  24781 2011-09-10 05:31 scons-time.1
drwxr-xr-x 2 oracle oracle   4096 2011-09-10 05:31 script/
-rw-r--r-- 1 oracle oracle    100 2011-09-10 05:31 setup.cfg
-rw-r--r-- 1 oracle oracle  15758 2011-09-10 05:31 setup.py
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 


oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ python setup.py install --prefix=/dan/scons
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.6
creating build/lib.linux-x86_64-2.6/SCons
copying engine/SCons/Warnings.py -> build/lib.linux-x86_64-2.6/SCons
copying engine/SCons/Subst.py -> build/lib.linux-x86_64-2.6/SCons
copying engine/SCons/Environment.py -> build/lib.linux-x86_64-2.6/SCons
copying engine/SCons/SConsign.py -> build/lib.linux-x86_64-2.6/SCons

snip......

byte-compiling /dan/scons/lib/scons-2.1.0/SCons/Debug.py to Debug.pyc
running install_scripts
creating /dan/scons/bin
copying script/scons -> /dan/scons/bin/scons-2.1.0
copying script/scons -> /dan/scons/bin
copying script/sconsign -> /dan/scons/bin/sconsign-2.1.0
copying script/sconsign -> /dan/scons/bin
copying script/scons-time -> /dan/scons/bin/scons-time-2.1.0
copying script/scons-time -> /dan/scons/bin
running install_data
creating /dan/scons/man
creating /dan/scons/man/man1
copying scons.1 -> /dan/scons/man/man1
copying sconsign.1 -> /dan/scons/man/man1
copying scons-time.1 -> /dan/scons/man/man1
running install_egg_info
Writing /dan/scons/lib/scons-2.1.0/scons-2.1.0-py2.6.egg-info
Installed SCons library modules into /dan/scons/lib/scons-2.1.0
Installed SCons scripts into /dan/scons/bin
Installed SCons man pages into /dan/scons/man/man1
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 




oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ ll /dan/scons/
total 588
drwxr-xr-x 6 oracle oracle   4096 2012-05-22 03:45 ./
drwxrwxrwt 5 root   root     4096 2012-05-22 03:43 ../
drwxr-xr-x 2 oracle oracle   4096 2012-05-22 03:45 bin/
drwxr-xr-x 3 oracle oracle   4096 2012-05-22 03:45 lib/
drwxr-xr-x 3 oracle oracle   4096 2012-05-22 03:45 man/
drwxr-xr-x 5 oracle oracle   4096 2012-05-22 03:45 scons-2.1.0/
-rw-r--r-- 1 oracle oracle 574666 2012-05-22 03:39 scons-2.1.0.tar.gz
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 


So far so good. Next, I added scons to my PATH.

I did this: vi ~/.bashrc

I added /dan/scons/bin to PATH

Then I did this:

oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ bash
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ which scons
/dan/scons/bin/scons
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 




oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ scons --help
usage: scons [OPTION] [TARGET] ...

SCons Options:
  -b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going, --no-print-directory, --print-directory, --stop,
  --touch
                              Ignored for compatibility.
  -c, --clean, --remove       Remove specified targets and dependencies.
  -C DIR, --directory=DIR     Change to DIR before doing anything.
  --cache-debug=FILE          Print CacheDir debug info to FILE.
  --cache-disable, --no-cache
                              Do not retrieve built targets from CacheDir.
  --cache-force, --cache-populate
                              Copy already-built targets into the CacheDir.
  --cache-show                Print build actions for files from CacheDir.
  --config=MODE               Controls Configure subsystem: auto, force, cache.
  -D                          Search up directory tree for SConstruct,       build all Default() targets.
  --debug=TYPE                Print various types of debugging information: count, duplicate, explain, findlibs, includes,
                                memoizer, memory, objects, pdb, prepare, presub, stacktrace, time, dtree, tree, stree,
                                nomemoizer.
  --diskcheck=TYPE            Enable specific on-disk checks.
  --duplicate=DUPLICATE       Set the preferred duplication methods. Must be one of hard-soft-copy, soft-hard-copy,
                                hard-copy, soft-copy, copy
  -f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
                              Read FILE as the top-level SConstruct file.
  -h, --help                  Print defined help message, or this one.
  -H, --help-options          Print this message and exit.
  -i, --ignore-errors         Ignore errors from build actions.
  -I DIR, --include-dir=DIR   Search DIR for imported Python modules.
  --implicit-cache            Cache implicit dependencies
  --implicit-deps-changed     Ignore cached implicit dependencies.
  --implicit-deps-unchanged   Ignore changes in implicit dependencies.
  --interact, --interactive   Run in interactive mode.
  -j N, --jobs=N              Allow N jobs at once.
  -k, --keep-going            Keep going when a target can't be made.
  --max-drift=N               Set maximum system clock drift to N seconds.
  --md5-chunksize=N           Set chunk-size for MD5 signature computation to N kilobytes.
  -n, --no-exec, --just-print, --dry-run, --recon
                              Don't build; just print commands.
  --no-site-dir               Don't search or use the usual site_scons dir.
  --profile=FILE              Profile SCons and put results in FILE.
  -q, --question              Don't build; exit status says if up to date.
  -Q                          Suppress "Reading/Building" progress messages.
  --random                    Build dependencies in random order.
  -s, --silent, --quiet       Don't print commands.
  --site-dir=DIR              Use DIR instead of the usual site_scons dir.
  --stack-size=N              Set the stack size of the threads used to run jobs to N kilobytes.
  --taskmastertrace=FILE      Trace Node evaluation to FILE.
  --tree=OPTIONS              Print a dependency tree in various formats: all, derived, prune, status.
  -u, --up, --search-up       Search up directory tree for SConstruct,       build targets at or below current directory.
  -U                          Search up directory tree for SConstruct,       build Default() targets from local
                                SConscript.
  -v, --version               Print the SCons version number and exit.
  --warn=WARNING-SPEC, --warning=WARNING-SPEC
                              Enable or disable warnings.
  -Y REPOSITORY, --repository=REPOSITORY, --srcdir=REPOSITORY
                              Search REPOSITORY for source and target files.
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 
oracle@z3:/dan/scons/scons-2.1.0$ 


I tried using SCons to construct MongoDB software:
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ scons .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 5 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 


I had seen this same issue on my Mac. I needed the C++ boost libraries. I downloaded the libraries from this URL:

http://www.boost.org/users/download/

I unpacked the boost libraries:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ tar zxf boost_1_49_0.tar.gz 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ll
total 60676
drwxr-xr-x  4 oracle oracle     4096 2012-05-22 04:02 ./
drwxrwxrwt  5 root   root       4096 2012-05-22 03:43 ../
drwxr-xr-x  8 oracle oracle     4096 2012-02-22 23:06 boost_1_49_0/
-rw-r--r--  1 oracle oracle 59136116 2012-05-22 04:00 boost_1_49_0.tar.gz
-rw-r--r--  1 oracle oracle      270 2012-05-22 04:01 example.cpp
drwxr-xr-x 20 oracle oracle     4096 2012-05-22 03:53 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle  2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
lrwxrwxrwx  1 oracle oracle       29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


I tested my installation of the boost libraries using a simple C++ file I found in the instructions:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cat example.cpp 
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 

oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ c++ -I /dan/mdb/boost_1_49_0 example.cpp -o example
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ echo 1 2 3 | ./example
3 6 9 oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


Also I needed to run a shell script to complete the installation of the Boost libraries:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cd boost_1_49_0
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ ll
total 128
drwxr-xr-x  8 oracle oracle  4096 2012-02-22 23:06 ./
drwxr-xr-x  4 oracle oracle  4096 2012-05-22 04:04 ../
drwxr-xr-x 87 oracle oracle 12288 2012-02-22 23:07 boost/
-rw-r--r--  1 oracle oracle   849 2012-01-31 02:30 boost-build.jam
-rw-r--r--  1 oracle oracle 18031 2012-01-31 02:30 boostcpp.jam
-rw-r--r--  1 oracle oracle   989 2012-01-31 02:30 boost.css
-rw-r--r--  1 oracle oracle  6308 2012-01-31 02:30 boost.png
-rw-r--r--  1 oracle oracle  2545 2012-01-31 02:30 bootstrap.bat
-rwxr-xr-x  1 oracle oracle 10324 2012-01-31 02:30 bootstrap.sh*
drwxr-xr-x  7 oracle oracle  4096 2012-02-22 23:05 doc/
-rw-r--r--  1 oracle oracle   769 2012-01-31 02:30 index.htm
-rw-r--r--  1 oracle oracle  5437 2012-01-29 21:58 index.html
-rw-r--r--  1 oracle oracle   291 2012-01-31 02:30 INSTALL
-rw-r--r--  1 oracle oracle 10160 2012-01-29 21:58 Jamroot
drwxr-xr-x 97 oracle oracle  4096 2012-02-22 23:06 libs/
-rw-r--r--  1 oracle oracle  1338 2012-01-31 02:30 LICENSE_1_0.txt
drwxr-xr-x  4 oracle oracle  4096 2012-02-22 23:10 more/
-rw-r--r--  1 oracle oracle  2608 2012-01-31 02:30 rst.css
drwxr-xr-x  2 oracle oracle  4096 2012-02-22 23:06 status/
drwxr-xr-x 12 oracle oracle  4096 2012-02-22 23:10 tools/
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 



oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ ./bootstrap.sh --with-libraries=date_time,filesystem,program_options,thread --prefix=/dan/mdb
Building Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2
Unicode/ICU support for Boost.Regex?... not found.
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/boost-build2/doc/html/index.html

oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 


Then I ran another shell command which took awhile:
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ ./b2 install

Component configuration:

    - chrono                   : not building
    - date_time                : building
    - exception                : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : not building
    - locale                   : not building
    - math                     : not building
    - mpi                      : not building
    - program_options          : building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - signals                  : not building
    - system                   : not building
    - test                     : not building
    - thread                   : building
    - timer                    : not building
    - wave                     : not building

...patience...
...found 19845 targets...
...updating 9891 targets...
common.mkdir /dan/mdb/lib
common.mkdir bin.v2
common.mkdir bin.v2/libs
common.mkdir bin.v2/libs/program_options
common.mkdir bin.v2/libs/program_options/build
common.mkdir bin.v2/libs/program_options/build/gcc-4.4.3
common.mkdir bin.v2/libs/program_options/build/gcc-4.4.3/release
common.mkdir bin.v2/libs/program_options/build/gcc-4.4.3/release/threading-multi
gcc.compile.c++ bin.v2/libs/program_options/build/gcc-4.4.3/release/threading-multi/cmdline.o
gcc.compile.c++ bin.v2/libs/program_options/build/gcc-4.4.3/release/threading-multi/config_file.o

snip....


common.mkdir bin.v2/libs/thread/build/gcc-4.4.3/release/link-static
common.mkdir bin.v2/libs/thread/build/gcc-4.4.3/release/link-static/threading-multi
common.mkdir bin.v2/libs/thread/build/gcc-4.4.3/release/link-static/threading-multi/pthread
gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.4.3/release/link-static/threading-multi/pthread/thread.o
gcc.compile.c++ bin.v2/libs/thread/build/gcc-4.4.3/release/link-static/threading-multi/pthread/once.o
gcc.archive bin.v2/libs/thread/build/gcc-4.4.3/release/link-static/threading-multi/libboost_thread.a
common.copy /dan/mdb/lib/libboost_thread.a
...updated 9891 targets...
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 
oracle@z3:/dan/mdb/boost_1_49_0$ 


At this point I had both SCons and Boost installed. I refocused my attention on MongoDB installation:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cd mongodb-src-r2.0.5
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ scons --prefix=/dan/mdb --extrapathdyn /dan/mdb .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 5 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... yes
Checking for C library boost_system-mt... no
Checking for C library boost_system... yes
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... yes
Checking for C library boost_filesystem-mt... no
Checking for C library boost_filesystem... yes
Checking for C library boost_program_options-mt... no
Checking for C library boost_program_options... yes
Checking for C++ header file execinfo.h... yes
Checking for C library pcap... no
Checking for C library wpcap... no
Checking whether the C++ compiler worksyes
Checking for C++ header file boost/filesystem/operations.hpp... yes
Checking for C library boost_system-mt... no
Checking for C library boost_system... yes
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... yes
Checking for C library boost_filesystem-mt... no
Checking for C library boost_filesystem... yes
Checking for C library boost_program_options-mt... no
Checking for C library boost_program_options... yes
Checking for C++ header file execinfo.h... yes
Checking for C library pcap... no
Checking for C library wpcap... no
scons: done reading SConscript files.
scons: Building targets ...
g++ -o pch.o -c -Wnon-virtual-dtor -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare snip...

snip...

g++ -o whereExample -fPIC -pthread -rdynamic client/examples/whereExample.o -L. -L/dan/mdb/lib snip ...
scons: done building targets.
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 


I studied the files which SCons had just installed:
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ 
oracle@z3:/dan/mdb/mongodb-src-r2.0.5$ cd /dan/mdb/
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ll
total 60724
drwxr-xr-x  7 oracle oracle     4096 2012-05-22 04:41 ./
drwxrwxrwt  5 root   root       4096 2012-05-22 03:43 ../
drwxr-xr-x  2 oracle oracle     4096 2012-05-22 04:48 bin/
drwxr-xr-x  9 oracle oracle     4096 2012-05-22 04:11 boost_1_49_0/
-rw-r--r--  1 oracle oracle 59136116 2012-05-22 04:00 boost_1_49_0.tar.gz
-rwxr-xr-x  1 oracle oracle    35021 2012-05-22 04:04 example*
-rw-r--r--  1 oracle oracle      270 2012-05-22 04:01 example.cpp
drwxr-xr-x  3 oracle oracle     4096 2012-05-22 04:15 include/
drwxr-xr-x  2 oracle oracle     4096 2012-05-22 04:18 lib/
drwxr-xr-x 20 oracle oracle     4096 2012-05-22 04:55 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle  2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
lrwxrwxrwx  1 oracle oracle       29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ cd bin
oracle@z3:/dan/mdb/bin$ 
oracle@z3:/dan/mdb/bin$ 
oracle@z3:/dan/mdb/bin$ ll
total 69884
drwxr-xr-x 2 oracle oracle    4096 2012-05-22 04:48 ./
drwxr-xr-x 7 oracle oracle    4096 2012-05-22 04:41 ../
-rwxr-xr-x 1 oracle oracle 7159680 2012-05-22 04:41 bsondump*
-rwxr-xr-x 1 oracle oracle 2435832 2012-05-22 04:42 mongo*
-rwxr-xr-x 1 oracle oracle 7204816 2012-05-22 04:43 mongod*
-rwxr-xr-x 1 oracle oracle 7188352 2012-05-22 04:43 mongodump*
-rwxr-xr-x 1 oracle oracle 7171968 2012-05-22 04:44 mongoexport*
-rwxr-xr-x 1 oracle oracle 7167872 2012-05-22 04:44 mongofiles*
-rwxr-xr-x 1 oracle oracle 7184256 2012-05-22 04:45 mongoimport*
-rwxr-xr-x 1 oracle oracle 7180160 2012-05-22 04:45 mongorestore*
-rwxr-xr-x 1 oracle oracle 4459784 2012-05-22 04:47 mongos*
-rwxr-xr-x 1 oracle oracle 7225216 2012-05-22 04:48 mongostat*
-rwxr-xr-x 1 oracle oracle 7171968 2012-05-22 04:48 mongotop*
oracle@z3:/dan/mdb/bin$ 
oracle@z3:/dan/mdb/bin$ 


oracle@z3:/dan/mdb/bin$ 
oracle@z3:/dan/mdb/bin$ cd ..
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongo
bin/mongo: error while loading shared libraries: libboost_system.so.1.49.0: cannot open shared object file: No such file or directory
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


oracle@z3:/dan/mdb/bin$ 
oracle@z3:/dan/mdb/bin$ cd ..
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongo
bin/mongo: error while loading shared libraries: libboost_system.so.1.49.0: cannot open shared object file: No such file or directory
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ll lib/libboost_system.*
-rw-r--r-- 1 oracle oracle 21574 2012-05-22 04:18 lib/libboost_system.a
lrwxrwxrwx 1 oracle oracle    25 2012-05-22 04:15 lib/libboost_system.so -> libboost_system.so.1.49.0*
-rwxr-xr-x 1 oracle oracle 20053 2012-05-22 04:15 lib/libboost_system.so.1.49.0*
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


I enhanced an environment variable value to help MongoDB find shared libraries it needed:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ envg ld
LD_LIBRARY_PATH=/oracle/app/oracle/product/11.2.0/dbhome_1/lib
OLDPWD=/dan/mdb/bin
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ export LD_LIBRARY_PATH=/oracle/app/oracle/product/11.2.0/dbhome_1/lib:/dan/mdb/lib
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongo
MongoDB shell version: 2.0.5
connecting to: test
Tue May 22 05:37:51 Error: couldn't connect to server 127.0.0.1 shell/mongo.js:84
exception: connect failed
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 


The above output convinced me that I had installed the MongoDB software correctly. I then started the MongoDB server, mongod, using some clues I found in this file:

mongodb-src-r2.0.5/README

oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ mkdir -p data/db
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ ll
total 60728
drwxr-xr-x  8 oracle oracle     4096 2012-05-22 05:43 ./
drwxrwxrwt  5 root   root       4096 2012-05-22 03:43 ../
drwxr-xr-x  2 oracle oracle     4096 2012-05-22 04:48 bin/
drwxr-xr-x  9 oracle oracle     4096 2012-05-22 04:11 boost_1_49_0/
-rw-r--r--  1 oracle oracle 59136116 2012-05-22 04:00 boost_1_49_0.tar.gz
drwxr-xr-x  3 oracle oracle     4096 2012-05-22 05:43 data/
-rwxr-xr-x  1 oracle oracle    35021 2012-05-22 04:04 example*
-rw-r--r--  1 oracle oracle      270 2012-05-22 04:01 example.cpp
drwxr-xr-x  3 oracle oracle     4096 2012-05-22 04:15 include/
drwxr-xr-x  2 oracle oracle     4096 2012-05-22 04:18 lib/
drwxr-xr-x 20 oracle oracle     4096 2012-05-22 04:55 mongodb-src-r2.0.5/
-rw-r--r--  1 oracle oracle  2971476 2012-05-09 18:27 mongodb-src-r2.0.5.tar.gz
lrwxrwxrwx  1 oracle oracle       29 2012-05-22 03:24 notes2012_0522.txt -> /pt/w/mong/notes2012_0522.txt
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongod
bin/mongod --help for help and startup options
Tue May 22 05:43:54 [initandlisten] MongoDB starting : pid=7392 port=27017 dbpath=/data/db/ 64-bit host=z3
Tue May 22 05:43:54 [initandlisten] db version v2.0.5, pdfile version 4.5
Tue May 22 05:43:54 [initandlisten] git version: nogitversion
Tue May 22 05:43:54 [initandlisten] build info: Linux z3 2.6.32-27-generic #49-Ubuntu SMP Thu Dec 2 00:51:09 UTC 2010 x86_64 BOOST_LIB_VERSION=1_49
Tue May 22 05:43:54 [initandlisten] options: {}
Tue May 22 05:43:54 [initandlisten] exception in initAndListen: 10296 dbpath (/data/db/) does not exist, terminating
Tue May 22 05:43:54 dbexit: 
Tue May 22 05:43:54 [initandlisten] shutdown: going to close listening sockets...
Tue May 22 05:43:54 [initandlisten] shutdown: going to flush diaglog...
Tue May 22 05:43:54 [initandlisten] shutdown: going to close sockets...
Tue May 22 05:43:54 [initandlisten] shutdown: waiting for fs preallocator...
Tue May 22 05:43:54 [initandlisten] shutdown: lock for final commit...
Tue May 22 05:43:54 [initandlisten] shutdown: final commit...
Tue May 22 05:43:54 [initandlisten] shutdown: closing all files...
Tue May 22 05:43:54 [initandlisten] closeAllFiles() finished
Tue May 22 05:43:54 dbexit: really exiting now
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 



oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongod --help
Allowed options:

General options:
  -h [ --help ]               show this usage information
  --version                   show version information
  -f [ --config ] arg         configuration file specifying additional options
  -v [ --verbose ]            be more verbose (include multiple times for more 
                              verbosity e.g. -vvvvv)
  --quiet                     quieter output
  --port arg                  specify port number
  --bind_ip arg               comma separated list of ip addresses to listen on
                              - all local ips by default
  --maxConns arg              max number of simultaneous connections
  --objcheck                  inspect client data for validity on receipt
  --logpath arg               log file to send write to instead of stdout - has
                              to be a file, not directory
  --logappend                 append to logpath instead of over-writing
  --pidfilepath arg           full path to pidfile (if not set, no pidfile is 
                              created)
  --keyFile arg               private key for cluster authentication (only for 
                              replica sets)
  --nounixsocket              disable listening on unix sockets
  --unixSocketPrefix arg      alternative directory for UNIX domain sockets 
                              (defaults to /tmp)
  --fork                      fork server process
  --auth                      run with security
  --cpu                       periodically show cpu and iowait utilization
  --dbpath arg                directory for datafiles
  --diaglog arg               0=off 1=W 2=R 3=both 7=W+some reads
  --directoryperdb            each database will be stored in a separate 
                              directory
  --journal                   enable journaling
  --journalOptions arg        journal diagnostic options
  --journalCommitInterval arg how often to group/batch commit (ms)
  --ipv6                      enable IPv6 support (disabled by default)
  --jsonp                     allow JSONP access via http (has security 
                              implications)
  --noauth                    run without security
  --nohttpinterface           disable http interface
  --nojournal                 disable journaling (journaling is on by default 
                              for 64 bit)
  --noprealloc                disable data file preallocation - will often hurt
                              performance
  --noscripting               disable scripting engine
  --notablescan               do not allow table scans
  --nssize arg (=16)          .ns file size (in MB) for new databases
  --profile arg               0=off 1=slow, 2=all
  --quota                     limits each database to a certain number of files
                              (8 default)
  --quotaFiles arg            number of files allower per db, requires --quota
  --rest                      turn on simple rest api
  --repair                    run repair on all dbs
  --repairpath arg            root directory for repair files - defaults to 
                              dbpath
  --slowms arg (=100)         value of slow for profile and console log
  --smallfiles                use a smaller default file size
  --shutdown                  kill a running server (for init scripts)
  --syncdelay arg (=60)       seconds between disk syncs (0=never, but not 
                              recommended)
  --sysinfo                   print some diagnostic system information
  --upgrade                   upgrade db if needed

Replication options:
  --fastsync            indicate that this instance is starting from a dbpath 
                        snapshot of the repl peer
  --oplogSize arg       size limit (in MB) for op log

Master/slave options:
  --master              master mode
  --slave               slave mode
  --source arg          when slave: specify master as 
  --only arg            when slave: specify a single database to replicate
  --slavedelay arg      specify delay (in seconds) to be used when applying 
                        master ops to slave
  --autoresync          automatically resync if slave data is stale

Replica set options:
  --replSet arg         arg is [/]

Sharding options:
  --configsvr           declare this is a config db of a cluster; default port 
                        27019; default dir /data/configdb
  --shardsvr            declare this is a shard db of a cluster; default port 
                        27018
  --noMoveParanoia      turn off paranoid saving of data for moveChunk.  this 
                        is on by default for now, but default will switch

oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 



oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongod --dbpath /dan/mdb/data/db
Tue May 22 05:46:19 [initandlisten] MongoDB starting : pid=7412 port=27017 dbpath=/dan/mdb/data/db 64-bit host=z3
Tue May 22 05:46:19 [initandlisten] db version v2.0.5, pdfile version 4.5
Tue May 22 05:46:19 [initandlisten] git version: nogitversion
Tue May 22 05:46:19 [initandlisten] build info: Linux z3 2.6.32-27-generic #49-Ubuntu SMP Thu Dec 2 00:51:09 UTC 2010 x86_64 BOOST_LIB_VERSION=1_49
Tue May 22 05:46:19 [initandlisten] options: { dbpath: "/dan/mdb/data/db" }
Tue May 22 05:46:19 [initandlisten] journal dir=/dan/mdb/data/db/journal
Tue May 22 05:46:19 [initandlisten] recover : no journal files present, no recovery needed
Tue May 22 05:46:24 [initandlisten] preallocateIsFaster=true 35.98
Tue May 22 05:46:32 [initandlisten] preallocateIsFaster=true 33.2
Tue May 22 05:46:46 [initandlisten] preallocateIsFaster=true 14.94
Tue May 22 05:46:46 [initandlisten] preallocateIsFaster check took 26.333 secs
Tue May 22 05:46:46 [initandlisten] preallocating a journal file /dan/mdb/data/db/journal/prealloc.0
		639631360/1073741824	59%
		734003200/1073741824	68%
		880803840/1073741824	82%
oracle@z3:/dan/mdb$ 
Tue May 22 05:47:09 [initandlisten] preallocating a journal file /dan/mdb/data/db/journal/prealloc.1
		775946240/1073741824	72%
		922746880/1073741824	85%
		1069547520/1073741824	99%
Tue May 22 05:47:28 [initandlisten] preallocating a journal file /dan/mdb/data/db/journal/prealloc.2
		786432000/1073741824	73%
		996147200/1073741824	92%
Tue May 22 05:47:47 [websvr] admin web console waiting for connections on port 28017
Tue May 22 05:47:47 [initandlisten] waiting for connections on port 27017
Tue May 22 05:48:21 [initandlisten] connection accepted from 127.0.0.1:51024 #1
Tue May 22 05:48:47 [clientcursormon] mem (MB) res:15 virt:177 mapped:0


Next, I connected the mongo CLI to the MongoDB server, mongod:
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ 
oracle@z3:/dan/mdb$ bin/mongo
MongoDB shell version: 2.0.5
connecting to: test
> help
	db.help()                    help on db methods
	db.mycoll.help()             help on collection methods
	rs.help()                    help on replica set methods
	help admin                   administrative help
	help connect                 connecting to a db help
	help keys                    key shortcuts
	help misc                    misc things to know
	help mr                      mapreduce

	show dbs                     show database names
	show collections             show collections in current database
	show users                   show users in current database
	show profile                 show most recent system.profile entries with time >= 1ms
	show logs                    show the accessible logger names
	show log [name]              prints out the last segment of log in memory, 'global' is default
	use                 set current database
	db.foo.find()                list objects in collection foo
	db.foo.find( { a : 1 } )     list objects in foo where a == 1
	it                           result of the last line evaluated; use to further iterate
	DBQuery.shellBatchSize = x   set default number of items to display on shell
	exit                         quit the mongo shell
> 
> 


The above output convinced me that my attempt to install MongoDB from source-code on my Ubuntu 10.04 system was a success.

2012-04-30 Rails Prerequesite: Effective Editor (Vim)

Topics covered in my Vim Class

  • Introduction: Vi and Vim
  • Why do I like Vim?
    • Vim is free; some editors are not. For example, TextMate is not free.
    • Vim is perhaps the most ubiquitous editor, it runs on Linux, Mac, and Windows.
    • On Linux and Mac, Vim is bundled with the OS; I don't need to install it.
    • Vim has an excellent "built-in" tutorial.
    • Vim is extensible, perhaps easily so.
    • Vim has many common commands which are only one or two characters. Once you memorize the characters for the commands, you have the ability to edit code and documents very quickly.
  • Why do I not like Vim?
    • Vim has a "command" mode which entices me to think it is in "insert" mode.
    • If I am in "command" mode and I think I am in "insert" mode, I could type in text (and thus commands) which will change content I don't want to change.
    • Typically Vim is running inside the shell. I'm either in Vim, or I'm in the shell. I prefer my editor to contain the shell which interests me. Since Vim runs inside the shell I use one set of commands for Vim and another set for the shell.

      On the other hand if I run the shell inside the editor (Emacs offers this feature), many of the commands (search, copy, paste, for example) which work in the editor will work in the shell. I am then free to perceive the shell as two things: a command line interface, or a document full of text which might be useful in another document (or shell). This reduces "Mental Context Switching" which allows my mind to code faster. This is the main reason I don't like Vim. Other than that it is an excellent editor.
  • Notes about keyboard keys:
    • Ctrl, When you press this, do hold it down.
    • Esc, When you press this, do it for an instant. Do not hold it down.
  • Vim command modes 1 and 2
    • I enter command mode by pressing Esc.
    • If I'm already in command mode but I'm not sure that I am, I ensure I'm in command mode by pressing Esc. I encounter no harm if I press Esc 5 times in a row.
    • I refer to this command mode as "command mode 1". I can go to another command mode "command mode 2", by pressing the colon key.
  • Vim command-mode-1
    • I enter command mode 1 by pressing Esc
    • Most commands are only 1 character which helps you code faster
    • I use command mode 1 mostly for navigation around my document and deleting text
    • The next line command: j or "plus-sign" or Enter (my preference)
    • The previous line command: k or "minus-sign"
    • Move right: space-bar or l
    • Move left: h
    • Move right 1 word: w
    • Move left 1 word: b
    • Erase a character: x
    • Repeat my last command: . (You might not see it. It is just a period.)
    • Undo my last command: u
    • Leave command mode 1, go to insert mode: i (This "inserts" text before the cursor)
    • Leave command mode 1, go to insert mode: a (This "appends" text after the cursor)
    • Leave command mode 1, go to insert mode: o (This "appends" text after the current line)
    • Some two character commands:
    • Erase a word: dw
    • Erase a line: dd
    • Move to top of document: [[
    • Move to bottom of document: ]]
    • Write changes to disk, exit vim: ZZ
  • Vim command-mode-1 commands which require I press enter after the command:
    • Search: /search-string-here (To repeat last search: n)
    • Erase 4 lines: d4
  • Vim command-mode-2
    • I enter command mode 2 by pressing Esc and then : (colon)
    • :h sends me to online help (which is excellent)
    • :w writes changes to disk
    • :q quits Vim and sends me back to the shell (if I changed nothing)
    • :q! discards changes and quits Vim
    • :33 sends me to line 33
    • :r /tmp/abc.html reads the file into my current Vim file (but does not write it to disk yet)

2012-04-29 Rails Prerequesite: Effective Editor (Emacs)

Topics covered in my Emacs Class

  • Introduction: I use Emacs to build Rails applications.
  • Why do I like Emacs?
    • Emacs is free; some editors are not. For example, TextMate is not free.
    • Emacs runs on Linux, Mac, Windows; TextMate, for example, runs on Mac only.
    • Emacs allows faster "Mental Context Switching" than other editors, in my opinion.
    • Emacs has an excellent "built-in" tutorial.
    • Simple macros are easy to build and save.
    • I can "label" and run Shells in Emacs.
    • Emacs has a "Buffer List" which helps my mind to switch between related files and related shells.
    • It has a modular nature; it does not feel monolithic and brittle.
    • Matz likes emacs: http://www.slideshare.net/yukihiro_matz/how-emacs-changed-my-life
  • Why do I not like Emacs?
    • Fresh install has poor support for code-completion
    • Emacs is not part of fresh OS installs, so I need to install it
    • Some types of customization are difficult (unless you know Lisp)
    • Customizations from developers are often difficult to understand
  • Notes about keyboard keys:
    • Ctrl, When you press this, do hold it down.
    • Esc, When you press this, do it for an instant. Do not hold it down.
  • My most frequent keyboard command actions in emacs:
    • Ctrl-g, keyboard-quit. This allows me to "quit" any command I am currently typing in. If you frequently change your mind, this will become your favorite command.
    • Esc-x buffer-menu, I do this so much, I tie it to Esc-m. It lists all files and shells I have open. If I ever get "lost" in Emacs, I run this command. It floats me up 100 feet and shows me the landscape.
    • Esc-x find-file, this is tied to Ctrl-f. It opens a file, existing or not.
    • Esc-x find-file, this is also tied to Ctrl-f. It can open a directory instead of a file.
    • Esc-x save-buffer, write recent changes to disk. Default is Ctrl-x,s I tie it to Esc-p which is quicker.
    • Esc-x shell, opens a new shell, inside an Emacs-buffer. I tie this to Ctrl-x,s.
    • Esc-x search-backward, this is tied to Ctrl-r. I use it in buffer-menu, files, directories and shells.
    • Esc-x split-window-horizontally, this is tied to Ctrl-x,2. I have many use cases for this feature.
    • Esc-x other-window, this is tied to Ctrl-x,0. Jump to other-window and make it the only window.
    • Esc-x kill-buffer, this is tied to Ctrl-x,k. Removes current buffer from Emacs and buffer-menu.
  • My most frequent keyboard edit actions in emacs:
    • Esc-x next-line, this is tied to Ctrl-n.
    • Esc-x previous-line, this is tied to Ctrl-p.
    • Esc-x end-of-line, this is tied to Ctrl-e.
    • Esc-x beginning-of-line, this is tied to Ctrl-a.
    • Esc-x beginning-of-buffer, this is tied to Esc-<.
    • Esc-x beginning-of-buffer, this is tied to Esc->.
    • Esc-x save-buffer, write recent changes to disk. Default is Ctrl-x,s I tie it to Esc-p which is quicker.
    • Esc-x kill-line, kill (delete) all text on this line to the right, this is tied to Ctrl-k.
    • Esc-x yank, un-kill (or yank-back) text I deleted; useful for moving text from point-a to point-b. Ctrl-y
    • Esc-x recenter, scroll the buffer so the cursor is in the middle of the screen.
    • Esc-x other-window, this is tied to Ctrl-x,0. Jump to other-window and make it the only window.
    • Esc-x kill-buffer, this is tied to Ctrl-x,k. Removes current buffer from Emacs and buffer-menu.
    • Esc-x undo, this is tied to simultaneous Ctrl-shift-minus.
    • Esc-x kill-region, Ctrl-w, This deletes a "region" (usually several lines) of text.
    • Esc-x ispell-word, spell check a word. Tied to Esc-$.
  • My most frequent mouse actions in Emacs:
    • Copy
    • Paste
    • Save
    • Search
    • Open File
    • Undo
    • List Buffers
    • Help
  • Simple use case: Edit abc.html in /tmp/
    • Start Emacs
    • Ctrl-x,Ctrl-f /tmp/abc.html
    • Start typing
    • Mouse in a giant gob of HTML from a web-page-view-source.
    • Ctrl-a sends me to beginning of line
    • Ctrl-k kills all text to the right
    • Ctrl-p sends me to previous line
    • Ctrl-y yanks (un-kills) killed text
    • Ctrl-n sends me to next line
    • Ctrl-e sends me to end of line
    • Esc-x save-buffer (or mouse-save) writes abc.html to /tmp/
    • Esc-x buffer-menu (or mouse-buffer) shows abc.html in buffer-list
    • Ctrl-r abc searches for abc in buffer-list
    • Ctrl-x,Ctrl-f /tmp/ shows list of files in /tmp/
    • If a file (or directory) in /tmp/ looks interesting, click on it to open it
  • More?
    • Start Emacs
    • Click on Help
    • Click on Tutorial, it is excellent
    • If you get lost, click on Buffers or type in Esc-x buffer-menu
    • Tip: Never close Emacs, just let the buffer-menu get gigantic. Emacs sorts the buffer-menu by age, newer buffers near the top where they are more noticeable. If you want to find a file you were working on 2 weeks ago or a shell you were in last week, just search for it in the buffer menu with mouse-search or Ctrl-r.

      If you resist the urge to close Emacs, you will find it very useful for re-connecting your mind to work which got interrupted by events like phone calls or an entire weekend away from the keyboard. I run an Emacs instance on my laptop for a month or more. At the end of that month I might have 20 or 30 shells in there and several hundred files opened. Sometimes it is interesting (or necessary) to see what I was working on three weeks ago.

2012-04-28 Rails Class Topics

I've taught Rails to a wide variety of people since 2006. This post is a mixture of a blog-post and a tech-tip. It's a bit more technical than opinionated so I placed this post in the "Tech Tips" section of this site.

When I teach Rails I prefer to explore the list of topics below:

  • Opinionated Initial Topics:
    • Windows is bad; Mac is pretty good but Ubuntu Linux is excellent
    • Installation of Ruby
    • You don't need to use RVM but you should know how to use it
    • RVM alternatives
    • Optional: Installation of JRuby
    • Installation of RubyGems
    • Interacting with "System Gems"
    • Install Bundler
    • Interact with Bundler
    • Git: You don't need to use Git but it is useful
    • Use RubyGems to install Rails
    • Database choices: SQLite best for learning else MySQL or Postgres
    • Use Rails to create a new application
  • Shell commands related to Rails:
    • rails
    • rake
    • gem
    • bundle
  • Opinion: Use "Inside/Out" thinking to learn Rails
  • Opinion: Use "Outside/In" thinking to practice Rails
  • bin/rake db:create, creates a "database"
  • bin/rails generate migration, create a database table script
  • bin/rake: db:migrate, creates a database table, users for example, from the script
  • bin/rails generate model, creates software to talk with database
  • bin/rails console, use this to learn Active Record API:
    • AR-class-methods interact with DB
    • Ex: @user = User.find_by_name 'dan@hackternoon.com'
    • Google: Rails Active Record Arel
    • Google: Rails Active Record Named Scope
    • AR-object getters/setters match table columns
    • Ex: @user.email
    • Use attr_accessible to create whitelist of attributes
    • Validations: Prevent bad data
    • Callbacks: before_create, after_create, before_save, after_save
    • Associations: CREATE TABLE projects(name,..., user_id)
    • belongs_to association, project belongs_to :user
    • Ex: @project.user.email
    • has_many association, user has_many :projects
    • Ex: @user.projects.first.description
  • bin/rails generate controller users index:
    • bin/rake routes
    • bin/rails server
    • Use ruby_debug19 to see interesting objects in the controller:
      • request
      • params
      • session
      • @user AR-object
    • render
    • redirect_to
    • double render exception
  • app/views:
    • Views are usually written in ERB (similar to PHP)
    • Other languages besides ERB: HAML and Slim
    • HAML is better than ERB for learning about app/views
    • Slim claims to be more performant
    • Controller instance variables are available in views
    • View hierarchy: Layout - Template - Partial - Partial - Partial,...
    • Naming convention: Layout named after controller
    • Naming convention: Template named after method in controller
    • Example File System Naming convention: app/views/layouts/
    • Example File System Naming convention: app/views/users/
    • Example File System Naming convention: app/views/projects/
    • My File System Naming convention for shared partials: app/views/shared/
    • Tag Helpers (many of them!) my top 4:
      • link_to
      • image_tag
      • form_for
      • form_tag
    • Techniques for sharing code between views:
      • Use application-wide layout when possible: app/views/layouts/application.html.haml
      • In controller, instead of default render, specify render
      • Use a "shared" directory to hold some partials: app/views/shared/
      • app/helpers/application_helper.rb holds logic/syntax which can be shared
    • Use ruby_debug19 to see interesting objects in the view:
      • params
      • notice
      • alert
      • controller instance variables
    • Assets:
      • Images: dan.jpg
      • CSS: dan.css
      • JavaScript: dan.js
      • Easy way: put assets under public/
      • Performant way: put assets under app/assets:
        • Google: Rails Asset Pipeline
        • Production needs assets precompiled
        • Development does not
        • bin/rake assets:clean:all
        • bin/rake assets:precompile:all
        • Coffee-Script now easy to use in Rails
        • Sass now easy to use in Rails
  • Configuration Files:
    • config/database.yml
    • config/routes.rb
    • config/environments/development.rb
    • config/environments/test.rb
    • config/environments/production.rb

2012-04-27 Rails Prerequesite: UNIX Shell (Bash Class)

I've taught Rails to a wide variety of people since 2006. Obviously teaching Rails allows me to gain a deeper understanding of it. Also I have bumped into people and situations where teaching Rails seems "smooth".

Other times though, teaching Rails is a cumbersome chore. Teaching Rails is usually difficult if the student lacks knowledge and ability related these two topics:

  • The UNIX Shell
  • An effective editor

Another issue which often comes up is the user wants to learn Rails on a windows laptop. For that situation, I claim lack of experience with windows and I tell the user to look for tutorials on the web. It is possible, however, to use a windows laptop to learn what I call "Rails Prerequesites".

So, I am now focused on the task of building course content for two classes:

  • Rails Prerequesite: UNIX Shell (Bash Class)
  • Rails Prerequesite: Effective Editors (Vim, Sed, and Emacs)

One assumption I have about the Effective Editors class is that if I can teach users how to write code with Vim and Emacs, they should be able to teach themselves Sublime Text and/or TextMate.

I'm not sure the same can be said for an IDE like RubyMine. I've spent 30 minutes with RubyMine and I've seen a new student struggle with it. My impression is that it acts well as an editor but it confused us when we tried to use it for running shell commands. Also we tried using it to step through code with the built-in debugger. That did not work at all; inside of RubyMine the debugger just issued error messages. Outside of RubyMine in a normal shell, the debugger worked fine. Eventually we gave up and used RubyMine only as an editor. Enough about RubyMine.

On with the post; I list below a general outline of Rails Prerequesite: UNIX Shell (Bash Class).

Bash Class is about dealing with the Bash shell prompt. The class is not about writing Bash shell scripts. To do that I assume you need a class on Effective Editors and that class comes after this class.

Topic: Finding a Bash shell prompt.

Duration: It depends on laptop type.

On Mac just start the terminal app.

Estimated Duration(on Mac): 1 Minute.

On Windows it is a chore.

  • Option 1 (best option)
    Ask Google: How do I install Cygwin?
    Estimated Duration: 40 Minutes.
  • Option 2 (time consuming)
    Ask Google: How do I install VMware Player on Windows to Run Ubuntu?
    Estimated Duration: 180 Minutes!
  • Option 3 (Requires Credit Card. Costs $0.02 / hour)
    Google: How do I install Ubuntu on Rackspace Cloud?
    Estimated Duration: 60 Minutes.
  • Option 4 (Similar but more difficult than Rackspace)
    Google: How do I install Ubuntu on Amazon EC2?
    Estimated Duration: 90 Minutes.


Topic: Bash shell prompt found, Now learn shell commands related to "Directories".

Estimated Duration: 15 min

Jargon tip: Directory is the UNIX word for Folder; it contains files and other directories.

We try and discuss the shell commands listed below:

ls
ls -l
ls -la
ls -lat
ls -latr

cd
dc

dc can trap you.
you get out of dc by typing "q"

cd /usr/lib
cd .
cd ..
cd ../..

pwd

mkdir
mkdir -p
rmdir
rm
rm -f
rm -rf


single-quote
single-quote can trap you
you get out by typing another single-quote

Quiz:

  • How is behavior ls -lat different that ls -latr ?
  • When or why would I want to run ls -latr ?
  • When or why would I want to run just "cd" ?
  • What does "cd ." do?
  • Is dc useful?
  • What is a file system?
  • What are some important directories and what purpose do they serve?



Topic: Now, I know commands to manipulate directories. Next, I learn the command line.

Estimated Duration: 15 min

No lecture, just a quiz!

Quiz:

  • What is a command line?
  • On a command line, why is the arrow key (sometimes) your friend?
  • On a command line, why is the tab-key useful?
  • On a command line, How do I go backwards exactly 2 words?
  • On a command line, How do I go forward exactly 1 word?
  • On a command line, How do I erase 1 word in front of me?
  • On a command line, How do I erase all words in front of me?
  • On a command line, How do I load the last command I ran?
  • The command line is "stuck", what can I do?



Topic: More shell commands, these related to files and sometimes directories:

Estimated Duration: 15 min

We try and discuss the shell commands listed below:

cp
cp -p
mv
touch

Quiz:

  • How is cp -p different than cp?
  • Why is mv called "mv"?
  • Does cp work on a directory?
  • In some situations, mv could have another name. What's that name?
  • In some situations, mv has the perfect name. What are those situations?
  • Is touch useful?



Topic: More shell commands, these related to files:

Estimated Duration: 60 min

We try and discuss the shell commands listed below:

pg
more
cat
grep
head
tail
sort
chmod
file
tar
rsync
zip
strings
wc
du
df
find
which
>
|

Quiz:

  • Why use pg instead of more?
  • Why use pg instead of cat?
  • Why use more instead of pg?
  • How can cat simulate cp?
  • What is a better name for grep?
  • What are the dangers of cat?
  • What are the dangers of chmod?
  • How can | hang my terminal?
  • What is stdout?
  • What is stderr?
  • How much disk-space you have now?
  • How much disk-space are you using?
  • How big is the largest file you can find?
  • What is the most common option for wc?
  • What is the best way to copy a directory to another directory?
  • What is the best way to move a directory to another directory?
  • What is the best way to rename a directory?



Topic: More shell commands, these related to the computer:

Estimated Duration: 30 min

We try and discuss the shell commands listed below:

ssh
w
who
ps
date
uptime
top

Quiz:

  • How long has your computer been "up"?
  • According to your Bash, what time is it right now?
  • How many processes are running on your computer right now?



Topic: Environment variables:

Estimated Duration: 15 min

We inspect and discuss the files listed below:

  • .bashrc
  • .bash_profile
  • .profile

We try and discuss the shell commands listed below:

echo
env
export
unset

Environment variables:

$HOME
$PATH
$PS1
$DISPLAY
$RAILS_ENV
$EDITOR

Quiz:

  • How do I see my environment variables in sorted order?
  • Why is changing PATH dangerous?
  • How do I protect myself from PATH mistakes?
  • How do I add "/tmp/bin" to end of my PATH?
  • How do I add "/tmp/bin" to beginning of my PATH?
  • How do I remove "/tmp/bin" from my PATH?
  • How do I make my shell prompt display the current time?
  • What are 3 typical values for RAILS_ENV?
  • What type of software depends on DISPLAY?


So that completes my rough outline of "Bash Class". After I teach it a few times I'm sure it will change. Also I'll have a better idea about what the durations should be for each topic.

Stay tuned for the outline of my class: "Effective Editors".



2012-04-26 Install MongoDB From Source on Mac OS/X

I started my installation efforts by creating a directory and downloading a tar-ball:
Tue Apr 24 14:11 ~/pt/mongo4 bikle611$ 
Tue Apr 24 14:11 ~/pt/mongo4 bikle611$ 
Tue Apr 24 14:11 ~/pt/mongo4 bikle611$ mkdir /dan/mongo
Tue Apr 24 14:12 ~/pt/mongo4 bikle611$ 
Tue Apr 24 14:12 ~/pt/mongo4 bikle611$ 
Tue Apr 24 14:12 ~/pt/mongo4 bikle611$ cd /dan/mongo
Tue Apr 24 14:12 /dan/mongo bikle611$ 
Tue Apr 24 14:12 /dan/mongo bikle611$ 
Tue Apr 24 14:12 /dan/mongo bikle611$ wget http://downloads.mongodb.org/src/mongodb-src-r2.0.4.tar.gz
--2012-04-24 14:12:52--  http://downloads.mongodb.org/src/mongodb-src-r2.0.4.tar.gz
Resolving downloads.mongodb.org... 207.171.187.118
Connecting to downloads.mongodb.org|207.171.187.118|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2966431 (2.8M) [application/x-tar]
Saving to: `mongodb-src-r2.0.4.tar.gz'

100%[======================================>] 2,966,431    125K/s   in 21s     

2012-04-24 14:13:13 (141 KB/s) - `mongodb-src-r2.0.4.tar.gz' saved [2966431/2966431]

Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ 
I unpacked the tar-ball and looked for installation instructions:
Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ 
Tue Apr 24 14:13 /dan/mongo bikle611$ tar zxf mongodb-src-r2.0.4.tar.gz 
Tue Apr 24 14:17 /dan/mongo bikle611$ 
Tue Apr 24 14:17 /dan/mongo bikle611$ 
Tue Apr 24 14:17 /dan/mongo bikle611$ ll
total 5800
drwxr-xr-x   4 bikle611  admin      136 Apr 24 14:17 ./
drwxr-xr-x   4 bikle611  admin      136 Apr 24 14:12 ../
drwxr-xr-x  34 bikle611  admin     1156 Mar 19 09:10 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin  2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Tue Apr 24 14:17 /dan/mongo bikle611$ 
Tue Apr 24 14:17 /dan/mongo bikle611$ 
Tue Apr 24 14:17 /dan/mongo bikle611$ cd mongodb-src-r2.0.4
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ ll
total 328
drwxr-xr-x   34 bikle611  admin   1156 Mar 19 09:10 ./
drwxr-xr-x    4 bikle611  admin    136 Apr 24 14:17 ../
-rw-r--r--    1 bikle611  admin     58 Mar 19 09:10 .gitattributes
-rw-r--r--    1 bikle611  admin   1255 Mar 19 09:10 .gitignore
-rw-r--r--    1 bikle611  admin  11358 Mar 19 09:10 APACHE-2.0.txt
-rw-r--r--    1 bikle611  admin  34520 Mar 19 09:10 GNU-AGPL-3.0.txt
-rwxr-xr-x    1 bikle611  admin   1774 Mar 19 09:10 README*
-rw-r--r--    1 bikle611  admin  56215 Mar 19 09:10 SConstruct
drwxr-xr-x   19 bikle611  admin    646 Mar 19 09:10 bson/
drwxr-xr-x   23 bikle611  admin    782 Mar 19 09:10 buildscripts/
drwxr-xr-x   29 bikle611  admin    986 Mar 19 09:10 client/
drwxr-xr-x  140 bikle611  admin   4760 Mar 19 09:10 db/
drwxr-xr-x   39 bikle611  admin   1326 Mar 19 09:10 dbtests/
drwxr-xr-x   29 bikle611  admin    986 Mar 19 09:10 debian/
drwxr-xr-x    6 bikle611  admin    204 Mar 19 09:10 distsrc/
drwxr-xr-x    7 bikle611  admin    238 Mar 19 09:10 docs/
-rw-r--r--    1 bikle611  admin  10758 Mar 19 09:10 doxygenConfig
-rw-r--r--    1 bikle611  admin   3606 Mar 19 09:10 gch.py
drwxr-xr-x  517 bikle611  admin  17578 Mar 19 09:10 jstests/
drwxr-xr-x    3 bikle611  admin    102 Mar 19 09:10 lib/
-rw-r--r--    1 bikle611  admin    191 Mar 19 09:10 mongo_astyle
-rw-r--r--    1 bikle611  admin   1061 Mar 19 09:10 pch.cpp
-rw-r--r--    1 bikle611  admin   5094 Mar 19 09:10 pch.h
drwxr-xr-x    7 bikle611  admin    238 Mar 19 09:10 rpm/
drwxr-xr-x   54 bikle611  admin   1836 Mar 19 09:10 s/
drwxr-xr-x   20 bikle611  admin    680 Mar 19 09:10 scripting/
-rw-r--r--    1 bikle611  admin    633 Mar 19 09:10 server.h
drwxr-xr-x   15 bikle611  admin    510 Mar 19 09:10 shell/
-rwxr-xr-x    1 bikle611  admin    243 Mar 19 09:10 speed.js*
-rw-r--r--    1 bikle611  admin    888 Mar 19 09:10 targetver.h
drwxr-xr-x   10 bikle611  admin    340 Mar 19 09:10 third_party/
drwxr-xr-x   14 bikle611  admin    476 Mar 19 09:10 tools/
drwxr-xr-x   77 bikle611  admin   2618 Mar 19 09:10 util/
-rw-r--r--    1 bikle611  admin     86 Mar 19 09:10 valgrind.suppressions
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 



Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:17 /dan/mongo/mongodb-src-r2.0.4 bikle611$ cat README 
MongoDB README

Welcome to MongoDB!

COMPONENTS

  mongod - The database process.
  mongos - Sharding controller.
  mongo  - The database shell (uses interactive javascript).

UTILITIES

  mongodump         - MongoDB dump tool - for backups, snapshots, etc..
  mongorestore      - MongoDB restore a dump
  mongoexport       - Export a single collection to test (JSON, CSV)
  mongoimport       - Import from JSON or CSV
  mongofiles        - Utility for putting and getting files from MongoDB GridFS
  mongostat         - Show performance statistics

BUILDING
      
  See docs/building.md, also www.mongodb.org search for "Building".

RUNNING

  For command line options invoke:

    $ ./mongod --help

  To run a single server database:

    $ mkdir /data/db
    $ ./mongod
    $
    $ # The mongo javascript shell connects to localhost and test database by default:
    $ ./mongo 
    > help

DRIVERS

  Client drivers for most programming languages are available at mongodb.org.  Use the 
  shell ("mongo") for administrative tasks.

DOCUMENTATION

  http://www.mongodb.org/

MAIL LISTS AND IRC

  http://www.mongodb.org/display/DOCS/Community

32 BIT BUILD NOTES

  MongoDB uses memory mapped files.  If built as a 32 bit executable, you will
  not be able to work with large (multi-gigabyte) databases.  However, 32 bit
  builds work fine with small development databases.

LICENSE

  Most MongoDB source files are made available under the terms of the
  GNU Affero General Public License (AGPL).  See individual files for
  details.

  As an exception, the files in the client/, debian/, rpm/,
  utils/mongoutils, and all subdirectories thereof are made available under
  the terms of the Apache License, version 2.0.
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:18 /dan/mongo/mongodb-src-r2.0.4 bikle611$ head -13  docs/building.md 

Building MongoDB
================

SCONS
---------------
        
For detail information about building, please see [the wiki](http://www.mongodb.org/display/DOCS/Building).

If you want to build everything (mongod, mongo, tools, etc):

    $ scons .

Tue Apr 24 14:22 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
I went on a quest for "scons".
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:23 /dan/mongo/mongodb-src-r2.0.4 bikle611$ which scons
/pt/p/bin/scons
Tue Apr 24 14:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


Tue Apr 24 14:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:25 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons --help
scons: Reading SConscript files ...
scons version: 1.2.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
error: no result
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
Tue Apr 24 14:25 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:25 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:25 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:25 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


That did not look good.
When did I install scons?
Tue Apr 24 14:32 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:32 /dan/mongo/mongodb-src-r2.0.4 bikle611$ ll /pt/p/bin/scons
-rwxr-xr-x  1 maco  staff  5889 Dec 20  2008 /pt/p/bin/scons*
Tue Apr 24 14:33 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:33 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


It's more than 3 years old now.
That's old but, I decided to see how far I could get using this old version of scons.
Tue Apr 24 14:34 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:34 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons .
scons: Reading SConscript files ...
scons version: 1.2.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
error: no result
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
Tue Apr 24 14:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


That is not good.
I'll see if I can install a newer version of scons.
I found scons via google and did this:
Tue Apr 24 14:41 /dan/scons bikle611$ ll ~/Downloads/scons-2.1.0.tar.gz 
-rw-r--r--@ 1 bikle611  staff  574666 Apr 24 14:42 /Users/bikle611/Downloads/scons-2.1.0.tar.gz
Tue Apr 24 14:43 /dan/scons bikle611$ 
Tue Apr 24 14:43 /dan/scons bikle611$ 
Tue Apr 24 14:43 /dan/scons bikle611$ mv ~/Downloads/scons-2.1.0.tar.gz .
Tue Apr 24 14:43 /dan/scons bikle611$ 
Tue Apr 24 14:43 /dan/scons bikle611$ 
Tue Apr 24 14:43 /dan/scons bikle611$ tar zxf scons-2.1.0.tar.gz 
Tue Apr 24 14:43 /dan/scons bikle611$ 
Tue Apr 24 14:43 /dan/scons bikle611$ ll
total 1128
drwxr-xr-x   4 bikle611  admin     136 Apr 24 14:43 ./
drwxr-xr-x   5 bikle611  admin     170 Apr 24 14:40 ../
drwxr-xr-x@ 16 bikle611  admin     544 Sep  9  2011 scons-2.1.0/
-rw-r--r--@  1 bikle611  staff  574666 Apr 24 14:42 scons-2.1.0.tar.gz
Tue Apr 24 14:44 /dan/scons bikle611$ 
Tue Apr 24 14:44 /dan/scons bikle611$ cd scons-2.1.0
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ ll
total 1328
drwxr-xr-x@ 16 bikle611  admin     544 Sep  9  2011 ./
drwxr-xr-x   4 bikle611  admin     136 Apr 24 14:43 ../
-rw-r--r--@  1 bikle611  admin  188146 Sep  9  2011 CHANGES.txt
-rw-r--r--@  1 bikle611  admin    1124 Sep  9  2011 LICENSE.txt
-rw-r--r--@  1 bikle611  admin    5568 Sep  9  2011 MANIFEST
-rw-r--r--@  1 bikle611  admin     442 Sep  9  2011 PKG-INFO
-rw-r--r--@  1 bikle611  admin    8156 Sep  9  2011 README.txt
-rw-r--r--@  1 bikle611  admin    3640 Sep  9  2011 RELEASE.txt
drwxr-xr-x@  3 bikle611  admin     102 Sep  9  2011 engine/
-rw-r--r--@  1 bikle611  admin    2445 Sep  9  2011 os_spawnv_fix.diff
-rw-r--r--@  1 bikle611  admin   24781 Sep  9  2011 scons-time.1
-rw-r--r--@  1 bikle611  admin  399963 Sep  9  2011 scons.1
-rw-r--r--@  1 bikle611  admin    4724 Sep  9  2011 sconsign.1
drwxr-xr-x@  6 bikle611  admin     204 Sep  9  2011 script/
-rw-r--r--@  1 bikle611  admin     100 Sep  9  2011 setup.cfg
-rw-r--r--@  1 bikle611  admin   15758 Sep  9  2011 setup.py
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 


Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:44 /dan/scons/scons-2.1.0 bikle611$ python setup.py install --prefix=/dan/scons
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/SCons
copying engine/SCons/__init__.py -> build/lib/SCons

snip ...

byte-compiling /dan/scons/lib/scons-2.1.0/SCons/Warnings.py to Warnings.pyc
running install_scripts
creating /dan/scons/bin
copying script/scons -> /dan/scons/bin/scons-2.1.0
copying script/scons -> /dan/scons/bin
copying script/sconsign -> /dan/scons/bin/sconsign-2.1.0
copying script/sconsign -> /dan/scons/bin
copying script/scons-time -> /dan/scons/bin/scons-time-2.1.0
copying script/scons-time -> /dan/scons/bin
running install_data
creating /dan/scons/man
creating /dan/scons/man/man1
copying scons.1 -> /dan/scons/man/man1
copying sconsign.1 -> /dan/scons/man/man1
copying scons-time.1 -> /dan/scons/man/man1
running install_egg_info
Writing /dan/scons/lib/scons-2.1.0/scons-2.1.0-py2.6.egg-info
Installed SCons library modules into /dan/scons/lib/scons-2.1.0
Installed SCons scripts into /dan/scons/bin
Installed SCons man pages into /dan/scons/man/man1
Tue Apr 24 14:48 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:48 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:48 /dan/scons/scons-2.1.0 bikle611$ 


I removed old copies of scons related scripts:

Tue Apr 24 14:48 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:48 /dan/scons/scons-2.1.0 bikle611$ ll /pt/p/bin/scons*
-rwxr-xr-x  1 maco  staff   5889 Dec 20  2008 /pt/p/bin/scons*
-rwxr-xr-x  1 maco  staff   5889 Dec 20  2008 /pt/p/bin/scons-1.2.0*
-rwxr-xr-x  1 maco  staff  48685 Dec 20  2008 /pt/p/bin/scons-time*
-rwxr-xr-x  1 maco  staff  48685 Dec 20  2008 /pt/p/bin/scons-time-1.2.0*
-rwxr-xr-x  1 maco  staff  16572 Dec 20  2008 /pt/p/bin/sconsign*
-rwxr-xr-x  1 maco  staff  16572 Dec 20  2008 /pt/p/bin/sconsign-1.2.0*
Tue Apr 24 14:51 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:51 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:51 /dan/scons/scons-2.1.0 bikle611$ rm -f /pt/p/bin/scons*
rm: /pt/p/bin/scons: Permission denied
rm: /pt/p/bin/scons-1.2.0: Permission denied
rm: /pt/p/bin/scons-time: Permission denied
rm: /pt/p/bin/scons-time-1.2.0: Permission denied
rm: /pt/p/bin/sconsign: Permission denied
rm: /pt/p/bin/sconsign-1.2.0: Permission denied
Tue Apr 24 14:51 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ sudo rm -f /pt/p/bin/scons*
Password:
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ 


I added the new scons to my PATH:
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:52 /dan/scons/scons-2.1.0 bikle611$ export PATH=/dan/scons/bin:${PATH}
Tue Apr 24 14:54 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:54 /dan/scons/scons-2.1.0 bikle611$ which scons
/dan/scons/bin/scons
Tue Apr 24 14:55 /dan/scons/scons-2.1.0 bikle611$ 
Tue Apr 24 14:55 /dan/scons/scons-2.1.0 bikle611$ 


I tried scons again to install MongoDB:
Tue Apr 24 14:56 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:56 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
Tue Apr 24 14:57 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 14:57 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


Darn!
Okay, I looked for boost via google.
Google sent me to this site:
http://boost.org
I downloaded it:
Tue Apr 24 15:13 /dan/mongo bikle611$ wget http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz/download
--2012-04-24 15:13:51--  http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.gz/download
Resolving sourceforge.net... 216.34.181.60
Connecting to sourceforge.net|216.34.181.60|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.gz?r=&ts=1335305628&use_mirror=softlayer [following]
--2012-04-24 15:13:52--  http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.gz?r=&ts=1335305628&use_mirror=softlayer
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://softlayer.dl.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.gz [following]
--2012-04-24 15:13:54--  http://softlayer.dl.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.gz
Resolving softlayer.dl.sourceforge.net... 74.86.229.28
Connecting to softlayer.dl.sourceforge.net|74.86.229.28|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 59136116 (56M) [application/x-gzip]
Saving to: `boost_1_49_0.tar.gz'

100%[======================================>] 59,136,116   163K/s   in 9m 58s  

2012-04-24 15:23:53 (96.6 KB/s) - `boost_1_49_0.tar.gz' saved [59136116/59136116]

Tue Apr 24 15:23 /dan/mongo bikle611$ 
Tue Apr 24 15:25 /dan/mongo bikle611$ 
Tue Apr 24 15:25 /dan/mongo bikle611$ 
Tue Apr 24 15:25 /dan/mongo bikle611$ 


That was a 59M download, kind of large for uncompiled software.
I looked at it:
Tue Apr 24 15:30 /dan/mongo bikle611$ 
Tue Apr 24 15:30 /dan/mongo bikle611$ 
Tue Apr 24 15:30 /dan/mongo bikle611$ tar zxf boost_1_49_0.tar.gz 
Tue Apr 24 15:31 /dan/mongo bikle611$ ll
total 121304
drwxr-xr-x   6 bikle611  admin       204 Apr 24 15:31 ./
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
drwxr-xr-x  20 bikle611  admin       680 Feb 22 15:06 boost_1_49_0/
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
drwxr-xr-x  39 bikle611  admin      1326 Apr 24 14:25 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Tue Apr 24 15:32 /dan/mongo bikle611$ 
Tue Apr 24 15:32 /dan/mongo bikle611$ cd boost_1_49_0
Tue Apr 24 15:32 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:32 /dan/mongo/boost_1_49_0 bikle611$ ll
total 176
drwxr-xr-x   20 bikle611  admin    680 Feb 22 15:06 ./
drwxr-xr-x    6 bikle611  admin    204 Apr 24 15:31 ../
-rw-r--r--    1 bikle611  admin    291 Jan 30 18:30 INSTALL
-rw-r--r--    1 bikle611  admin  10160 Jan 29 13:58 Jamroot
-rw-r--r--    1 bikle611  admin   1338 Jan 30 18:30 LICENSE_1_0.txt
drwxr-xr-x  208 bikle611  admin   7072 Feb 22 15:07 boost/
-rw-r--r--    1 bikle611  admin    849 Jan 30 18:30 boost-build.jam
-rw-r--r--    1 bikle611  admin    989 Jan 30 18:30 boost.css
-rw-r--r--    1 bikle611  admin   6308 Jan 30 18:30 boost.png
-rw-r--r--    1 bikle611  admin  18031 Jan 30 18:30 boostcpp.jam
-rw-r--r--    1 bikle611  admin   2545 Jan 30 18:30 bootstrap.bat
-rwxr-xr-x    1 bikle611  admin  10324 Jan 30 18:30 bootstrap.sh*
drwxr-xr-x    8 bikle611  admin    272 Feb 22 15:05 doc/
-rw-r--r--    1 bikle611  admin    769 Jan 30 18:30 index.htm
-rw-r--r--    1 bikle611  admin   5437 Jan 29 13:58 index.html
drwxr-xr-x  101 bikle611  admin   3434 Feb 22 15:06 libs/
drwxr-xr-x    8 bikle611  admin    272 Feb 22 15:10 more/
-rw-r--r--    1 bikle611  admin   2608 Jan 30 18:30 rst.css
drwxr-xr-x    6 bikle611  admin    204 Feb 22 15:06 status/
drwxr-xr-x   15 bikle611  admin    510 Feb 22 15:10 tools/
Tue Apr 24 15:32 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:32 /dan/mongo/boost_1_49_0 bikle611$ 


I added BOOST_ROOT to my environment:
export BOOST_ROOT=/dan/mongo/boost_1_49_0
Next, I looked for the file which Mongo wanted:
Tue Apr 24 15:41 /dan/mongo bikle611$ 
Tue Apr 24 15:41 /dan/mongo bikle611$ find . -name operations.hpp -print
./boost_1_49_0/boost/filesystem/operations.hpp
./boost_1_49_0/boost/filesystem/v2/operations.hpp
./boost_1_49_0/boost/filesystem/v3/operations.hpp
./boost_1_49_0/boost/iostreams/operations.hpp
./boost_1_49_0/boost/mpi/operations.hpp
./boost_1_49_0/boost/numeric/ublas/operations.hpp
Tue Apr 24 15:42 /dan/mongo bikle611$ 
Tue Apr 24 15:42 /dan/mongo bikle611$ 
Tue Apr 24 15:42 /dan/mongo bikle611$ 


Then, the boost documentation suggested that I write and then compile a simple C++ file:
Tue Apr 24 15:46 /dan/mongo bikle611$ 
Tue Apr 24 15:46 /dan/mongo bikle611$ cat example.cpp 
#include <boost/lambda/lambda.hpp>
#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
Tue Apr 24 15:47 /dan/mongo bikle611$ 
Tue Apr 24 15:47 /dan/mongo bikle611$ 
Tue Apr 24 15:47 /dan/mongo bikle611$ 


Tue Apr 24 15:47 /dan/mongo bikle611$ 
Tue Apr 24 15:47 /dan/mongo bikle611$ which c++
/Developer/usr/bin/c++
Tue Apr 24 15:48 /dan/mongo bikle611$ 
Tue Apr 24 15:48 /dan/mongo bikle611$ 
Tue Apr 24 15:49 /dan/mongo bikle611$ c++ -I /dan/mongo/boost_1_49_0 example.cpp -o example
Tue Apr 24 15:49 /dan/mongo bikle611$ 
Tue Apr 24 15:49 /dan/mongo bikle611$ 


Then, I ran it:
Tue Apr 24 15:49 /dan/mongo bikle611$ 
Tue Apr 24 15:50 /dan/mongo bikle611$ 
Tue Apr 24 15:50 /dan/mongo bikle611$ echo 1 2 3 | ./example
3 6 9 Tue Apr 24 15:50 /dan/mongo bikle611$ 
Tue Apr 24 15:50 /dan/mongo bikle611$ 
Tue Apr 24 15:50 /dan/mongo bikle611$ 


Then I followed more instructions from the documentation:
Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --help
`./bootstrap.sh' prepares Boost for building on a few kinds of systems.

Usage: ./bootstrap.sh [OPTION]... 

Defaults for the options are specified in brackets.

Configuration:
  -h, --help                display this help and exit
  --with-bjam=BJAM          use existing Boost.Jam executable (bjam)
                            [automatically built]
  --with-toolset=TOOLSET    use specific Boost.Build toolset
                            [automatically detected]
  --show-libraries          show the set of libraries that require build
                            and installation steps (i.e., those libraries
                            that can be used with --with-libraries or
                            --without-libraries), then exit
  --with-libraries=list     build only a particular set of libraries,
                            describing using either a comma-separated list of
                            library names or "all"
                            [all]
  --without-libraries=list  build all libraries except the ones listed []
  --with-icu                enable Unicode/ICU support in Regex 
                            [automatically detected]
  --without-icu             disable Unicode/ICU support in Regex
  --with-icu=DIR            specify the root of the ICU library installation
                            and enable Unicode/ICU support in Regex
                            [automatically detected]
  --with-python=PYTHON      specify the Python executable [python]
  --with-python-root=DIR    specify the root of the Python installation
                            [automatically detected]
  --with-python-version=X.Y specify the Python version as X.Y
                            [automatically detected]

Installation directories:
  --prefix=PREFIX           install Boost into the given PREFIX
                            [/usr/local]
  --exec-prefix=EPREFIX     install Boost binaries into the given EPREFIX
                            [PREFIX]

More precise control over installation directories:
  --libdir=DIR              install libraries here [EPREFIX/lib]
  --includedir=DIR          install headers here [PREFIX/include]

Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ 


The option '--with-libraries=list' interested me.
I asked bootstrap.sh for a list of libraries:
Tue Apr 24 15:53 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:55 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --show-libraries
-n Building Boost.Build engine with toolset darwin... 
tools/build/v2/engine/bin.macosxx86/b2

The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by including
the headers only.

The Boost libraries requiring separate building and installation are:
    - chrono
    - date_time
    - exception
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - timer
    - wave
Tue Apr 24 15:56 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:56 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 15:56 /dan/mongo/boost_1_49_0 bikle611$  


MongoDB wants the filesystem library so I fed 'filesystem' to bootstrap.sh:
Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --with-libraries=filesystem --prefix=/dan/mongo
-n Building Boost.Build engine with toolset darwin... 
tools/build/v2/engine/bin.macosxx86/b2
-n Unicode/ICU support for Boost.Regex?... 
not found.
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/boost-build2/doc/html/index.html

Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:04 /dan/mongo/boost_1_49_0 bikle611$ 



Tue Apr 24 16:07 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:07 /dan/mongo/boost_1_49_0 bikle611$ ll b2*
-rwxr-xr-x  1 bikle611  admin  173148 Apr 24 16:04 b2*
Tue Apr 24 16:07 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:07 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:07 /dan/mongo/boost_1_49_0 bikle611$ ./b2 install

Component configuration:

    - chrono                   : not building
    - date_time                : not building
    - exception                : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : not building
    - locale                   : not building
    - math                     : not building
    - mpi                      : not building
    - program_options          : not building
    - python                   : not building
    - random                   : not building

snip ...


darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/operations.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/path.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/portability.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/windows_file_codecvt.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/codecvt_error_category.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/path_traits.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/unique_path.o
darwin.compile.c++ bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/v3/src/utf8_codecvt_facet.o
darwin.link.dll bin.v2/libs/filesystem/build/darwin-4.0.1/release/threading-multi/libboost_filesystem.dylib
common.copy /dan/mongo/lib/libboost_filesystem.dylib
...updated 9814 targets...
Tue Apr 24 16:13 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:13 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:13 /dan/mongo/boost_1_49_0 bikle611$  


I looked for any new directories in /dan/mongo/
Tue Apr 24 16:13 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:13 /dan/mongo/boost_1_49_0 bikle611$ 
Tue Apr 24 16:16 /dan/mongo/boost_1_49_0 bikle611$ cd /dan/mongo/
Tue Apr 24 16:16 /dan/mongo bikle611$ 
Tue Apr 24 16:16 /dan/mongo bikle611$ ls -latr
total 121384
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
drwxr-xr-x  39 bikle611  admin      1326 Apr 24 14:25 mongodb-src-r2.0.4/
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
-rw-r--r--   1 bikle611  admin       270 Apr 24 15:46 example.cpp
-rwxr-xr-x   1 bikle611  admin     34364 Apr 24 15:49 example*
drwxr-xr-x  25 bikle611  admin       850 Apr 24 16:07 boost_1_49_0/
drwxr-xr-x   3 bikle611  admin       102 Apr 24 16:10 include/
drwxr-xr-x  10 bikle611  admin       340 Apr 24 16:13 ./
drwxr-xr-x   6 bikle611  admin       204 Apr 24 16:13 lib/
Tue Apr 24 16:16 /dan/mongo bikle611$ 
Tue Apr 24 16:16 /dan/mongo bikle611$ 
Tue Apr 24 16:16 /dan/mongo bikle611$ 


Tue Apr 24 16:16 /dan/mongo bikle611$ 
Tue Apr 24 16:16 /dan/mongo bikle611$ ll include lib
include:
total 0
drwxr-xr-x    3 bikle611  admin   102 Apr 24 16:10 ./
drwxr-xr-x   10 bikle611  admin   340 Apr 24 16:13 ../
drwxr-xr-x  208 bikle611  admin  7072 Apr 24 16:13 boost/

lib:
total 3368
drwxr-xr-x   6 bikle611  admin      204 Apr 24 16:13 ./
drwxr-xr-x  10 bikle611  admin      340 Apr 24 16:13 ../
-rw-r--r--   1 bikle611  admin  1413292 Apr 24 16:13 libboost_filesystem.a
-rwxr-xr-x   1 bikle611  admin   193704 Apr 24 16:13 libboost_filesystem.dylib*
-rw-r--r--   1 bikle611  admin    74304 Apr 24 16:13 libboost_system.a
-rwxr-xr-x   1 bikle611  admin    29884 Apr 24 16:13 libboost_system.dylib*
Tue Apr 24 16:17 /dan/mongo bikle611$ 
Tue Apr 24 16:17 /dan/mongo bikle611$ 


Next, I tried scons again to install MongoDB.
Tue Apr 24 16:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 16:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
Tue Apr 24 16:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Tue Apr 24 16:20 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


Darn, scons does not see my new install of boost libraries.
How do I tell scons that my boost libraries are here:
/dan/mongo/boost_1_49_0/
??
I asked Google.
Google sent me here:
http://forums.wesnoth.org/viewtopic.php?f=5&t=24343
I tried this:
Thu Apr 26 15:48 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 15:48 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 15:48 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons boostdir=/dan/mongo/include boostlibdir=/dan/mongo/lib .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... no
can't find boost headers
Thu Apr 26 15:51 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 15:51 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 15:51 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


I searched more of the web and learned that scons is partially controlled by a file named: SConstruct.

I looked at it and found it somewhat readable; it appears to be written in Python. This is sweet; I prefer that Domain Specific Languages be based on an interpreted language like Python, Ruby, or Perl. I dislike technologies which rely on configuation files written in a syntax which is used rarely. Examples of these technologies are Apache, Squid, Sendmail, and Make.

Anyway I looked at this file:
/dan/mongo/mongodb-src-r2.0.4/SConstruct
I found this syntax on line 151:
add_option( "extrapathdyn", "comma separated list of add'l paths  (--extrapath /opt/foo/,/foo) dynamic linking" , 1 , True )


So, I tried this:
Thu Apr 26 16:24 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 16:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 16:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons --prefix=/dan/mongo --extrapathdyn /dan/mongo .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... yes
Checking for C library boost_system-mt... no
Checking for C library boost_system... yes
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... no
can't find or link against library ['boost_thread-mt', 'boost_thread'] in ['/dan/mongo/lib', '/dan/mongo/lib64', '/opt/local/lib']
see config.log for more information
Thu Apr 26 16:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 16:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 16:35 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


I appear to be making progress!
I returned my attention on my install of boost. I asked it if it had any libraries which look like ['boost_thread-mt', 'boost_thread'].
Thu Apr 26 16:39 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:39 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --show-libraries
-n Building Boost.Build engine with toolset darwin... 
tools/build/v2/engine/bin.macosxx86/b2

The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by including
the headers only.

The Boost libraries requiring separate building and installation are:
    - filesystem
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ 


This made me unhappy.
I already have the 'filesystem' library.
I tossed my installation of boost in the trash and started the installation again:
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:40 /dan/mongo/boost_1_49_0 bikle611$ cd /dan/mongo
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ ls -la
total 121384
drwxr-xr-x  10 bikle611  admin       340 Apr 24 16:13 ./
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
drwxr-xr-x  25 bikle611  admin       850 Apr 24 16:07 boost_1_49_0/
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
-rwxr-xr-x   1 bikle611  admin     34364 Apr 24 15:49 example*
-rw-r--r--   1 bikle611  admin       270 Apr 24 15:46 example.cpp
drwxr-xr-x   3 bikle611  admin       102 Apr 24 16:10 include/
drwxr-xr-x   6 bikle611  admin       204 Apr 24 16:13 lib/
drwxr-xr-x  39 bikle611  admin      1326 Apr 26 16:34 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ mkdir junk
Thu Apr 26 16:43 /dan/mongo bikle611$ 
Thu Apr 26 16:43 /dan/mongo bikle611$ mv boost_1_49_0/ include/ lib/ junk/
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ tar zxf boost_1_49_0.tar.gz 
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ ls -la
total 121384
drwxr-xr-x   9 bikle611  admin       306 Apr 26 16:44 ./
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
drwxr-xr-x  20 bikle611  admin       680 Feb 22 15:06 boost_1_49_0/
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
-rwxr-xr-x   1 bikle611  admin     34364 Apr 24 15:49 example*
-rw-r--r--   1 bikle611  admin       270 Apr 24 15:46 example.cpp
drwxr-xr-x   5 bikle611  admin       170 Apr 26 16:44 junk/
drwxr-xr-x  39 bikle611  admin      1326 Apr 26 16:34 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ 




Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ 
Thu Apr 26 16:44 /dan/mongo bikle611$ cd boost_1_49_0
Thu Apr 26 16:46 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:48 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:48 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --show-libraries
-n Building Boost.Build engine with toolset darwin... 
tools/build/v2/engine/bin.macosxx86/b2

The following Boost libraries have portions that require a separate build
and installation step. Any library not listed here can be used by including
the headers only.

The Boost libraries requiring separate building and installation are:
    - chrono
    - date_time
    - exception
    - filesystem
    - graph
    - graph_parallel
    - iostreams
    - locale
    - math
    - mpi
    - program_options
    - python
    - random
    - regex
    - serialization
    - signals
    - system
    - test
    - thread
    - timer
    - wave
Thu Apr 26 16:49 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:49 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:49 /dan/mongo/boost_1_49_0 bikle611$ 


I googled: "mongodb boost bootstrap.sh filesystem thread"
One interesting hit:
http://www.mongodb.org/display/DOCS/Building+Boost
Also I searched for "filesystem" and "thread" in /dan/mongo/mongodb-src-r2.0.4/SConstruct
On line 214 I found this syntax:
boostLibs = [ "thread" , "filesystem" , "program_options" ]


I did this:
Thu Apr 26 16:49 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 16:49 /dan/mongo/boost_1_49_0 bikle611$ ./bootstrap.sh --with-libraries=date_time,filesystem,program_options,thread --prefix=/dan/mongo
-n Building Boost.Build engine with toolset darwin... 
tools/build/v2/engine/bin.macosxx86/b2
-n Unicode/ICU support for Boost.Regex?... 
not found.
Generating Boost.Build configuration in project-config.jam...

Bootstrapping is done. To build, run:

    ./b2
    
To adjust configuration, edit 'project-config.jam'.
Further information:

   - Command line help:
     ./b2 --help
     
   - Getting started guide: 
     http://www.boost.org/more/getting_started/unix-variants.html
     
   - Boost.Build documentation:
     http://www.boost.org/boost-build2/doc/html/index.html

Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 


The above output told me the next step was to run this shell command:
./b2


But the boost documentation told me to run this shell command:
./b2 install
So, I did this:
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 17:03 /dan/mongo/boost_1_49_0 bikle611$ ./b2 install

Component configuration:

    - chrono                   : not building
    - date_time                : building
    - exception                : not building
    - filesystem               : building
    - graph                    : not building
    - graph_parallel           : not building
    - iostreams                : not building
    - locale                   : not building
    - math                     : not building
    - mpi                      : not building
    - program_options          : building
    - python                   : not building
    - random                   : not building
    - regex                    : not building
    - serialization            : not building
    - signals                  : not building
    - system                   : not building
    - test                     : not building
    - thread                   : building
    - timer                    : not building
    - wave                     : not building

...patience...
...found 19840 targets...
...updating 9886 targets...
common.mkdir /dan/mongo/lib
common.mkdir bin.v2
common.mkdir bin.v2/libs
common.mkdir bin.v2/libs/program_options
common.mkdir bin.v2/libs/program_options/build
common.mkdir bin.v2/libs/program_options/build/darwin-4.0.1
common.mkdir bin.v2/libs/program_options/build/darwin-4.0.1/release
common.mkdir bin.v2/libs/program_options/build/darwin-4.0.1/release/threading-multi
darwin.compile.c++ bin.v2/libs/program_options/build/darwin-4.0.1/release/threading-multi/cmdline.o
darwin.compile.c++ bin.v2/libs/program_options/build/darwin-4.0.1/release/threading-multi/config_file.o
darwin.compile.c++ bin.v2/libs/program_options/build/darwin-4.0.1/release/threading-multi/options_description.o
darwin.compile.c++ bin.v2/libs/program_options/build/darwin-4.0.1/release/threading-multi/parsers.o

snip about 10,000 lines ...

common.mkdir bin.v2/libs/thread/build/darwin-4.0.1/release/link-static
common.mkdir bin.v2/libs/thread/build/darwin-4.0.1/release/link-static/threading-multi
common.mkdir bin.v2/libs/thread/build/darwin-4.0.1/release/link-static/threading-multi/pthread
darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.0.1/release/link-static/threading-multi/pthread/thread.o
./boost/thread/detail/thread.hpp:316: warning: type attributes are honored only at type definition
darwin.compile.c++ bin.v2/libs/thread/build/darwin-4.0.1/release/link-static/threading-multi/pthread/once.o
darwin.archive bin.v2/libs/thread/build/darwin-4.0.1/release/link-static/threading-multi/libboost_thread.a
common.copy /dan/mongo/lib/libboost_thread.a
...updated 9886 targets...
Thu Apr 26 17:15 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 18:13 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 18:13 /dan/mongo/boost_1_49_0 bikle611$ 


Next, I did this:
Thu Apr 26 17:15 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 18:13 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 18:13 /dan/mongo/boost_1_49_0 bikle611$ 
Thu Apr 26 18:18 /dan/mongo/boost_1_49_0 bikle611$ cd ..
Thu Apr 26 18:18 /dan/mongo bikle611$ 
Thu Apr 26 18:18 /dan/mongo bikle611$ ll
total 121384
drwxr-xr-x  11 bikle611  admin       374 Apr 26 17:11 ./
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
drwxr-xr-x  25 bikle611  admin       850 Apr 26 17:07 boost_1_49_0/
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
-rwxr-xr-x   1 bikle611  admin     34364 Apr 24 15:49 example*
-rw-r--r--   1 bikle611  admin       270 Apr 24 15:46 example.cpp
drwxr-xr-x   3 bikle611  admin       102 Apr 26 17:11 include/
drwxr-xr-x   5 bikle611  admin       170 Apr 26 16:44 junk/
drwxr-xr-x  12 bikle611  admin       408 Apr 26 17:15 lib/
drwxr-xr-x  39 bikle611  admin      1326 Apr 26 16:57 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Thu Apr 26 18:18 /dan/mongo bikle611$ 
Thu Apr 26 18:19 /dan/mongo bikle611$ 
Thu Apr 26 18:19 /dan/mongo bikle611$ 
Thu Apr 26 18:19 /dan/mongo bikle611$ cd mongodb-src-r2.0.4
Thu Apr 26 18:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:19 /dan/mongo/mongodb-src-r2.0.4 bikle611$ scons --prefix=/dan/mongo --extrapathdyn /dan/mongo .
scons: Reading SConscript files ...
scons version: 2.1.0
python version: 2 6 2 'final' 0
Checking whether the C++ compiler worksyes
Checking for C library stdc++... yes
Checking for C++ header file boost/filesystem/operations.hpp... yes
Checking for C library boost_system-mt... no
Checking for C library boost_system... yes
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... yes
Checking for C library boost_filesystem-mt... no
Checking for C library boost_filesystem... yes
Checking for C library boost_program_options-mt... no
Checking for C library boost_program_options... yes
Checking for C++ header file execinfo.h... yes
Checking for C library pcap... yes
Checking whether the C++ compiler worksyes
Checking for C++ header file boost/filesystem/operations.hpp... yes
Checking for C library boost_system-mt... no
Checking for C library boost_system... yes
Checking for C library boost_thread-mt... no
Checking for C library boost_thread... yes
Checking for C library boost_filesystem-mt... no
Checking for C library boost_filesystem... yes
Checking for C library boost_program_options-mt... no
Checking for C library boost_program_options... yes
Checking for C++ header file execinfo.h... yes
Checking for C library pcap... yes
scons: done reading SConscript files.
scons: Building targets ...
g++ -o pch.o -c -Wnon-virtual-dtor -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare snip...
/dan/mongo/include/boost/thread/detail/thread.hpp:316: warning: type attributes are honored only at type definition


snip ...

g++ -o rsExample -fPIC -pthread -rdynamic client/examples/rs.o -L. -L/dan/mongo/lib -L/dan/mongo/lib64 snip...
g++ -o secondExample -fPIC -pthread -rdynamic client/examples/second.o -L. -L/dan/mongo/lib -L/dan/mongo/lib64 snip...
g++ -o test -fPIC -pthread -rdynamic dbtests/background_job_test.o dbtests/balancer_policy_tests.o snip...
g++ -o whereExample -fPIC -pthread -rdynamic client/examples/whereExample.o -L. -L/dan/mongo/lib snip...
scons: done building targets.
Thu Apr 26 18:53 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:53 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:53 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:53 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 18:53 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 


Next, I looked at this URL:
http://www.mongodb.org/display/DOCS/Tutorial
It described an executable file named "mongo" under a bin directory.
I looked for it and found it where I expected it to be relative to /dan/mongo/ which was the prefix directory I specified when I built MongoDB:
Thu Apr 26 21:26 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 21:26 /dan/mongo/mongodb-src-r2.0.4 bikle611$ 
Thu Apr 26 21:26 /dan/mongo/mongodb-src-r2.0.4 bikle611$ cd /dan/mongo/
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ ll
total 121384
drwxr-xr-x  12 bikle611  admin       408 Apr 26 18:38 ./
drwxr-xr-x   5 bikle611  admin       170 Apr 24 14:40 ../
drwxr-xr-x  14 bikle611  admin       476 Apr 26 18:44 bin/
drwxr-xr-x  25 bikle611  admin       850 Apr 26 17:07 boost_1_49_0/
-rw-r--r--   1 bikle611  admin  59136116 Feb 24 03:57 boost_1_49_0.tar.gz
-rwxr-xr-x   1 bikle611  admin     34364 Apr 24 15:49 example*
-rw-r--r--   1 bikle611  admin       270 Apr 24 15:46 example.cpp
drwxr-xr-x   3 bikle611  admin       102 Apr 26 17:11 include/
drwxr-xr-x   5 bikle611  admin       170 Apr 26 16:44 junk/
drwxr-xr-x  12 bikle611  admin       408 Apr 26 17:15 lib/
drwxr-xr-x  67 bikle611  admin      2278 Apr 26 18:53 mongodb-src-r2.0.4/
-rw-r--r--   1 bikle611  admin   2966431 Mar 19 20:44 mongodb-src-r2.0.4.tar.gz
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ ll bin/mongo
-rwxr-xr-x  1 bikle611  admin  3363632 Apr 26 18:39 bin/mongo*
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$  


I tried running it:
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ 
Thu Apr 26 21:34 /dan/mongo bikle611$ bin/mongo
dyld: Library not loaded: libboost_system.dylib
  Referenced from: /dan/mongo/bin/mongo
  Reason: image not found
Trace/BPT trap
Thu Apr 26 21:37 /dan/mongo bikle611$ 
Thu Apr 26 21:37 /dan/mongo bikle611$ 
Thu Apr 26 21:37 /dan/mongo bikle611$ 


Thu Apr 26 21:39 /dan/mongo bikle611$ 
Thu Apr 26 21:39 /dan/mongo bikle611$ find . -type f -print | grep libboost_system
./boost_1_49_0/bin.v2/libs/system/build/darwin-4.0.1/release/link-static/threading-multi/libboost_system.a
./boost_1_49_0/bin.v2/libs/system/build/darwin-4.0.1/release/threading-multi/libboost_system.dylib
./lib/libboost_system.a
./lib/libboost_system.dylib
Thu Apr 26 21:39 /dan/mongo bikle611$ 
Thu Apr 26 21:40 /dan/mongo bikle611$ 
Thu Apr 26 21:40 /dan/mongo bikle611$ 


Darn. bin/mongo cannot find a dynamic/shared library. I tried using LD_LIBRARY_PATH which I've used in the past to signal to the OS that it can find shared libraries in directories I specify:
Thu Apr 26 21:40 /dan/mongo bikle611$ 
Thu Apr 26 21:40 /dan/mongo bikle611$ export LD_LIBRARY_PATH=/dan/mongo/lib
Thu Apr 26 21:41 /dan/mongo bikle611$ 
Thu Apr 26 21:41 /dan/mongo bikle611$ bin/mongo
dyld: Library not loaded: libboost_system.dylib
  Referenced from: /dan/mongo/bin/mongo
  Reason: image not found
Trace/BPT trap
Thu Apr 26 21:41 /dan/mongo bikle611$ 
Thu Apr 26 21:41 /dan/mongo bikle611$ 
Thu Apr 26 21:41 /dan/mongo bikle611$ 


I looked at the dylib files which the find-command had found:
Thu Apr 26 21:41 /dan/mongo bikle611$ 
Thu Apr 26 21:41 /dan/mongo bikle611$ find . -type f -name libboost_system.dylib |xargs ls -la
-rwxr-xr-x  1 bikle611  admin  29884 Apr 26 17:11 ./boost_1_49_0/bin.v2/libs/system/build/darwin-4.0.1/release/threading-multi/libboost_system.dylib
-rwxr-xr-x  1 bikle611  admin  29884 Apr 26 17:11 ./lib/libboost_system.dylib
Thu Apr 26 21:44 /dan/mongo bikle611$ 
Thu Apr 26 21:44 /dan/mongo bikle611$ 


Okay so I see that they are in my filesystem and they don't look very strange.
I did some google searches and found an interesting document:
http://qin.laya.com/tech_coding_help/dylib_linking.html
I tried "otool":
Thu Apr 26 21:46 /dan/mongo bikle611$ 
Thu Apr 26 21:46 /dan/mongo bikle611$ 
Thu Apr 26 21:46 /dan/mongo bikle611$ otool -L bin/mongo
bin/mongo:
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
	libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
	libboost_thread.dylib (compatibility version 0.0.0, current version 0.0.0)
	libboost_filesystem.dylib (compatibility version 0.0.0, current version 0.0.0)
	libboost_program_options.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.7)
Thu Apr 26 21:59 /dan/mongo bikle611$ 
Thu Apr 26 21:59 /dan/mongo bikle611$ 
Thu Apr 26 21:59 /dan/mongo bikle611$ 
Thu Apr 26 21:59 /dan/mongo bikle611$ 


One worrisome aspect of the above output is that the libboost-lines display version strings which contain only zeros.

Anyway, according to the above document, and the above otool output, it seems plausible that bin/mongo is looking for the libboost_*.dylib files in the bin/ directory.

So, as an experiment, I copied the libboost_*.dylib files into the bin/ directory:
Thu Apr 26 21:59 /dan/mongo bikle611$ 
Thu Apr 26 21:59 /dan/mongo bikle611$ ls -la lib/libboost_*dylib
-rwxr-xr-x  1 bikle611  admin   92692 Apr 26 17:11 lib/libboost_date_time.dylib*
-rwxr-xr-x  1 bikle611  admin  193704 Apr 26 17:11 lib/libboost_filesystem.dylib*
-rwxr-xr-x  1 bikle611  admin  462868 Apr 26 17:11 lib/libboost_program_options.dylib*
-rwxr-xr-x  1 bikle611  admin   29884 Apr 26 17:11 lib/libboost_system.dylib*
-rwxr-xr-x  1 bikle611  admin  150908 Apr 26 17:11 lib/libboost_thread.dylib*
Thu Apr 26 22:06 /dan/mongo bikle611$ 
Thu Apr 26 22:06 /dan/mongo bikle611$ 
Thu Apr 26 22:06 /dan/mongo bikle611$ cp -p lib/libboost_*dylib  bin/
Thu Apr 26 22:07 /dan/mongo bikle611$ 
Thu Apr 26 22:07 /dan/mongo bikle611$ 
Thu Apr 26 22:07 /dan/mongo bikle611$ 


Then, I tried bin/mongo again:
Thu Apr 26 22:07 /dan/mongo bikle611$ 
Thu Apr 26 22:07 /dan/mongo bikle611$ 
Thu Apr 26 22:07 /dan/mongo bikle611$ bin/mongo
dyld: Library not loaded: libboost_system.dylib
  Referenced from: /dan/mongo/bin/mongo
  Reason: image not found
Trace/BPT trap
Thu Apr 26 22:09 /dan/mongo bikle611$ 
Thu Apr 26 22:09 /dan/mongo bikle611$ 
Thu Apr 26 22:09 /dan/mongo bikle611$ 

At this point I felt that installing MongoDB from source on my Mac was too much effort. I was ready to knuckle under and use Homebrew.

http://www.google.com/search?q=homebrew+site:MongoDB.org
http://mxcl.github.com/homebrew

2012-04-22 Struggles with Active Scaffold and Rails 3.2.3

I used Active Scaffold on a Rails 1.2.x project back during the summer of 2007. I liked it. So, now almost 5 years later, I need an administrative UI for an App I'm working on. I went to http://ActiveScaffold.com to see what's up.

I discovered the site was down. I looked for them on http://github.com and found them here: http://github.com/activescaffold/active_scaffold The latest activity was 6 days ago which is a good sign. I checked the Issues link for recent chatter: http://github.com/activescaffold/active_scaffold/issues

They have only 16 open issues which seems okay. Issue 157 complains about the site being down and that issue is 5 days old. I followed the instructions in the Github Readme to install ActiveScaffold. I bumped into an issue when I tried to compile my assets:

/home/oracle/.rvm/rubies/ruby-1.9.2-p318/bin/ruby 
  bin/rake assets:precompile:all 
  RAILS_ENV=production 
  RAILS_GROUPS=assets

rake aborted!
translation missing: en.time.formats.picker
  (in /home/oracle/.rvm/gems/ruby-1.9.2-p318/gems/
    active_scaffold-3.2.3/
    app/assets/javascripts/jquery/date_picker_bridge.js.erb)
So I placed this syntax in config/locales/en.yml
en:
  time:
    formats:
      picker: "%a, %d %b %Y %H:%M:%S"
The above syntax is an exact duplicate of the syntax I found in the gem:

gems/active_scaffold-3.2.3/config/locales/en.yml

Then I tried rake again. I got the same problem.

I found some chatter about this issue in google groups but nothing seemed like an obvious fix. To me this smells like a bug. I wanted to show Active Scaffold to a client but I want it to install smoothly before I do that.

Something like this should be a two step install:

Then, I should be able to start using it.

2012-04-12 Debugging Node.js During Development

When I develop Ruby scripts or Rails sites I'm dependent on a good debugger. When I'm working on a feature in an application my flow goes something like this: This style of coding makes me very dependent on the debugger and its features. When I started writing Node.js software, I wanted to use a similar style of coding. I looked for evidence of a debugger from the Node.js command line arguments:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ which node
/dan/nodejs/bin/node
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node --help
Usage: node [options] [ -e script | script.js ] [arguments] 
       node debug script.js [arguments] 

Options:
  -v, --version        print node's version
  -e, --eval script    evaluate script
  -p, --print          print result of --eval
  --v8-options         print v8 command line options
  --vars               print various compiled-in variables
  --max-stack-size=val set max v8 stack size (bytes)

Environment variables:
NODE_PATH              ':'-separated list of directories
                       prefixed to the module search path.
NODE_MODULE_CONTEXTS   Set to 1 to load modules in their own
                       global contexts.
NODE_DISABLE_COLORS    Set to 1 to disable colors in the REPL

Documentation can be found at http://nodejs.org/
oracle@z3:/dan$ 
oracle@z3:/dan$ 

I noticed the 'debug' token in the Usage message; that looked promising. I wrote some simple JavaScript syntax into a file called debugthis.js:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ cat debugthis.js 
(function() {
  var cubes, list, math, num, number, opposite, race, square;
  var __slice = Array.prototype.slice;
  number = 42;
  opposite = true;
  if (opposite) {
    number = -42;
  }
  square = function(x) {
    return x * x;
  };
  list = [1, 2, 3, 4, 5];
  math = {
    root: Math.sqrt,
    square: square,
    cube: function(x) {
      return x * square(x);
    }
  };
  race = function() {
    var runners, winner;
    winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
    return print(winner, runners);
  };
  if (typeof elvis !== "undefined" && elvis !== null) {
    alert("I knew it!");
  }
  cubes = (function() {
    var _i, _len, _results;
    _results = [];
    for (_i = 0, _len = list.length; _i < _len; _i++) {
      num = list[_i];
      _results.push(math.cube(num));
    }
    return _results;
  })();
}).call(this);
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 
I tried using the debug token as suggested by the command line help:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node debug debugthis.js
< debugger listening on port 5858
connecting... ok
break in debugthis.js:37
 35     return _results;
 36   })();
 37 }).call(this);
 38 
 39 });
debug> quit
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node debug debugthis.js
< debugger listening on port 5858
connecting... ok
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, restart, kill, list, scripts, breakpoints, version
debug> list
[Function]
debug> s
break in debugthis.js:2
  1 (function() {
  2   var cubes, list, math, num, number, opposite, race, square;
  3   var __slice = Array.prototype.slice;
  4   number = 42;
debug> n
break in debugthis.js:3
  1 (function() {
  2   var cubes, list, math, num, number, opposite, race, square;
  3   var __slice = Array.prototype.slice;
  4   number = 42;
  5   opposite = true;
debug> n
break in debugthis.js:4
  2   var cubes, list, math, num, number, opposite, race, square;
  3   var __slice = Array.prototype.slice;
  4   number = 42;
  5   opposite = true;
  6   if (opposite) {
debug> n
break in debugthis.js:5
  3   var __slice = Array.prototype.slice;
  4   number = 42;
  5   opposite = true;
  6   if (opposite) {
  7     number = -42;
debug> number
ReferenceError: number is not defined
    at repl:1:2
    at Interface.controlEval (_debugger.js:930:21)
    at REPLServer.eval (native)
    at Interface.<anonymous> (repl.js:182:12)
    at Interface.emit (events.js:67:17)
    at Interface._onLine (readline.js:162:10)
    at Interface._line (readline.js:426:8)
    at Interface._ttyWrite (readline.js:603:14)
    at ReadStream.<anonymous> (readline.js:82:12)
    at ReadStream.emit (events.js:88:20)
debug> watch number
... 
... 

It dawned on me that this debugger behaved differently than the Ruby debugger which I was acquainted with. So, I asked my friend Adam at the BayNode Meetup what he used to debug Node.js software. He suggested I use a module named 'Node Inspector'. I googled it and then went to a github page:

http://github.com/dannycoates/node-inspector

There, I learned I could install Node Inspector with a package manager for Node.js called "npm". So, I installed Node-Inspector with the npm shell command:
oracle@z3:/dan$ 
oracle@z3:/dan$ npm --help

Usage: npm <command>

where <command> is one of:
    add-user, adduser, apihelp, author, bin, bugs, c, cache,
    completion, config, deprecate, docs, edit, explore, faq,
    find, get, help, help-search, home, i, info, init, install,
    la, link, list, ll, ln, login, ls, outdated, owner, pack,
    prefix, prune, publish, r, rb, rebuild, remove, restart, rm,
    root, run-script, s, se, search, set, show, shrinkwrap,
    star, start, stop, submodule, tag, test, un, uninstall,
    unlink, unpublish, unstar, up, update, version, view,
    whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm faq          commonly asked questions
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    /home/oracle/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@1.1.16 /dan/nodejs/lib/node_modules/npm
oracle@z3:/dan$ npm list
/dan
└── (empty)
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 



oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ npm install -g node-inspector
npm http GET https://registry.npmjs.org/node-inspector
npm http 304 https://registry.npmjs.org/node-inspector
npm http GET https://registry.npmjs.org/paperboy
npm http GET https://registry.npmjs.org/socket.io
npm http 304 https://registry.npmjs.org/paperboy
npm http 304 https://registry.npmjs.org/socket.io
npm http GET https://registry.npmjs.org/socket.io-client/0.8.7
npm http GET https://registry.npmjs.org/redis/0.6.7
npm http GET https://registry.npmjs.org/policyfile/0.0.4
npm http 304 https://registry.npmjs.org/redis/0.6.7
npm http 304 https://registry.npmjs.org/socket.io-client/0.8.7
npm http 304 https://registry.npmjs.org/policyfile/0.0.4
npm WARN excluding symbolic link lib/socket.io-client.js -> io.js
npm http GET https://registry.npmjs.org/uglify-js/1.0.6
npm http GET https://registry.npmjs.org/websocket-client/1.0.0
npm http GET https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/websocket-client/1.0.0
npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2
npm http 304 https://registry.npmjs.org/uglify-js/1.0.6
/dan/nodejs/bin/node-inspector -> /dan/nodejs/lib/node_modules/node-inspector/bin/inspector.js
paperboy@0.0.3 /dan/nodejs/lib/node_modules/node-inspector/node_modules/paperboy

policyfile@0.0.4 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/policyfile

redis@0.6.7 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/redis

xmlhttprequest@1.2.2 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/ snip...

websocket-client@1.0.0 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/ snip...

uglify-js@1.0.6 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/ snip...

socket.io-client@0.8.7 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io/node_modules/ snip...

socket.io@0.8.7 /dan/nodejs/lib/node_modules/node-inspector/node_modules/socket.io

node-inspector@0.1.10 /dan/nodejs/lib/node_modules/node-inspector
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 


oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ npm list
/dan
└── (empty)

oracle@z3:/dan$ 
oracle@z3:/dan$ which node-inspector
/dan/nodejs/bin/node-inspector
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ 


Some of the output looked garbled because npm could not detect that I was calling it from an Emacs shell. It assumed I was in a normal terminal window and it wanted to colorize some of the output. Aside from that, I was happy because I had just installed Node Inspector with npm. How do I "run" Node Inspector? The github page suggested I run it like this:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node-inspector &
[1] 32700
oracle@z3:/dan$    info  - socket.io started
visit http://0.0.0.0:8080/debug?port=5858 to start debugging

oracle@z3:/dan$ 
oracle@z3:/dan$ 


The impression I got from searching the web is that Node Inspector is something I should have running in the background on my laptop most of the time. Then it will be ready for action when I need it. This is similar to how I think a database or webserver should behave.

After starting Node Inspector, the github page suggested I run my node-script with a command line option: --debug-brk

So, I did that:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node --debug-brk debugthis.js 
debugger listening on port 5858


And that shell became locked.
The github page suggested I point my Chrome browser at this URL:

http://127.0.0.1:8080/debug?port=5858

This looked familiar because the Node Inspector prompt had told me to do this:

visit http://0.0.0.0:8080/debug?port=5858 to start debugging

So, I loaded the second URL into a Chrome browser and saw this:



Obviously, that was not very useful. I had done something wrong. I then noticed this message in the window running Node Inspector:

oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ debugger not connected
debugger not connected
debugger not connected
debugger not connected
debugger not connected

So, I killed Node Inspector and then I killed the debugger. Then, I started them in different order; the debugger first, Node Inspector second. I loaded the URL into Chrome again and saw this:

I felt good when I saw the above UI in Chrome. I was familiar with it. It is identical to the UI I use to debug JavaScript served to a browser from a normal webserver. I checked that I could use it to step through code and interact with objects and variables. It worked great; I was happy because I was at the point where I was with Ruby and Rails. I could attach a debugger to both application software and testing software.


2012-04-11 Install Node.js from source

When a developer wants to install Node.js on a laptop, it is often done with the help of a package manager like apt-get on Ubuntu or Homebrew on Mac OS/X. Sometimes you will have reasons for not using the package manager:

I installed Node.js from source on two types of laptops, a Linux laptop and a Mac running OS/X 10.5.8. Both were easy tasks. Notes from both of those efforts are displayed below.

Ubuntu 10.04: Install Node.js from source

I started by creating a directory owned by me rather than root:
oracle@z3:/dan/nodejs$ mkdir -p /dan/nodejs
oracle@z3:/dan/nodejs$ cd       /dan/nodejs
I got a copy of the source:
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ wget http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz
--2012-04-10 20:08:50--  http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz
Resolving nodejs.org... 8.12.44.238
Connecting to nodejs.org|8.12.44.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10741691 (10M) [application/octet-stream]
Saving to: `node-v0.6.15.tar.gz'

100%[======================================>] 10,741,691   307K/s   in 34s     

2012-04-10 20:09:24 (308 KB/s) - `node-v0.6.15.tar.gz' saved [10741691/10741691]

oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
I unpacked it, configured it and compiled it:
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ ll
total 10500
drwxrwxrwt 2 root   root       4096 2012-04-10 20:08 ./
drwxrwxrwt 3 root   root       4096 2012-04-10 20:05 ../
-rw-r--r-- 1 oracle oracle 10741691 2012-04-09 17:07 node-v0.6.15.tar.gz
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ tar zxf node-v0.6.15.tar.gz 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 


oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ ll
total 10504
drwxrwxrwt 3 root   root       4096 2012-04-10 20:10 ./
drwxrwxrwt 3 root   root       4096 2012-04-10 20:05 ../
drwxr-xr-x 9 oracle oracle     4096 2012-04-09 17:03 node-v0.6.15/
-rw-r--r-- 1 oracle oracle 10741691 2012-04-09 17:07 node-v0.6.15.tar.gz
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ 

oracle@z3:/dan/nodejs$ 
oracle@z3:/dan/nodejs$ cd node-v0.6.15
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ ll
total 256
drwxr-xr-x 9 oracle oracle  4096 2012-04-09 17:03 ./
drwxrwxrwt 3 root   root    4096 2012-04-10 20:10 ../
-rw-r--r-- 1 oracle oracle 10036 2012-04-09 17:03 AUTHORS
drwxr-xr-x 4 oracle oracle  4096 2012-04-10 20:10 benchmark/
-rw-r--r-- 1 oracle oracle    61 2012-04-09 17:03 BSDmakefile
-rw-r--r-- 1 oracle oracle 69546 2012-04-09 17:03 ChangeLog
-rw-r--r-- 1 oracle oracle  6355 2012-04-09 17:03 common.gypi
-rwxr-xr-x 1 oracle oracle   444 2012-04-09 17:03 configure*
-rwxr-xr-x 1 oracle oracle  6397 2012-04-09 17:03 configure-gyp*
drwxr-xr-x 8 oracle oracle  4096 2012-04-10 20:10 deps/
drwxr-xr-x 7 oracle oracle  4096 2012-04-10 20:10 doc/
-rw-r--r-- 1 oracle oracle    22 2012-04-09 17:03 .gitattributes
-rw-r--r-- 1 oracle oracle   431 2012-04-09 17:03 .gitignore
drwxr-xr-x 2 oracle oracle  4096 2012-04-10 20:10 lib/
-rw-r--r-- 1 oracle oracle 28069 2012-04-09 17:03 LICENSE
-rw-r--r-- 1 oracle oracle  6223 2012-04-09 17:03 Makefile
-rw-r--r-- 1 oracle oracle 10204 2012-04-09 17:03 Makefile-gyp
-rw-r--r-- 1 oracle oracle  6682 2012-04-09 17:03 node.gyp
-rw-r--r-- 1 oracle oracle  1328 2012-04-09 17:03 README.md
drwxr-xr-x 2 oracle oracle  4096 2012-04-10 20:10 src/
drwxr-xr-x 8 oracle oracle  4096 2012-04-10 20:10 test/
drwxr-xr-x 9 oracle oracle  4096 2012-04-10 20:10 tools/
-rw-r--r-- 1 oracle oracle   158 2012-04-09 17:03 .travis.yml
-rw-r--r-- 1 oracle oracle  5905 2012-04-09 17:03 vcbuild.bat
-rw-r--r-- 1 oracle oracle 36634 2012-04-09 17:03 wscript
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
The readme says I need Python 2.6 or 2.7.
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ which python
/usr/bin/python
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ python --version
Python 2.6.5
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
I have that Python; yay!
I want the Node.js executables to reside under /dan/nodejs.
So, I use '--prefix' to specify that:
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ ./configure --prefix=/dan/nodejs
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /usr/bin/gcc 
Checking for gcc                         : ok  
Checking for library dl                  : yes 
Checking for openssl                     : yes 
Checking for library util                : yes 
Checking for library rt                  : yes 
Checking for fdatasync(2) with c++       : yes 
'configure' finished successfully (2.063s)
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
Then I issued shell commands, 'make' and 'make install':
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ make
Waf: Entering directory `/dan/nodejs/node-v0.6.15/out'
DEST_OS: linux
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
[ 1/35] copy: src/node_config.h.in -> out/Release/src/node_config.h
[ 2/35] cc: deps/http_parser/http_parser.c -> out/Release/deps/http_parser/http_parser_3.o
/usr/bin/gcc -rdynamic -pthread -g -O3 -DHAVE_OPENSSL=1 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 

snip ....

/usr/bin/g++ Release/src/node_main_5.o Release/src/node_5.o Release/src/node_buffer_5.o snip...
Waf: Leaving directory `/dan/nodejs/node-v0.6.15/out'
'build' finished successfully (4m14.574s)
-rwxr-xr-x 1 oracle oracle 9.8M 2012-04-10 20:24 out/Release/node
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 


oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ make install
Waf: Entering directory `/dan/nodejs/node-v0.6.15/out'
DEST_OS: linux
DEST_CPU: x64
Parallel Jobs: 1
Product type: program
* installing deps/uv/include/ares_version.h as /dan/nodejs/include/node/ares_version.h
* installing deps/uv/include/uv.h as /dan/nodejs/include/node/uv.h
* installing deps/uv/include/ares.h as /dan/nodejs/include/node/ares.h
* installing deps/uv/include/uv-private/uv-unix.h as /dan/nodejs/include/node/uv-private/uv-unix.h
* installing deps/uv/include/uv-private/uv-win.h as /dan/nodejs/include/node/uv-private/uv-win.h
* installing deps/uv/include/uv-private/ev.h as /dan/nodejs/include/node/uv-private/ev.h
* installing deps/uv/include/uv-private/eio.h as /dan/nodejs/include/node/uv-private/eio.h
* installing deps/uv/include/uv-private/ngx-queue.h as /dan/nodejs/include/node/uv-private/ngx-queue.h

snip......

* symlink /dan/nodejs/bin/npm (-> ../lib/node_modules/npm/bin/npm-cli.js)
* installing out/Release/node as /dan/nodejs/bin/node
* installing out/Release/src/node_config.h as /dan/nodejs/include/node/node_config.h
Waf: Leaving directory `/dan/nodejs/node-v0.6.15/out'
'install' finished successfully (4.589s)
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
oracle@z3:/dan/nodejs/node-v0.6.15$ 
Next, I tried running a simple server. I pulled a simple code-demo off of nodejs.org and ran it:
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ which node 
/dan/nodejs/bin/node
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ cat example.js 
// example.js
// I got this code from here:
// http://nodejs.org

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
oracle@z3:/dan$ 
oracle@z3:/dan$ 
oracle@z3:/dan$ node example.js 
Server running at http://127.0.0.1:1337/
The above shell command locked my shell.
So I started another shell and ran a simple shell command to GET a response from the server:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ curl http://127.0.0.1:1337
Hello World
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I considered the above output sufficient proof that I had installed Node.js and that it was running well on my Linux host.

Mac OS/X 10.5.8 (Leopard): Install Node.js from source

I started my install of Node.js on my Mac by creating a directory:
Tue Apr 10 13:18 ~/pt/apr bikle611$ 
Tue Apr 10 13:18 ~/pt/apr bikle611$ sudo bash
Password:
Tue Apr 10 13:18 ~/pt/apr root$ 
Tue Apr 10 13:18 ~/pt/apr root$ mkdir -p /dan/nodejs
Tue Apr 10 13:18 ~/pt/apr root$ chown bikle611 /dan /dan/nodejs
Tue Apr 10 13:19 ~/pt/apr root$ 
Tue Apr 10 13:19 ~/pt/apr root$ exit
exit
Tue Apr 10 13:19 ~/pt/apr bikle611$ 
Tue Apr 10 13:19 ~/pt/apr bikle611$ cd /dan/nodejs/
Tue Apr 10 13:19 /dan/nodejs bikle611$ 
Tue Apr 10 13:19 /dan/nodejs bikle611$ 
Tue Apr 10 13:19 /dan/nodejs bikle611$ 


I downloaded the Node.js source code from a link I found on a page at http://nodejs.org
Tue Apr 10 13:19 /dan/nodejs bikle611$ 
Tue Apr 10 13:19 /dan/nodejs bikle611$ 
Tue Apr 10 13:19 /dan/nodejs bikle611$ wget http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz
--2012-04-10 13:21:47--  http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz
Resolving nodejs.org... 8.12.44.238
Connecting to nodejs.org|8.12.44.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10741691 (10M) [application/octet-stream]
Saving to: `node-v0.6.15.tar.gz'

100%[======================================>] 10,741,691   321K/s   in 36s     

2012-04-10 13:22:23 (293 KB/s) - `node-v0.6.15.tar.gz' saved [10741691/10741691]

Tue Apr 10 13:24 /dan/nodejs bikle611$ 
Tue Apr 10 13:24 /dan/nodejs bikle611$ 


I unpacked it and looked at the README.md file:
Tue Apr 10 13:25 /dan/nodejs bikle611$ 
Tue Apr 10 13:25 /dan/nodejs bikle611$ tar zxf node-v0.6.15.tar.gz 
Tue Apr 10 13:26 /dan/nodejs bikle611$ 
Tue Apr 10 13:26 /dan/nodejs bikle611$ 
Tue Apr 10 13:26 /dan/nodejs bikle611$ ll
total 20984
drwxr-xr-x   4 bikle611  admin       136 Apr 10 13:25 ./
drwxr-xr-x   3 bikle611  admin       102 Apr 10 13:18 ../
drwxr-xr-x  25 bikle611  admin       850 Apr  9 09:03 node-v0.6.15/
-rw-r--r--   1 bikle611  admin  10741691 Apr  9 09:07 node-v0.6.15.tar.gz
Tue Apr 10 13:26 /dan/nodejs bikle611$ 
Tue Apr 10 13:26 /dan/nodejs bikle611$ 
Tue Apr 10 13:26 /dan/nodejs bikle611$ cd node-v0.6.15
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ ll
total 440
drwxr-xr-x  25 bikle611  admin    850 Apr  9 09:03 ./
drwxr-xr-x   4 bikle611  admin    136 Apr 10 13:25 ../
-rw-r--r--   1 bikle611  admin     22 Apr  9 09:03 .gitattributes
-rw-r--r--   1 bikle611  admin    431 Apr  9 09:03 .gitignore
-rw-r--r--   1 bikle611  admin    158 Apr  9 09:03 .travis.yml
-rw-r--r--   1 bikle611  admin  10036 Apr  9 09:03 AUTHORS
-rw-r--r--   1 bikle611  admin     61 Apr  9 09:03 BSDmakefile
-rw-r--r--   1 bikle611  admin  69546 Apr  9 09:03 ChangeLog
-rw-r--r--   1 bikle611  admin  28069 Apr  9 09:03 LICENSE
-rw-r--r--   1 bikle611  admin   6223 Apr  9 09:03 Makefile
-rw-r--r--   1 bikle611  admin  10204 Apr  9 09:03 Makefile-gyp
-rw-r--r--   1 bikle611  admin   1328 Apr  9 09:03 README.md
drwxr-xr-x  30 bikle611  admin   1020 Apr 10 13:26 benchmark/
-rw-r--r--   1 bikle611  admin   6355 Apr  9 09:03 common.gypi
-rwxr-xr-x   1 bikle611  admin    444 Apr  9 09:03 configure*
-rwxr-xr-x   1 bikle611  admin   6397 Apr  9 09:03 configure-gyp*
drwxr-xr-x   8 bikle611  admin    272 Apr 10 13:26 deps/
drwxr-xr-x  22 bikle611  admin    748 Apr 10 13:26 doc/
drwxr-xr-x  37 bikle611  admin   1258 Apr 10 13:25 lib/
-rw-r--r--   1 bikle611  admin   6682 Apr  9 09:03 node.gyp
drwxr-xr-x  71 bikle611  admin   2414 Apr 10 13:25 src/
drwxr-xr-x  10 bikle611  admin    340 Apr 10 13:25 test/
drwxr-xr-x  22 bikle611  admin    748 Apr 10 13:26 tools/
-rw-r--r--   1 bikle611  admin   5905 Apr  9 09:03 vcbuild.bat
-rw-r--r--   1 bikle611  admin  36634 Apr  9 09:03 wscript
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 


Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:26 /dan/nodejs/node-v0.6.15 bikle611$ cat  README.md 
Evented I/O for V8 javascript. [![Build Status](https://secure.travis-ci.org/joyent/node.png)](http://travis-ci.org/joyent/node)
===

### To build:

Unix/Macintosh (requires python 2.6 or 2.7):

    ./configure
    make
    make install

Windows:

    vcbuild.bat

### To run the tests:

Unix/Macintosh:

    make test

Windows:

    vcbuild.bat test

### To build the documentation:

    make doc

### To read the documentation:

    man doc/node.1

Resources for Newcomers
---
  - [The Wiki](https://github.com/joyent/node/wiki)
  - [nodejs.org](http://nodejs.org/)
  - [how to install node.js and npm (node package manager)](http://joyeur.com/2010/12/10/installing-node-and-npm/)
  - [list of modules](https://github.com/joyent/node/wiki/modules)
  - [searching the npm registry](http://search.npmjs.org/)
  - [list of companies and projects using node](https://github.com/joyent/node/wiki/Projects,-Applications,-and-Companies-Using-Node)
  - [node.js mailing list](http://groups.google.com/group/nodejs)
  - irc chatroom, [#node.js on freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
  - [community](https://github.com/joyent/node/wiki/Community)
  - [contributing](https://github.com/joyent/node/wiki/Contributing)
  - [big list of all the helpful wiki pages](https://github.com/joyent/node/wiki/_pages)
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 


I checked that I had Python installed on my Mac:
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ which python
/pt/p/bin/python
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ python --version
Python 2.6.2
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 13:27 /dan/nodejs/node-v0.6.15 bikle611$ 


I changed my path so it looks for g++ under /Developer/usr/bin/

I have this in my .bashrc:
export PATH=/Developer/usr/bin:${PATH}


I did this:
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ bash
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ which g++
/Developer/usr/bin/g++
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ uname -a
Darwin mac3.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ 
Tue Apr 10 14:48 /dan/nodejs bikle611$ 


Okay, now I'm all setup. I put it in gear and pressed the gas pedal:
Tue Apr 10 14:50 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 14:50 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 14:50 /dan/nodejs/node-v0.6.15 bikle611$ ./configure --prefix=/dan/nodejs
Checking for program g++ or c++          : /Developer/usr/bin/g++ 
Checking for program cpp                 : /Developer/usr/bin/cpp 
Checking for program ar                  : /Developer/usr/bin/ar 
Checking for program ranlib              : /Developer/usr/bin/ranlib 
Checking for g++                         : ok  
Checking for program gcc or cc           : /Developer/usr/bin/gcc 
Checking for program ar                  : /Developer/usr/bin/ar 
Checking for program ranlib              : /Developer/usr/bin/ranlib 
Checking for gcc                         : ok  
Checking for library dl                  : yes 
Checking for openssl                     : yes 
Checking for library util                : yes 
Checking for library rt                  : not found 
Checking for fdatasync(2) with c++       : no 
'configure' finished successfully (1.327s)
Tue Apr 10 14:51 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 14:52 /dan/nodejs/node-v0.6.15 bikle611$ 


Darn!

It looks like I am missing two things:
Checking for library rt                  : not found 
Checking for fdatasync(2) with c++       : no 


Lets see how far I get with these two things missing:
Tue Apr 10 14:52 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 14:52 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 14:53 /dan/nodejs/node-v0.6.15 bikle611$ make
Waf: Entering directory `/dan/nodejs/node-v0.6.15/out'
DEST_OS: darwin
DEST_CPU: ia32
Parallel Jobs: 1
Product type: program
[ 1/35] copy: src/node_config.h.in -> out/Release/src/node_config.h
[ 2/35] cc: deps/http_parser/http_parser.c -> out/Release/deps/http_parser/http_parser_3.o
/Developer/usr/bin/gcc -rdynamic -pthread -arch i386 -m32 -g -O3 -DHAVE_OPENSSL=1 snip ...
[ 3/35] src/node_natives.h: src/node.js lib/dgram.js lib/console.js lib/buffer.js snip ...
[ 4/35] uv: deps/uv/include/uv.h -> out/Release/deps/uv/uv.a
rm -f src/ares/*.o
rm -f src/unix/ev/*.o
rm -f src/unix/eio/*.o
rm -f src/unix/*.o
rm -rf test/run-tests.dSYM run-benchmarks.dSYM
rm -f -f src/*.o *.a test/run-tests test/run-benchmarks
/Developer/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude snip ...
/Developer/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude snip ...
/Developer/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude snip ...
/Developer/usr/bin/gcc --std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter -Iinclude snip ...

snip ...

[33/35] cxx: src/platform_darwin.cc -> out/Release/src/platform_darwin_5.o snip ...
/Developer/usr/bin/g++ -pthread -arch i386 -m32 -g -O3 -DHAVE_OPENSSL=1 -D_LARGEFILE_SOURCE  snip ...
[34/35] cxx: src/node_crypto.cc -> out/Release/src/node_crypto_5.o snip ...
/Developer/usr/bin/g++ -pthread -arch i386 -m32 -g -O3 -DHAVE_OPENSSL=1 -D_LARGEFILE_SOURCE  snip ...
[35/35] cxx_link: out/Release/src/node_main_5.o out/Release/src/node_5.o  snip ...
/Developer/usr/bin/g++ Release/src/node_main_5.o Release/src/node_5.o Release/src/node_buffer_5.o  snip ...
Waf: Leaving directory `/dan/nodejs/node-v0.6.15/out'
'build' finished successfully (4m32.565s)
-rwxr-xr-x  1 bikle611  admin   6.0M Apr 10 14:58 out/Release/node
Tue Apr 10 14:58 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ 


That looked good, no error messages. So I pressed on:
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:00 /dan/nodejs/node-v0.6.15 bikle611$ make install
Waf: Entering directory `/dan/nodejs/node-v0.6.15/out'
DEST_OS: darwin
DEST_CPU: ia32
Parallel Jobs: 1
Product type: program
* installing deps/uv/include/ares.h as /dan/nodejs/include/node/ares.h
* installing deps/uv/include/ares_version.h as /dan/nodejs/include/node/ares_version.h
* installing deps/uv/include/uv.h as /dan/nodejs/include/node/uv.h
* installing deps/uv/include/uv-private/eio.h as /dan/nodejs/include/node/uv-private/eio.h
* installing deps/uv/include/uv-private/ev.h as /dan/nodejs/include/node/uv-private/ev.h

snip ...

* installing deps/npm/man/man3/help-search.3 as /dan/nodejs/lib/node_modules/npm/man/man3/help-search.3
* installing deps/npm/man/man3/tag.3 as /dan/nodejs/lib/node_modules/npm/man/man3/tag.3
* installing deps/npm/man/man3/docs.3 as /dan/nodejs/lib/node_modules/npm/man/man3/docs.3
* installing deps/npm/man/man3/view.3 as /dan/nodejs/lib/node_modules/npm/man/man3/view.3
* installing deps/npm/man/man3/list.3 as /dan/nodejs/lib/node_modules/npm/man/man3/list.3
* installing deps/npm/man/man3/test.3 as /dan/nodejs/lib/node_modules/npm/man/man3/test.3
* installing deps/npm/man/man3/rm.3 as /dan/nodejs/lib/node_modules/npm/man/man3/rm.3
* symlink /dan/nodejs/bin/npm (-> ../lib/node_modules/npm/bin/npm-cli.js)
* installing out/Release/node as /dan/nodejs/bin/node
* installing out/Release/src/node_config.h as /dan/nodejs/include/node/node_config.h
Waf: Leaving directory `/dan/nodejs/node-v0.6.15/out'
'install' finished successfully (6.205s)
Tue Apr 10 15:01 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:01 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:01 /dan/nodejs/node-v0.6.15 bikle611$ 
Tue Apr 10 15:01 /dan/nodejs/node-v0.6.15 bikle611$ 


That looked good, no error messages. So I pressed on. I edited my .bashrc:
export PATH=/dan/nodejs/bin:/Developer/usr/bin:${PATH}


I tinkered:
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ which node
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ bash
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ which node
/dan/nodejs/bin/node
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ node --version
v0.6.15
Tue Apr 10 15:04 /tmp bikle611$ 
Tue Apr 10 15:04 /tmp bikle611$ 


Yay!!! I had just installed Node.js on my Mac. Next, I focused on installing coffee. I read this page:

http://coffeescript.org/

I did this:
Tue Apr 10 15:06 /tmp bikle611$ 
Tue Apr 10 15:06 /tmp bikle611$ 
Tue Apr 10 15:06 /tmp bikle611$ which npm
/dan/nodejs/bin/npm
Tue Apr 10 15:16 /tmp bikle611$ 
Tue Apr 10 15:16 /tmp bikle611$ 


Tue Apr 10 15:16 /tmp bikle611$ 
Tue Apr 10 15:16 /tmp bikle611$ npm install coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 200 https://registry.npmjs.org/coffee-script
npm http GET https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.1.tgz
npm http 200 https://registry.npmjs.org/coffee-script/-/coffee-script-1.3.1.tgz
coffee-script@1.3.1 ./node_modules/coffee-script
Tue Apr 10 15:17 /tmp bikle611$ 
Tue Apr 10 15:17 /tmp bikle611$ 
Tue Apr 10 15:17 /tmp bikle611$ 


npm seemed to do its job but lacked enough sophistication to see I was running it from an Emacs-shell. It assumed I was on a terminal so it sent codes to my display to change how it looked. So, that is why its output above looks strange. I did not worry about it. I then checked that I had both coffee and node in my PATH:
Tue Apr 10 15:18 /tmp bikle611$ 
Tue Apr 10 15:18 /tmp bikle611$ which coffee
Tue Apr 10 15:18 /tmp bikle611$ 
Tue Apr 10 15:18 /tmp bikle611$ which node
/dan/nodejs/bin/node
Tue Apr 10 15:18 /tmp bikle611$ 
Tue Apr 10 15:18 /tmp bikle611$ 
Tue Apr 10 15:18 /tmp bikle611$ which coffee-script
Tue Apr 10 15:19 /tmp bikle611$ 
Tue Apr 10 15:19 /tmp bikle611$ 
Tue Apr 10 15:19 /tmp bikle611$ 


Darn!

Something is WRONG. The install of coffee-script seemed to go okay but my shell is not seeing anything in the PATH. I investigated:
Tue Apr 10 15:19 /tmp bikle611$ 
Tue Apr 10 15:19 /tmp bikle611$ ll
total 8
drwxrwxrwt  10 root      wheel  340 Apr 10 15:17 ./
drwxr-xr-x@  6 root      wheel  204 Jan 30  2009 ../
srwxrwxrwx   1 postgres  wheel    0 Apr 10 15:04 .s.PGSQL.5432=
-rw-------   1 postgres  wheel   24 Apr 10 15:04 .s.PGSQL.5432.lock
srwxrwxrwx   1 bikle611  wheel    0 Apr 10 13:04 com.hp.launchport=
drwx------   3 bikle611  wheel  102 Apr 10 13:04 launch-F3UqKH/
drwx------   3 bikle611  wheel  102 Apr 10 13:04 launch-SApkAY/
drwx------   3 bikle611  wheel  102 Apr 10 13:04 launch-zAIsG4/
drwx------   3 bikle611  wheel  102 Apr 10 13:04 launchd-109.mpCZ0P/
drwxr-xr-x   4 bikle611  staff  136 Apr 10 15:17 node_modules/
Tue Apr 10 15:22 /tmp bikle611$ 
Tue Apr 10 15:22 /tmp bikle611$ 
Tue Apr 10 15:22 /tmp bikle611$ ll node_modules/
total 0
drwxr-xr-x   4 bikle611  staff  136 Apr 10 15:17 ./
drwxrwxrwt  10 root      wheel  340 Apr 10 15:17 ../
drwxr-xr-x   4 bikle611  staff  136 Apr 10 15:17 .bin/
drwxr-xr-x  11 bikle611  staff  374 Apr 10 15:17 coffee-script/
Tue Apr 10 15:22 /tmp bikle611$ 
Tue Apr 10 15:22 /tmp bikle611$ 
Tue Apr 10 15:22 /tmp bikle611$ 


Perhaps I should have used the -g option:
Tue Apr 10 15:22 /tmp bikle611$ 
Tue Apr 10 15:24 /tmp bikle611$ 
Tue Apr 10 15:24 /tmp bikle611$ npm install -g coffee-script
npm http GET https://registry.npmjs.org/coffee-script
npm http 304 https://registry.npmjs.org/coffee-script
/dan/nodejs/bin/coffee -> /dan/nodejs/lib/node_modules/coffee-script/bin/coffee
/dan/nodejs/bin/cake -> /dan/nodejs/lib/node_modules/coffee-script/bin/cake
coffee-script@1.3.1 /dan/nodejs/lib/node_modules/coffee-script
Tue Apr 10 15:24 /tmp bikle611$ 
Tue Apr 10 15:24 /tmp bikle611$ 
Tue Apr 10 15:24 /tmp bikle611$ 


That looks better. It acts better too:
Tue Apr 10 15:24 /tmp bikle611$ 
Tue Apr 10 15:24 /tmp bikle611$ 
Tue Apr 10 15:25 /tmp bikle611$ which coffee
/dan/nodejs/bin/coffee
Tue Apr 10 15:25 /tmp bikle611$ 
Tue Apr 10 15:25 /tmp bikle611$ 



Tue Apr 10 15:30 /tmp bikle611$ 
Tue Apr 10 15:30 /tmp bikle611$ cat three.coffee 
# /tmp/three.coffee

three = 1 + 2
console.log three
Tue Apr 10 15:30 /tmp bikle611$ 
Tue Apr 10 15:30 /tmp bikle611$ 
Tue Apr 10 15:30 /tmp bikle611$ coffee three.coffee 
3
Tue Apr 10 15:30 /tmp bikle611$ 
Tue Apr 10 15:30 /tmp bikle611$ 


I tried the debugger:
Tue Apr 10 15:55 /tmp bikle611$ coffee --nodejs debug  three.coffee 
< debugger listening on port 5858
connecting... ok
break in /dan/nodejs/lib/node_modules/coffee-script/bin/coffee:3
  1 
  2 
  3 var path = require('path');
  4 var fs   = require('fs');
  5 var lib  = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, restart, kill, list, scripts, breakpoints, version
debug> list
[Function]
debug> n
break in /dan/nodejs/lib/node_modules/coffee-script/bin/coffee:4
  2 
  3 var path = require('path');


That is not very helpful to me. Maybe to use the debugger I should use coffee to generate a .js file and then run the debugger from Node.js

I tried that:
Tue Apr 10 15:55 /private/tmp bikle611$ 
Tue Apr 10 15:55 /private/tmp bikle611$ cd /tmp
Tue Apr 10 15:55 /tmp bikle611$ 
Tue Apr 10 15:55 /tmp bikle611$ 
Tue Apr 10 15:55 /tmp bikle611$ coffee -help

Usage: coffee [options] path/to/script.coffee -- [args]

If called without options, `coffee` will run your script.

  -b, --bare         compile without a top-level function wrapper
  -c, --compile      compile to JavaScript and save as .js files
  -e, --eval         pass a string from the command line as input
  -h, --help         display this help message
  -i, --interactive  run an interactive CoffeeScript REPL
  -j, --join         concatenate the source CoffeeScript before compiling
  -l, --lint         pipe the compiled JavaScript through JavaScript Lint
  -n, --nodes        print out the parse tree that the parser produces
      --nodejs       pass options directly to the "node" binary
  -o, --output       set the output directory for compiled JavaScript
  -p, --print        print out the compiled JavaScript
  -r, --require      require a library before executing your script
  -s, --stdio        listen for and compile scripts over stdio
  -t, --tokens       print out the tokens that the lexer/rewriter produce
  -v, --version      display the version number
  -w, --watch        watch scripts for changes and rerun commands

Tue Apr 10 16:02 /tmp bikle611$ coffee -c three.coffee 
Tue Apr 10 16:02 /tmp bikle611$ 
Tue Apr 10 16:02 /tmp bikle611$ 
Tue Apr 10 16:02 /tmp bikle611$ ll three.*
-rw-r--r--  1 bikle611  wheel   53 Apr 10 15:29 three.coffee
-rw-r--r--  1 bikle611  wheel  119 Apr 10 16:02 three.js
Tue Apr 10 16:03 /tmp bikle611$ 
Tue Apr 10 16:03 /tmp bikle611$ cat three.js
// Generated by CoffeeScript 1.3.1
(function() {
  var three;

  three = 1 + 2;

  console.log(three);

}).call(this);
Tue Apr 10 16:03 /tmp bikle611$ 
Tue Apr 10 16:03 /tmp bikle611$ 
Tue Apr 10 16:03 /tmp bikle611$ 

Tue Apr 10 16:13 /tmp bikle611$ 
Tue Apr 10 16:13 /tmp bikle611$ node debug three.js 
< debugger listening on port 5858
connecting... ok
break in three.js:9
  7   console.log(three);
  8 
  9 }).call(this);
 10 
 11 });
debug> help
Commands: run (r), cont (c), next (n), step (s), out (o), backtrace (bt), setBreakpoint (sb), clearBreakpoint (cb),
watch, unwatch, watchers, repl, restart, kill, list, scripts, breakpoints, version
debug> s
break in three.js:3
  1 // Generated by CoffeeScript 1.3.1
  2 (function() {
  3   var three;
  4 
  5   three = 1 + 2;
debug> n
break in three.js:5
  3   var three;
  4 
  5   three = 1 + 2;
  6 
  7   console.log(three);
  8 
  9 }).call(this);
debug> c
< 3
program terminated
debug> quit
Tue Apr 10 16:14 /tmp bikle611$ 
Tue Apr 10 16:15 /tmp bikle611$ 
Tue Apr 10 16:15 /tmp bikle611$ 


Next, I tried starting a server to listen for requests. I started with a pure JavaScript server:
Tue Apr 10 16:24 ~/pt/apr bikle611$ 
Tue Apr 10 16:24 ~/pt/apr bikle611$ 
Tue Apr 10 16:24 ~/pt/apr bikle611$ cat myserver.js 
// myserver.js
// I found this code here:
// http://nodejs.org

// demo:
// node myserver.js

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Tue Apr 10 16:24 ~/pt/apr bikle611$ 
Tue Apr 10 16:24 ~/pt/apr bikle611$ 
Tue Apr 10 16:24 ~/pt/apr bikle611$ node myserver.js 
Server running at http://127.0.0.1:1337/


I used another shell to point curl at my server:
Tue Apr 10 16:25 ~/pt/apr bikle611$ 
Tue Apr 10 16:25 ~/pt/apr bikle611$ curl 127.0.0.1:1337/
Hello World
Tue Apr 10 16:25 ~/pt/apr bikle611$ 
Tue Apr 10 16:25 ~/pt/apr bikle611$ 
Yay! It worked. Next, I transformed the code into some coffee-script:
Tue Apr 10 19:25 ~/pt/apr bikle611$ 
Tue Apr 10 19:25 ~/pt/apr bikle611$ cat myserver2.coffee 
# myserver2.coffee

# demo:
# coffee myserver2.coffee

http = require 'http'

callback =(req,res) ->
  res.writeHead 200, {'Content-Type': 'text/plain'}
  res.end 'Hello World\n'

http.createServer(callback).listen 1337, '127.0.0.1'

console.log('Server running at http://127.0.0.1:1337/')
Tue Apr 10 19:25 ~/pt/apr bikle611$ 
Tue Apr 10 19:25 ~/pt/apr bikle611$ 
Tue Apr 10 19:25 ~/pt/apr bikle611$ 
I ran it and it worked great.

Shell 1:
Sat Apr 21 18:01 ~/pt/apr bikle611$ 
Sat Apr 21 18:01 ~/pt/apr bikle611$ 
Sat Apr 21 18:01 ~/pt/apr bikle611$ coffee myserver2.coffee 
Server running at http://127.0.0.1:1337/


Shell 2:
Sat Apr 21 18:02 ~/pt/apr bikle611$ 
Sat Apr 21 18:02 ~/pt/apr bikle611$ curl http://127.0.0.1:1337/
Hello World
Sat Apr 21 18:02 ~/pt/apr bikle611$ 
Sat Apr 21 18:02 ~/pt/apr bikle611$ 

Summary:

Installing Node.js on either Linux or Mac OS/X boils down to these steps:

2012-03-29 Notes about Heroku 'pgbackups'

I looked for information on backup/restore of pg data on Heroku.

I started by simple interaction with the Heroku gem:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku 
Usage: heroku COMMAND [--app APP] [command-specific-options]

Primary help topics, type "heroku help TOPIC" for more details:

  addons    # manage addon resources
  apps      # manage apps (create, destroy)
  auth      # authentication (login, logout)
  config    # manage app config vars
  domains   # manage custom domains
  logs      # display logs for an app
  ps        # manage processes (dynos, workers)
  releases  # view release history of an app
  run       # run one-off commands (console, rake)
  sharing   # manage collaborators on an app

Additional topics:

  account      # manage heroku account options
  db           # manage the database for an app
  drains       # display syslog drains for an app
  help         # list commands and display help
  keys         # manage authentication keys
  maintenance  # toggle maintenance mode
  pg           # manage heroku postgresql databases
  pgbackups    # manage backups of heroku postgresql databases
  plugins      # manage plugins to the heroku gem
  ssl          # manage ssl certificates for an app
  stack        # manage the stack for an app
  status       # check status of Heroku platform
  update       # update the heroku client
  version      # display version

oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku help pg
Additional commands, type "heroku help COMMAND" for more details:

  pg:credentials [DATABASE]  # Display the DATABASE credentials.
  pg:info [DATABASE]         # Display database information
  pg:promote [DATABASE]      # Sets DATABASE as your DATABASE_URL
  pg:psql [DATABASE]         # Open a psql shell to the database
  pg:reset [DATABASE]        # Delete all data in DATABASE
  pg:unfollow <REPLICA>      # stop a replica from following and make it a read/write database 
  pg:wait [DATABASE]         # monitor database creation, exit when complete

I was curious about the configuration of my Postgres db on Heroku.

So I looked:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku config
DATABASE_URL        => postgres://hgfrrmiw23:YLQXU6GCSPmDBPnpVYL4@ec2-107-20-155-141.compute-1.amazonaws.com/hgfrrmiw23
GEM_PATH            => vendor/bundle/ruby/1.9.1
LANG                => en_US.UTF-8
PATH                => bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
RACK_ENV            => production
RAILS_ENV           => production
SHARED_DATABASE_URL => postgres://hgfrrmiw23:YLQXU6GCSPmDBPnpVYL4@ec2-107-20-155-141.compute-1.amazonaws.com/hgfrrmiw23




oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pg:info
=== SHARED_DATABASE (DATABASE_URL)
Data Size    160k
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pg:credentials
 !    Cannot ingress to a shared database
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 

Next, I looked for information about how pgbackups work:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku help pgbackups
Usage: heroku pgbackups

 list captured backups

Additional commands, type "heroku help COMMAND" for more details:

  pgbackups:capture [DATABASE]                           # capture a backup from a database id
  pgbackups:destroy BACKUP_ID                            # destroys a backup
  pgbackups:restore [<DATABASE> [BACKUP_ID|BACKUP_URL]]  # restore a backup to a database
  pgbackups:url [BACKUP_ID]                              # get a temporary URL for a backup

oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 




oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku help pgbackups:capture
Usage: heroku pgbackups:capture [DATABASE]

 capture a backup from a database id

 if no DATABASE is specified, defaults to DATABASE_URL

 -e, --expire  # if no slots are available to capture, destroy the oldest backup to make room

oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 




oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku help pgbackups:url
Usage: heroku pgbackups:url [BACKUP_ID]

 get a temporary URL for a backup

oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
Next, I created two Postgres databases on my localhost straight from the bash command line:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ createdb db1
oracle@z3:/pt/w/hn/z3_2012_0329$ createdb db2
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
I put a table in the first db:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ psql db1
psql (8.4.10)
Type "help" for help.

db1=#
db1=#
db1=# create table mytable (n int) ;
CREATE TABLE
db1=# insert into mytable values(10);
INSERT 0 1
db1=#
db1=#


db1=# \q
oracle@z3:/pt/w/hn/z3_2012_0329$ psql db1
psql (8.4.10)
Type "help" for help.

db1=# select * from mytable;
 n  
----
 10
(1 row)

db1=# 
db1=# 
I tried using the heroku gem to back it up:
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pgbackups:capture postgres://localhost/db1
 !    Please add the pgbackups addon first via:
 !    heroku addons:add pgbackups
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 



oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku addons:add pgbackups
----> Adding pgbackups to hackternoon... done, v29 (free)
      You can now use "pgbackups" to backup your databases or import an external backup.
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 



oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pgbackups:capture postgres://localhost/db1

Database on localhost  ----backup--->  b001

Pending...  -
 !    An error occurred and your backup did not finish.
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
Maybe I can only use the heroku gem to backup Postgres databases which are hosted by heroku.

I looked for clues in Google:

google:
pgbackups site:heroku.com

Result:

Heroku PG Backups | Heroku Dev Center devcenter.heroku.com/articles/pgbackups Mar 13, 2012 – The Heroku PGBackups add-on lets you easily capture and manage backups for your shared and dedicated Heroku PostgreSQL databases.

I tried this:
oracle@z3:/pt/w/hn/z3_2012_0329$ heroku pgbackups:capture

SHARED_DATABASE (DATABASE_URL)  ----backup--->  b002

Capturing... done
Storing... done

oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
I tried this:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pgbackups
ID   | Backup Time         | Size   | Database       
-----+---------------------+--------+----------------
b002 | 2012/03/29 15:46.37 | 10.9KB | SHARED_DATABASE
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
I tried this:
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ bin/heroku pgbackups:url b002
"https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip..."
oracle@z3:/pt/w/hn/z3_2012_0329$ 
oracle@z3:/pt/w/hn/z3_2012_0329$ 
I tried this:
oracle@z3:/tmp$ wget https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip...
[1] 2088
[2] 2089
--2012-03-29 23:50:54--  https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip..
Resolving s3.amazonaws.com... 207.171.185.200
Connecting to s3.amazonaws.com|207.171.185.200|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2012-03-29 23:50:55 ERROR 403: Forbidden.


[2]+  Done                    Expires=1333061930
[1]-  Exit 8                  wget https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip..
[2]+  Done                    Expires=1333061930
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
Oops, I let my shell see some characters in the command line I fed to wget.

I tried this:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ wget 'https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip..
--2012-03-29 23:53:12--  https://s3.amazonaws.com/hkpgbackups/app3351536@heroku.com/b002.dump?AWSAccessKeyId=snip..
Resolving s3.amazonaws.com... 72.21.211.199
Connecting to s3.amazonaws.com|72.21.211.199|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11185 (11K) [binary/octet-stream]
Saving to: `b002.dump'

100%[======================================>] 11,185      --.-K/s   in 0.01s   

2012-03-29 23:53:13 (807 KB/s) - `b002.dump' saved [11185/11185]
How big is the backup?
oracle@z3:/tmp$ 
oracle@z3:/tmp$ ll b002.dump 
-rw-r--r-- 1 oracle oracle 11185 2012-03-29 23:46 b002.dump
oracle@z3:/tmp$ 


That is small.

I asked bash what it thinks the backup file is:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ file b002.dump
b002.dump: PostgreSQL custom database dump - v1.10-0
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I used emacs to look at the file.

I saw that it is not a text file.

I used the strings utility to look inside the binary PostgreSQL dump file:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ strings b002.dump|head -9
PGDMP
hgfrrmiw23
8.3.11
8.3.14
ENCODING
ENCODING
SET client_encoding = 'UTF8';
false
STDSTRINGS
oracle@z3:/tmp$ 
oracle@z3:/tmp$ strings b002.dump | tail -9
><5ZN
0sU4
p~__
:9#/
T0EJ
\*3M
|>.@a
bol/Z0
et:8
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ strings b002.dump | wc -l
368
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I looked for clues in Google on how to interact with this file.

I wanted to know:
Some clues I got from Google:
I tried this:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ which pg_restore
/usr/bin/pg_restore
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I tried this:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ pg_restore --list b002.dump 
;
; Archive created at Thu Mar 29 15:46:38 2012
;     dbname: hgfrrmiw23
;     TOC Entries: 32
;     Compression: -1
;     Dump Version: 1.10-0
;     Format: CUSTOM
;     Integer: 4 bytes
;     Offset: 8 bytes
;     Dumped from database version: 8.3.11
;     Dumped by pg_dump version: 8.3.14
;
;
; Selected TOC Entries:
;
3; 2615 2200 SCHEMA - public postgres
1769; 0 0 COMMENT - SCHEMA public postgres
1475; 1259 1136552 TABLE public invitations hgfrrmiw23
1474; 1259 1136550 SEQUENCE public invitations_id_seq hgfrrmiw23
1770; 0 0 SEQUENCE OWNED BY public invitations_id_seq hgfrrmiw23
1771; 0 0 SEQUENCE SET public invitations_id_seq hgfrrmiw23
1477; 1259 1136560 TABLE public projects hgfrrmiw23
1476; 1259 1136558 SEQUENCE public projects_id_seq hgfrrmiw23
1772; 0 0 SEQUENCE OWNED BY public projects_id_seq hgfrrmiw23
1773; 0 0 SEQUENCE SET public projects_id_seq hgfrrmiw23
1473; 1259 1136546 TABLE public schema_migrations hgfrrmiw23
1479; 1259 1136571 TABLE public users hgfrrmiw23
1478; 1259 1136569 SEQUENCE public users_id_seq hgfrrmiw23
1774; 0 0 SEQUENCE OWNED BY public users_id_seq hgfrrmiw23
1775; 0 0 SEQUENCE SET public users_id_seq hgfrrmiw23
1746; 2604 1136555 DEFAULT public id hgfrrmiw23
1747; 2604 1136563 DEFAULT public id hgfrrmiw23
1748; 2604 1136574 DEFAULT public id hgfrrmiw23
1763; 0 1136552 TABLE DATA public invitations hgfrrmiw23
1764; 0 1136560 TABLE DATA public projects hgfrrmiw23
1762; 0 1136546 TABLE DATA public schema_migrations hgfrrmiw23
1765; 0 1136571 TABLE DATA public users hgfrrmiw23
1754; 2606 1136557 CONSTRAINT public invitations_pkey hgfrrmiw23
1756; 2606 1136568 CONSTRAINT public projects_pkey hgfrrmiw23
1761; 2606 1136582 CONSTRAINT public users_pkey hgfrrmiw23
1757; 1259 1136583 INDEX public index_users_on_confirmation_token hgfrrmiw23
1758; 1259 1136584 INDEX public index_users_on_email hgfrrmiw23
1759; 1259 1136585 INDEX public index_users_on_reset_password_token hgfrrmiw23
1752; 1259 1136549 INDEX public unique_schema_migrations hgfrrmiw23
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I wanted to transform the dump file into a file full of SQL syntax.

I tried this:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ pg_restore --no-owner --file=b002.dump.txt b002.dump
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I looked for the output file:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ ll b002.dump.txt 
-rw-r--r-- 1 oracle oracle 10087 2012-03-30 02:27 b002.dump.txt
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I looked to see if it contained SQL statements:

oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ head -9 b002.dump.txt
--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ tail -9 b002.dump.txt
--

CREATE UNIQUE INDEX unique_schema_migrations ON schema_migrations USING btree (version);


--
-- PostgreSQL database dump complete
--

oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ grep -i create b002.dump.txt|grep -i table
CREATE TABLE invitations (
CREATE TABLE projects (
CREATE TABLE schema_migrations (
CREATE TABLE users (
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
It contained no INSERT statements:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ grep -i insert b002.dump.txt
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
But it did contain COPY statements:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ grep -i copy b002.dump.txt
COPY invitations (id, msg, project_id, sender_id, user_id, created_at, updated_at) FROM stdin;
COPY projects (id, name, dscrptn, user_id, github_url, tech_tag1, tech_tag2, tech_tag3, biz_tag1, biz_tag2 snip...
COPY schema_migrations (version) FROM stdin;
COPY users (id, email, encrypted_password, reset_password_token, reset_password_sent_at, remember_created_at, snip...
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
I tried to restore it into a blank database named db1:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ pg_restore --schema-only --no-owner --dbname=db1 b002.dump
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 


oracle@z3:/tmp$ psql db1
psql (8.4.10)
Type "help" for help.

db1=#
db1=# \d projects

                                     Table "public.projects"
   Column   |            Type             |                       Modifiers                       
------------+-----------------------------+-------------------------------------------------------
 id         | integer                     | not null default nextval('projects_id_seq'::regclass)
 name       | character varying(255)      | 
 dscrptn    | text                        | 
 user_id    | integer                     | 
 github_url | character varying(255)      | 
 tech_tag1  | character varying(255)      | 
 tech_tag2  | character varying(255)      | 
 tech_tag3  | character varying(255)      | 
 biz_tag1   | character varying(255)      | 
 biz_tag2   | character varying(255)      | 
 biz_tag3   | character varying(255)      | 
 created_at | timestamp without time zone | not null
 updated_at | timestamp without time zone | not null
Indexes:
    "projects_pkey" PRIMARY KEY, btree (id)


db1=# 
db1=# 
I tried to restore it into a blank database named db2 on my localhost:
oracle@z3:/tmp$ 
oracle@z3:/tmp$ pg_restore --no-owner --dbname=db2 b002.dump
oracle@z3:/tmp$ 
oracle@z3:/tmp$ 
oracle@z3:/tmp$ psql db2
psql (8.4.10)
Type "help" for help.

db2=# select count(*) from projects;
 count 
-------
     2
(1 row)

db2=# 
db2=# 

It worked. Yay!


2012-03-18 jQuery-UI, Rails 3.2.x, application.js

I wanted to use jQuery-UI to "Accordion" my Blog Entries and Technical Tips.

I bumped into an issue where my browser could not see any of the jQuery-UI functions. I was confused because I could see jQuery-UI as being loaded when I viewed source.

I did find a good clue in the JavaScript console of my browser. It displayed this error:

Uncaught TypeError: Object [object Object] has no method 'accordion'

I figured out the problem by studying the order of .js files served to my browser.

Short story: public/assets/application.js was over-writing other .js files loaded earlier. And it was missing the jQuery-UI library.

Long story:

The file public/assets/application.js is generated from this file:

https://github.com/hackternoon/hackternoon/blob/master/app/assets/javascripts/application.js

When I add a jquery-ui "directive" to app/assets/javascripts/application.js, I need to then run this rake command:

bin/rake assets:precompile

Normally I run the above command before I deploy my site to Heroku. But in this situation I needed to run it in my development environment.

Why?

Because it will then add jQuery-UI functions to this file:

public/assets/application.js

which is the very last file to get loaded and thus the file which overwrites all the JS in previous files I see in the source.

Moral: Ensure that your JavaScript code resides in public/assets/application.js