This blog is mainly about Java...

Friday, July 4, 2008

How to change the language of your Firefox

I have installed ubuntu on a HP Compaq 6910p for my mom. She is not so fluent in english, so she wanted everything in Norwegian. I thought first that it would be easy to install firefox in norwegian. Boy was I wrong. Yes, I can easily download firefox in the language I wanted, but I wanted to modify the already existing mozilla firefox that was in Ubuntu Hardy Heron. This because all the plugins and whatnot was already installed for me.

Anyways, about two days worth of Googling, and I found a way.
What you need to do is go to this page:

http://releases.mozilla.org/pub/mozilla.org/firefox/releases/
Then you want to find your version of firefox, choose xpi, and then the language you want for firefox, and voilla! Enjoy...

Generating InnoDB engine and UTF-8 for MySQL using hibernate

I found these blogs:

http://blog.tremend.ro/2007/08/14/how-to-set-the-default-charset-to-utf-8-for-create-table-when-using-hibernate-with-java-persistence-annotations


and

http://neoexpedition.wordpress.com/2007/11/01/persisting-japanese-characters-in-db-using-hibernate

They had the same problem as me, on how to generate InnoDB engine and UTF-8 for MySQL through hibernate.

This is the solution for doing it:

In persistence.xml or hibernate.cfg.xml (depending on what you are using), you add this line to get InnoDB as engine.

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>


or

<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect">


if you are using MySQL 4.x.

To get utf8 as default charset, you have to create the database as default charset utf8 and hibernate will do that automatically for you.

create database foo default charset utf8;

Friday, May 23, 2008

Visiting Iran first time in 21 years (part 2)

Heading back from where I used to live, it was time for dinner. My aunt had made a list of all the food she knew to be good, and wanted me to choose which ones I liked. Mmmm. In hindsight, I shouldn't have eaten that much. I did gain a few kilos in the short period I was there :-D
Oh well....

Food like "Fesenghon", "Ghormesabsi", "Mirza Ghasemi", "Joje kabab", "Cholo kabab" and more are all coming back to me...

Party party party

My cousin Bashir, on the left here, through a party for me and invited some of his friends. Now I don't want to say too much, but it was a pretty cool party, much like the ones we have here in Norway if you know what I mean.
But one thing that can never prepare you was the smoking. The house was filled with smoke. I had to go out and take fresh air every 10 minutes.
Not much more happened that evening. We ended the party quite early and went home singing in the car.
Here is a short video clip from that car...


The days that followed was spent on sightseeing in Tehran. I went to a big museum, which is a park and some castles of the old palace from the Shah time, plus some other cool stuff.
Here is some pictures from inside and outside of the museum.
















These pictures are taken from outside of the museum. You can see the old cars which was used back during the Shah times.















These pictures are from inside of the castle. The rugs are hand made the one on the left was huge!

We also went to another castle where one could see The Marble Throne terrace.
It was a place where the former King used to receive gifts among other things when visitors came. There was also other gifts from Kings, Queens and other royalty as well as countries in one of the museums.

The king used to sit up on the throne and people would come from both sides and give gifts.






Here is right outside of the throne.





to be continued....

Wednesday, May 7, 2008

Seam-gen problems when having MyISAM as engine in MySQL

I tried running seam-gen on an existing MySQL database, where the engine is MyISAM.
Jboss-seam-2.0.1.GA is the version of seam I was running.

The strangest thing happened. When I reversed engineered the database to create entity beans, the foreign keys where not Objects like it is normally, but rather String.
For instance, in our Address entity bean, I have a foreign key that is mapped to the Country entity bean.
Normally the Address.java should look something like this:

@Entity
@Table(name = "address")
public class Address implements java.io.Serializable {

private Integer addressId;
//The ID
private Country country; //The foreign key
....
}


However, the foreign key was generated like this:
private String countryId; //The foreign key

But when I changed the MySQL engine to use InnoDB instead, and I ran a new seam-gen, it was generated correctly.

Just a heads up if someone encounters the same problem. I would guess it is a bug in either seam or hibernate. Probably hibernate, since it is hibernate that does the generation.

Labels