-
D: Come rimuovere un 'unnamed constraint' da una tabella?
R:
I constraint unnamed sono visibili tramite il comando \d table name con la notazione "$1", "$2" ecc.
La seguente sequenza é unesempio:
create table prova (
id integer primary key references acs_objects (object_id)
,dat varchar(10)
);
alter table prova add id2 integer references acs_objects (object_id);
alter table prova drop constraint prova_pkey;
alter table prova drop constraint "$1";
alter table prova add primary key(id2);
-
D: Come accedere ad un DB remoto con PSQL?
R:
Occorre qualificare l'host ed il port come nelle'esempio seguente:
psql -h 10.1.211.75 -p 5432 idraeprlu -P pager
-
D: Su Open Suse 10.3 si verificano degli errori di compilazione dei moduli di Aolserver nscache e nssha: come evitarli?
R:
In realtà i file *.a mancanti non sono necessari, ma per evitare l'errore basta eseguire questa sequenza, invece del classico 'make install':
make test=/usr/local/aolserver45
make install NSHOME=/usr/local/aolserver45
-
D: Cosa devo fare per attivare la macchina virtuale standard, naturalmente dopo aver installato Vmware Server e copiato la macchina virtuale sul server di destinazione?
R:
- Configurare la tastiera in italiano
- Attivare run level 3
- Eliminare la scheda di rete preinstallata e quindi configurarne una nuova, preferibilmente con IP statico
- Eliminare (con yast) il servizio HTTPD che ascolta sulla porta 80
- Copiare in /etc/init.d lo script per avviare postgres ed eseguire 'chkconfig --add postgresql' per avviarlo al boot
- Eseguire 'createlang plpgsql template1'
- Eseguire 'createuser nsadmin'
- Personalizzare i seguenti parametri di postgresql.conf e riavviare il servizio:
shared_buffers=256MB
work_mem=2MB
maintenance_work_mem=64MB
autovacuum=on
- Personalizzare i file della home dir .bashrc, .emacs e ssh22221
- Configurare il prompt con:
PROMPT='PS1="\u@\h: \W \\$ "'
echo $PROMPT >> /etc/bash.bashrc.local
- Copiare e adattare la proc backup_and_restart ed eseguire crontab -e per schedularla
-
D: Come installare aolserver 4.0 su OpenSuse 10.3?
R:
Seguire le tracce di: http://www.cognovis.de/developer/en/aolserver40
Scaricare la versione da CVS:
cvs -z3 -d:pserver:anonymous@aolserver.cvs.sourceforge.net:/cvsroot/aolserver co -r aolserver_v40_bp aolserver
eapplicare la patch:
wget http://media.wu-wien.ac.at/download/aolserver-nsd-conn.patch
patch -p0 <aolserver-nsd-conn.patch
Ricordare inoltre di modificare nsd/info.c e nsthreadtest/nsthreadtest.c commentando l'istruzione:
Tcl_GetMemoryInfo
Quindi:
NS=/usr/local/aolserver40r10
CPPFLAGS="-nostartfiles" ./configure --prefix ${NS}
make
make install
-
D: Come installare i daemontools su Ubuntu?
R:
Aggiungere a apt/sources-list il repository
deb http://cz.archive.ubuntu.com/ubuntu dapper main multiverse
With the moving of ubuntu from the old fashioned init to the modern upstart, the daemontools svscanboot package doesn’t cleanly install. Here’s how to fix it. You really do need daemontools if you’re going to run djbdns or qmail.
The daemontools-installer package modifies /etc/inittab to cause the svscan/svscanboot process to launch. With upstart, there is no /etc/inittab, instead it is replaced with a collection of config files in /etc/event.d. There’s currently a bug for this misbehavior, however it is over a year old, but has the workaround documented.
The solution is to first create an empty, bogus /etc/inittab, then run the installer, and then put a manually created file in /etc/event.d to actually launch svscan.
- Create a bogus inittab,
touch /etc/inittab
- Install the installer,
apt-get install daemontools-installer
- Fetch the code,
get-daemontools
- Build the package,
build-daemontools (and, of course, install it when prompted)
- Create
/etc/event.d/svscan
- Run
initctl start svscan
- If desired,
rm /etc/inittab
The following is the contents of /etc/event.d/svscan:
start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
respawn
exec /usr/bin/svscanboot
Now you will get the desired behavior of svscan starting at boot and being kept running by upstart.
-
D: Come assicurarsi che i parametri di un programma siano inviati via POST, evitando così possibili manipolazioni?
R:
Inserire questo frammento nel programma:
if { [ad_conn method] ne "POST" } {
ad_script_abort
}
-
D: Chi risponde a questa porta?
R: netstat -tlnp
-
D: Come posso eseguire scp senza password?
R: Vedi http://support.svi.nl/wiki/ScpBatchMode
-
D: Come risolvere il problema di testo che deborda dai confini di un portlet?
R:
Firefox e IE a volte si comportano diversamente. Per uniformare il loro comportamento è opportuno aggiungere la direttiva:
text-align: normal;
Vedi ad esempio il file xowiki.css dell'istanza dotlrn-demo.
-
D: Come faccio a spostare un repository CVS e far puntare le working copies al nuovo repo?
R:
Il repository si può tranquillamente spostare via tar.
Per adeguare le working copies il procedimento è il seguente:
-
D: catch e db_transaction hanno l'effetto secondario di nascondere i dettagli di eventuali errori: come faccio a visualizzarli?
R:
Inserisci nel blocco dove l'errore viene intercettato il comando:
ad_log_stack_trace
che scrive su error.log tutti i dettagli dell'errore.
-
D: Come configurare postfix su Ubuntu?
R:
Occorre porre attenzione soprattutto a due impostazioni:
- il file /etc/mailname deve contenere il dominio, ad es. oasisoftware.it
- nel parametro mydestination del file main.cf omettere il dominio, ad es. mydestination = ubuntu.oasisoftware.it, localhost.oasisoftware.it, localhost
Il secondo punto è necessario per evitare che postfix cerchi i destinatari del proprio dominio fra gli utenti locali.
-
D: Come attivare e disattivare PostgreSQL
R: /sbin/service postgresql start/stop/status
oppure (SUSE) rcpostgresql start/stop/status
Verificare dopo lo stop che abbia veramente chiuso! con:
ps -ef | grep postmaster
Se non chiude regolarmente forzare la chiusura con:
pg_ctl stop -D /var/lib/pgsql/data -m immediate
-
D: Come controllare lo spazio residuo nel file system
R: df -m
-
D: Come visualizzare una function in psql
R: select * from acs_func_defs where fname='acs_object__new'
-
D: Come riportare un job (tipicamente emacs) in foreground dopo averlo sospeso con CTRL-Z
R: fg
-
D: Come controllare la memoria di un processo
R: ps -Ao pid,vsz,rss,comm | egrep "PID|20257"
-
D: Come ordinare un file
R: sort +1 -2 -t "|" -r -o output input
il comando richiede la selezione del file input in ordine inverso (-r) sul secondo campo
del file (+1) sospendendo la selezione subito dopo (-2) e utilizzando come separatore di
campo la barra verticale (-t "|") e creando il file output
-
D: Come eseguire il dump e il restore di un DB
R:
Prima di dare il comando dropdb occorre assicurarsi che non ci siano sessioni attive chiudendo aolserver. Vista la cattiva abitudine di lasciare aperte delle sessioni psql in emacs potrebbe essere necessario stoppare e ristartare anche postgresql
# Drop e create del database
dropdb $dbname
createdb -E UNICODE -T template0 $dbname
# Questo è il modo più flessibile, in quanto gestisce i blob
pg_dump $dbname -b -Fc -f /tmp/$dbname.dmp
pg_restore -d $dbname -v -O -Fc /tmp/$dbname.dmp >& /tmp/$dbname.log
# Questa è una alternativa più semplice
pg_dump $dbname > /tmp/$dbname.dmp
psql -f /tmp/$dbname.dmp $dbname 2> /tmp/$dbname.log
# Occasionalmente può essere necessario eseguire separatamente il restore dello schema e dei dati. In questo modo c'è l'opportunità di editare lo schema prima di applicarlo
pg_dump $dbname -b -Fc -f /tmp/$dbname.dmp
pg_restore -O -s /tmp/$dbname.dmp > /tmp/$dbname-create.sql
psql $dbname -f /tmp/$dbname-create.sql &> /tmp/$dbname-create.log
pg_restore -d $dbname -a ?v -O ?Fc /tmp/$dbname.dmp &> /tmp/$dbname.log
# Per semplificare il copia e incolla impostare preventivamente la variabile dbname e quindi eseguire direttamente le istruzioni incollate
export dbname=xxxxx
-
D: tuning di PostgreSQL
R: echo 128000000 > /proc/sys/kernel/shmmax
# inserire in /etc/sysctl.conf la riga:
kernel.shmmax = 128000000
# modificare /var/lib/pgsql/data/postgresql.conf con le seguenti righe:
sort_mem = 32168
shared:buffers = 9600
-
D: Come installare AOLSERVER 3.3
R: ricordare di aggiornare la function postgresql sec_rotate_last_visit in security.sql e modificare nell'ultima insert il parametro v_time::char in v_time::varchar
# Installazione AOLSERVER con RedHat 8
modificare /usr/local/aolserver/modules/tcl/sendmail.tcl
ed eliminare la stringa AOLSERVER dopo il comando HELO
-
D: Come aggiungere General Comments a diversi subsite
R: Vedi http://openacs.org/forums/message-view?message_id=292636
-
D: Come attivare un WYSIWYG editor con OpenACS 5.2
R: basta definire un widget richtext (invece di textarea)
-
D: Come ottenere group_id da group_name in uno specifico subsite
R: Vedi http://openacs.org/forums/message-view?message%5fid=319561
-
D: Come installare Tcllib
R: Vedi http://openacs.org/bugtracker/openacs/bug?f%5fcomponent=56181&format=table&f%5fstate=8&bug%5fnumber=2568&project%5fid=56106
-
D: Come controllare il layout di form generati da ad_form
R: <daveb> There is a tcl proc that will generate the template code
[03:12:26] <daveb> template::form::template
[03:12:29] <daveb> do something like this
[03:12:32] <daveb> in your adp
[03:12:47] <daveb> <%= [template::form::template my_form_id] %>
[03:12:55] <daveb> and you will see all the form template code
[03:13:14] <daveb> stick that in between the <formtemplate></formtemplate> tags and you get full
control over the presentation
-
D: Come importare users con vecchia password
R: the bulk add facility doesn't let you load an encrypted password from the "original" site since it uses
one way encryption. One way you can do this is load all the people via bulk add, and then create an
update script that you run through psql. What you want to do on the old system is get both the password
and salt from the old users and set them for the new users. Now, assuming that username is unique
(which it should be) and the same on both systems, you can then do this:
psql -t -c "
select 'update users set password = ''' ||
password || ''', salt = ''' ||
salt || ''' where username = ''' ||
username || ''';'
from users
" OLDDBNAME > update_users.sql
This creates a file update_users.sql which you should then run on the new server copying it there and
doing this:
psql -f update_users.sql NEWDBNAME
That should do it...
-
D: Importazione catalogo da translation server
R: 1. eseguire acs-lang/admin/import-messages-from-ts
2. eseguire esportazione su file system
-
D: Come personalizzare un sito senza compromettere la possibilità di upgrade a nuove versioni?
R:
Da un post di Matthew Geddert
The solution you have come up with is the same one I did a while back. One recommendation that I have for you, in order to ease upgradeability, is to create a package for your site named something like packages/mysite and put your new proc a /packages/mysite/tcl/mysite-customized-procs-init.tcl file, which would reference where the original procs are from and what you customized via a comment that is something like:
# From acs-templating/tcl/list-procs.tcl
# changed return make csv download as an
# attachment
ad_proc -public template::list::write_output {
...
This file would contain all procs you customize for your site. That way when you do an upgrade to a new version of acs-templating your customized proc would remain active. Packages are sourced alphabetically first with the -procs files then the -init files. Your custom proc will be initialized after all the procs files load since its an init file thus upgrading won't override your customized procs.
I used to document changes that I needed to make to a bunch of packages and every upgrade was a hassel since I had to redo all my changes - which got trickier and tricker the more i customized. Now, when I upgrade, I simply look in my /packages/mysite/tcl/mysite-customized-procs-init.tcl file and compare those procs to the ones that are in the upgraded packages. If there are differences, especially security changes, between the new ones and the procs I customized off of I choose what and how to modify my custom proc to match the changes made by the upgrade and my sites custom needs. Most of the procs I customized aren't changed with every upgrade so I don't have to do any customizations to those procs to keep running the way my users expect it to.
-
D: Come eseguire il checkout di un modulo CVS quando quest'ultimo non é propriamente un modulo?
R:
Se si tenta ad es.
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot co -r HEAD xowiki
si ottiene:
cvs server: cannot find module `xowiki' - ignored
cvs [checkout aborted]: cannot expand modules
In questi casi si deve usare:
cvs -d:pserver:anonymous@cvs.openacs.org:/cvsroot checkout openacs-4/packages/xowiki
-
D: Come risolvere il problema dei caratteri UNICODE non validi per PostgreSQL?
R: Vedi <a href="http://openacs.org/forums/message-view?message_id=441003">questo posting</a> nel forum.
-
D: Come impostare PUTTY per gestire correttamente i caratteri speciali?
R: Andare in Window -> Translation impostare il selection box a UFT-8 e salvare la configurazione.
-
D: Come installare PostrgreSQL 8.1.4 con OpenACS 5.2
R:
L'ultima release di PostgrSQL è ora utilizzabile, ma con un piccolo accorgimento descritto nel seguente messaggio tratto dal forum OpenACS:
I just sucessfuly installed OpenACS core HEAD & 5.2.3 & .LRN 2.2.0b1 on PG 8.1.4, there was a function preventing it:
packages/acs-kernel/sql/utilities-create.sql
http://eye.openacs.org/viewrep/OpenACS/packages/acs-kernel/sql/postgresql/utilities-create.sql?r=1.6
(plus I grep and none acs-core or dotlrn-all package is using it!, anyway I fixed it, in 8.1.x seems that PG check correct syntax at function creation, previous versions seems to check when the function was actually used)
Also followed these instructions:
-Configure postgres8 with all compatibility ON in postgresql.conf:
add_missing_from = on
regex_flavor = extended
default_with_oids = on
-Generate the next function:
create or replace function bitfromint4 (integer)
returns bit varying as '
begin
return $1::bit(32);
end;' language 'plpgsql' immutable strict;
(http://openacs.org/forums/message-view?message_id=404776)
More test will be required, but everything seems to be working just fine.
N.B.
Le istruzioni precedenti si applicano al porting di un data base esistente alla nuova release di PostgreSQL, ma se si vuole installare OACS-5-2 da zero occorre anche seguire queste istruzioni: http://www.vestasoft.com/dotlrn/clubs/vestasoft/file-storage/view/public/notes_PG8.1.html
-
D: Come eliminare da un file il fastidioso carattere ^M
R:
Per eliminare o rimpiazzare il fastidioso carattere ^M puoi usare la funzione search and replace di emacs (attivabile con ALT-SHIFT-%).
Per rappresentare il carattere ^M occorre digitare la sequenza CTRL-q CTRL-m e dopo di che basta indicare il carattere di rimpiazzo (che può essere nullo).
Se si desidera invece rimpiazzarlo con il carattere line feed occorre usare la sequenza CTRL-q CTRL-j
Volendo invece operare da TCL occorre sostituire, con regsub i pattern \n e \r
-
D: Come configurare un nuovo sito basato su .LRN e Xowiki?
R: Vedi questo documento.
-
D: Come posso risolvere problemi di invio email?
R:
Vedi questo documento.
Se postfix funziona, ricordare di impostare nel file di configurazione /etc/main.cf il parametro myorigin con un dominio valido!
Idem per il parametro BounceDomain di acs-mail-lite!
Inoltre attenzione ad acs-mail-lite in oacs54: richiede tcllib 1.10 http://openacs.org/forums/message-view?message_id=1885701
-
D: Come configurare il mio PC per accedere a file-storage via WebDAV?
R: Troverai tuute le risposte in questa pagina xowiki.
-
D: Come usare XINHA?
R: Questo documento ti spiega come fare.
-
D: Come definire l'istanza di file-storage in cui gestire le immagini caricate via XINHA?
R: Ecco la risposta di Gustaf Neuman.
-
D: Come si può schedulare il restart giornaliero di Aolserver?
R: Vedi lo script /root/restart_aolserver.sh e modificalo come opportuno.
-
D: Come risolvere occasionali malfunzionamenti dei Daemontools?
R: Vedi questo documento.
-
D: Come fare apparire una piccola icona nella URL box del browser?
R:
La procedura è molto semplice:
- creare una immagine esattamente 100 x 100 pixels in formato jpeg o gif o png
- visitare il sito http://www.favicongenerator.com/ che offre il servizio di trasformarla nel formato .ico ed ottenere il file, che si DEVE chiamare esattamente favicon.ico
- copiare il file nella root directory del servizio
Fatto!
-
D: Come installare tsoap?
R: Vedi questo documento.
-
D: Come si gesticono i temi?
R: Vedi questo messaggio nel forum.
-
D: Come attivare manualmente POUND?
R:
Normalmente pound dovrebbe partire automaticamente al boot, ma altrimenti può essere attivato con il comando seguente:
/usr/local/sbin/pound -f /usr/local/etc/pound.cfg
-
D: Come avviare automaticamente Pound?
R:
Ho risolto il problema di avvio automatico di pound alla partenza del server.
Il problema era dovuto al fatto che pound veniva lanciato prima del servizio network
ed ovviamente andava in errore.
Questo perchè su Suse gli script memorizzati in /etc/init.d devono avere il commento:
### BEGIN INIT INFO
# Provides: pound
# Required-Start: $named
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: Pound reverse proxy
### END INIT INFO
al posto del commento che serviva per Red Hat:
# chkconfig: 35 80 20
Con Default-Start si specifica per quali runlevel bisogna far partire il servizio.
Con Required-Start, si specifica il servizio dopo il quale è possibile far partire il servizio corrente.
Per capire che valori poter mettere in Required-Start, bisogna vedere /etc/insserv.conf.
L'ho già provato su Eureka e l'ho già messo su Vestasoft.
Ora rimane da copiare il file pound che ti allego in /etc/init.d del server che abbiamo da Gazzoni.
Dare i diritti in modo coerente con gli altri script di tale directory (root.root e 755).
Ridefinire le priorità all'avvio con:
chkconfig --del pound
chkconfig --add pound
-
D: Come creare indirizzi IP addizionali su una unica scheda ethernet?
R:
- Individuare il file che descrive la scheda nella directory /etc/sysconfig/network (il file inizia con ifcfg-eth-id-*)
- Modificare il file aggiungendo, per ogni indirizzo IP, i seguenti comandi:
IPADDR_tornieri='192.168.70.14'
NETMASK_tornieri='255.255.255.0'
LABEL_tornieri='tornieri'
PREFIXLEN_tornieri=''
Naturalmente adattando l'indirizzo e il nome simbolico.
- Aggiungere un'entrata nel file /etc/hosts:
192.168.70.14 tornieri.vestasoft.com tornieri
- Riavviare i servizi di rete con: /etc/init.d/network restart
-
D: Come applicare un foglio di stile ad una pagina adp?
R:
Basta dichiarare il foglio nella property header_stuff, come nell'esempio seguente:
<property name="header_stuff"><link rel="stylesheet" type="text/css" href="http://www.vestasoft.com/resources/costs/portlet.css" media="all" /></property>
-
D: Le macchine VMWare clonate non vedono la scheda etho: che fare?
R:
In some cases, networking does not work properly in a copied or cloned virtual machine or a virtual machine deployed to end users as part of a VMware ACE package. If you copy a virtual machine and specify that the copy should have a unique identifier, the MAC addresses for any virtual Ethernet adapters attached to the virtual machine change. When a SUSE LINUX 10 guest operating system is installed, it includes the MAC address as part of a key configuration filename. When the virtual machine?s MAC address changes, the guest operating system might fail to associate this configuration file with the virtual Ethernet adapter. If you experience this problem, you can work around it by copying or renaming the file. For
eth0, for example, make the following change:
Old name:
/etc/sysconfig/network/ifcfg-eth0-id-<MAC_address>
New name:
/etc/sysconfig/network/ifcfg-eth0
-
D: Come risolvere il problema delle shared libraries sulla nuova SUSE SLES10?
R:
A volte le librerie appena installate non vengono viste dal sistema. In questo caso usare il comando:
/sbin/ldconfig /usr/local/lib
dove l'argomento indica il path di installazione.
-
D: Come installare tDOM sulla SUSE SLES10?
R: Occorre seguire i consigli di Gustaf e un po' di fortuna: http://openacs.org/forums/message-view?message_id=479910
-
D: Come creare una serie di numeri o di date in PostgreSQL?
R:
Dalla release 8.x è disponible una nuova funzione che restituisce come risultato un numero variabile di righe. La funzione si chiama generate_series ed accetta come argomenti start, stop e step che rappresentano il numero iniziale, quello finale e l'incremento della serie.
Un paio di esempi chiariscono come usarla:
select * from generate_series(0,14,7);
generate_series
-----------------
0
7
14
(3 rows)
select current_date + seqno as dates from generate_series(0,14,7) as s(seqno);
dates
------------
2007-01-13
2007-01-20
2007-01-27
(3 rows)
-
D: Come usare xowiki in un dotLRN portal?
R: Vedi i forum posting http://openacs.org/forums/message-view?message_id=459480 e http://openacs.org/forums/message-view?message_id=584170
-
D: Come installare e configurare LDAP in OpenACS?
R: Vedi http://openacs.org/forums/message-view?message_id=937445
-
D: Come attivare il tema Zen?
R:
Occorre fare altre prove.
Oltre alla documentazione ufficiale:
- http://openacs.org/xowiki/dotlrn-zen-standards
- http://openacs.org/xowiki/dotlrn-zen-project
vedi anche questo post: http://openacs.org/forums/message-view?message%5fid=1064955
-
D: Come importare un package in un repository CVS già esistente?
R:
La procedura è la seguente, usando come esempio il repository alter e il package bug-tracker:
- Posizionarsi nella top directory del package:
cd /tmp/bug-tracker
- Eseguire il comando di import facendo attenzione ad indicare il percorso nel repository:
cvs import -m "Importazione iniziale" alter/packages/bug-tracker oasisoftware start
- Cancellare il sorgente:
rm -rf /tmp/bug-tracker
- Aggiornare la propria working copy con:
cd /var/lib/aolserver/alter/packages
cvs up -Pd
-
D: Qual'è la procedura di upgrade di un sito OpenACS non modificato?
R:
- get the new core files
- start aolserver + openacs with the "old" database + new core files
- do upgrade of kernel packages
- restart
- do upgrade of application packages
- restart