2012. 3. 12.

simple compile erlang

I read that  I must use 'c' to compile in erlang. but I met error 'write error'.
I  am googling and then  I know that I must change directory with 'cd' command.
It is simple. but before I found it  It was stress to statr to learn the erlang.



c("modulefilename").   % sometimes you will meet error ' writing error'


%% method 1: you need to change working directory.

cd("pathname"). %%  which includes module file
c("modulefilename").

%% method 2  

c("modulename", [{outdir, "output directory .."}]).  %% you can assign output directory option  by {outdir, "..."} .

2012. 2. 22.

install python into user home

mkdir /home/iam/.targetdir
cd Python-2.7
make clean
./configure --prefix=/home/iam/.targetdir
make
make install
check.
/home/iam/.targetdir/bin/python2.7

You must change first line.
#!/home/iam/.targetdir/bin/python2.7

2012. 2. 16.

How to install google_api_lib when you have no root right.

How to  install google_api_lib when you have no root right.

python ./setup.py install --home=~


This command install lib in your home directory


==> ~lib/python

2012. 1. 16.

extract list from XML (xmldom) in python


data ="
 aaa
 bbb
 ccc
 ddd
 eee
"


from xml.dom.minidom import parse, parseString

#data is xml formatted string 

dom3 = parseString( data )   #make dom object
tagList = dom3.getElementsByTagName("tag1")  #select list "tag1"

txt = tagList[0].firstChild.nodeValue  #first node->txtNode->nodeValue
print txt

===result==========
aaa

How to clear console in python


# # Screen clear 
# You can use it when you make  a console type.

import os
if os.name == "posix":
   os.system('clear')   # not MS-series
elif os.name in ("nt", "dos", "ce"):
   os.system('CLS')   #  MS-series --> DOS/Windows