2013年11月27日 星期三

python search path

current directory(sys.path)-->PYTHONPATH-->installation-dependent default path; on Unix, this is usually "/usr/local/lib/python".

How Human and Robot are different?

We humans draw effeortlessly on many different cognitive capabilities for any given task, and we pursue a seemingly infinite variety of tasks. When we have difficulties, we don't freeze up; we muddle through.
                                                                               --from JOHN E. LAIRD
                                                                                          THE SOAR COGNITIVE ARCHITECTURE

2013年11月26日 星期二

Install Qt creator in UBUNTU (Manual)

Because using apt-get to install QT is not the last version, I try to install it manually.

step 1: Download file
Download the last version of QT from http://qt-project.org/downloads
For example, i download Qt Online Installer for Linux 64-bit, and then go to the download folder,
find the file "qt-linux-opensource-1.4.0-2-x86_64-online.run".

step 2: Rename file
It's with a little long name. So i rename it as "qt.run" using the command
~$ mv qt-linux-opensource-1.4.0-2-x86_64-online.run qt.run

step 3: Change the access permissions
~$ chmod -x qt.run

step 4: Run the file
~$ sudo ./qt.run

you will see the install screen like below


the you can install it step by step.

2013年11月24日 星期日

compiling opencv with g++

There are two methods in compiling opencv with g++ without IDE

First is typing following command in command line directly

~$  g++ testcv.cpp -o testcv `pkg-config opencv --cflags --libs `

