Monday, September 29, 2014

Ubuntu Crashes Again

I should be very careful working with Linux console. It seems it is able to do anything including destroying itself.

Anyway, it's lucky that we can recover the system by reinstalling it. Note that reinstalling the system will usually not ruin your home folder, which means you can keep all your files and settings.

Follow the step here to do a thorough re-installation:

https://help.ubuntu.com/community/UbuntuReinstallation

Friday, September 26, 2014

A Severe Accident with Ubuntu Kernel Update

I was being too young, sometimes naive to have the linux kernel updated since I believe it might resolve some of the bugs of the system.

The truth is: I'm wrong. After installing the latest kernel, which is 3.13.0-32-generic, I cannot boot into my system! It boots into the black screen instead.

It took me some time to resolve this, but it is actually very simple. In the grub menu, you can choose which kernel version you want to work with (in the advanced boot options). Choose the old one, and you will probably be able to have all the stuffs back.

What next? Remove all the latest kernels!

Do this:

sudo apt-get remove linux-image-3.13.0-32--generic

OK if you are unsure what kernel you have now use the following command:

cd /boot ls vmlinuz* 

It will list all the kernels you installed.

ubuntu 14.04

Nautilus sucks!

Try nemo instead.

Thursday, September 25, 2014

A Common Gitignore File

# Compiled Object files
*.slo
*.lo
*.obj

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
*.lib

# Executables
*.exe
*.out
*.app

#dir
dataset/

*.o
bin/

Save it as .gitignroe

Tuesday, September 23, 2014

The Matlab Trick

Recently I had something tricky with Matlab.

[1 2 3]/[4 5 6]=0.4156  (this is equal to [1 2 3]*pinv([4 5 6]) )

[1 2 3]./[4 5 6]=[0.25 0.4 0.5]

These are two different things.

Sunday, September 21, 2014

Open Multi-threaded Programming

Open Multi-threaded Programming:

#include <omp.h>

Linker settings: other linker options: -fopenmp

A toy example:


  #pragma omp parallel for  
 for (unsigned vel=0; vel<laser_points_all.size(); vel++)   
 {  
       #pragma omp critical  
       {  
             laser_in_camera.push_back(lasercam);  
             intersections.push_back(intersection);  
             iplane.push_back(std::pair<int,int>(vel,inter_plane));  
        }  
 }  

Thursday, September 4, 2014

Format number and digit

If you want to format an integer to be six-digit by adding leading 0s, you can do that:
 string GetSixDigitAccuracyName(int id)  
 {  
   ostringstream oss;  
   oss<<setw(6)<<setfill('0')<<id<<"_accuracy.txt";  
   return oss.str();  
 }