sourcecode

Thursday, March 21, 2013

create library in C/C++

http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html

Friday, March 8, 2013

Mount USB external drive on Linux

1. Plug in the USB disk.

2. Under
/dev/disk/by-label
find the device info, e.g.
Seagate\x20Backup\x20Plus\x20Drive -> ../../usb_bk

(or, simple $ lsusb)

3. sudo makedir /mnt/usb_bk

4. cd ../..

5. mount sdb1 /mnt/usb_bk

Now, the disk shows up under /mnt/usb_bk

6. (optional)
To make it auto mount, first confirm the mount parameters:
$mount
 it should show the mount type:
/dev/sdb1 on /mnt/usb_bk type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

Then edit /etc/fstab
/dev/sdb1       /mnt/usb_bk          fuseblk    defaults        0       0 
 
http://linuxconfig.org/Howto_mount_USB_drive_in_Linux 
http://myubuntublog.wordpress.com/2009/05/25/auto-mount-usb-hard-drive-at-boot/


ARECA backup tool

1. Install Java
sudo apt-get install openjdk-7-jdk openjdk-7-jre icedtea-7-plugin

2. Download and install areca:
http://www.areca-backup.org/

Thursday, March 7, 2013

clang 3.2

compile from source code. Follow the instructions on:
http://clang.llvm.org/get_started.html

Note: the ./configure line is changed to
$ CC=gcc CXX=g++ ../llvm/configure


OR, apt-get install
http://askubuntu.com/questions/261636/how-do-i-backport-install-a-newer-version-of-clang

Tuesday, March 5, 2013

Recursive global replace

 find ./ -type f -exec \
 sed -i 's/\<map\>/unordered_map/g' {} +
under a folder, do an exact match, and recursively replace to a new word.

The motivation was this: I want to upgrade my source code to C++11. To be more efficient, all the old <map> header and usage, which is log(n), should be replaced by the new hash function in <unordered_map>. But there are other names with prefix or postfix "map", which should not be changed.