Debian, eclipse and exit code 127

Just after installing eclipse from lenny repository, it crashed me up with the error JVM terminated. Exit code=127. After a bit of searching and watching at what a console execution told me, I tried execute eclipse from command line with a simple java -jar /usr/lib/eclipse/startup.jar. Well, in this way it starts up successfully without any problem. Then I tried again a startup from gnome menu and everything worked fine.

Now there is still the failing about integrated browser and the fact that eclipse shipped with lenny is the very obsolete 3.2.

execute shell command via java

It happened to me that working via an extranet on a citrix environment in a WSAD workspace, that I needed to remove the attribute to at least 200 files in different directories.

Since do it one by one via WSAD is unthinkable, and I didn’t have time to going to the client, loggin into the net in order to have a shell and I dind’t have a shell by my hands, I did it via java.

The environment is Windows machine and here is the source

package tests.runners;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;

public class ShellCommandRunner {
	public static void main(String[] args) throws IOException{
		OutputStream stdin = null;
		BufferedReader br = null;
		String line = null;
		String command = null;

		command = "cmd.exe /C attrib -r /S /D X:\\workspaces\\tuc-workspace\\*.*";

		System.out.println(command);
		Process p = Runtime.getRuntime().exec(command);
		stdin = p.getOutputStream(); //use this to push commands

		//processing stdout
		br = new BufferedReader(new InputStreamReader(p.getInputStream()));
		while((line=br.readLine())!=null) System.out.println(line);

		//processing stderr
		br = new BufferedReader(new InputStreamReader(p.getErrorStream()));
		while((line=br.readLine())!=null) System.err.println(line);

		System.out.println("done!");
	}
}

[bash] format date

It happens often a script I have the needs to append a simple timestamp in the format of YYYYMMDDHHMMSS to a generated file.

It’s very easy to get it to work in pure bash, without perl script and similia. Just use the native date command with his format option. Easy as drinking a glass of water, the command is (for the format above)

$ date +”%Y%m%d%H%M%S”

for the full detail of the format arguments, refer to the man page.

A simple usage in script is

#!/bin/bash
set -e

NOW=`date +”%Y%m%d%H%M%S”`
FILE=my-cool-file-${NOW}.txt

echo $FILE

[eclipse-svn] branching, tagging and merging

branching, tagging and merging are foundamental concepts of the SVN operativity. For their means I redirect you to the Chapter 4 in the SVN book.

Here we will discuss the merging operativity. The case presented is the one in which I would like to merge (align) the latest fixes/development in the trunk in a specific branch (say 2.2).

What I like to do is download a new project, as said in the preceding post, but pointing to the desired branch instead of the trunk. Then when asked, specify a different project name, in order to avoid naming conflicts.

When done, on the root of the branch project, select with a right click the Team->Merge.

Now in the URL field specify the url of the source from which you would like to take the latest version. Then in the Start Revision specify the version from which you would like to start search for editing and in Stop Revision specify the version to stop for searches. Generally the last one is the number beside the trunk project in the repository (if you want to align to the latest version). Here is how the form should end up after compilation.

Before proceeding I prefer take a quick preview with the suitable button. When assured that everything is ok, click on the OK button and wait for the end of the process.

When process complete it should be safe to give a Commit of everything but maybe it’s better to give a full recompile and a full test :)

edivad-suite 3.0.0 is out!

edivad-suite, a suite of script-fu add-ons for automating some
operations in The Gimp has reached the 3.0.0 milestone which
accomplish requirements for running under gimp 2.4. Go to the download
page
for getting it.

[eclipse-svn] start contributing an existing project

For this issue, we take my project edivad-suite as the project you would like to contribute.

The main configuration of the SVN plugin should work, however if you would like to change your settings, you coudl do it by the Window->Preferences->Team->SVN (for example the SVN Connector)..

For starting contributing you will have to do a check out (in SVN slang) of the project. To do so in eclipse, you will have to select File->New->Project->Project From SVN [step 1]. In the form that appear, specify the url and user/pass if needed and proceed with next [step 2].

If it appear an error (for example after clicking the browse buttont) that it’s not possible to access the repository, maybe you could be behind a proxy that need authentication. You have to store credential informations in the eclipse networt settings (Window->Preferences->General->Network Connection), since the SNV plugin wont ask you for it.

Then in the next screen, using the browse button, selecte the resource needed (in this example the leaf in trunk) and with the finish button start download the sources [step 3, step 4].

After a bit of thinking eclipse will prompt you something how to download the project. Sice we are starting a new one, let’s use the default provided. Here you can change for example the project name that will be created in your workbench [step 5]. Use the next to proceed.

Here you can specify (if needed) a different location of the sources outside the workspace [step 6]. Use the finish to end the process.

Now everything should be done and you should have your project ready for contributing.

I’ve found a little fault (?). If I try to create (download) the project on a FAT filesystem (my usb pendrive), the whole process ask me for some file for authenticating via SSL. Maybe something fail to write something else, I don’t know. The fastest workaround I’ve found is to download the project in the normal workspace (that on work is on C:\… and is a NTFS) . Then copy the directory project into the pendrive, remove the project (via eclipse) from the workspace (deleting content on FS) and then import an existing project into workspace that points to the pendrive.

[eclipse-svn] Quick tutorial

I’m starting here, or at least I try, a very simple tutorial on the integration of SVN with the Eclipse IDE.

This tutorial is oriented to developers, so it start assuming that you already have a repository and user/pass for accessing it.

It’s based on Eclipse 3.4 (Ganymede).

Let’s start by installing the required plugins: subversive plugin.

NOTE: the list of the updated repository can be found at the download page of the project.

Starting from the download page of the project take the url for the latest stable release of the Subversive plugin & conntector plugin.

On the Help->Software Updates, use the Add Site to add the url for both component [step 1]:

If after adding url, they don’t appear in the list, maybe they are not selected in the Manage Sites. Click on the proper button and select all the urls [step 2].

Then it’s time for select the items to install [step 3].  Complete the operation with the install button and restart of the workbench.

Note, that if you are contributing a java project, maybe it’s better you install the JDT Ignore extension that automatically prevent output folders to be automatically added to the repository.

Maybe you will have to tweak your selection according to your installation [step 4].

edivad-suite released the 2.2.1

Released a new version of my suite of script for The Gimp that fix a small bug in the watermark functionality.

watermark for the edivad-suite

Released a new version of the edivad-suite which include a script for making a watermark on the image. As usual it works on opened image, single file or directory.

From now you can also find, browsing the SVN, a bash script I use for sequentially renaming (actually a cp) all files in a directory, starting from a provided number, and a desired file extension.

[emacs] log4j-start-filter

Sometimes ago I cited a cool mode for emacs: log4j-mode. Since I started useing it just for “syntax hilight”, I’ve discovered a very cool macro: log4j-start-filter.

I had the needs to filter an application log file (30Mb growing) in which many applications is logging. I’ve not decided this, so don’t hang up with me :) .

Well just typing M-x log4j-start-filter <my-list-of-keywords-space-separated> RET and automagically the file is showing only what I need. I can’t live without this functionality.

The counterpart of this macro is M-x log4j-stop-filter.

Next Page »