Firefox is already running – linux .parentlock problem

While using a Ubuntu linux machine, this can happen for a lot of people. This is the solution. Error Message: “Firefox is already running but is not responding …” The problem: Many packages (like firefox) create lock files in your account to prevent database corruption with multiple copies of the application. Look in your account … Read more

Trace Source Code in Eclipse: Attaching source to a JAR file

The API document only list the description of class, interface, and methods. If you want to trace back to the original implementation code by clicking “F3” button in Eclipse, then source file need to be attached. The source file under window is here: C:Program FilesJavajdk1.6.0_24src.zip http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/org.eclipse.jdt.doc.user/tasks/tasks-115.htm

Linux Process Programming – fork()

What is a process?

In computing, a process is an instance of a computer program that is being executed. It contains the program code and its current activity. Depending on the operating system (OS), a process may be made up of multiple threads of execution that execute instructions concurrently.

Read more

An example of C++ dot vs. arrow usage

vs. Overall, dot(.) is for object itself, arrow(->) is for pointer. A good example worth a thousand words. The following example should be a good one. #include <iostream>   using namespace std;   class Car { public: int number;   void Create() { cout << "Car created, number is: " << number << "\n" ; … Read more

Regular Expression: exclude a word/string

If you want to exclude a certain word/string in a search pattern, a good way to do this is regular expression assertion function. It is indispensable if you want to match something not followed by something else. A Simple Example String str = "programcreek"; Pattern p = Pattern.compile(".*program(?=creek).*"); Matcher m = p.matcher(str);   if(m.matches()){ System.out.println("Match!"); … Read more

Lisp Code: Add two list

Can we have a function that can add two list to one, such as (add ‘(1 2 3) ‘(4 5 6)) = (5 7 9)

(defun add-two-list (l r)
; e.g. (1 2 3) (2 3 4)
; returns (3 5 7)
  (setf return-value '())
  (loop for i from 0 to (- (length l) 1)
        do (setf return-value (cons (+ (nth i l) (nth i r)) return-value))
)
 (reverse return-value)
)

Read more

Put a Table/Figure/Equation at the right position

Just add h after begin tag. As simple as it is. H here means Place the float here, i.e., at the same point it occurs in the source text. begin{table}[h] center begin{tabular}{|l|l|}   hline multicolumn{2}{|c|}{Schedule of This Week} hline Monday & SigNEW Tuesday & Artificial Intelligence, Compiler Wednesday & Research Meeting Thursday & Artificial Intelligence, … Read more