*****************************************************************
************       Former Linux Secrets v023         ************
************       2007/6/25 - [email protected]       ************
*****************************************************************



**************************************
*******  FEUP VPN & Wireless *********
**************************************

Instalação do cliente vpn em pptp em ubuntu (para ligar à FEUP NET sob linux)

Instalação da placa wireless pci/pcmcia com o chip da Broadcom 4317 em ubuntu (Drivers+Info)


*********************************
************  Kylix  ************
*********************************
-------- Guide to Installing 5dpo's Setup  ------

Link to Kylix5dpo.pdf 
http://www.fe.up.pt/~asousa/lunxadas/Kylix_5dpo.pdf

-------- Other Kylix Info ------  


Paulo Marques and Paulo Costa fixed Kylix for recent >2.6.10 kernels

We've now been able to make the debugger work with any recent kernel (I hope) using a stub that intercepts system calls made by the debugger, so that it simulates the old kernel behavior. I've posted the file with the stub to borland.public.attachments.
To make the debugger work:
- unzip the stub file
- place the ptrace_interposer.so in /usr/lib (for instance)
- do export "LD_PRELOAD=/usr/lib/ptrace_interposer.so" before calling "startdelphi"

This works for us under both kernel 2.6.12 and 2.6.16-rc3. The debugger doesn't hang anymore and works just fine.

Get ptrace4.tar.gz at my page - Thank you Paulo Marques & Paulo Costa !!!

------------------------------------------------------------------

To have nice fonts, change in: ~/.borland/.borlandrc

[Tweak.Layout]
WineLook=Win95

You may also want to delete ~/.kderc

------------------------------------------------------------------

Arrancar kylix em kernel 2.6 -- no kylix3/bin/startdelphi acrescentar:
export LD_ASSUME_KERNEL=2.4.2

------------------------------------------------------------------

http://www.linuxquestions.org/questions/history/215425

echo 1 > /proc/sys/vm/legacy_va_layout

I added it to /etc/rc.d/rc_local
then I start kylix with...
export LD_ASSUME_KERNEL=2.2.5; ./startdelphi
------------------------------------------------------------------

http://forum.clubedelphi.net/viewtopic.php?t=79016&highlight=autocompletar

Siga os passos abaixo para corrigir o problema do auto-completar do kylix 3 no kernel 2.6

------------------------------------------------------------------

Poder executar apps standalone Kylx por no .bash_profile ou /etc/bashrc:

app_ld_path=~/kylix3/bin
if [ -n "$LD_LIBRARY_PATH" ]; then
export $LD_LIBRARY_PATH="$app_ld_path:$LD_LIBRARY_PATH"
else
export LD_LIBRARY_PATH="$app_ld_path"
fi
------------------------------------------------------------------

To prevent CTRL+F2 from going to screen 2, allowing kylix/lazarus to reset the debugger,

Regional & Accessibility -> Keyboard Shortcuts -> Shortcut Sequences -> (reset the change to desktop 2)

------------------------------------------------------------------

Kylix / Lazarus F12 troca entre Form e Código:

Configure your desktop -> LookNFeel -> Window Behavior -> Advanced -> Focus Stealing ... : None

------------------------------------------------------------------

Kylix Open no "Nag Screen" (run arguments): -ns

------------------------------------------------------------------

Corrigir teclas dentro do Kylix (wine?): xmodmap ~/.Xmodmap.pt no ~/.bash_profile

Cópia do meu ficheiro .Xmodmap.pt .

Ver codigos de teclas & eventos X: xev (num terminal)

------------------------------------------------------------------



***********************************************************
************               Lazarus             ************
***********************************************************


Erro:
"Can not load Postgresql client. Is it installed (libpq.so) ?"

(have you restarted lazarus ???)

Add the path to seach libpq* from the PostgreSQL installation.
In linux add the path to the libpq.so file to the libraries section in your /etc/fpc.cfg file.
For example I have the following entry: -Fl/usr/local/pgsql/lib
In windows, add these libs anywhere in the Path environment varible...

Por icone no projecto, lazarus 0.9.20, sob windows:

1. Fazer um project.rc com o texto:
MAINICON ICON "editor.ico"

2. Executar na command line:
windres -i project.rc -o project.res

