Rasmus​.krats​.se

Denna sida på svenska

Posts tagged “java”

Reminiscing this and that, on the web since 1994.

Logdriver

Posted 2009-06-03 18:10. Last updated 2017-06-24 12:00. Tagged , , , .

When developing code with Hibernate (or other Java tools that create SQL statements for you) it is often a good idea to take a close look at the generated SQL code, for example if you have performerance issues.

A very nice and simple way to do that is logdriver by Ryan Bloom. (Update 2017-06-24: Unfortunatley, the domain seems to have been lost to a spam site).

And it’s simple to use! I’ve got a .properties file where I’ve commented out the ordinary db driver and use logdriver instead. As simple as this:

# DB_DRIVER=oracle.jdbc.driver.OracleDriver
# DB_URL=jdbc:oracle:thin:@dbhost.mydomain:1523:db
DB_DRIVER=net.rkbloom.logdriver.LogDriver
DB_URL=jdbc:log:oracle.jdbc.driver.OracleDriver:oracle:thin:@dbhost.mydomain:1523:db

Be the first to comment.

Destruktorer och defer

Publicerad 2014-11-09 00:10. Taggat , , , , , .

En av de saker jag verkligen gillar i c++ är att man kan ha lokala variabler som är objekt i kombination med att objekt har destruktorer. När man lämnar ett scope där det finns lokala variabler kommer deras destruktorer omedelbart att köras, oavsett hur man lämnar scopet. Det ger ett trevligt sätt att hantera öppna filer, databaskoppel, mutexar och annat som behöver stängas. Andra språk har andra, ofta krångligare, sätt att få motsvarande resultat.

Språket go har en helt annan aproach, som är värd att titta lite närmare på.

Läs hela Destruktorer och defer med 2 kommentarer.

Some ways to log stuff in java

Posted 2013-11-14 15:10. Tagged , , .

Logging in java is a mess. For a long time there was no standard way of logging in java, so there is a lot of 3:rd party solutions. Apache commons logging, slf4j, and log4j are probably the most used.

By now, there is standard java.util.logging package, but most people stick to the old 3:rd party solutions. As we shall see, that isn’t really surprising, since java util logging kind of sucks.

I have done some exploration of different options for logging in java.

Read whole Some ways to log stuff in java.

Black Box

Posted 2000-07-03 22:58. Tagged , , .

Welcome to this simple mind game.

Read whole Black Box.

Java game of fifteen tiles

Posted 1998-07-25 22:43. Tagged , , .

This is the classical game of fifteen tiles in Java. If you’ve seen a real one it shouldn’t be too hard to figure it out …

Read whole Java game of fifteen tiles.