Utilitats i trucs

Index

MS Windows 2000/NT i Linux

  1. A la instal·lació de Linux: posar el Lilo a la partició principal de Linux (NO al Master Boot Record). Si teniu problemes perquè la vostra partició comença en un cilindre més gran que 1024, proveu a afegir l'opció lba32 (una línia sola, cap al principi) al fitxer /etc/llilo.conf.
  2. Des de Linux: si la partició principal és, per exemple /dev/hda7 :
    dd if=/dev/hda7 of=/root/bootsec.lin bs=512 count=1
  3. Des de Linux: moure el fitxer creat a la partició MSWindows:
    cp /root/bootsec.lin /mnt/<partició de MSWindows>
    Si no podem muntar el disc de MSWindows (perquè sigui NTFS i no VFAT, per exemple), podem gravar el fitxer en un disquet (cp /root/bootsec.lin /mnt/floppy) i copiar-lo a c:\bootsec.lin des de MSWindows.
  4. Des de Windows 2000: afegir al fitxer c:\boot.ini la línia
    c:\bootsec.lin = "Linux"
  5. Si tot ha anat bé, quan arrenquem l'ordinador, el loader de W2000 ens demanarà si volem arrencar des de Linux o des de W2000.

Resin

  • La variable d'entorn JAVA_HOME ha de contenir l'adreça de la distribució del JDK:
    • csh: en el fitxer .cshrc
      setenv JAVA_HOME /usr/local/jdk1.2.2/
    • bash: en el fitxer .bashrc
      JAVA_HOME=/usr/local/jdk1.2.2/
      export JAVA_HOME

Resin i Apache

Per a fer servir el Resin amb l'Apache (assegureu-vos que teniu l'apache-devel) heu de posar aquestes opcions quan compileu el Resin (tot en una línia):
  • ./configure --with-apache-libexec=/usr/lib/apache --with-apache-include=/usr/include/apache --with-apache-conf=/etc/httpd/conf/httpd.conf

Resin i MS Internet Information Server

En el fitxer resin.conf una configuració d'aquest tipus no funciona:
  • <http-server>
    <http-port>8888<http-port/>
    <app-dir>doc<app-dir/>
    <http-server/>
Ha de ser tot en una sola línia:
  • <http-server port='8888' app-dir='doc'/>