3. Inclui no *.lpr com o comando :
{$R project.res}


***********************************************************************
************ Coriander & 1394 Firewire Libs ***********
***********************************************************************
To fix the list of run time libraries use /etc/ld.so.conf and then run ldconfig

The ...SDL... libs exist in Mandriva releases (no need to compile)

Initial releases of mandriva 10.x have bugs in the creation of devices -- this prevents coriander from working.  Here is a quick solution to rebuild devices that may deseapear after reboot. This my coriander_init file:

#!/bin/bash

#mknod -m 666 /dev/raw1394 c 171 0
#mkdir /dev/video1394
#mknod -m 666 /dev/video1394/0 c 171 16
#mknod -m 666 /dev/video1394/1 c 171 17
#mknod -m 666 /dev/video1394/2 c 171 18
#mknod -m 666 /dev/video1394/3 c 171 19
#chmod 777 /dev/video1394/
#chmod 777 /dev/raw1394
modprobe video1394
modprobe raw1394
------------------------------------------
Apperently a quick and dirty solution to a bug in some Mandrake 10.x distros, add the above chmods to the /etc/rc file in order to correct permissions at startup without manual hassle...
------------------------------------------


To install coriander André Carvalhosa & Tiago Leite documented the following:

Libraw
1 - Extrair a libraw1394 numa directoria;
2 - Abrir um terminal nessa directoria;
3 - Executar ./configure;
4 _ Executar make;
5 - Passar para root (su + password);
6 - Executar make install;
7 - Executar make dev;
8 - Mudar as permissões do device /dev/raw1394 executando chmod a+rw /dev/raw1394;
9 - Mudar as permissões do ficheiro /etc/ld.so.conf executando chmod a+rw /etc/ld.so.conf;
10 - Adicionar a directoria /usr/local/lib ao ficheiro /etc/ld.so.conf;
11 - Executar ldconfig (demora alguns segundos);

Libdc
12 - Extrair a libdc1394 numa outra directoria;
13 - Abrir um terminal nessa directoria;
14 - Executar ./configure;
15 - Executar make;
16 - Passar para root (su + password);
17 - Executar make install;

mk1394nd
18 - Extrair o ficheiro mk1394nd para uma directoria;
19 - Abrir um terminal nessa directoria;
20 - Passar para root (su + password);
21 - Executar ./mk1394nd;
22 - Executar chmod a+rw /dev/video1394/0
23 - Colocar o comando anterior no root do linux para ser executado sempre que este é chamado
ou sempre que o computador arranca (exemplo: /etc/rc)!

Conteudo do ficheiro mk1394nd:
#!/bin/bash
mknod -m 666 /dev/raw1394 c 171 0
mkdir /dev/video1394 
mknod -m 666 /dev/video1394/0 c 171 16
mknod -m 666 /dev/video1394/1 c 171 17
mknod -m 666 /dev/video1394/2 c 171 18
mknod -m 666 /dev/video1394/3 c 171 19


*********************************************** 
************  General Linux Stuff  ************
***********************************************

See Assembly code: objdump -d prog

Mount Floppy: mount -t msdos /dev/fd0 /mnt

Mount an *.iso: mount -t iso9660 iso_file.iso /mnt/mount_location -o /dev/loop0

To mount a samba remote share: 
mount -t smb -o username=xxx,password=xxx //machine/share /mount/point

GCC Produzir ASM: gcc -S

GCC todos os avisos: -Wall

Permitir teclas do cursor na KSH: set -o vi

Descobrir onde + porque estoura um executavel binario: strace

FSTAB para aceder a um share windows (SMBClient):
//diogocao/d$ /mnt/diogocao_d smbfs user,noauto,username=...,password=...,_netdev 0 0

SMBClient (pergunta passwd): smbclient //winshare/dir -U username

Ejectar o CDROM: eject

Trabalhos de Impressora: lpc , lpq , lprm

Procurar no texto (appropos) dos HELPs: man -k seach_in_help_files

Utilizar ALT+F2 para lançar "Run box" e depois pedir man:command ou info:command

Utilizar Ctrl+Alt+Esc para lancar o XKILL

Utilizar Ctrl+Esc para lancar o gestor de processos

Utilizar ALT para mover a janela

