Monday, February 29, 2016

Lever et activer les contraintes d'un schéma Oracle

Désactivation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'ENABLED' ORDER BY c.constraint_type DESC) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' disable constraint ' || c.constraint_name); END LOOP; END; 

Activation

BEGIN FOR c IN (SELECT c.owner, c.table_name, c.constraint_name FROM user_constraints c, user_tables t WHERE c.table_name = t.table_name AND c.status = 'DISABLED' ORDER BY c.constraint_type) LOOP dbms_utility.exec_ddl_statement('alter table ' || c.owner || '.' || c.table_name || ' enable constraint ' || c.constraint_name); END LOOP; END;

Source : http://www.silverlake.fr/index.php?post/2010/12/11/Lever-et-activer-les-contraintes-Oracle

LF will be replaced by CRLF in git - What is that and is it important

Thursday, February 25, 2016

Equivalent type TEXT MySQL in Oracle

Oracle has BLOB, CLOB and NCLOB for storing binary, character and unicode character data types. You can also specify the LOB storage area which allows a DBA to fine tune the storage if necessary (i.e. putting the LOB data on separate disks)

Check this out : http://docs.oracle.com/cd/B10501_01/server.920/a96524/c13datyp.htm#13754

Thursday, February 18, 2016

[Git] Comment annuler un commit ?

Supprimer définitivement le dernier commit non pushé :
  • git reset --hard HEAD~1

Supprimer le dernier commit non pushé tout en conservant les modifications dans la staging area :
  • git reset --soft HEAD~1

Supprimer le dernier commit pushé
  • git revert HEAD~1

Thursday, February 11, 2016

Oracle Keywords

The following words also have a special meaning to Oracle but are not reserved words and so can be redefined. However, some might eventually become reserved words.

ADMINCURSORFOUNDMOUNT
AFTERCYCLEFUNCTIONNEXT
ALLOCATEDATABASEGONEW
ANALYZEDATAFILEGOTONOARCHIVELOG
ARCHIVEDBAGROUPSNOCACHE
ARCHIVELOGDECINCLUDINGNOCYCLE
AUTHORIZATIONDECLAREINDICATORNOMAXVALUE
AVGDISABLEINITRANSNOMINVALUE
BACKUPDISMOUNTINSTANCENONE
BEGINDOUBLEINTNOORDER
BECOMEDUMPKEYNORESETLOGS
BEFOREEACHLANGUAGENORMAL
BLOCKENABLELAYERNOSORT
BODYENDLINKNUMERIC
CACHEESCAPELISTSOFF
CANCELEVENTSLOGFILEOLD
CASCADEEXCEPTMANAGEONLY
CHANGEEXCEPTIONSMANUALOPEN
CHARACTEREXECMAXOPTIMAL
CHECKPOINTEXPLAINMAXDATAFILESOWN
CLOSEEXECUTEMAXINSTANCESPACKAGE
COBOLEXTENTMAXLOGFILESPARALLEL
COMMITEXTERNALLYMAXLOGHISTORYPCTINCREASE
COMPILEFETCHMAXLOGMEMBERSPCTUSED
CONSTRAINTFLUSHMAXTRANSPLAN
CONSTRAINTSFREELISTMAXVALUEPLI
CONTENTSFREELISTSMINPRECISION
CONTINUEFORCEMINEXTENTSPRIMARY
CONTROLFILEFOREIGNMINVALUEPRIVATE
COUNTFORTRANMODULEPROCEDURE

PROFILESAVEPOINTSQLSTATETRACING
QUOTASCHEMASTATEMENT_IDTRANSACTION
READSCNSTATISTICSTRIGGERS
REALSECTIONSTOPTRUNCATE
RECOVERSEGMENTSTORAGEUNDER
REFERENCESSEQUENCESUMUNLIMITED
REFERENCINGSHAREDSWITCHUNTIL
RESETLOGSSNAPSHOTSYSTEMUSE
RESTRICTEDSOMETABLESUSING
REUSESORTTABLESPACEWHEN
ROLESQLTEMPORARYWRITE
ROLESSQLCODETHREADWORK
ROLLBACKSQLERRORTIME

Oracle Reserved Words

The following words are reserved by Oracle. That is, they have a special meaning to Oracle and so cannot be redefined. For this reason, you cannot use them to name database objects such as columns, tables, or indexes.

ACCESSELSEMODIFYSTART
ADDEXCLUSIVENOAUDITSELECT
ALLEXISTSNOCOMPRESSSESSION
ALTERFILENOTSET
ANDFLOATNOTFOUNDSHARE
ANYFORNOWAITSIZE
ARRAYLENFROMNULLSMALLINT
ASGRANTNUMBERSQLBUF
ASCGROUPOFSUCCESSFUL
AUDITHAVINGOFFLINESYNONYM
BETWEENIDENTIFIEDONSYSDATE
BYIMMEDIATEONLINETABLE
CHARINOPTIONTHEN
CHECKINCREMENTORTO
CLUSTERINDEXORDERTRIGGER
COLUMNINITIALPCTFREEUID
COMMENTINSERTPRIORUNION
COMPRESSINTEGERPRIVILEGESUNIQUE
CONNECTINTERSECTPUBLICUPDATE
CREATEINTORAWUSER
CURRENTISRENAMEVALIDATE
DATELEVELRESOURCEVALUES
DECIMALLIKEREVOKEVARCHAR
DEFAULTLOCKROWVARCHAR2
DELETELONGROWIDVIEW
DESCMAXEXTENTSROWLABELWHENEVER
DISTINCTMINUSROWNUMWHERE
DROPMODEROWSWITH

Wednesday, February 10, 2016

Faire un include avec Symfony2 et Twig

Symfony 2 Génération des traductions

Symfony propose un outil console qui génère des traductions.

Extraction des traductions dans un bundle avec translation:update
php app/console translation:update fr --force --output-format=xlf

Cette commande crée le fichier app/Resources/translations/messages.fr.xlf

Le premier paramètre de ces deux commandes est la locale pour laquelle il faut générer la liste des traductions ( fr dans notre exemple)
Si un fichier de traduction existe déjà, il est mis à jour en ajoutant les clés absentes de la précédente version

La valeur de --outpu-format indique que le format du fichier de sortie :xlf pour XLIFF, yml pour Yaml et php pour PHP

Tuesday, February 2, 2016

Disable comment on wordpress

Copy this on your function.php file :

add_filter('comments_open', 'wpc_comments_closed', 10, 2); function wpc_comments_closed( $open, $post_id ) { $post = get_post( $post_id ); if ('post' == $post->post_type) $open = false; return $open; }

This function disable comments on post, you can disable comment on page or custom type content, you should set false on these as well.

Source : https://wpchannel.com/desactiver-commentaires-wordpress/