ps: ` place in the left of 1 on the keyboard, not ' in the left of Enter

 Second is to set a makefile as below:

testcv: testcv.cpp
g++  -o ${@} $<  `pkg-config opencv --cflags --libs `

and then type make in command line

~$ make

note:

keep the sequence of the command. put the `pkg-config opencv --cflags --libs ` after others.

If you make a command like

~$  g++  `pkg-config opencv --cflags --libs ` testcv.cpp -o testcv

there will be error

I don't know why...><
###########################################################################
opencv on qt creater ubuntu

set .pro

INCLUDEPATH += /usr/local/include

LIBS += `pkg-config opencv --libs`

If an error occur like this

"Cannot connect creator comm socket /tmp/qt_temp.S27961/stub-socket: No such file or directory"

go to "Run Settings" and then cancel "Run in terminal"
 

2013年10月24日 星期四

IJulia

source from: https://github.com/JuliaLang/IJulia.jl

Using Julia language in IPython notebook.

Needs:
IPython >= 1.0
Julia >= 0.2

Installation:

open Julia and in command line input Pkg.add("IJulia") as showed in below.
julia> Pkg.add("IJulia")

Running:

in your command line input
ipython notebook --profile julia

Password:
first, open IPython and type the following code in IPython

In [1]: from IPython.lib import passwd
In [2]: passwd()
Enter password: abc (password is not showed)
Verify password: abc
Out[2]: 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

you can get the hashed password 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

and then open the file ~/.ipython/profile_julia/ipython_notebook_config.py
in window it was put in your USER folder/.ipython/profile_julia/ipython_notebook_config.py

open ipython_notebook_config.py and search c.NotebookApp.password = u''
put the hashed password between ' and ' . the example is 
c.NotebookApp.password = u'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

then you can use your password login IJulia on web

2013年9月25日 星期三

word 方程式大括號內靠左對齊


括號內要靠左對齊先將專業改成橫式

改成橫式後再要對齊的每個方程式前加入&符號

如圖在兩個f之前加入&

再改回專業模式,用空格把if往後一致對齊

2013年7月9日 星期二

Using SBCL to run PAIP

PAIP source code and usage is from
http://www.norvig.com/paip/README.html

in SBCL command line
* (load "auxfns.lisp")
        having a debugger message:
            debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread
        select 2
            2: [UNLOCK-PACKAGE] Unlock the package.

*(requires "examples")
        having a debugger message:
            debugger invoked on a SB-INT:SIMPLE-FILE-ERROR in thread
            #<THREAD "initial thread" RUNNING {1002998E73}>:
            failed to find the WRITE-DATE of /home/user/test/paip/bin/examples.bin:

revise the file "auxfns.lisp" as follows
in Line 87:
;Replace 
;(defun load-paip-file (file)
;  "Load the binary file if it exists and is newer, else load the source."
;  (let* ((src (paip-pathname file :lisp))
;  (src-date (file-write-date src))
;  (bin (paip-pathname file :binary))
;  (bin-date (file-write-date bin)))
;    (load (if (and (probe-file bin) src-date bin-date (>= bin-date src-date))
;       bin
;     src))))
;with:
(defun load-paip-file (file)
    "Load the binary file if it exists and is newer, else load the source."
        (load (paip-pathname file :lisp)))

reload "auxfns.lisp" and then try again

* (requires "examples")
* (do-example :all)    ;do all examples
* (do-example 1)       ;do first example
* (do-example '(1 2))  ;do first and second example


the solution reference from 
http://compgroups.net/comp.lang.lisp/paip-auxfns.lisp-continuable-error/697367


2013年6月26日 星期三

flask

$ sudo easy_install flask
$ sudo easy_install flask-wtf                     //for wtf
$ sudo easy_install sqlalchemy-migrate    //for db
sqlalchemy-migrate==0.7.2 is not compatible with SQLAlchemy 0.8.x. install SQLAlchemy 0.7.10 instead with pip install SQLAlchemy==0.7.10 or easy_install QLAlchemy==0.7.10


Memo for Big Data

Python
Crawler
Scrapy
http://scrapy.org/

Data Analysis
pandas

Machine Learning
scikit-learn

Graphs Analysis
NetworkX

Data Base
Mongo

Distributed Computing Framework
disco

DPark

Spark

happy

A Guide to Python Frameworks for Hadoop

Visualization
matplotlib

R
RHIPE

2013年6月24日 星期一

The problem with NVIDIA GeGorce GT 640m in UBUNTU12.04

When i execute Openrave in Aspire V3-471G notebook, there is error message about "Can't set up a valid OpenGL canvas, something is seriously wrong with the system!"
The cause of this problem  is that Nvidia Optimus function is not support in Ubuntu.
So i have to install Bumblebee-UI in ubuntu.

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic

2013年5月30日 星期四

pyinstaller

convert your py file to exe file
user who can execute your program without python
Install:
just unzip to your file folder

Usage:
python pyinstaller.py /path/to/yourscript.py
or
python /path/to/pyinstaller.py yourscript.py

2013年5月6日 星期一

Weka FP Growth dataset

Weka FPGrowth needs Binary attributes, arff form likes this:


@relation FPGrowth dataset

@attribute a {1,0}
@attribute b {1,0}
@attribute c {1,0}

@data
0,0,0
0,0,1
0,1,0
0,1,1
1,0,0
1,0,1
1,1,0
1,1,1

2013年1月15日 星期二

SBCL


Steel Bank Common Lisphttp://www.sbcl.org/ )

ubuntu:

Install SBCL

    ~$ sudo apt-get install sbcl
installed to
    /usr/bin
    /usr/lib
    /usr/share/doc

Running SBCL

    ~$ sbcl
    * (quit)     ;quit sbcl



ASDF: Another System Definition Facility http://common-lisp.net/project/asdf/ )

Install 

    ~$ sudo apt-get install cl-asdf
install to
    /usr/lib/asdf

SHOP2

Simple Hierarchical Ordered Planner (http://www.cs.umd.edu/projects/shop/)

~$ sbcl
* (require :asdf)
* (push "/home/user/experiment/shop2/" asdf:*central-registry*)    ;push shop2 folder path to asdf
* (asdf:oos 'asdf:load-op "shop2")    ;load shop2 in asdf
* (load "~/experiment/basic")    ;load shop2 domain, problem & plan which you define