Archive pour février 2012
JAVA – memory, GC & co
Posté par D.E.S. dans capitalisation, GEEK le 28 février 2012
ORACLE – ressources
Posté par D.E.S. dans capitalisation, GEEK le 28 février 2012
sites de référence :
http://dba-oracle.com
JAVA – Signed vs unsigned integer (vs C/C++)
Posté par D.E.S. dans capitalisation, GEEK, Pertinent le 27 février 2012
source – extract(s) :
>> C/C++:
1 2 3 4 5 |
unsigned byte b = ...; b += 100; unsigned int v = ...; v *= 2; |
>>> Java:
1 2 3 4 5 |
int b = ...; b = (b + 100) & 0xff; long v = ...; v = (v * 2) & 0xffffffff; |
When an integer is signed, one of its bits becomes the sign bit, meaning that the maximum magnitude of the number is halved. (So an unsigned 32-bit int can store up to 232-1, whereas its signed counterpart has a maximum positive value of 231-1.)
Signed vs unsigned shifts
An important exception is the right shift operator, represented by two « greater than » symbols: >>. In both C/C++ and Java, this operator performs sign extension: that is, as well as shifting the bits of the number one place to the right, it preserves the sign. Specifically, after performing the shift, it copies the sign bit (the leftmost bit) into the leftmost position.
Now, if we’re treating an integer as unsigned, then we don’t want to copy the sign bit, because it doesn’t actually represent the sign! Instead, we want to leave it as zero. To achieve this, in Java, instead of writing >>, we write >>>. This variant of the shift is sometimes called a logical shift, and the previous variant— which takes account of the sign— an arithmetic shift. At the machine code level, most architectures in fact provide different instructions for the two shifts, and the C/C++ compiler chooses the appropriate one depending on whether we’ve declared the variable in question as unsigned. In Java, we must explicitly say which type we require.
ALLMYAPPS & NINITE – réinstaller son ordinateur (plus) facilement
Accessibles et faciles d’utilisation : allmyapps & ninite (cf. google) vous permettent d’installer une série d’application de façon complètement automatique !
…
SQL (sqlplus / plsql / Oracle / Etc.)
Posté par D.E.S. dans capitalisation, GEEK le 8 février 2012
En vrac… pour memo :
>> Génération d’un script d’inserts à partir d’une table sur une base non visible de la table à remplir :
1 2 3 4 5 |
select 'Insert into tablelibellescible(LOCALE,KEY,VALUE,TRANSLATED,CODE,TYPE) values ('''|| TS.locale||''','''||'localisation.'||TS.id_libelle||''','''|| REPLACE(TS.libelle,'''','''''') ||''',1'||','''||'CODE_DEFAUT'||''','''||'TYPE_DEFAUT'||''');' from tablelibellessource TS order by TS.id_libelle,TS.locale; |
>> Attention aux commentaires dans sqlplus /* */, bien mettre un espace après ‘/*’ => ‘/* ‘ au risque de voir la commande précédante interprétée ue seconde fois, le ‘/’ étant interprété par sqlplus comme ‘exécute la commande que tu as en mémoire’
Où
1 |
REPLACE(t0.libelle,'''','''''') |
permet de doubler les quotes dans la string récupérée du select.