
ivan

ivan.revelli@synaptica.info

10 March 2010
-
-
-
-
SELECT
-
U.OBJECT_NAME,U.STATUS ,DBMS_METADATA.GET_DDL(U.object_type,u.object_name)
-
FROM
-
user_objects u
-
WHERE
-
object_type = ‘TRIGGER’;
-
-
-
-
-
SELECT object_type, COUNT(*) FROM USER_OBJECTS
-
GROUP BY OBJECT_TYPE
-
-
-

ivan

ivan.revelli@synaptica.info

10 March 2010
to raise an Exception from a Trigger, Stored Procedure or Function without needing enithing you can use the function : raise_application_error.
Syntax : raise_application_error(<your excpetion integer code>, <your string description>);

ivan

ivan.revelli@synaptica.info

10 March 2010

http://www.openclipart.org , non lo conoscevo e ne sono rimasto veramente impressionato, è un archivio di ClipArt in fomrato vettoriale SVG enorme, qualsiasi cosa ho scritto nella ricerca mi son trovato l’immagine corrispondente. Come direbbe il signor Burns dei Simpons “Eccellente”. Ogni immagine selezionata è disponibile per il download in formato sia svg che png.
Ogni immagine è sotto la copertura delle Creative Commons, quindi in teoria l’uso commerciale è consentito a patto che se ne citi la fonte, il che mi sembra veramente un requisito minimo. Se penso al tempo che ho buttato creandomi delle immagini oscene per le mie presentazioni - siti e applicazioni ad un sito così mi sarei felicemente abbonato.
a presto
ivan

ivan

ivan.revelli@synaptica.info

8 March 2010
Oracle Version : 10g
As you know inside a Oracle row trigger you cannot access to the base table, for example when you make a trigger like this, on a table named “activity“.
-
-
CREATE OR REPLACE TRIGGER UNAME.ACTIVITY_FK_MENU_INTEGRITY
-
AFTER INSERT OR UPDATE
-
ON UNAME.ACTIVITY
-
REFERENCING NEW AS New OLD AS Old
-
FOR EACH ROW
-
DECLARE
-
-
tmpVar NUMBER;
-
e_Menu_Already_Exists EXCEPTION;
-
-
BEGIN
-
SELECT count(*) INTO tmpVar FROM Activity aa WHERE (aa.fk_menu = :new.fk_menu)AND(aa.pk_id <> :new.pk_id);
-
-
-
– if (tmpVar > 0) then
-
–:New.FK_MENU := null;
-
– raise e_Menu_Already_Exists;
-
– end if;
-
-
END ACTIVITY_FK_MENU_INTEGRITY;
-
when you try to use the table making an update happen this :

To avoid this error and obviusly assuming the risk about ricorsive trigger, you can define a custom transaction for your trigger, so you can access to data inside the mutating table. To do this you need to declare “PRAGMA AUTONOMOUS_TRANSACTION;” means that the trigger give a specific transaction. So now you need to specify an explicit “commit;” at the end of the trigger.
The example will result like:
-
-
CREATE OR REPLACE TRIGGER UNAME.ACTIVITY_FK_MENU_INTEGRITY
-
AFTER INSERT OR UPDATE
-
ON UNAME.ACTIVITY
-
REFERENCING NEW AS New OLD AS Old
-
FOR EACH ROW
-
DECLARE
-
PRAGMA AUTONOMOUS_TRANSACTION;
-
tmpVar NUMBER;
-
e_Menu_Already_Exists EXCEPTION;
-
-
BEGIN
-
SELECT count(*) INTO tmpVar FROM Activity aa WHERE (aa.fk_menu = :new.fk_menu)AND(aa.pk_id <> :new.pk_id);
-
-
commit;
-
-
END ACTIVITY_FK_MENU_INTEGRITY;
-
that’s all until next tip
bye
ivan

Riccardo

riccardo.casatta@synaptica.info

26 February 2010
Hello,
we want to sync two directories in two different server that are connected to the internet. We want to use ssh as channel protocol because we already have the firewall rules to connect and because it is encrypted.
First of all we need that machine A will connect to machine B without password asking, this can be achieved by generating public key from machine A and copy it to machine B. Here are the commands:
generate the key from machine A.
the public key will be created in /home/[user]/.ssh/id_rsa.pub
then we copy it to the machine B
-
scp /home/[user]/.ssh/id_rsa.pub [user]@[machine-B]
now we have to append the contents of the file id_rsa.pub in ./ssh/authorized_keys
-
cat id_rsa.pub >>~/.ssh/authorized_keys
Now we can connect with ssh from machine A to machine B without password asking.
Now we use rsync from machine A to sync the directories.
-
rsync -zave ssh –numeric-ids –recursive –delete [user]@[machine-B]:/dir1 /dir2
After this command we found /dir2/dir1 on machine A, backupped and synced. Put the commands in cron to have sync over time.
We can now sleep peacefully.

ivan

ivan.revelli@synaptica.info

25 February 2010
L’inversione di tendenza ? ma speriamo di no, che l’Open Source abbia permesso a milioni di società e di individui singoli di poter accedere ,e dare il proprio contributo ,a Software prima inarrivabili è ormai noto. Era normale aspettarsi che tutti coloro che giustamente vivono sulle licenze dei “loro” software non vedano di buon occhio questa nuova filosofia, che a detta di molti non è una cosa che va contro le regole del mercato.
In questo senso non mi esprimo, ma credo che fino ad oggi la bilancia dei vantaggi e svantaggi di questa nuova filosofia di cooperazione penda fortemente dalla parte dei vantaggi.
Ulitmamente mi capita di leggere cose che mi lasciano un po sconcertato, una di queste fù l’articolo pubblicato da Riccardo che ad una riunione presso un grosso cliente sentì dire la frase “l’open source è illegale”.
Oggi leggendo ,come di mio consueto, il blog http://www.ossblog.it , che è un blog a mio avviso molto “fico” e attendibile mi ritrovo quest’articolo : “Usate software FOSS? Allora siete dei pirati!“.
C’era da aspettarselo? boh non credo comunque sia non sta a me decidere, penso che in tutte le cose ci voglia moderazione e in questo caso son andati un po oltre, creando anche una lista nera di paesi additati per questo.
a presto
ivan