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

Restrict Apache with .htpasswd

Setup

Create access file (.htaccess)
Create password files (.htpasswd, .htgroups)
Place the files to corresponding location

Required files

.htaccess
in your DocumentRoot
.htpasswd in the desired path
.htgroups (optional)


Create .htpasswd file

Create
your new own .htpasswd file:
htpasswd -c /home/user/www/.htpasswd my_user_name

Add user to existing .htpasswd:
htpasswd /home/user/www/.htpasswd another_user_name


Create .htaccess in your document root

.htaccess

AuthType Basic
AuthName "Restricted Files"
AuthUserFile /home/user/www/.htpasswd
#
# Allow access only for user 'my_user_name'
Require user my_user_name
#
# Require user which belongs to particular group
AuthGroupFile /home/user/www/.htgroups
Require group GroupName
#
# Require any valid user mentioned in htpasswd
Require valid-user

.htgroups (optional)
GroupName: my_user_name

.htpasswd (just example)
my_user_name:mOF02rW7UXe0w

Sources
src: http://httpd.apache.org/docs/2.0/howto/auth.html
src: http://httpd.apache.org/docs/2.0/programs/htpasswd.html

Change default locale in Debian Linux

Change locale in Command line

Commands:
dpkg-reconfigure locales
locale-gen en_US.UTF-8


GNOME

Go to GNOME - System > Administration > Language Support


KDE

Go to KDE - System Settings > Regional & Accessibility > Country/Region & Language


Files
Default locale: /etc/default/locale
Generated locales: /etc/locale.gen
Available locales: /usr/share/i18n/SUPPORTED
/var/lib/locales/supported.d/local