Monday, May 21, 2012

Sunday, May 20, 2012

list 2 env in R

list2env {base}R Documentation

From A List, Build or Add To an Environment

Description

From a named list x, create an environment containing all list components as objects, or "multi-assign" from x into a pre-existing environment.

c++filt - Demangle C++ and Java symbols.

c++filt <symbol>

Example:
c++filt -n _Z1fv

 -n
       --no-strip-underscores
           Do not remove the initial underscore.


Saturday, May 19, 2012

a couple of git branch cmds

1. create a new branch from origin's branch

git checkout -b serverfix origin/serverfix

2. get everything from origin

git fetch origin 

3. deleting remote branch

git push origin :serverfix

Note that the syntax for git push is
git push [remote name] [local branch]:[remote branch]

source:

Sunday, May 13, 2012

using the default constructor

From page 460 of C++ Primer (4th ed)

A common mistake among programmers new to c++ is 
to declare an object initialized with the default constructor
as follows

// oops! declares a function, not an object
Sales_item myobj();

The problem is that our definition of myobj is interpreted as
a declaration of a function taking no parameters and returning 
an object of type Sales_item --- hardly we intended.  The correct
way to define an object using the default ctor is to leave off the 
trailing, empty parentheses. 

// ok: defines a class ojbect ...
Sales_item myobj;
On the other hand, this code is fine:

// ok, create an unnamed, empty sales_item and use to initialize myobj
Sales_item myobj = Sales_item();

Here we create and value-initialize a Sales_item object and to use 
it to initialize myobj.  The compiler value-initializes a Sales_item by running
its default ctor.