2009-06-23

Tools for Linux, MySQL, OpenVZ...

Useful tools for Linux, MySQL, OpenVZ, etc.

dstat - disk and memory statistics
vmstat - virtual hosts statistics
htop - like top but more user friendly
mytop - like top but does MySQL monitoring
ipcs - ipc facilities info
ntop - like top but for network statistics
gparted - GNOME partition editor, allows drag and drop (partition magic for Linux)

2009-06-03

Subversion keywords: svn propset

While commiting file into subversion you can get following error:

File: trunk/etc/init.d/apache-local
Appears to be a text file, yet it does not allow RCS Id substitution.
Sorry, this is a rule. Please fix svn:keywords.


Solution

svn propset 'svn:keywords' 'Author Date Id Revision' file-name


Shell alias

alias svnpropset='svn propset '\''svn:keywords'\'' '\''Author Date Id Revision'\'''


Other examples

set file executable flag:
svn propset 'svn:executable' 1 filename


Another svn task: list files which will be altered by further svn update
svn st -u


2009-05-26

SSH file system: FUSE

Install:
apt-get install sshfs

Mount remote home:
sshfs hostname: mountpoint

Mount under different user:
sshfs user@hostname: mountpoint

Mount specific path:
sshfs hostname:/path mountpoint

Umount:
fusermount -u mountpoint

source: http://fuse.sourceforge.net/sshfs.html

2009-05-14

Burning DVD in Debian Linux

Burning CD / DVD under Debian / Kubuntu

# Install k3b
apt-get install k3b libk3b2-extracodecs

# Suggested packages
k3b-i18n movixmaker-2 normalize-audio sox toolame

# Run k3b
k3b

2009-05-07

Debugging with gdb

If I want to debug some program I miss some handfull guide. Here is one:

Commands 
gdb name-of-executable 
gdb -e name-of-executable -c name-of-core-file 
gdb name-of-executable -pid process-id 
(Use ps -auxw to list process id's.) 

Resources 

Software 
cgdb - curses based gdb ide 
ddd - gdb ide for x window



Other Linux Debugging techniques


Valgrind usage

valgrind --leak-check=full \
         --show-leak-kinds=all \
         --track-origins=yes \
         --verbose \
         --log-file=valgrind-out.txt \
         ./executable exampleParam1




GCC compile/link options:
-fsanitize=address
XORs with:
-fsanitize=thread




Oracle OFFSET LIMIT


ROWNUM psuedocolumn or the ROW_NUMBER()

A:



 

2009-04-03

Must be connected to a terminal

Problem:

Connection to a remote host by ssh and starting screen in one command can cause following error:

ssh user@example.com screen -R -d
Must be connected to a terminal.

Solution:

Provide screen with a terminal by switch -t:

ssh -t user@example.com screen -R -d

Source: wlug.org.nz

2009-03-27

MySQL tools and settings

MySQL tools
apt-get install mytop

ANALYZE TABLE;

SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED ;
SET sql_mode='TRADITIONAL' ;

SET AUTOCOMMIT = 0;
SET NAMES utf-8;
SET CHARACTER SET utf-8;

(or optionally: latin2 or cp1250, cp1251, etc.)

source: MySQL modes
source2: MySQL charset