Archive for March, 2008

Autobackup de la base de datos

Friday, March 28th, 2008

Since this days the server has been out for holidays I have been tempted of moving everything to another server, just until the service is back. However I have faced the problem that I didn’t have access to an updated database, so I couldn’t do anything. I wished to have at least a version of the database from the same day or the day before of the server crash.

The question is that I have founded a quite easy solution: to send myself a mail with a copy of the database dump once or twice a day (this is not possible on every server)

In order to do that you only have to create a script like this.

#!/bin/sh

mysqldump -u user -ppassword -h host.domain database | gzip > ~/database.sql.gz

echo “This is an autogenerated mail with the backup” | mutt -s “[databasebak]” -a ~/database.sql.gz miemailparabackup@servidor.com

It’s necessary to have mutt installed because this command sends an email in MIME format so we can send a binary file attached

We can call this script “~/scripts/dbbak.sh” so now we only need a “crontab.txt” looking like:

SHELL=/bin/bash

#h m dom mon dow command

35 0,12 * * * ~/scripts/dbback.sh

And then we install the crontab file with

crontab crontab.txt

I hope it will be helpful for you.

Hace bastante frío en Noruega

Thursday, March 27th, 2008

During the last week it has been quite cold here in Trondheim. We have reached -12ºC. Here is the proof.

Woody.

Dreamhost caido

Thursday, March 27th, 2008

Since tree days ago this blog has been inaccessible because of one of Dreamhost’s cluster that has been down. I’m just considering to change to another host. It seems that the problem is not fixed yet, so It can keep on failing.

Estoy de vuelta

Monday, March 24th, 2008

It seems that the server is again working after being down the whole evenin. I hope it’s not going to happen again.

Blog disponible en inglés

Monday, March 24th, 2008

Finally I configured qTranslate in order to write english translations of some of the posts. For the moment usability seem to be ok. I will keep on using it and seeing how is it going.

Not everything is already translated but give me time.

Escuchame: “God Påske”

Sunday, March 23rd, 2008

Listen to me

Lytte meg: “God Påske”

Como me gusta el abrecartas leporido

Sunday, March 23rd, 2008

Note: do not use with email!!


The program ‘java’ can be found in the following packages:

Sunday, March 9th, 2008

The program ‘java’ can be found in the following packages:

* cacao

* j2re1.4

* kaffe

* jamvm

* java-gcj-compat

* gij-4.1

* gij-4.2

* sablevm

Try: sudo apt-get install <selected package>

bash: java: command not found

And I have just installed. We cannot forget to do:

sudo update-alternatives –config java

sudo update-alternatives –config javac

in order to fix the problem :(.

JBO-29000: Exception [TOPLINK-4002] – Luchando contra JDeveloper y ADF

Monday, March 3rd, 2008

Definitivamente en Oracle necesitan contratar a algún que otro incompetente. El motivo esta bien claro, al ser todos tan eficaces y preparados, cuando se encuentran con un mensaje de error semejante siempre sabrían como resolverlo inmediatamente.Este error ocurria siempre que intentabamos insertar un usuario en la tabla USERS a traves de un formulario. Depurando paso por paso hemos descubierto que todo funcionaba correctamente hasta llegar a la llamada a uow.commit(); donde se lanza la excepción.

Hemos seguido todos los pasos (incluso varias veces) del tutorial para ADF que Oracle proporciona intentando adaptar todos los pasos a nuestra aplicación.

Dejando nuestro código en la clase que hace de PublicFacadeBean de la siguiente manera:

public Users createUser(Long userID, String name,String password, String email, String perm){
UnitOfWork uow = getSessionFactory().acquireUnitOfWork();

Users newInstance = (Users)uow.newInstance(Users.class);

newInstance.setId(userID);
newInstance.setName(name);
newInstance.setEmail(email);
newInstance.setPassword(password);
newInstance.setPerm(perm);
newInstance.setAtempts(0);

uow.commit();

return newInstance;
}

Tras probar un montón de alternativas y buscar información por todos lados (solo hemos descubierto que esta excepción se lanza siempre sea cual sea el problema, así que no nos vale investigar), al final nos iluminamos con la idea feliz de usar la técnica del avestruz, consistente en meter el “commit” en un bloque “try” (meter la cabeza debajo de la tierra y hacer como si no pasara nada).

try{
uow.commit();
}
catch (Exception e){

}

No dabamos crédito cuando descubrimos que con esto todo funciona bien, pero digo yo que podrían dar un poco más de detalle en los mensajes de error.