Thursday, July 14, 2011

How to rebuild the LaunchServices database

I discovered I had 6 versions of GIMP on my computer (although only one was active). If your "Open With" menu shows applications that are no longer installed, or shows some of them as duplicates, you can use the following Terminal command to rebuild your LaunchServices database:

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user -f

Wednesday, July 13, 2011

How to modify the FIGURE prefix in LATEX

How to change the prefix of all figure captions LaTeX? For example, IEEEtran defaults to "Fig.", and I wanted "Figure."?
\renewcommand{\figurename}{Figure}

Monday, July 11, 2011

How to synchronize files through a SSH shell to a unix server

I have my own server, but until today I'd just manually update the files I changed. Never once thought of writing a script to do it for me... Until today. Solution? RSYNC!


rsync -e ssh -avz ./FOLDER ssh.server.address:NEW_FOLDER_LOCATION/

rsync's speciality lies in its ability to analyse files and only copy the changes made to files rather than all files. This can lead to enormous improvements when copying a directory tree a second time.

-a Archive mode, most likely you should always keep this on. Preserves file permissions and does not follow symlinks.
-v Verbose, lists files being copied
-z Enable compression, this will compress each file as it gets sent over the pipe. 
-e ssh Uses ssh as the transport, this should always be specified.


Make sure that rsync is installed on both client and server machines. I've heard that rsync has problems with trailing spaces and characters, so notice that there is NONE on the folder, but there is one on the new folder location.