Tagebuch eines Technikers

Tuesday, September 8, 2009

Howto install BibLaTeX with MikTex

I recently found a pointer to BibLaTeX, a reimplementation of the bibliographic capabilities of LaTeX. It is still in beta stage
MikTeX 2.7, BibLaTeX 0.8h
  1. Download BibLaTeX.
  2. Create a folder named local-texmf (or choose a different name, it doesn't matter) somewhere on your hard drive. This folder will be used to install biblatex.
  3. Create a folder named local-texmf/tex/latex/biblatex. Unzip the contents of the latex-subdirectory of biblatex package into this folder.
  4. Create a folder named local-texmf/doc/latex/biblatex/. Unzip the documentation into this folder.
  5. Extract the remaining folders of the zip package into local-texmf.
  6. Open the "Settings"-window of MikTeX and choose add your folder as root. You might need admin rights for this.
  7. Open the "Settings"-window and choose "Refresh FNDB"
That's it. Now you can use BibLaTeX!

Sunday, February 22, 2009

Display result of select in vertical format

Sometimes the default way of displaying query results in tabular format can be quite annoying. Escpecially, when you have to view them i a small CL window. Fortunately, there is a workaroung:

SELECT * FROM USER\G

By replacing the default ; with \G, the result gets displayed in vertical format. Of course, this needs more vertical space in the CL window. On the other hand, you do not have to deal with annoying line wrapping and stuff.
Be sure to use a capital G though, otherwise this will not work and result in the default tabular view instead.

Saturday, February 21, 2009

Many-to-one and tinyblob

I had the weirdest bug the other day. I was creating a data model for a Java application using JPA and Hibernate as provider.

I was implementing a many-to-one-relationship. Even though I'm no pro at JPA, I never experienced big trouble. Until now. Suddenly, my relations did not turn out in the database model I expected. Instead of creating a foreign key, I always had a tinyblob field. The relevant parts of the class were something like:

protected FinanceProfile financeProfile;

// ...

@ManyToOne
public void setFinanceProfile(FinanceProfile financeProfile) {
this.financeProfile = financeProfile;
}

public FinanceProfile getFinanceProfile() {
return financeProfile;
}


I tried to use this class, but always received an error like:
org.hibernate.exception.DataException: could not insert [com.mypackage.model.FinanceAccount][SQL: 0, 22001]
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'finance_profile' at row 1

Now, do you see the error? Because... well, I didn't. Took me several hours to figure it out. The culprit is... tadaa... I had switched the order of the getter/setter-methods. Well, Eclipse did this for me, and I didn't check. After I changed the order of the two methods (and put the annotation above the getter), everything was ok.

I think I should start annotating the members themselves. That way, this won't happen again (at least I hope so).