Thursday, May 13, 2010

Taxme Ubuntu Lucid Lynx

Well this post is very strongly Swiss oriented and of no interest to anyone not living in Bern.

I downloaded the new Taxme software, for paying taxes, nothing very funny!
Unfortunately, it worked fine with Ubuntu 9.10, but with Lucid, it just did not start.
Silently without any notice. The log was not very explicit, but I then tried to start the application with root. And it worked.

i.e. from the console:

sudo ./TaxMeBe2009

There is still a problem with the help which cannot be displayed as apparently the application cannot find firefox.

Strangely I had to download the version with the java virtual machine. But this is most probably due to the fact that I have a 64b system

Monday, May 10, 2010

Ubuntu lucid lynx post installation

There is a few things you need to do after installing Unubu lucid lynx

1. Ubuntu restricted extra (thank you Ranjith Siji, even if I saw it also elsewhere). The problem is if you want real Java as I do, you will have to remove openJDK 6 and install the sun version.

2. As I use gmail on the web, I found a well integrated application (thank D0od ). It is perfectly integrated into the me menu. The problem is you can only watch one mail account at the time.

To install it open a terminal and enter the following lines carefully: -

  • sudo add-apt-repository ppa:gm-notify-maintainers/ppa
  • sudo apt-get update && sudo apt-get install gm-notify

To set up your GMail account with GMail Notifier head to System > Preferences > GMail Notifier Configuration. From here you can also specify alert sounds, labels and on-launch preferences.

3. Skype I'm not very happy that Skype is not in the repositories anymore, thus you have to download it from the skype site

4. vlc media player

5. Desktop Webmail allows an additional integration between gmail and Ubuntu. (Thank you Kaba)
After installing Desktop Webmail (sudo apt-get install desktop-webmail) set-it-up as your default e-mail client in System -> Preferences -> Preferred Application – > Mail Reader, replacing Evolution with desktop-webmail.

Friday, May 7, 2010

Facelets and eclipse

Per default, eclipse does not recognize xhtml files, the default file extension for facelets. I.e., you don't have code completion and the jsf managed beans are not recognized either.

There is a solution:

In window->preferences you do 2 things...

1. In General->Content Types you choose text/jsp in the content types and add *.xhtml as a file association

2. In General->Editors->File Associations select the *.xhtml file type and add th JSP Editor as the Default

I'm not sure if you really need to put the TLD in WEB-INF. (at least with eclipse 3.5) It workds without for me.
now just add the TLD to WEB-INF dir of your project and hey presto tag:completion now works for xhtml files.

I picked this from Andrew Lovell, thanks a lot.

Friday, April 16, 2010

Template Method Pattern

I'm not a big fan of the template method pattern, but it is useful.
Usually I apply it only when I have to made a change, and realize, I have to do it at too many places. I don't like it because it is a bit confusing, especially the stack traces.

Here is an example taken from a db connection.

public abstract class Template{
String sql ;
Template(String sql){
this.sql = sql;
}

public void exec() {
Statement statement = null;
ResultSet rs = null;
try {
statement = getConnection().createStatement();
rs = statement.executeQuery(sql);
execute(rs);
} catch (SQLException e) {
log.error("failed to execute query " + sql);
throw e;
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
log.error("failed to close result set");
}
}
if (statement != null) {
statement.close();
}
}
public abstract void execute(ResultSet resultSet);
}


The problem lies in retrieving something from the execute method


final List results = new ArrayList();
Template call = new Template(sql) {

@Override
public void execute(ResultSet rs) throws SQLException {
rs.next();
Boolean result = rs.getBoolean("BoolColumn");
results.add(result);
}
};
call.exec();
boolean result = results.get(0);


Maybe I missed something, but It is the best way I found for retrieving a value.

Tuesday, March 16, 2010

Hidden feature of ant's Taskdef

I recently had a problem with ant taskdef task.
I could launch findbugs with ant from within eclipse and from the console, but once it was launched by hudson, I got an error:

BUILD FAILED
/var/lib/hudson/jobs/jpf/workspace/build.xml:30: taskdef class edu.umd.cs.findbugs.anttask.FindBugsTask cannot be found

the ant file was correct but I found out (by googling of course) that the by adding a classpathref entry, I solved the problem.









The taskdef task documentation does not evoke the classpathref tag. It should probably be well known, but I don't use ant on an everyday basis.

Thursday, August 20, 2009

The meaning of GPL

Like most of you I guess there is always the question of what am I allowed to do with GPL libraries.

I found an understandable blog about this topic which I summerize here it is based on MySQL, but basically, it is a description of GPL:

Here are some things the GPL allows:

  • The GPL allows you to run a for-profit business on MySQL.
  • The GPL allows you to modify the MySQL source code in any way you want.
  • The GPL allows you to sell MySQL.
  • The GPL allows you to redistribute MySQL.
  • The GPL allows you to redistribute your modifications of MySQL.

Here are some things the GPL does not require:

  • The GPL doesn’t require you to redistribute your modifications to MySQL.
  • The GPL doesn’t require you to GPL-license any software that merely connects to MySQL.
  • The GPL doesn’t require you to GPL-license all the software in your company.

So if you have to buy a commercial license for things the GPL doesn’t permit, what are those? Here are a couple of scenarios I can think of.

  • You need a commercial license if you want to modify MySQL and redistribute the result as non-Free software.
  • You need a commercial license if you want to embed MySQL within your non-Free program. Note that embed is not the same as “make a connection to.”

Wednesday, June 24, 2009

Environment Variables in Ubuntu

I got some problems to find out where I should define environment variable in Ubuntu.
I had to search a while and finally found the right page:

https://help.ubuntu.com/community/EnvironmentVariables

in summary
  • ~/.profile - This is probably the best file for placing environment variable assignments in, since it gets executed automatically by the DisplayManager during the startup process desktop session as well as by the login shell when one logs-in from the textual console.

  • ~/.bash_profile or ~./bash_login - If one of these file exist, bash executes it rather then "~/.profile" when it is started as a login shell. (Bash will prefer "~/.bash_profile" to "~/.bash_login"). However, these files won't influence a graphical session by default.

  • ~/.bashrc - Because of the way Ubuntu currently sets up the various script files by default, this may be the easiest place to set variables in. The default configuration nearly guarantees that this file will be executed in each and every invocation of bash as well as while logging in to the graphical environment. However, performance-wise this may not be the best thing to do since it will cause values to be unnecessarily set many times.