Monthly Archives: June 2011

SVN check in command line when you want to add new files in a exist folder.

This post comes from

I often update code by adding files in a bunch of directories and then need to add all thosefiles to the svn repository. Here is the command line one-liner to get that done and an explanation:

svn stat | grep "^?" | awk '{print $2}' | xargs svn add

  1. svn stat tells you the status of all the files in the directory with a question mark at the beginning of the line for any files that svn doesn’t currently know about (i.e. that aren’t under revision control).
  2. The next step is to pipe that to a grep command that looks for lines beginning with a question mark so that we can add only those items to svn.
  3. Next, since the output of svn stat is a two column listing split by whitespace with the status indicator first and the full path to the file second, we use a simple awk pattern to print out just filename
  4. Finally, we use the xargs command to take the input and pass it on to the svn add command which schedules the files to be added to the repository.

I will typically run svn stat | less first and review the output to make sure that the command is only going to add things I want. I do the same thing just before any commit. If you need to undo the addition of some file prior to the commit, simply svn revert filename or use the recursive flag like svn revert --recursive path/to/directory/ if you are dealing with a directory.

Once you’re happy with the changes, all you need to do is an actual svn commit so that the files will be permanently added to the repository.


Floating Point Exception when using rand function.

When I use rand function, I encounter “Floating Point Exception” error.

Please have a look at the code and find the answer by your self.

The answer is presented next to the code.

bool modularExponentiationTest(unsigned long long exponent, unsigned long long modulus)
    short index = 0;
    unsigned long long base;
    unsigned long long result;

            result = 1;
            base = rand() % exponent; // <--CAUSED BY THIS             while (exponent > 0) 
                if (exponent & 1)       
                        result = (result * base) % modulus;
                exponent >>= 1;
                base = (base * base) % modulus;

            if (result != 1)
                return false;
    }while(++index < 10);

    return true;

When the denominator is 0, rand%0 could cause a problem.

Therefore need some protection code when denominator has 0 value.


Apple finalcut pro X finally got released.

Hey, guys.


Today, Apple finally got released finalcut pro X.

Although it looks pretty similar with iMovie I expect more professional and easy-way footage editing stuffs are included in this version.

Especially “Color” looks like merged into Final cut Pro X.

Btw, it’s quite cheap. Only cost $299 and $49 for Motion5 from AppleStore.