Run On My Way About what I learnt

7May/120

Collected Android post

1. A set of simple tutorials and examples of android dev.

http://www.mkyong.com/tutorials/android-tutorial/

2. How to use external libraries with Android http://geekswithblogs.net/cyberycon/archive/2011/05/17/using-external-libraries-with-android.aspx

3. How to capture audio stream from microphone on Android: http://andrewbrobinson.com/2011/11/27/capturing-raw-audio-data-in-android/

26Apr/110

install opencv and python

Here is the good instruction about how to setup opencv and python.

http://luugiathuy.com/2011/02/setup-opencv-for-python/

4Apr/110

Install Git on Hostmoster

Very good post about how to install Git on Hostmoster.
Original Post by Marli01. http://hostmonsterforum.com/showthread.php?4589-HOWTO-install-Git-on-Hostmonster

$ mkdir git
$ cd git
$ wget http://kernel.org/pub/software/scm/git/git-1.6.0.4.tar.gz
$ gunzip git-1.6.0.4.tar.gz
$ tar -xf git-1.6.0.4.tar
$ cd git-1.6.0.4/
$ ./configure --prefix=$HOME/git
$ make && make install

#add to .bashrc
export PATH=$HOME/git/bin/:$HOME/git/lib/libexec/git-core/:$PATH

#check your install and reload bash
$ source ~/.bashrc
$ git --version

#ini and started
$ git init
# Initialized empty Git repository in /home/mysite/rails/bpc/.git/
$ git add .
2Apr/110

a good math guide of latex

Here is a good guide of writing math symbols, equations with LaTex, written by Michael Downes.
ftp://ftp.ams.org/ams/doc/amsmath/short-math-guide.pdf

20Mar/110

KMP string matching

Get a small time slot to review the popular string matching algorithm KMP (Knuth-Morris-Pratt).

This algorithm reduced the matching time by utilize an auxiliary prefix function. With the prefix function, it can avoid repeated character matching. Simply, we can think about this in this way: Assume there are p characters matched the pattern, How many characters will match the pattern if the next one do not match the pattern.  Obviously, it is the length of longest prefix that is the suffix of substring with first p characters.

19Mar/110

Snapper Chain -codejam 2010

Problem

The Snapper is a clever little device that, on one side, plugs its input plug into an output socket, and, on the other side, exposes an output socket for plugging in a light or other device.

When a Snapper is in the ON state and is receiving power from its input plug, then the device connected to its output socket is receiving power as well. When you snap your fingers -- making a clicking sound -- any Snapper receiving power at the time of the snap toggles between the ON and OFF states.

19Mar/110

Find Sophie – Facebook puzzle

The facebook puzzles are interesting and can be solved with the algorithms we learned in algorithm class, like dynamic programing, graph algorithms, etc. Find Sophie is the one labeled as Buffet which is the most difficult level, at current stage. Well, it may be not so difficult once you see the graph problem hidden in this puzzle.  The next step is how to optimize your solution.  And even small modification of your algorithm may lead to big improvement.

Puzzle

Detailed description of this problem can be found in http://www.facebook.com/careers/puzzles.php?puzzle_id=11

Briefly, Sophie is hiding in one of the given places with specified probability sum to 1.  The time/distance between connected places are given.  Now the goal is to visit all non-zero probability places with smallest expected cost. It is similar to traveling  salesman problem(TSP), but can visit places more than ones. This difference make this puzzle easier to be tackled.

13Mar/110

Face Detection with PHP

Here is one nice work for face detection with pure PHP (Not OPENCV necessary) written by Karthik Tharavaad

Here is one slightly modified demo, It may take some time to do the computation. Be patient and make sure your image is not too large.

please enter the complete URL of the image(JPEG Only) for face detection.


11Mar/110

check the connectivity between two nodes with BFS

In this post, breadth first search is used to check the connectivity between two nodes in a graph. A simplified function to build a graph from user input is also implemented. Remember to delete all those dynamic created nodes in this function.

10Mar/110

Implement Add, Swap with Bit Operator

In the following reference, you will find out most of usages of bit operation: Bit Twidding Hacks by  Sean Eron Anderson, http://www-graphics.stanford.edu/~seander/bithacks.html

Here, the implementation of addition without "+" operator and swapping without temp variable are implemented.