Apache

  • Virtual hosts
    • /etc/httpd/conf/vhosts.d/*.conf:
      • <Directory "/var/www/html_2">
            Options -Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
  • HTTPS server
    • urpmi apache-mod_ssl
    • Server certificate


      • openssl - /etc/pki/tls/

        Apache config



        generated file
        BEGIN name
        value
        self signed
        server key
        openssl genrsa -des3 -out server.key 4096 server.key
        RSA PRIVATE KEY
        SSLCertificateKeyFile
        /etc/pki/tls/private/server.key
        server request for signing
        openssl req -new -key server.key -out server.csr server.csr
        CERTIFICATE REQUEST


        server certificate (self signed)
        openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt server.crt
        CERTIFICATE SSLCertificateFile /etc/pki/tls/certs/server.crt
        CA + signed
        CA key
        openssl genrsa -des3 -out ca.key 4096 ca.key RSA PRIVATE KEY

        misc/CA -newca /etc/pki/tls/demoCA/private/cakey.pem

        CA certificate

        CERTIFICATE

        openssl req -new -x509 -days 365 -key ca.key -out ca.crt ca.crt


        server key openssl genrsa -des3 -out server.key 4096 server.key RSA PRIVATE KEY SSLCertificateKeyFile /etc/pki/tls/private/server.key
        misc/CA -newreq /etc/pki/tls/newkey.pem

        server request for signing /etc/pki/tls/newreq.pem CERTIFICATE REQUEST

        openssl req -new -key server.key -out server.csr server.csr

        server certificate openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt server.crt CERTIFICATE SSLCertificateFile /etc/pki/tls/certs/server.crt
        misc/CA -sign /etc/pki/tls/newcert.pem


        misc/CA no funciona! Workaround to avoid bugs in misc/CA:
        mkdir /etc/pki/tls/newcerts
        touch /etc/pki/tls/index.txt
        ...
      • Inspect content:
        BEGIN/END
        extensions
        openssl
        RSA PRIVATE KEY
        • key
        • pem
        openssl rsa -noout -text -in toto.key
        CERTIFICATE REQUEST
        • csr
        openssl req -noout -text -in toto.csr
        CERTIFICATE
        • crt
        openssl x509 -noout -text -in toto.crt

      • X509:


        notes
        C
        Country name

        ST
        State or province name

        L
        Locality name

        O
        Organization name

        OU
        Organization unit name

        CN
        Common name
        • Must exactly match "ServerName" in Apache config
        • Must be different in CA and a certificate signed by the CA
        emailAddress
        Email address


      • Secure Websites Using SSL And Certificates
        • cd /etc/pki/tls
        • misc/CA -newca
          • Common Name (eg, your name or your server's hostname) []:hostname
        • misc/CA -newreq
          • Common Name (eg, your name or your server's hostname) []:hostname.yourdomain.com
        • misc/CA -sign
        • mv newcert.pem hostnameCert.prm; cp /etc/pki/tls/hostnameCert.prm /etc/pki/tls/certs/hostname.crt
        • mv newkey.pem hostnameKey.pem; cp /etc/pki/tls/hostnameKey.pem /etc/pki/tls/private/hostname.key
        • /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf
          • Optional:
            DocumentRoot "/var/www/html_segur"
            <Directory "/var/www/html_segur">
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                Allow from all
            </Directory>

          • SSLCertificateFile /etc/pki/tls/certs/hostname.crt
          • SSLCertificateKeyFile /etc/pki/tls/private/hostname.key
        • to avoid entering the passphrase every boot:
          • cd /etc/pki/tls/private; cp hostname.key hostname.key.orig; openssl rsa -in hostname.key.orig -out hostname.key; chmod 700 hostname.key
      • Creating Certificate Authorities and self-signed SSL certificates
      • /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf
    • Client certificate request:
      • CA certificate (Autenticación DNIe con Apache2 y PHP):
        • cd /etc/pki/tls/certs/
        • wget http://www.dnielectronico.es/ZIP/ACRAIZ-SHA1.zip
        • unzip ACRAIZ-SHA1.zip
        • openssl x509 -in ACRAIZ-SHA1.crt -inform DER -out ACRAIZ-SHA1.crt -outform PEM
      • /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf
        • SSLEngine on
          #CA certificate (PEM encoded) whose client certificates the server is prepared to accept
          SSLCACertificateFile
          /etc/pki/tls/certs/ACRAIZ-SHA1.crt
          SSLVerifyClient require
          SSLVerifyDepth  10
      • Si quan el client es connecta apareix un error del tipus ssl_error_handshake_failure_alert, pot ser que:
        • el servidor no tingui el SSLCACertificate adequat
        • el client no tingui instal·lat el DNIe
    • service httpd restart
  • Authentication, Authorization and Access Control (htaccess,...) / Access Control (Apache 2.2)
    • User Authentication
    • How to Use OpenSSL to Create PKCS#12 Certificate Files
      • pkcs12 = [.crt] + [.key] + [root.crt]
      • [openssl x509 –in root.crt –inform DER –out root_pem.crt –outform PEM]
      • [openssl x509 –in input.crt –inform DER –out output_pem.crt –outform PEM]
      • [openssl rsa –in input.key –inform DER –out output_pem.key –outform PEM]
      • openssl pkcs12 -export -in output_pem.crt -inkey output_pem.key [-certfile root_pem.crt] -out bundle.p12
      • Nota: els fitxers .crt i .key generats amb openssl, ja són, per omissió, en format PEM
    • mod_auth_basic, mod_auth_digest
      • mkdir /var/www/passwd
      • htpasswd -c /var/www/passwd/passwords user_name
      • /etc/httpd/conf/httpd.conf
        • <Directory "/var/www/html/protegit">
            AuthType Basic
            AuthName "Zona protegida"
            # (Following line optional)
            AuthBasicProvider file
            AuthUserFile /var/www/passwd/passwords
            Require valid-user
          </Directory>
      • http://server/protegit/
    • mod_auth_cert
    • mod_auth_certificate (*)
  • WebDAV
    • urpmi apache-mod_dav
    • httpd.conf:
      • Listen 8080 (optional)
      • LoadModule dav_module modules/mod_dav.so
      • LoadModule dav_fs_module modules/mod_dav_fs.so
      • LoadModule dav_lock_module modules/mod_dav_lock.so
      • DAVLockDB /var/lock/apache2/DAVLock
        Alias /toto /var/www/toto
        <Location /toto>
          Dav on
        </Location>
        <Directory "/var/www/toto">
            Options -Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    • client
      • Dolphin
        • webdav://server[:8080]/toto
      • Windows browser
        • \\server[:8080]\toto

Tomcat

  • Per a instal·lar-lo en MS Windows, falta el fitxer:
  • Axis2: name of the host behind a NAT (wdsl file) (*)
    • WEB-INF/conf/axis2.xml
      • <axisconfig name="AxisJava2.0">
              ...
            <!-- Following parameter will set the host name for the epr-->
            <parameter name="hostname" locked="true">myhost.com</parameter>

DOS-UNIX

  • Per a canviar el tipus de fitxer de DOS (amb retorns de carro ^M) a UNIX (retorns de carro senzills): dos2unix
  • Noms de fitxer de majúscula a minúscula:
    #! /bin/csh
    foreach f ( * )
    mv $f `echo $f | tr '[A-Z]' '[a-z]'`
    end

    #! /bin/bash
    for f in *;
    do mv $f `echo $f | tr '[A-Z]' '[a-z]'`;
    done

Canvi de nom 

  • #! /usr/bin/bash
    comptador=1;
    while test $comptador -le $1
    do
    mv Imatge${comptador}.hist Imatge${comptador}_rgb_256d.hist
    let comptador=$comptador+1
    done

Conversió de MS-Word a PDF

  • Des d'OpenOffice:
    1. Obriu el fitxer .doc i feu "Exporta com a PDF".
    2. Per a generar vistes prèvies i hiperenllaços: extendedPDF
  • Des de MS Word:
    1. Assegureu-vos que a Windows teniu configurada una impressora PostScript. Si no, aneu a Inici/Configuració/Impressores i afegiu-ne una altra, del tipus PostScript (p.ex. qualsevol HP LaserJet, o bé una genèrica).
    2. Obriu el fitxer amb MS Word.
    3. Imprimir / A fitxer: toto (assegureu-vos que a les opcions d'impressora hi ha Opcions de Postscript / Màxima portabilitat; si està activa l'opció de màxima velocitat podeu tenir problemes de numeració de les pàgines en el fitxer PS generat). La impressora seleccionada ha de ser la de tipus PostScript.
    4. Des de l'explorador de Windows (o similar) canvieu el nom de fitxer de toto.prn a toto.ps
    5. Feu la conversió de Postscript a PDF.
  • Des de MS Word:

Conversió de Postscript a PDF

  • UNIX
    1. ps2pdf toto.ps toto.pdf
  • MS Windows
    1. Obriu toto.ps amb el GSView (assegureu-vos que utilitzi Ghostscript >=6.01; si no, algunes lletres poden quedar amb quadrets [format bitmap en lloc del desitjat vectorial])
    2. Imprimiu-lo a fitxer amb el dispositiu pdfwrite: toto.pdf

Múltiple pàgina en PostScript

  • psnup -2 toto.ps toto.2.ps

PDF

  • Manipulació
    • pdftk
      • separa en pàgines individuals / split into single pages:
        • pdftk toto.pdf burst
      • uneix documents / join documents
        • pdftk 1.pdf 2.pdf cat output 12.pdf
    • PDF-Xchange viewer
  • Edició
    • Inkscape

Substitució / Replacement

  • Per a substituir totes (g) les cadenes inici en el fitxer fitxer_original per final, en fitxer_final:
    sed 's/inici/final/g' fitxer_original > fitxer_final
  • En tots els fitxers del directori public_html
    #! /bin/bash
    for f in public_html/*;
    do
    echo $f;
    sed 's*<P ALIGN=center>*<P STYLE="text-align:center">*g' $f > ${f}#;
    rm -f $f;
    mv ${f}# $f;
    done
  • kfilereplace (KDE)

X-face

  • giftoppm face.gif | ppmtopgm |pgmnorm |pnmscale -xy 48 48 |pgmtopbm > face.pbm
  • pbmmake -white 48 48 |pnmpaste face.pbm 0 0 |pbmtoicon |tail +3 |compface > face.xface

Registre MS Windows

  • Auto login: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\
    • AutoAdminLogon REG_SZ 1
    • DefaultUsername REG_SZ usuari
    • DefaultPassword REG_SZ contrasenya
    • DefaultDomainName REG_SZ
  • Auto login gràfic: control userpasswords2
  • Execució a l'inici: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Xerces

  • Xerces C++ samples
  • MS Visual / MFC:
    • To avoid errors of type "error LNK2001: unresolved external symbol" about a function containing wchar:
      • Project Poperties (All Configurations) / Configuration Properties / C/C++ / Language / Treat wchar_t as Built-in type: No
  • Ambiguous DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentFragment
    • #define WIN32_LEAN_AND_MEAN // to vaoid using MSxml.h
  • DOMWriter
    • delete of object LocalFileFormatTarget to close and release the file
  • Active-X: to avoid failed registration, copy all xerces .lib and .dll files into the same directory of .ocx file to be registered.
  • Memory leaks
    • cal alliberar sempre el resultat d'un transcode (or better: use std:string instead of char*):
      • char *pStringValorNode;
      • pStringvalorNode = XMLString::transcode( nodeAtribut->getNodeValue() );
      • XMLString::release(&pStringValorNode);
  • Avoid loading (downloading) external DTD:
  • Read from memory (parse a string):
    • string cadena;
    • const char*  gXMLInMemBuf = cadena.c_str();
    • static const char*  gMemBufId = "prodInfo";
    • MemBufInputSource* memBufIS = new MemBufInputSource(
              (const XMLByte*)gXMLInMemBuf,
              strlen(gXMLInMemBuf),
              gMemBufId,
              false );
    • XercesDOMParser *parser = new XercesDOMParser;
    • parser->parse(*memBufIS);
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = parser->getDocument();
  • Copy of a node:
    • same document:
      • nodeA2 = nodeA1->cloneNode( true );
      • nodeRootA->appendChild( nodeA2 );
    • different documents (docA -> docB):
      • nodeB1 = docB->importNode( nodeA1, true );
      • nodeRootB->appendChild( nodeB1 );
  • Moving nodes from one document (docA, containing nodeA1) to another (docB, containing elB1), using fragments:
    • nodeA1_bis = nodeA1->cloneNode(true); (true: recursive; false: non recursive)
    • fragA1 = docA->createDocumentFragment();
    • nodeAi = fragA1->appendChild(nodeA1_bis);
    • elB2 = docB->createElement("tag");
    • nodeB3 = docB->importNode( fragA1, true );
    • elB2->appendChild(nodeB3);

VMWare / QEmu

  • Install RPM:
  • urpmi kernel-desktop-devel
  • Launch config:
    • /usr/bin/vmware-config.pl
  • Resize virtual disk size
    1. vmplayer
    2. select virtual machine -> Settings -> Utilities -> Expand disk
    3. start guest OS (eg Mandriva) in safe mode
    4. #drakdisk -> resize partition
    5. reboot
  • Resize virtual disk file (6GB -> 8GB) (NOTA: les noves versions de vmplayer ja permet el redimensionament dels discos):
    1. Install needed software
      1. urpmi qemu
      2. urpmi dkms-kqemu (plf) (needed to activate -kernel-kqemu option)
    2. resize disk from several parts (option 1, recommended):
      1. qemu-img convert WindowsXP-s001.vmdk -O raw WindowsXP-s001.raw
      2. qemu-img convert WindowsXP-s002.vmdk -O raw WindowsXP-s002.raw
      3. qemu-img convert WindowsXP-s003.vmdk -O raw WindowsXP-s003.raw
      4. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      5. cat WindowsXP-s001.raw WindowsXP-s002.raw WindowsXP-s003.raw WindowsXP-s004.raw > WindowsXP_8G.raw
      6. dd bs=1 if=/dev/zero of=WindowsXP_8G.raw seek=8G count=0
      7. qemu-img convert WindowsXP_8G.raw -O vmdk WindowsXP_8G.vmdk
    3. resize disk from several parts (option 2):
      1. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP-s004.raw seek=2G count=0
      3. qemu-img convert WindowsXP-s004.raw -O vmdk WindowsXP-s004.vmdk
      4. edit WindowsXP-s004.vmdk:
        • RW 6144 SPARSE "WindowsXP-s004.vmdk" -> RW 4192256 SPARSE "WindowsXP-s004.vmdk"
    4. resize disk from one part
      1. qemu-img convert WindowsXP_6GB.vmdk -O raw WindowsXP_8GB.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP_8GB.raw seek=8G count=0
      3. qemu-img convert WindowsXP_8GB.raw -O vmdk WindowsXP_8GB.vmdk
    5. resize partition with Gparted-LiveCD (select "force Vesa"):
      1. (modprobe kqemu)
      2. qemu -kernel-kqemu [-no-kvm] -m 512 -k es -cdrom gparted-livecd-xxx.iso -boot d -hda WindowsXP_8G.vmdk
    6. cp WindowsXP.vmx WindowsXP_8G.vmx and edit it:
      1. ide0:0.fileName = "WindowsXP_8G.vmdk"
    7. vmplayer WindowsXP_8G.vmx
  • serial device on file.vmx:
    • serial0.present = "TRUE"
    • serial0.fileName = "Auto Detect"
    • serial0.autodetect = "TRUE"
    • serial0.hardwareFlowControl = "TRUE"
  • Xarxa / Network

NFS/Samba

  • server SMBFS
    • urpmi samba-server
    • add user
  • server NFS
    • urpmi nfs-utils
    • service nfs-server start
    • /etc/exports:
      • /tmp 172.16.11.0/24(no_all_squash,async,secure,no_subtree_check,ro)
    • exportfs -ra
    • showmount -e
    • firewall (shorewall) (Réseau Linux avec NFS - Mandriva) (Configuring NFS under Linux for Firewall control)
      • /etc/sysconfig/nfs-common:
        • STATD_OPTIONS="--port 4000"
      • service nfs-common restart
      • /etc/sysconfig/nfs-server:
        • RPCMOUNTD_OPTIONS="--port 4002"
      • service nfs-server restart
      • /etc/modprobe.conf:
        • options lockd nlm_udpport=4001 nlm_tcpport=4001
      • reboot computer
      • open ports: 111/tcp 111/udp 2049/tcp 2049/udp 4000:4002/tcp 4000:4002/udp
      • check port attibution:
        • rpcinfo -p
  • client SAMBA from Unix (*):
    • urpmi mount-cifs [samba_client]
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o username=usuari_remot,password=contrasenya_remota
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd
    • /home/usuari_local/.smbpasswd
      • username=usuari_remot
      • password=contrasenya_remota
    • server client
      mount /etc/fstab
      CIFS no UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local
      //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local 0 0
      UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd 0 0
      Samba mount -t smbfs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local,nounix
      //server/dir /mnt/toto smbfs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local,nounix 0 0
    • konqueror/dolphin: smb://usuari_remot@server/dir
    • if local computer is using UTF8:
      • ... iocharset=utf8,credentials=...
    • Problemes / Problems
      • ??????????  ? ?       ?   ?                ? directory
        • Solution: umount -l /mnt/directory
  • client NFS from Unix:
    • urpmi nfs-utils-clients
    • service rpcbind start
    • service nfs-common start
    • mount -t nfs server:/tmp /mnt/toto

Compartició de carpetes en MS Windows / MS Windows sharing folders

  1. Comparteix la carpeta / Share the folder
  2. Dóna permisos a l'usuari
    • Properties / Security / Add / Advanced options / Search now
    • if Security tab is not present:
      • Tools / Folder options / View / (don't use) Simple file sharing

Open Office

  • Tipus de lletres generals / General fonts
    • Eines -> Opcions -> OpenOffice.org Writer -> Tipus de lletra bàsic
  • Estils i formatació / Styles and formatting
    • Format -> Estils i formatació (F11)
    • Copying and moving styles
    • Aplicar estils d'una pàgina mestra (ooimpress)
      • A partir d'una pàgina mestra:
        • Plafó lateral dret: Pàgines mestres -> Disponibles per a ser utilitzades (les de ~/.ooo3/user/template/)
        • Si heu modificat la pàgina mestra d'una plantilla disponible, haureu de tancar i tornar a obrir l'OpenOffice perquè els canvis es recarreguin.
      • Per a tenir més pàgines mestres disponibles, a partir de plantilles (Load additional slide masters):
        • Format -> Disseny de la diapositiva -> Carrega -> Les meves plantilles (potser les que ja surten no són les de ~/.ooo3/user/template/)
      • Si es vol importar la pàgina mestra des d'una altra presentació, primer s'haurà de desar aquesta altra presentació com a plantilla, i després aplicar el procediment descrit en el punt anterior.
  • Plantilles / Templates (.ot*)
  • Pàgines mestres / Master pages
    • Visualitza -> Mestra -> Elements mestres...: data/hora, peu, número de diapositiva (cal tancar la mestra per a actualitzar)
    • Es poden afegir tantes pàgines mestres com calgui (com si fos una presentació normal): títol, contingut,...
  • Número de pàgina
    • A la diapositiva mestre cal que hi aparegui (Elements mestres)
    • i, a més, cal activar Visualitza -> Capçalera i peu
    • Es poden desactivar també amb si trieu Format - Disseny de la diapositiva i desactiveu la casella de selecció Objectes al fons.
  • Esquema / Outline
  • Removing line breaks
    • Tools / AutoCorrect/AutoFormat
    • Options: Combine single line paragraphs if length is greater than 50%
    • Select text
    • Apply Style: Default
    • Format / AutoFormat / Apply
  • Numeració de les capçaleres / Heading numbering
    • Eines -> Numeració d'esquemes...
  • Make Table of Contents hyperlink?
    • menú: Edita l'índex o la taula -> Entrades
    • a la posició desitjada (casella en blanc), amb el botó Enllaç, incloure principi d'enllaç (LS); a la posició final, tornar a prémer el botó Enllaç per a posar un final d'enllaç (LE). El text així delimitat serà clicable.
  • Peus / capçaleres
    • Per a distingir entre capçalera i peu per a la primera pàgina i la resta, assegureu-vos que el format de pàgina és el que correspon:
      • Visualitza -> Barra d'eines -> Formatació
      • Estils de pàgina -> Primera pàgina / Per defecte
    • Activeu capçalera/peu:
      • (Estil de pàgina -> Primera pàgina / Per defecte): menú -> Modifica -> Capçalera/Peu de pàgina -> Activa
    • Editeu-los normalment
    • Per a posar text a l'extrem dret i a l'esquerre, separeu-lo amb tabuladors.
  • Per a definir la llengua del text:
    • (impress) Format -> Caràcter -> Llengua
    • Per a tot el text:
      • Eines -> Opcions -> Language settings -> Languages -> Default languages for documents -> Només per al document actual
  • Per a activar la correcció ortogràfica automàtica:
    • Edita -> Opcions -> Configuració de la llengua -> Opcions: Revisa l'ortografia a mida que es teclegi
  • Activeu el control de canvis: Edita -> Canvis -> Registra
  • L'estructura lògica s'ha de veure reflectida en la visió de l'estructura del document:
    • Edita -> Navegador
  • El cos de text ha de tenir l'estil "Cos de text".
  • Autofit text (Impress for Linux) equivalent:
    • Format -> Text -> Fit to frame
  • Per a incloure figures:
    • Insereix -> Imatge
    • Si encara no té llegenda, afegiu-la amb el menú contextual: Llegenda
    • Per a properes ocasions, si voleu que cada vegada que s'insereixi una imatge es posi automàticament una llegenda:
      • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Imatge de l'OpenOffice Writer -> Categoria: Figura
    • Posicionament del marc (marc = imatge+llegenda):
      • Alineació -> Centrada
      • Àncora -> Al paràgraf
      • Ajusta -> Sense ajustament (Cap)
    • Referència a una figura:
      • Insereix -> Referència creuada -> Insereix una referència creuada a: Categoria i número.
  • Inclusió de fitxers EPS:
    • el fitxer EPS a inserir ha d'haver estat normalitzat amb eps2eps.
    • des de l'OpenOffice: Insereix -> Imatge -> Des d'un fitxer
    • es veurà bé a la pantalla i s'imprimirà en alta qualitat
  • Taules
    • Tipus de numeració:
      • ...
    • Peu automàtic de taules:
      • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Taula de l'OpenOffice Writer -> Categoria: Taula
  • Per a eliminar les modificacions locals de format respecte el format de l'estil:
    • Format -> Formatació per defecte
  • Clipart (png, svg)
    • urpmi openoffice.org-openclipart
    • Eines -> Galeria
  • Enllaços / Hyperlinks
  • Nom de la diapositiva / Slide name
  • Conversió a PDF
    • Si s'han importat fletxes grosses bidireccionals des d'un MSPowerPoint, l'OpenOffice petarà quan s'intenti fer una exportació a PDF.
  • Problemes amb Mandriva i KDE/Qt:
  • Bugs
    • Impress 2.1.7
      • un cop desada una plantilla, la llista de la diapositiva mestra no s'actualitza (aquesta mestra inactualitzable seguirà així en els documents creats a partir d'aquesta plantilla). Però l'estil, que és el que compta, es modificarà bé i serà el que s'aplica als documents creats a partir d'aquesta plantilla.
      • per a tornar a aplicar la mateixa plantilla un cop modificada, cal aplicar una altra plantilla, desar el document, tancar i obrir l'OpenOffice, i aplicar de nou la plantilla que hem modificat.

ffmpeg compilation on Linux

ffmpeg compilation on MSWindows

  • using cygwin
    • [Mplayer-cygwin] list
    • setup Cygwin. Install packages:
      • make
      • gcc
      • diffutils (cmp)
      • patch
    • install and compile yasm (nasm not always works)

    • static dynamic
      x264
      (*)
      svn co svn://svn.videolan.org/x264/trunk x264

      patch -p0 < dll.patch
      ./configure ./configure --enable-shared
      modify config.mak:
      delete all -mno-cygwin occurences

      make libx264.a make
      install -m 644 libx264.a /usr/local/lib
      install -m 644 x264.h /usr/local/include
      make install
      ffmpeg svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
      modify libavcodec/mpegaudiodec.c. Add line:
      #define llrint lrint
      or apply a patch

      ./configure --enable-libx264 --enable-gpl ./configure --enable-shared --disable-static --enable-libx264 --enable-gpl
      make
      make install
  • using MinGW
    • ffmpeg Windows help
    • setup MinGW
      • install MSYS in c:\msys (from minGW / Download / Current)
        • MSYS_1.0.10.exe
      • install MinGW in c:\MinGW (from minGW / Download / Current) (use f.i. 7zip to untar)
        • MinGW Runtime: mingw-runtime-3.9.tar.gz
        • Windows API: w32api-3.6.tar.gz
        • binutils: binutils-2.15.91-20040904-1.tar.gz
        • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
      • copy needed tools from MS Visual:
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
      • Start / MinGW / MSYS / msys.exe
    • install and compile yasm (nasm not always works)
    • compile x264
    • compile ffmpeg
      • cd /c/.../gpac_extra_libs/ffmpeg
      • ./configure --enable-shared --disable-debug --enable-memalign-hack
      • make

GPAC

  • Linux compilation
    • install needed libraries
      • add plf to your distribution sources (Easy URPMI)
      • Mandriva 2007.x:
        • urpmi libfaad2_0-devel libffmpeg51-devel libfreetype6-devel libjpeg62-devel libjs1-devel libmad0-devel libogg0-devel libopenjpeg1-devel  libopenssl0.9.8-devel libpng3-devel libSDL1.2-devel libtheora0-devel  libvorbis0-devel libwxgtk2.6-devel libwxgtku2.6-devel libxml2-devel libxvid4-devel zlib1-devel libmesaglut3-devel
        • ln -s /usr/include/js-1.5 /usr/include/js
      • Mandriva 2008.x:
        • from 2008.0: urpmi libfreetype6-devel libjs-devel libmad0-devel libopenjpeg1-devel libopenssl0.9.8-devel libpng-devel libSDL1.2-devel libwxgtk2.8-devel (libxml2-devel) libwxgtku2.8-devel 
        • from 2008.1: urpmi libfaad2-devel libffmpeg-devel (liblame-devel libfaac-devel libmpeg4ip-devel liba52dec-devel libmrnb-devel libtheora-devel libvorbis-devel libx264-devel libmrwb-devel) libglib2.0-devel libmesaglut3-devel
    • get GPAC source:
    • compile gpac
      • chmod +x configure
      • run configure:
        • cvs: ./configure
        • svn (portivity): ./configure --disable-ipv6 (to avoid error in utils/os_net.c: sin_port)
        • 0.4.2-rc2: ./configure --use-ffmpeg=local
      • to prepare for debugging:
        • ./configure --enable-debug
        • to get an unstripped installed /usr/local/lib/libgpac-xx-DEV.so (to be used by gdb):
          • src/Makefile: INSTFLAGS= (not INSTFLAGS=-s, which installs a stripped version in /usr/local/lib)
      • make
      • (gcc -O3  -fno-strict-aliasing -Wno-pointer-sign -Wall -I/home/fpinyol/src/svn-portivity/trunk/wp5/gpac_0.4.4/include -DGPAC_HAS_SPIDERMONKEY -DXP_UNIX -I/usr/include/js -c -o laser/lsr_[dec,enc,tables].o laser/lsr_[dec,enc,tables].c)
      • make install
      • add line to /etc/ld.so.conf:
        • /usr/local/lib
      • ldconfig
    • using kdevelop
      • Import project: C (?with automake)
    • using eclipse
      • File / New / Project: CVS / Projects from CVS
      • Create a new repository location
        • Host: gpac.cvs.sourceforge.net
        • Repository path: /cvsroot/gpac
        • User: anonymous
        • Password:
        • Connection type: pserver
      • Use specified module name: gpac
      • Check Out As: Check out as a project configured using New Project wizard
      • Select tag: HEAD
      • Select a wizard: C / C Project
      • Project name: gpac_cvs
      • Project types: Makefile project
      • Configuration: Default
      • cd gpac_cvs; chmod +x configure; ./configure --enable-debug
      • Project / Build All
      • Make Targets: applications / testapps / broadcaster
      • Add make target:
        • Target name: broadcaster_all
        • Make target: all
        • Deactivate Run all project builders
      • Select broadcaster_all / Build Make target
      • Add make target:
        • Target name: broadcaster_clean
        • Make target: clean
        • Deactivate Run all project builders
      • Debug
        • Open Debug Dialog / C/C++ Local Application
        • Environment:
          • Variable: LD_LIBRARY_PATH
          • Value: .../gpac_cvs/bin/gcc
  • Linux usage
    • Fonts
      • import MSWindows fonts
        • Mandriva Control Centre / System / Manage Windows fonts / Obtain Windows fonts 
      • modify ~/.gpacrc:
        • [FontEngine]
          FontDirectory=/usr/share/fonts/drakfont/ttf
  • MS Windows compilation
    • compile gpac_extra_libs
      • compile ffmpeg
          • MSYS_1.0.10.exe
          • MinGW Runtime: mingw-runtime-3.9.tar.gz
          • Windows API: w32api-3.6.tar.gz
          • binutils: binutils-2.15.91-20040904-1.tar.gz
          • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
        • copy needed tools from MS Visual:
          • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
          • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
        • Start / MinGW / MSYS / msys.exe
        • some checks
          • cd /c/.../gpac_extra_libs/lib
          • mkdir w32_deb w32_rel
          • edit /c/.../gpac_extra_libs/libavformat/Makefile and fix the bug:
            • cp avcodec... should be: cp avformat...
        • cd /c/.../gpac_extra_libs/ffmpeg
        • ./configure --enable-shared --disable-debug --enable-memalign-hack
        • make
      • compile the rest of gpac_extra_libs with MS Visual:
        • Open build\msvc6\BuildAll.dsw
        • Batch Build
    • compile gpac with MSVisual 6.0
      • Open gpac\build\msvc6\gpac.dsw
      • set gpac_dll as active (StartUp) project
      • Build libgpac_dll
    • compile gpac with MSVisual 2005 (svn portivity)
      • open build/win32/win32.sln
      • check "Solution Platforms": Win32
      • for computers with HT or dual core: set 1 parallel process
      • Build solution
  • MS Windows Mobile compilation
    1. Be sure you have VS2005 and WM 5.0 Developer Resource Kit installed
    2. From the VS2005 open the solution file for WM5 located at: <download folder>\build\wm5\wm5.sln 
    3. Select the correct solution configuration and platform (Debug/Release and Windows Mobile 5.0 Pocket PC SDK (ARMV4I) 
    4. Connect you device using the USB cable and verify that you can communicate with it (Explore from the ActiveSync) 
    5. Compile and deploy as usual
  • Extraction of binarised LASeR access units:
    1. MP4Box -mp4 toto.xml
    2. MP4Box -raws 1 toto.mp4
    3. MP4Box -nhml 1 toto.mp4
    4. manually extract each access unit from toto_track1.media, according to lengths given by toto_track1.nhml

LASeR reference software

  1. Install eclipse
  2. Download ref_software_2007-01-26.zip (w8869) from MPEG site (access needed)
    1. mv LASeRCodec1206 LASeRJPlayer1206 ~/workspace
  3. Download and install Sun's J2ME Wireless Toolkit (WTK)
  4. Download and install eclipseme, a J2ME plugin from eclipse. On the web site, there are detailed instructions for setting up the plugin and for linking it with the WTK.
  5. From Eclipse, create a new Java Project, and give it the name of the directory you put into the workspace (eg. LaserJPlayer, J2ME_Renderer). Eclipse will import the project (the source files and the libraries). It is recommended to have different source/output directories (see "Window/Preferences/Java/Build path" before creating the project)
  6. Convert the newly created project into a J2ME project (right click on the project, J2ME/Convert to J2ME Midlet Suite). Select the MIDP 2.0 Platform
  7. Change the build settings as following. Right click on the project, Properties, Java Build Path, Order and Export - check library.jar.
  8. Add some .lsr input files. For doing that, create a new source directory - eg res (right click on your project, New Source Folder). Put inside the .lsr files, and rebuild
     (if you have automatic build turned on - which is the case by default - right click on the directory, and click Refresh)
  9. In the file iso.mpeg.streamezzo.player.tool.SceneLoader, you should change the INIT_LASER_URL attribute according to the input file you wish to play.
  10. For executing / debugging, right click on iso.mpeg.streamezzo.player.tool.LASeRPlayer, Run as / Debug as Emulated J2ME Midlet

Flameproject

  • urpmi libgnome2_0-devel

Biblioteques compartides / Shared libraries

  • Per a afegir un camí amb biblioteques compartides / To add a path which contains shared libraries:
    • edit /etc/ld.so.conf
    • ldconfig

Llengua / Language

  • /etc/sysconfig/i18n:
    • LANGUAGE=ca:en
    • LANG=ca_ES.UTF-8:en
  • gimp in English
    • export LANGUAGE=en; gimp

Servei / Service

  • /etc/init.d/toto:
    • #!/bin/sh
      #
      # Startup script for the toto daemon
      #
      # chkconfig: 2345 26 59
      #
      # description: toto daemon
      #
      ### BEGIN INIT INFO
      # Provides: toto
      # Should-Start: xxxx
      # Required-Start: xxx
      # Required-Stop: xxx
      # Default-Start: 2 3 4 5
      # Short-Description: Toto daemon
      # Description: Toto daemon
      ### END INIT INFO

      . /etc/init.d/functions

      case "$1" in
        start)
              gprintf "Starting toto daemon: "
              daemon "/usr/bin/toto -i 172.16.11.5" -d
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && touch /var/lock/subsys/toto
              ;;
        stop)
              gprintf "Shutting down toto daemon: "
              killproc toto
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/toto
              ;;
        status)
              status toto
              RETVAL=$?
              ;;
        restart|reload)
              $0 stop
              $0 start
              ;;
        condrestart)
              [ -f /var/lock/subsys/toto ] && restart || :
              ;;
        *)
              gprintf "Usage: %s {start|stop|status|restart}\n" "$0"
              RETVAL=1
              ;;
      esac

      exit $RETVAL
  • ln -s /etc/init.d/toto /etc/rc5.d/S99toto
  • service toto start

Logitech Harmony

  • concordance (develop)
    • Harmony 700
      • concordance >= 0.22
    • [cvs -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance login]
    • [cvs -z3 -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance co -P concordance]
    • urpmi autoconf automake make gcc-c++ libtool-base libusb-compat0.1-devel
    • cd concordance/libconcord
      • autoreconf --install
      • ./configure
      • make
      • make install
    • cd concordance/libconcord/bindings/python
      • urpmi libpython2.6-devel
      • python setup.py install
    • cd concordance/concordance
      • autoreconf --install
      • ./configure
      • make
      • make install
    • Add /usr/local/lib to the library path
  • congruity (GUI)
  • http://members.harmonyremote.com/ (it will call Congruity)

SVG

  • Include scalable SVG into HTML (Inkscape ViewBox bug, Bug #168261) (feedicons examples):
    • .svg
      • <svg ...
        width="..."
        height="..."
        ViewBox="0 0 200 100">
        ...
    • .html (figure scaled to 40x20 pixels)
      • <object type="image/svg+xml" data="figure.svg" width="40" height="20">
        You cannot display SVG files.
        </object>

Dropbox

Emacs 

  • xemacs indent tutorial
  • (setq default-tab-width 4);
  • (setq-default indent-tabs-mode t);
  • c-set-style java
  • carregar un fitxer .el / load a .el file
    • M-x load-file
    • .emacs:
      • (load "~/nxml-mode-200YMMDD/rng-auto.el")
  • carregar un mode / load a mode
    • M-x [c-mode xml-mode...]
    • .emacs:
      • (setq auto-mode-alist
                (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
                      auto-mode-alist))
  • informació sobre un mode / information about a mode
    • M-x describe-mode
  • newline in replace:
    • C-q C-j
  • Inverted colours:
    • emacs -rv
  • .emacs:
    • disable bell
      • (setq visible-bell t)
    • font
      • (set-default-font "6x13")

eyeOS

  1. urpmi php-curl php-mbstring php-mcrypt php-mysqli php-sqlite3 php-pdo_mysql php-pdo_sqlite openoffice.org-pyuno
  2. Download the latest version
  3. untar it
  4. /etc/httpd/conf/vhosts.d/eyeos.conf:
    • Alias /eyeOS /var/www/eyeOS
      <Directory "/var/www/eyeOS">
          Options -Indexes FollowSymLinks MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
      </Directory>
  5. Open http://localhost/eyeOS/install

Diccionaris per a Netscape

  • Aquests són alguns diccionaris:
  • Linux: poseu-los a /usr/lib/netscape/spell
  • MS Windows: poseu-los a ...\Netscape\Communicator\Program\SpellChk\

Diccionaris per a ispell

  1. Obteniu els diccionaris (de català: ispell-ca, Softcatalà)
  2. Modifiqueu [/usr/share/emacs/20.7/lisp/]ispell.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això ens funcionarà ispell-change-disctionary (accessible també des del menú Edit/Spell/Change dictionary)
  3. Modifiqueu [/usr/share/emacs/20.7/lisp/]loaddefs.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això funcionarà el menú Edit/Spell/Select Catala.

Internacionalització de Netscape

Per a tenir el Netscape internacionalitzat des de UNIX us heu d'instal·lar:
  1. netscape-communicator
  2. (algun netscape-llengua)
Després establiu la variable d'entorn LANG al valor desitjat:
  • ca -> català
  • es -> castellà
I el netscape se us engegarà en aquella llengua.

Diccionari català per a MS Word

Descarregueu-vos aquest fitxer i seguiu les instruccions del fitxer HTML:

Defunció del ratolí en Linux

Si el ratolí se us ha mort mentre utilitzàveu Linux, proveu el següent:
  1. CTRL+ALT+F1 per anar a una sessió de text.
  2. Mogueu el ratolí i veureu el cursor (quadrat blanc) que belluga.
  3. CTRL+ALT+F7 per a tornar allà on éreu. El ratolí hauria d'anar bé.

Ratolí estrany en MSWindows 2000 sota VMWare

  • Dins de MSWindows: mireu si teniu dues petites icones a baix a la dreta que siguin "VMWare tools". Elimineu la que té el martellet i deixeu la del logotip de VMWare.
  • Més informació a vmware.for-linux.configuration: Jumpy mouse

CVS

  • server (computer_name)
    • cvs -d /usr/local/cvsroot/repository_name init
    • chown cvs.cvs /usr/local/cvsroot
    • sticky group (els nous fitxers i directoris es crearan amb el grup cvs / new files and directories are created as group cvs): 
      • chmod 2775 /usr/local/cvsroot
    • edit /etc/cvs/cvs.conf:
      • CVS_REPOS="/usr/local/cvsroot/repository_name"
    • start cvspserver (as root): 
      • (urpmi xinetd)
      • chkconfig cvs on
      • service xinetd restart
    • tallafocs / firewall:
      • allow 2401/tcp
    • client: cvs -d :pserver:usuari@computer_name:/usr/local/cvsroot/repository_name login
  • Per a fer servir el WinCVS:
    • La primera vegada
      • CVSROOT -> :pserver:username@dev.isoco.com:/usr/local/cvs-repository
      • Identification: password on CVS server
      • Admin / Login
      • Create / Checkout del projecte que ens interessa:
        • Local directory: BackOfficeCVS (o un altre qualsevol)
        • CVS directory: BackOfficeRepository
      • Globals / read-only deshabilitada
    • Les altres vegades
      • per a pujar un fitxer que hem modificat: commit
      • per a baixar-nos l'última versió que hi ha al CVS: update
  • Si els fitxers es pugen per primera vegada al CVS en mode binary es baixaran com a tals quan es faci checkout o update.
  • L'inconvenient de fer-ho en binari és que si es modifica localment una versió més antiga que la que hi havia al CVS, no es fa el merge automàticament quan es puja.
  • Les combinacions text/binary són:
    PC local (commit) CVS (update) PC local fitxer final
    paraula^M -(bin)-> paraula^M -(-kb)-> paraula^M PC



    -(-ko)-> paraula^M^M Netscape
    paraula^M -(text)-> paraula -(-kb)-> paraula UNIX



    -(-ko)-> paraula^M PC

  • Per a eliminar "-kb" d'un fitxer (*):
    • cvs admin -kkv toto.txt
    • cvs update -A toto.txt (des de lincvs: "Treure opcions locals (-kx")
  • Per a eliminar "-kb" de tots els fitxers d'un directori (*):
    • find . -type f -maxdepth 1 -print | xargs -n1 cvs admin -kkv
    • find . -type f -maxdepth 1 -print | xargs -n1 cvs update -A
  • Els finals de línia es fan de les formes següents, depenent del sistema operatiu (aquesta nomenclatura és la que fa servir TextPad):
    PC ^M \r \n CR LF
    UNIX      \n    LF
    Mac ^M \r CR
    Netscape ^M^M \r \r \n CR CR LF
    CR: 0D, LF: 0A

  • Vigileu que el rellotge del vostre ordinador estigui ben configurat (GMT+1) i a l'hora. Si no, pot ser que no es detectin diferències entre els fitxers locals i els corresponents al CVS.
  • Canvi de log en un commit:
    • crear nou_log.txt amb els nous comentaris per a la versió 1.35 de fitxer.cpp (que conté uns comenatris erronis)
    • Linux:
      • cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • Cygwin:
      • /cygdrive/c/Archivos\ de\ programa\LinCVS\cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • MS Windows (amb text de comentari simple):
      • "c:\Archivos de programa\LinCVS\cvs.exe" admin -m 1:35:"canvis de l'actual versió" fitxer.cpp

WinCVS -> LinCVS

  • CVS/Root:
    • :pserver;username=usuari;hostname=maquina:/cvsroot -> :pserver:usuari@maquina:/cvsroot

Subversion

  • servidor (maquina)
    • urpmi subversion-server subversion-tools
    • chown svn.svn /var/lib/svn/repositories
    • sticky group (els nous fitxers i directoris es crearan amb el grup cvs): chmod 2775 /var/lib/svn/repositories
    • svnadmin create /var/lib/svn/repositories/repo1
    • svnpserver (urpmi subversion-server): 
      • (urpmi xinetd)
      • /etc/xinetd.d/svnserve:
        • server_args = -i -r /var/lib/svn/repositories (-i: inetd; -r: repositories as root dir)
      • chkconfig svnserve on
      • service xinetd restart
    • tallafocs / firewall:
      • 3690/tcp (/etc/services)
      • mcc:
        • 3690/tcp 3690/udp

    • /var/lib/svn/repositories/repo1/conf/svnserve.conf
      • password-db = passwd
      • realm = etiqueta_reialme
    • /var/lib/svn/repositories/repo1/conf/passwd
      • usuari1 = contrasenya_usuari1
      • ...
    • client: 
      • svn list svn://maquina/repo1 --verbose --non-interactive
      • ~/.subversion
  • GUI client
    • esvn
      • File / Options / Other / Authentication / User and Password
      • ~/.qt/esvnrc
    • TortoiseSVN
  • cvs2svn
    • urpmi cvs2svn
    • Documentation
    • without options file
      • cvs2svn -s /var/lib/svn/repositories/repo2 --encoding latin_1 /usr/local/cvsroot/repository_name/module_name (/usr/local/cvsroot/repository_name/CVSROOT exists)
      • cvs2svn --dumpfile DUMPFILE CVSREPOS
    • with options file
        • (cd /home/cvs)
        • wget http://cvs2svn.tigris.org/source/browse/*checkout*/cvs2svn/tags/2.3.0/cvs2svn-example.options
        • cp cvs2svn-example.options your_file.options
      • your_file.options:
        • ctx.cvs_author_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_log_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_filename_decoder = CVSTextDecoder(['latin1',],)
        • ctx.output_option = DumpfileOutputOption(
              dumpfile_path=r'toto.dump', # Name of dumpfile to create
              )
        • run_options.add_project(
          'my/cvsrepo/project_a',
          trunk_path='project_a/trunk',
          branches_path='project_a/branches',
          tags_path='project_a/tags',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
        • run_options.add_project(
          'my/cvsrepo/project_b',
          trunk_path='project_a/trunk/dir_b',
          branches_path='project_a/branches/dir_b',
          tags_path='project_a/tags/dir_b',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
      • cvs2svn --options=your_file.options
    • Per a importar un fitxer dump:

Calendaris / Calendars

apropos

  • makewhatis

Matlab

  • gcf = figure( 'Position', [0 0 mida_x mida_y] );
    ...
    axis( [0 255 0 Inf] );
    set( gcf, 'PaperPositionMode', 'auto' );
    print( '-r72', '-dtiff', 'toto.tif' );

C / C++

  • Temps / Time
    • include <time.h>
    • time_t tHoraActualUTC;
    • time( &tHoraActualUTC ); // get present time
-> time_t tm str
time_t
(sec from 1 jan 1970)
- gmtime
localtime ctime
tm
(struct)
timegm ( gnu c)
_mkgmtime (ms visual)
- asctime
mktime (ansi)
timelocal ( gnu c)

str
getdate
strptime
strftime
-

NO fa la conversió a hora local
fa la conversió a hora local

Cygwin

Postfix (servidor de correu)

  • /etc/postfix/main.cf
    • myorigin = $mydomain
    • relayhost = [mail.domini.org]

MySQL

  • urpmi mysql
    • check that:
      • installation is ok (no errors about mysql user or group)
    • service mysqld start
  • set the root password (How to reset the root password) by using one of the following methods:
    1. /usr/bin/mysqladmin -u root password 'new-password'
      /usr/bin/mysqladmin -u root -h localhost password 'new-password'

    2. urpmi mysql-administrator
      • mysql-administrator
      • Stored connection / Save this connection...: your_label
      • Server hostname: localhost
      • Username: root
      • Password: (empty)
      • Connect
      • User Administration / root : New password / Apply changes
    3. $ mysql -u root
      • mysql> UPDATE mysql.user SET password = password('new_password') WHERE user = 'root';
        mysql> FLUSH PRIVILEGES;
  • Causes of Access denied Errors
  • config for:
  • Admin (GUI)
    • urpmi mysql-administrator
  • Client (GUI)
    • sqlgui
      • urpmi sqlgui libsqlguimysql
      • ln -s /usr/lib/libsqlguimysql-0.1.1.so /usr/lib/libsqlguimysql.so

Bugzilla

  • MySQL
  • urpmi apache-mpm-prefork postfix perl-DBD-mysql
  • [urpmi bugzilla-contrib eclipse-bugzilla]
  • [urpmi apache-mode_perl perl-GDGraph perl-Template-GD perl-Chart perl-PatchReader perl-Image-Magick perl-HTML-Scrubber perl-Apache-DBI perl-DBD-Pg perl-MIME-tools perl-Email-MIME-Attachment-Stripper perl-Email-Reply interdiff]
  • urpmi bugzilla
    • /usr/share/bugzilla/bin/checksetup.pl
    • configure mysql for bugzilla
      • add user 'bugs' with password $db_pass
      • /etc/bugzilla/localconfig
        • set $db_pass
    • /usr/share/bugzilla/bin/checksetup.pl (again)
  • service httpd start

Scmbug

  • CVS
  • Bugzilla
  • Scmbug
    • instal·lació dels paquets necessaris (exemple per a MandrivaLinux):
      • urpmi docbook-style-dsssl-doc perl-XML-Simple perl-Mail-Sendmail
    • correspondència entre usuaris de cvs i usuaris de bugzilla:
      • /etc/scmbug/daemon.conf
        • userlist => {enabled => 1, values => {'usuari' => 'usuari@domini.org'}}
    • inici del servei:
      • temporalment: service scmbug-server restart
      • permanentment: chkconfig scmbug-server on
    • enganxa l'scmbug entre cvs i bugzilla:
      • scm_install_glue --scm=CVS --product=nom_modul --repository=/usr/local/cvsroot --bug=1 --daemon=127.0.0.1 --binary-paths=/usr/bin
    • edita algunes preferències:
      • chmod 644 /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf
      • /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf 
        • presence_of_bugs_ids => {value => 'optional' }
        • valid_bug_owner => {enabled => 0}
        • log_regex => '[Bb][Uu][Gg].*?:(.*)'

Eclipse

NTP

  • UNIX / Linux
    • client (no funcionarà si el servei ntpd està funcionant, perquè ocupa el port) (maybe you need to open the NTP port: 123)
      • ntpdate -u europe.pool.ntp.org (amb l'opció -u sí que funcionarà quan el servei ntpd està en marxa / use -u option to force update when ntpd service is running)
      • ntpdate -q europe.pool.ntp.org (just query)
      • KDE adjust time: automatically
    • client / server (nom_servidor)
      • /etc/ntp.conf
        • server nom_servidor (ex: aries.salle.url.edu)
      • service ntpd start
      • nom_servidor no serà vàlid fins que no surti un * quan se'l pregunta amb ntpq -p nom_servidor / nom_servidor will not be valid until a * appears before it when calling ntpq -p nom_servidor
  • MS Windows XP, 2003
    • client / server
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
        • "NtpServer"="aries.salle.url.edu,0x1"
        • "Type"="NTP"
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
        • "Enabled"=dword:00000001
        • "SpecialPollInterval"=dword:00000708 (cada 1800s es connecta al servidor / connected to server every 1800s)
    • server
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer]
        • "Enabled"=dword:00000001

UUID

  • UNIX
    • urpmi libext2fs-devel
    • #include <uuid/uuid.h>
    • uuid_generate( uu );
    • needed lib: -luuid
  • MS Windows
    • #inlcude <rpc.h>
    • UuidCreate(&uu);
    • needed lib: Rpcrt4.lib

MS Visual Web Services

  • Check that your web service is running:
    • http://localhost/<your_web_service>/<your_web_service>.asmx
  • "Server Application Unavailable" (when trying to access web services with .net 2.0):
    • uninstall .net 3.0
  • "Failed to access iis metabase". Solution:
    • WINDOWS\Microsoft.NET\Framework\vX.X.XXXXX\aspnet_regiis -i
  • "The process account used to run ASP.NET must have read access to the IIS metabase"
    • aspnet_regiis -ga <WindowsUserAccount>
  • Others:
    • aspnet_regiis -ua
    • aspnet_regiis -i -enable
  • "Parser Error Message: Unrecognized configuration section 'connectionStrings'" / "Server Error in '/<your_web_service>' Application, Configuration Error"
    • Check that your web service is using the right ASP version:
      • Start / Control Panel / Administrative Tools / Computer Management / Services and Applications / Internet Information Services / Web sites / Default Web Site
      • <your_web_service>: Properties / ASP.NET tab / ASP.NET version: <the_needed_version_for_your_web_service>
  • To install NET framework from Microsoft:
  • Verify that the ASPNET user have writing permissions in the wanted directories:
    • Properties / Security / Add / Advanced options / Search now
    • if Security tab is not present:
      • Tools / Folder options / View / (don't use) Simple file sharing
  • ASP tab not present
  • Virtual units (subst) do not work for user ASPNET.
  • Needed files for deployment of a web service in a computer without MS Visual installed (to be put under C:\Inetpub\wwwroot\<your_web_service>\bin\):
    • developed with MS Visual 2005:
      • Release
        • ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\
          • msvcp80.dll
          • msvcr80.dll
          • Microsoft.VC80.CRT.manifest
        • ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.MFC\
          • mfc80.dll
          • Microsoft.VC80.MFC.manifest
      • Debug
        • ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT\
          • msvcp80d.dll
          • msvcr80d.dll
          • Microsoft.VC80.DebugCRT.manifest
        • ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugMFC\
          • mfc80d.dll
          • Microsoft.VC80.DebugMFC.manifest
  • Security issues (accessing network drives)

Toggle keybord layout in MS Windows

  • Control Panel / Regional and Language Options / Languages / Details
  • select the language and then Add
  • add a keyboard
  • Language bar: select all options

KDE

  • Font antialiasing
    • KDE control centre: Fonts / Use anti-aliasing / Enabled / Style: Complete
  • Menú / Menu
    • kmenuedit
    • /etc/xdg/menus/
    • /etc/xdg/kde4/menus/
  • Auto start of applications/scripts:
    • Configure desktop -> Advanced ->  Autostart
    • applications
      • ~/.config/autostart/*.desktop
    • scripts
      • ~/.kde4/Autostart/*.desktop

rdesktop

  • rdesktop -g 1024x768 -k es remote_server -r disk:C=/

shell commands

  • get the returned value of the latest command:
    • echo $?
  • CPU/memory activity
    • top
    • atop
    • htop
    • vmstat 1
  • File activity
    • lsof (list open files)
    • iotop
  • find
    • list (detailed) all files with extension m2v:
      • find . -name "*.m2v" -exec ls -l '{}' \;
    • Delete all *.ts files (not beginning with a dot), without entering into the subdirectories (maxdepth 1), with less than 1k:
      • find . -maxdepth 1 -size -1k -name "[^\.]*.ts" -delete
    • Copy all the files (-type f) in /var/export/backup_zeus3/ modified in the latest 24h (-mtime -1) to /tmp:
      • find /var/export/backup_zeus3/ -mtime -1 -type f -exec cp -pf '{}' /tmp \;
    • Recursively delete all directories named ".svn":
      • find . -name ".svn" -type d -exec rm -rf {} \;
  • Substitució / Replacement
    • sed
  • Elimina el CR
    • sed -e "s!\\r!!g" toto.txt
  • Errors in English:
    • LC_ALL=C <command>
  • Redireccionament / Redirection
  • Power Up Linux GUI Apps (Linux Magazine)
  • Remove file extension and add a new one ".txt": (Shell parameter expansion)
    • txtfile=${file%.*}.txt
  • Get the file extension: (Shell parameter expansion)
    • extension=${file#.*}
  • Integer arithmetics (observe the absence of spaces)
    • let var1=$var1+1
  • Non-integer arithmetics
    • Math commands
    • Bash, non-integers and arithmetic

    • total=`echo $var1/$var2 | bc -l`
    • var1=`bc << EOF
      $var1 / $var2
      EOF
      `
    • var1=$(bc << EOF
      $var1 / $var2
      EOF
      )
    • Comparison of non-integers (Shell scripting):
      • if [ `echo "$a < $b" | bc -l` = 1 ] then ...
    • Comprovació que el valor de variable sigui 1.3:
      • if [ `echo "$variable == 1.3" | bc -l` = 1 ]
        then
            echo "la variable si que val 1.3"
        else
            echo "la variable no val 1.3"
        fi   

  • Check mime-type (or use mimetype command instead of file command)
    • if [ `file -b --mime-type $1` = "text/plain" ]
      then
          echo "plain text"
      else
          echo "no plain text"
      fi
  • Manipulating strings
  • Obté l'enèsima línia (p.ex. 15) d'un fitxer / Get the nth (e.g. 15th) line of a file
    • awk 'NR==15' toto.txt
    • sed -n '15p' toto.txt
  • Escriu els valors de la segona columna del fitxer, on les columnes estan separades pel caràcter '=':
    • awk -F= '{print $2}' toto.txt
  • Obté el segon camp ("xx") de la línia que sigui "ID_LENGTH=xx" del fitxer .toto.txt
    • awk -F= '$1 ~ /ID_LENGTH/ {print $2}' toto.txt
  • Gotchas

TimeTracker

  • Install (Ubuntu installation)
    • urpmi apache-mod_php php-pear php-pear-DB [php-smarty php-mysql php-pear-MDB2_Driver_mysql]
    • download timetracker.zip
    • unzip -d /var/www timetracker.zip
    • mysql -u root -p
      • CREATE DATABASE timetracker;
      • GRANT ALL ON timetracker.* TO 'wrtts'@'localhost' IDENTIFIED BY 'wrtts';
      • FLUSH PRIVILEGES;
      • exit;
    • mysql -u root -p -D timetracker < mysql.sql
    • cp /var/www/timetracker/WEB-INF/config.php.dist config.php
    • /var/www/timetracker/WEB-INF/config.php
      • define("DSN",'mysql://wrtts:wrtts@localhost/timetracker');
      • define("APP_NAME",'timetracker');
      • define('MAIL_SMTP_HOST', 'smtp.salle.url.edu');
    • /etc/httpd/conf/webapps.d/timetracker.conf
      • Alias /timetracker /var/www/timetracker
        <Directory "/var/www/timetracker">
          Order allow,deny
          Allow from All
        </Directory>
  • Upgrade
  • timeout
    • /etc/php.ini
      • session.gc_maxlifetime=28800
    • /usr/lib/php/maxlifetime (used in /etc/cron.d/php)
      • max=28800

Kimai

  • Install
    • urpmi php-pdo_mysql
    • mysql -u root -p
      • CREATE DATABASE kimaidb;
    • /etc/httpd/conf/webapps.d/kimai.conf
      • Alias /kimai /var/www/kimai_0.9.0.1082
        <Directory "/var/www/kimai_0.9.0.1082">
          Order allow,deny
          Allow from All
        </Directory>
    • chown apache.apache -R /var/www/kimai_0.9.0.1082/compile
    • chown apache.apache -R /var/www/kimai_0.9.0.1082/extensions
    • chown apache.apache -R /var/www/kimai_0.9.0.1082/temporary
    • open browser:
      • http://localhost/kimai
    • default user: admin/changeme

VPN

WebDAV

  • How To Set Up WebDAV With Apache2 On Mandriva 2009.1
  • How to set up WebDAV with Apache2 on Debian Etch
  • Servidor / Server
    • urpmi apache-mod_dav
    • mkdir -p /var/www/toto
    • chown apache:apache /var/www/toto
    • Add user test_user:
      • htpasswd -c /var/www/passwd.dav test_user
    • httpd.conf:
      • LoadModule dav_module modules/mod_dav.so
        LoadModule dav_fs_module modules/mod_dav_fs.so
        LoadModule dav_lock_module modules/mod_dav_lock.so
        Alias /toto /var/www/toto
        <Location /toto>
          Dav on
        AuthType Basic
        AuthName "toto_webdav"
        AuthUserFile /var/www/passwd.dav
        Require valid-user
        </Location>
        <Directory "/var/www/toto">
            Options -Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    • service httpd restart
  • Client
    • cadaver
      • urpmi cadaver
      • cadaver http://webdav_server/toto/
    • Nautilus
      • dav://webdav_server/toto/
    • /etc/fstab
      • ...

Wiki

  • WikiMatrix
  • Instal·lació de Mediawiki (Cómo instalar MediaWiki en Mandriva Linux)
    1. urpmi mediawiki wget http://download.wikimedia.org/mediawiki/1.13/mediawiki-1.13.3.tar.gz (mediawiki-1.15.1-1mdv2010.0.noarch.rpm)
    2. /etc/httpd/conf/webapps.d/mediawiki.conf:
      • Alias /mediawiki /var/www/mediawiki
        <Directory "/var/www/mediawiki">
          Order allow,deny
          Allow from All
        </Directory>

        <Directory "/var/www/mediawiki/bin">
          Order allow,deny
          Deny from All
        </Directory>
    3. Check that MySQL is running
    4. open http://server_address/mediawiki/
    5. Please set up the wiki first.
      • Use superuser account: yes
      • prefix: mw_
    6. mv /var/www/mediawiki/config/LocalSettings.php /var/www/mediawiki/
    7. Open http://localhost/mediawiki/index.php
  • Upgrade Mediawiki
    • ssh user@server
    • cd /var/www/mediawiki/
    • mv LocalSettings.php LocalSettings.php.old
    • firefox -no-remote http://server_address/mediawiki/config/index.html
      • Use superuser account
      • prefix: mw_
  • PHP debug
    • /etc/php.ini (urpmi php-ini)
      • display_errors = On
    • service httpd restart
  • Llengües
  • Aplicacions
    • mwlib (PediaPress)
      • urpmi python-setuptools libpython2.6-devel gcc-c++ python-imaging python-reportlab python-pygments 
      • easy_install mwlib
      • easy_install mwlib.rl (per a generar pdf) (readme.txt)
      • Examples
        • mw-render --list-writers
        • mw-render --config=http://localhost/mediawiki/ --writer=rl --output=./p.pdf Pàgina_Principal
      • Configuració
        • pdf
          • /usr/lib/python2.5/site-packages/mwlib.rl-0.9.2-py2.5.egg/mwlib/rl/pdfstyles.py
            • titlepagefooter = _(u'Peu de pàgina del títol')
            • pagefooter = _(u'Peu de pàgina')
            • show_creation_date = False
            • show_article_attribution = False (without "Article Sources and Contributors" and "Image Sources, Licenses and Contributors" sections)
        • odf
          • /usr/lib/python2.5/site-packages/mwlib-0.9.5-py2.5-linux-i686.egg/mwlib/odfstyles.py
  • Extensions
    • Collection / Pdf Writer (es necessita mwlib, mwlib.rl) (readme.txt)
      • Help
      • mw-serve -i localhost(engega el servidor mwlib per a ser accedit des de l'API de mediawiki) (el nom del servidor, en aquest cas localhost, ha de ser coherent amb el valor indicat a$wgCollectionMWServeURL)
        • per a fer-ho de forma automàtica quan engega l'ordinador:
      • urpmi php-curl
      • cd /var/www/mediawiki/extensions
      • svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Collection
      • /var/www/mediawiki/LocalSettings.php
        • require_once("$IP/extensions/Collection/Collection.php");
        • $wgCollectionMWServeURL = "http://localhost:8899";
        • $wgCollectionFormats = array(
                     'rl' => 'PDF',
                     'odf' => 'ODT',
                 );
      • open port: 8899/tcp
      • /var/www/mediawiki/skins/MonoBook.php
        • <?php
          if(isset($GLOBALS['wgSpecialPages']['Book'])) {
          Collection::printPortlet();
          }
          ?>
      • Hauríeu de veure una nova capseta a l'esquerra, sobre la capseta "eines", anomenada "create a book". Si no es veu, buideu la memòria cau del vostre navegador
      • Comprovació:
        • wget "http://localhost/mediawiki/index.php?title=Especial:Book/render_article/&arttitle=Pàgina_principal&oldid=2&writer=rl"
        • wget "http://localhost/mediawiki/index.php?title=Especial:Book/render_article/&arttitle=Pàgina_principal&oldid=2&writer=odf"
        • Si hi ha error del tipus 500, verifiqueu
          • tail /var/log/httpd/error_log
    • Bibwiki
      • urpmi php-mbstring
      • Settings: /var/www/mediawiki/extensions/Bibwiki-0.99d/BibwikiSettings.php (copy BibwikiSettings.Default.php)
        • $wgBibPath = '/var/www/mediawiki/bib';
        • $wgDefaultBib = 'my.bib';
        • Export
          • urpmi tetex (/usr/bin/bibtex)
          • Exporting via BibTeX
          • $wgEnableExport = true;
          • $wgBibTeXExecutable = '/usr/bin/bibtex';
          • $wgTempDir = '/tmp';
          • $wgBibStyles = array('plain', 'abbrv','ieeetr'); (styles available under /usr/share/texmf/bibtex/bst)
      • Problemes / Problems
        • The style file: plain.bst
          I couldn't open database file toto.bib
        • Problems with accents at exported text.
          • Solution: modify /var/www/mediawiki/extensions/Bibwiki-0.99d/Bblfile.php
            • elseif ($cmd == "'" and $arg != "" and stristr('aeiouy', $arg) !== false)
                          return '&'.$arg.'acute;';
              elseif ($cmd == "`" and $arg != "" and stristr('aeiouy', $arg) !== false)
                          return '&'.$arg.'grave;';

    • Cite (references as footnotes)
    • Cerca / Search
      • SphinxSearch
        • urpmi sphinx
        • download SphinxSearch-0.6.1 to /tmp/SphinxSearch-0.6.1
          • sphinx.conf
            • sql_user =... (same as in LocalSettings.php)
            • sql_pas = ... (same as in LocalSettings.php)
            • sql_db = ... (same as in LocalSettings.php)
            • check sql_query sql_query_info (prefix coherent with $wgDBprefix in LocalSettings.php)
            • morphology    = stem_ca (?)
          • mkdir /var/data/ /var/data/sphinx 
          • sphinx-indexer --config sphinx.conf --all
          • search --config sphinx.conf "paraula"
          • crontab -e:
            • tototototot
        • mkdir /var/www/mediawiki/extensions/SphinxSearch
        • cp /usr/share/doc/sphinx/api/sphinxapi.php /var/www/mediawiki/extensions/SphinxSearch
        • cd /var/www/mediawiki/extensions/SphinxSearch
        • svn export http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ExtensionFunctions.php
        • mv /tmp/SphinxSearch-0.6.1/sphinx.conf /etc/sphinx/
        • cp /tmp/SphinxSearch-0.6.1/* /var/www/mediawiki/extensions/SphinxSearch/
        • service sphinx-searchd restart
        • LocalSettings.conf
          • require_once( "$IP/extensions/SphinxSearch/SphinxSearch.php" );
        • minus sign:
    • Editors WYSIWYG
    • Semantic mediawiki
  • math / LATeX
    • urpmi make ocaml
    • cd mediawiki/math
    • make

http://www.terra.es/personal9/francesc.pinyol/utilitats.html
Darrera modificació: 4 de febrer de 2011 / Last update: 4th February 2011

Cap a casa / Back home.