Ruben Laguna's blog

Aug 31, 2007 - 1 minute read - bug compare contentMergeViewer eclipse enhancement java page preference preferencepage

Eclipse #201116 contentMergeViewers discarded

I filled Bug 201116 – Compare will silently discard additional contentMergeViewers associated with the same file extension a couple of days ago. As Szymon Brandys says eclipse should allow the user to switch between the differente merge viewer available for a given extension. He proposes two solutions:

  1. Having a mechanishm inside the compare view to do the switch
  2. or having a preference page to do the same

I feel more inclined towards the second solution, as I’m used to change the defautl editor for .xml, etc though the preference page General -> Editors -> File Associations. Having a similar preference page would fit me. I’m trying to figure out how to integrate a preference page to org.eclipse.compare and send it back to eclipse.org to include it in the next release.

Aug 23, 2007 - 1 minute read - eclipse font fontdefinition formatter java plugin

Updating the java compare plugin

I received some comments about my java compare plugin about my plugin ignoring preferences for text font and formatter settings. I didn’t address those at the beginning because I didn’t notice so as soon as I realized that was missing I put my hands at work.

The java formatter settings was easy just modifying the old

final Properties options = new Properties();
final CodeFormatter codeFormatter = ToolFactory .createCodeFormatter(options);

with

final Map options = JavaCore.getOptions();
final CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(options);

That’s easy. The font issue was also easy, just adding the following snippet to the plugin.xml did the trick:

Aug 19, 2007 - 1 minute read - avahi avahi-daemon dns domain linux local opendns troubleshooting

avahi and .local domain troubleshooting

I got the “avahi-daemon disabled because there is a unicast .local domain” but I have no .local domain so I was a little bit confused.

~$ sudo /etc/init.d/avahi-daemon restart
 * Restarting Avahi mDNS/DNS-SD Daemon: avahi-daemon                            
 * avahi-daemon disabled because there is a unicast .local domain

After a while I realized that my ISP is playing tricks with the DNS. It will never return a “DNS lookup failed”, it always resolve any dns name you pass to it. If the name is assigned it will return the proper IP but if the name is not assigned it will return the IP of the ISP portal. (Nice trick to get more page hits in their home page).

Aug 18, 2007 - 2 minute read - code comments compare decided eclipse formatting ignore java revisions whitespace

Eclipse Compare. Ignoring java formatting changes not only whitespace.

I met some difficulties dealing with the default eclipse java compare. I got involved on a project where everybody likes to commit code to CVS formatted their way, so comparing between CVS revisions is almost impossible.

So I decided to start investigating about Eclipse plugin development to make a Java Compare Viewer that not only ignores whitespace but also all java formatting changes. The result is the following

*Before *ignore java formatting plugin: comparebefore.png

Aug 17, 2007 - 1 minute read - easyinstall howto installation linux plugin python rpc setuptools trac xml xmlrpc xml_rpc

How to install trac 0.10.4 and XmlRpcPlugin on a non-standard directory location

First you need setuptools/EasyInstall:

cd $HOME/opt
wget http://peak.telecommunity.com/dist/ez_setup.py
mkdir -p $HOME/opt/easyinstall/lib/python2.4/site-packages
PYTHONPATH=$HOME/opt/easyinstall/lib/python2.4/site-packages python ez_setup.py --prefix=$HOME/opt/easyinstall

Next, trac:

cd $HOME/opt
wget http://ftp.edgewall.com/pub/trac/trac-0.10.4.tar.gz
tar xvzf trac-0.10.4.tar.gz
cd trac-0.10.4
python setup.py install --prefix=$HOME/opt/trac
cd ..
rm -rf trac-0.10.4
cd trac
PYTHONPATH=$HOME/opt/easyinstall/lib/python2.4/site-packages/:$HOME/opt/trac/lib/python2.4/site-packages/  bin/trac-admin $HOME/testtracenv initenv

Then the xmlrpcplugin:

cd $HOME/opt
wget -O xmlrpcplugin.zip  'http://trac-hacks.org/changeset/latest/xmlrpcplugin?old_path=/&filename=xmlrpcplugin&format=zip'
unzip xmlrpcplugin.zip
cd xmlrpcplugin/0.10/
PYTHONPATH=$HOME/opt/easyinstall/lib/python2.4/site-packages/ python setup.py bdist_egg
cp dist/*.egg $HOME/testtracenv/plugins
cat <<EOF >>$HOME/testtracenv/conf/trac
.ini
> [components]
> tracrpc.* = enabled
> EOF

And now you can test your installation:

Jul 25, 2007 - 1 minute read - details eclipse error errordialog exception java reporting stacktrace

Eclipse Error Reporting: Exception stacktrace details

I’m working with Eclipse 3.2.2 RCP right now and I’m getting an exception that I want to display on screen. I found in the eclipsepedia that we must use ErrorDialog to report errors:

try {
// ...
} catch (InvocationTargetException e) {
  IStatus status = new Status(IStatus.ERROR, Application.ID, 1, "Exception found.", e.getCause());
  ErrorDialog.openError(window.getShell(),"Error while loading file", null,status);                     
}

But using this code snippet will only print the e.getLocalizedMessage() in the Details pane of the ErrorDialog. See screenshot

Jul 5, 2007 - 1 minute read - bug domexception java namespace namespace_err saaj saaj0511

Java bug producing SAAJ0511 error

I run onto the following exception a couple of days ago:

Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create
 or change an object in a way which is incorrect with regard to namespaces.
        at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.checkDOMNSErr
(CoreDocumentImpl.java:2421)

the following log trace was also present in the log file

SEVERE: SAAJ0511: Unable to create envelope from given source

Apparently I run onto a known java bug present in jdk1.5.0_08 up to jdk1.5.0_11. Funny, I downgraded to jdk1.5.0_07.

Jul 5, 2007 - 2 minute read - avi avi_files files linux normalize rename script shows srt_files tv

Scripts to rename avi files from TV Shows

If you got a lot of ill-named files like:

$ ls
S01E03.The.Sopranos.S01E03.Denial.Anger.Acceptance.avi
The.Sopranos.1x04.Meadowlands.avi
The.Sopranos.S01E01.The.Sopranos.avi
The.Sopranos.S01E02.46.Long.avi
The.Sopranos.S01E06.Pax.Soprana.avi
The_Sopranos.105.College.avi

that your divx player can’t sort properly and you want to end up with something like:

$ ls
1x01.avi  1x02.avi  1x03.avi  1x04.avi  1x05.avi  1x06.avi  

you can use the following script in this way:

cd /path/to/avi/files
../script.sh|sh

and if you want to do the same thing to srt files then:

cd /path/to/srt/files
../script.sh srt|sh

As an example the script will normalize any of the following patterns S01E03, 103,1x03, or just 03 to 1x03.

Jul 4, 2007 - 3 minute read - cost españa euro money parity power ppp purchasing purchasing-power-parity spain suecia sweden Uncategorized

Cost of life in different countries

I’m moving to Sweden soon and a friend of mine sent me the following link (in Spanish, sorry) about the salaries in different countries. From here, I learnt about Purchasing Power Parity and using the data from the IMF I obtained the PPP ratios from Spain, Sweden and other countries. Using this list you can translate how much worth is your money in other country. For example, roughly we can say that goods you buy in Sweden using 10000€ can be purchased in Spain for only 8058€. Or saying it in another way, if I have 10000€ in Spain I have the same purchasing power than a suede that owns 12409€. Yet another way to say it is that living in Sweden is a 19,41% more expensive than living in Spain.