Quando nao desmonta (lazy): umount -l device_or_mount

Quando nao desmonta (force): umount -f device_or_mount

Listar ficheiros abertos: lsof

Listar processos que estão a utilizar um dado ficheiro ou socket: fuser

Secure Copy (atraves da rede):
scp from_user@from_ip.ip.ip.ip:/complete/file/loc to_user@to_ip.ip.ip.ip:/complete/file/loc

Sincronizar ficheiros de um computador (remoto) para este computador (local) [aparentado do scp]:
rsync -avHz [email protected]:/remote/tree /local/tree
rsync -avHz --rsh=ssh [email protected]:/remote/tree /local/tree

Ver Mensagens Inicio: dmesg

Ver Ultimas n linhas de um ficheiro: tail

Em BASH, exportar o display para a manquina de onde estou a conectar-me: export DISPLAY=$REMOTEHOST

Permitir comandar o servidor X da minha maquina local: xhost +ip.ip.ip.ip

Permitir q toda a gente possa comandar o servidor X da minha maquina local: xhost +

Fazer backup comprimindo tudo num unico ficheiro BZIP2:
tar -cjvf fich.bzip2.tar file_list

Ver particoes em modo de texto (melhor q o fdisk): cfdisk

----> KDE Admin + Drak Wizards

Para configurar ethernet linha de comando:
ifconfig eth0 ip.ip.ip.ip
route add default gw ip.ip.ip.ip

**************************************************** 
************        PostGreSQL          ************
****************************************************

PostGreSQL MDK 10.1:
su postgres
initdb -D ~/postgresql_databases U

Arrancar servidor:
/usr/bin/postmaster -D ~/postgresql_databases
/usr/bin/pg_ctl -D ~/postgresql_databases -l logfile start

Depois:
createuser ...
createdb ...
psql ...

Config file for PGSQL: pg_hba.conf

***********************************************
***              PDF IEEE                   ***
***********************************************
Para criar documentos PDF de acordo com a norma do IEEE,
imprimir para .PS com aopção "download fonts" e executar:
ps2pdf -dMaxSubsetPct=100 -dCompatibilityLevel=1.3 -dOptimize=false -dSubsetFonts=true -dEmbedAllFonts=true -dPDFSETTINGS=/prepress sudholt.ps sudholt.pdf

[O ficheiro ps2pdf tb existe no miktex, para windows]

*********************************************** 
************      Linux KERNEL     ************
***********************************************

Cuidado!!!

acpi=off
irqpoll
apic=debug
acpi=verbose
pnpacpi=off
pci=routeirq
nocddma
nodma
verbose
apci=off
noapic
nolapic
ide=nodma
pci=noacpi

************************************************ 
************         Knoppix        ************
************************************************

Arrancar com a config Knoppix gravada anteriormente:
knoppix myconfig=/mnt/hda1
knoppix myconfig=scan

************************************************ 
************         DOSHERE        ************
************************************************

Link to my doshere.inf file  (part of an old power toy, needs corrections in the registry for w2k+)

************************************************ 
**********        RAID SW LINUX      ***********
************************************************

diskdrake

cat /etc/mdadm.conf

cat /proc/mdstat

mdadm /dev/mdXXX -a /dev/sdYYYZZZ

cat /proc/mdstat

mdadm --grow /dev/mdXXX --raid-devices=WWW

watch -n 1 cat /proc/mdstat

resize2fs /dev/mdXXX

mdadm -D /dev/mdXXX

************************************************ 
**********        RAID SW LINUX      ***********
************************************************

To mount a linux swap on a file:

Based on: http://linuxhelp.blogspot.com/2005/11/adding-swap-file-to-your-linux-system.html

1. First create a file of size 64 MB.
dd if=/dev/zero of=/my_swap_file bs=1M count=64
(Here bs is block size and count is the number of blocks to be used)

2. Make the permissions read and write for owner and no permissions for group and others.
chmod 600 /my_swap_file

3. Prepare the file to be used for swapping.
mkswap my_swap_file

4. Start using the swap file
swapon my_swap_file

* If you want this file to be used for swapping across reboots (permanently), then enter the following line in the /etc/fstab file.
/my_swap_file swap swap defaults 0 0