User talk:Mathieu
Linux
I use Linux. The main reasons are stability and ease of use (I love shells !).
Links:
Debian
Debian is really cool, you have access to billions of package one command line away. The very last package I discover is gcc-snapshot:
http://packages.debian.org/unstable/devel/gcc-snapshot
Basically you have access to gcc4.0 (+fortran !!) with no hassle. another cool stuff is that gcj comes with libjawt (jawt.h ...) can't wait to compile VTK using gcj.
gVim
Tip #312: Copy, Cut, and Paste
Zsh
Zsh simply rocks, there absolutely no reason not to switch to zsh from bash since it support all the bash command and is better:
Also read From Bash to Z Shell: Conquering the Command Line
Some usefull zsh command:
Eventhought it should be possible to set zsh to behave like vim with 'set -o vi', I am used to the 'emacs' style command in zsh:
Ctrl+a : Start of line Ctrl+e : End of line Ctrl+l : Clean screen Ctrl+u : Delete anything Ctrl+w : Delete anything on the left side of cursor Ctr+r : Historic search
Ctrl+y : Paste buffer Ctrl+d : delete active character or disconnect if empty line Alt+b / Alt+f : jump from one word to the other Ctrl+Backspace (Ctrl+w) : erase previous work Alt+d : delete next work Alt+t : exhcange current word and next one Alt+c : capitalize current letter, and uncapitalize the next letter, and jump to the end of word Ctrl+t : exchange two letters
UNIX shell differences and how to change your shell
Copy paste from: http://www.faqs.org/faqs/unix-faq/shell/shell-differences/
sh csh ksh bash tcsh zsh rc es Job control N Y Y Y Y Y N N Aliases N Y Y Y Y Y N N Shell functions Y(1) N Y Y N Y Y Y "Sensible" Input/Output redirection Y N Y Y N Y Y Y Directory stack N Y Y Y Y Y F F Command history N Y Y Y Y Y L L Command line editing N N Y Y Y Y L L Vi Command line editing N N Y Y Y(3) Y L L Emacs Command line editing N N Y Y Y Y L L Rebindable Command line editing N N N Y Y Y L L User name look up N Y Y Y Y Y L L Login/Logout watching N N N N Y Y F F Filename completion N Y(1) Y Y Y Y L L Username completion N Y(2) Y Y Y Y L L Hostname completion N Y(2) Y Y Y Y L L History completion N N N Y Y Y L L Fully programmable Completion N N N N Y Y N N Mh Mailbox completion N N N N(4) N(6) N(6) N N Co Processes N N Y N N Y N N Builtin artithmetic evaluation N Y Y Y Y Y N N Can follow symbolic links invisibly N N Y Y Y Y N N Periodic command execution N N N N Y Y N N Custom Prompt (easily) N N Y Y Y Y Y Y Sun Keyboard Hack N N N N N Y N N Spelling Correction N N N N Y Y N N Process Substitution N N N Y(2) N Y Y Y Underlying Syntax sh csh sh sh csh sh rc rc Freely Available N N N(5) Y Y Y Y Y Checks Mailbox N Y Y Y Y Y F F Tty Sanity Checking N N N N Y Y N N Can cope with large argument lists Y N Y Y Y Y Y Y Has non-interactive startup file N Y Y(7) Y(7) Y Y N N Has non-login startup file N Y Y(7) Y Y Y N N Can avoid user startup files N Y N Y N Y Y Y Can specify startup file N N Y Y N N N N Low level command redefinition N N N N N N N Y Has anonymous functions N N N N N N Y Y List Variables N Y Y N Y Y Y Y Full signal trap handling Y N Y Y N Y Y Y File no clobber ability N Y Y Y Y Y N F Local variables N N Y Y N Y Y Y Lexically scoped variables N N N N N N N Y Exceptions N N N N N N N Y Key to the table above. Y Feature can be done using this shell. N Feature is not present in the shell. F Feature can only be done by using the shells function mechanism. L The readline library must be linked into the shell to enable this Feature. Notes to the table above 1. This feature was not in the orginal version, but has since become almost standard. 2. This feature is fairly new and so is often not found on many versions of the shell, it is gradually making its way into standard distribution. 3. The Vi emulation of this shell is thought by many to be incomplete. 4. This feature is not standard but unoffical patches exist to perform this. 5. A version called 'pdksh' is freely available, but does not have the full functionality of the AT&T version. 6. This can be done via the shells programmable completion mechanism. 7. Only by specifing a file via the ENV environment variable.
Other link to documentation:
Mac OSX
Some tricks I always forgot on MacOSX:
ldd -> otools -L
strace/ltrace -> ktrace / kdump
Configuring and running X11 on MacOSX
Valgrind
gdb and valgrind
some valgrind 'feature' to gdb an unitialized var you need to use valgrind macro:
From [How to output address of the unitialized value? ]
Your best bet in that case is to inspect the code at the failing location and see if there is an obvious cause, and if not then to try inserting some assertions using the valgrind macros to try and work out what is uninitialised - assertions like this will do it:
assert( !VALGRIND_CHECK_READABLE( &variable, sizeof( variable ) ) );
file open and valgrind
You can track how many files are open when your programm terminates if you use the flag (works only with recent valgrind version):
--track-fds=yes
Another approach is to use:
strace -eopen
GDB
Yet another trick for debugging the destructor of a class: Steps:
nm --defined-only -C vtkEnSight6Reader.o | grep '~'
copy the hexadecimal for those symbol then do
nm --defined-only vtkEnSight6Reader.o | grep 'my_symbol'
then you just need to add a breakpoint on that particular symbol, repeat if more than one destructor.
CMake
Another trick when writting regex in CMake, look at:
http://www.aivosto.com/vbtips/regex.html
It's fairly well describe
Xvfb
How to run a VTK dashboards without window poping up (using Xvfb):
sudo apt-get install xvfb
Xvfb :9 -ac -screen 0 300x300x24 export DISPLAY=:9 ctest -D Experimental
Links: http://lists.debian.org/debian-user/2004/11/msg02220.html
just for the archive: found the solution on the net, the file named by -auth should simply contain host names in cleartest. In my case I made a file /etc/X99.cfg containing the single line: localhost and call Xvfb thus: Xvfb :86 -auth /etc/X99.cfg -screen scrn 800x600x32 &
xvfb could not init font path element usr x11r6 lib x11 fonts cid removing list
Better user Xvfb. Depending on the distribution you use you can place a start script like this in /etc/init.d or /etc/rc.d/init.d to start xvfb. XVFB=/usr/X11R6/bin/Xvfb XVFBARGS=":99 -screen 0 1024x768x24 -fbdir /var/run -ac" PIDFILE=/var/run/xvfb.pid case "$1" in start) echo -n "Starting virtual X frame buffer: Xvfb" start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS echo "." ;; stop) echo -n "Stopping virtual X frame buffer: Xvfb" start-stop-daemon --stop --quiet --pidfile $PIDFILE echo "." ;; restart) $0 stop $0 start ;; *) echo "Usage: /etc/init.d/xvfb {start|stop|restart}" exit 1 esac exit 0 This is what we use for debian. :99 is the value for the xserver id that must be set in the DISPLAY env. DISPLAY=localhost:99.0 Additionaly you have to define a link in /etc/rc?.d to this file for the run levels where you need the Xvfb. (This is for debian, other distributions
Xvfb
- http://public.kitware.com/pipermail/vtkusers/2000-November/054336.html
- http://www.cs.mcgill.ca/~stever/mayavi.html
Running your dashboard with Xvfb (=a quick way to have an offscreen dashboard).
sudo apt-get install xvfb Xvfb :99 -screen scrn 300x300x24 -ac -fbdir /tmp export DISPLAY=:99 ctest -D Experimental
You can look what is going on with:
xwd -root -display :98 | xwud
I could not find any way to directly look at
xwud -in /tmp/Xvfb_screen0
xwud only works with 8bits...
A nice script for your dashboard to specify different screen for each dashboard (no need to be root !):
#! /bin/sh # Startup script for Xvfb (also to stop it properly) # Found on: http://marc.theaimsgroup.com/?l=tomcat-user&m=102335321103262&w=2 XVFB=/usr/X11R6/bin/Xvfb #XVFBARGS=":99 -screen 0 1024x768x24 -fbdir /var/run -ac" XVFBARGS=":$2 -screen 0 1024x768x24 -fbdir /tmp -ac" echo $XVFBARGS #PIDFILE=/var/run/xvfb.pid PIDFILE=/tmp/xvfb$2.pid case "$1" in start) echo -n "Starting virtual X frame buffer: Xvfb" /sbin/start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS echo "." ;; stop) echo -n "Stopping virtual X frame buffer: Xvfb" /sbin/start-stop-daemon --stop --quiet --pidfile $PIDFILE echo "." ;; restart) $0 stop $0 start ;; *) echo "Usage: xvfb {start|stop|restart}" exit 1 esac exit 0
ATI (fglrx)
For some reason seems to work outof the box, no need for the LIBGL_ALWAYS_INDIRECT=1 magic...
NVidia
Couldn't get the thing to work. I had to use Mesa instead. For some reason
ctest -R Mace
Was only working for the first Mace but breaking on the second with:
X Error of failed request: BadAlloc (insufficient resources for operation) Major opcode of failed request: 147 (GLX) Minor opcode of failed request: 3 (X_GLXCreateContext) Serial number of failed request: 35 Current serial number in output stream: 36
I solved it using LD_PRELOAD=/opt/Mesa/lib/libGL.so
Stuff TODO
- I need to setup a guide to cross compile VTK on debian
- http://people.debian.org/~debacle/cross.html
- http://www.creatis.insa-lyon.fr/~bellet/creatis/cygwin/cross.html
- I ................... install intel icc on debian linux (all versions)
- http://colt.projectgamma.com/intel/ixc-debian.html
- http://archive.daniel-baumann.ch/linux-from-scratch/hints/intel-c-compiler/
- http://www.theochem.uwa.edu.au/fortran/intel_on_debian
I still canot boot into BeOS using grub:
- http://www.linux-sxs.org/administration/grubbeos.html
- http://f3wm.free.fr/linux/grub.html
- http://www.linuxforums.org/tutorials/1/tutorial-19999.html
- http://leaf.sourceforge.net/doc/guide/bugrub.html
Keep an eye on svn:
[ugly problem found while trying to test KDE SVN] http://svn.haxx.se/dev/archive-2005-02/0897.shtml
[How do you tell the compiler to make a member function inline?] http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.7
Borland:
- http://www.cs.wustl.edu/~schmidt/ACE_wrappers/include/makeinclude/compiler.bor
- http://www.objectcentral.com/vide/help/videdoc/bcc32.html
- http://www.roguewave.com/support/docs/hppdocs/mny211bd/4-6.html
Add a proper steps to install Free C++ Tools (with libcmtd.lib), copy/paste stuff from:
http://wiki.wxwidgets.org/wiki.pl?Installing_WxWin_For_MS_Free_Tools
Also add ctest example