vendredi 25 janvier 2013

Oracle : order by, different results [problem]


When you execute a SELECT .... ORDER BY query from a sql client (like SQuirreL), you may have a result with an order that is not the same when you execute your query with another sql client or inside your Java application.

It's depending on some locale parameters (country and language) on the client side.

For a Java application, you can update your locale by adding parameters to your jvm. 
For example : -Duser.country=en -Duser.language=en

There are more solutions here (adding a NLSSORT() to your ORDER BY clause, etc...).

FYI, you can check the NLS_LANGUAGE and the NLS_SORT on the Oracle server side :

Query:
select parameter,value from NLS_DATABASE_PARAMETERS where parameter in('NLS_LANGUAGE','NLS_SORT');

Result:
NLS_LANGUAGE AMERICAN
NLS_SORT BINARY


Source : http://stackoverflow.com/questions/8818201/oracle-order-by-different

lundi 14 janvier 2013

CherryPy and Python 3 : Port not bound / _Timer / _Event

Hi all,

I have recently updated my Python 3 and my CherryPy to the latest versions.

After that, different problems occur during the startup process of my application(using CherryPy):

These issues are marked as "resolved" ...  but in fact they are resolved in the release 3.2.3.

This release 3.2.3 is not easily accessible :
- not present on the CherryPy website on the "Download" section
- not present on the CherryPy bitbucket wiki
=>On the "Download" section and on the bitbucket wiki, the last version is the 3.2.2 :(

For downloading the 3.2.3, you must go to the project on bitbucket.org and click on "Downloads" 

Tada :)

samedi 12 janvier 2013

Crème au chocolat avec de la Maïzena

Pour 3 personnes.

Ingrédients :


  • 50 g de Maïzena 
  • 50 g de chocolat en poudre 
  • 75 g de sucre poudre 
  • 750 cl de lait

Préparation :
  • Dans une casserole, verser une partie du lait avec tout le sucre et porter à ébullition.
  • Dans un saladier, mélanger la Maïzena, le chocolat en poudre et le reste du lait.
  • Verser le lait chaud dans le saladier et mélanger.
  • Reverser le tout dans la casserole et faire réchauffer en mélangeant. La crème s'épaissit.
  • Verser dans des ramequins et servir frais.



lundi 7 janvier 2013

SQL : Trier dans l'ordre des valeurs présentes dans la clause IN()

Si vous avez une requête SQL avec une clause IN(<valeurs>), et que vous souhaitez récupérer les rows dans un ordre bien précis (par exemple dans l'ordre des valeurs présentes dans le IN()), il existe une solution :


Sous MySQL:
SELECT id FROM table1 WHERE id IN(1, 20, 45) ORDER BY FIELD(id, 1, 20, 45)

Sous Oracle:

SELECT id FROM table1 WHERE id IN(1, 20, 45) ORDER BY INSTR('1, 20, 45', id);
Source : http://stackoverflow.com/questions/396748/ordering-by-the-order-of-values-in-a-sql-in-clause



N'hésitez pas à me laisser un petit commentaire :)

Categories