quote

giovedì, ottobre 11, 2012

mercurial and mercurialEclipse plugin in ubuntu

Install the latest version of mercurial

  • $ sudo add-apt-repository ppa:mercurial-ppa/releases
  • sudo apt-get update
  • $ sudo apt-get install mercurial
  • check version of mercurial: $ hg --version

Mercurial eclipse plugin

  • Help/Eclipse marketplace
  • Find: Mercurial
  • Install MercurialEclipse (requires at least mercurial 2.0)
Resources


mercoledì, ottobre 10, 2012

Creating a shortcut to eclipse on the ubuntu desktop

Proceed in this way:
  • right click on desktop: Create Launcher
  • set the proper icon eclipse_home/icon.xpm
  • Set the command: eclipse_home/eclipse
Troubleshooting
Issue: "A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations "
Solution
  • $ cd eclipse_home
  • $ mkdir jre
  • $ cd jre
  • $ ln -s /opt/jdk1.6.0_35/jre/bin/ bin
Resources:

martedì, maggio 08, 2012

filesync eclipse plugin

Nice eclipse plugin to synchronize resources.
http://andrei.gmxhome.de/filesync/index.html
Adopting it will speed up your development process without need to rebuild each time you edit a resource in the src folder, for instances a jsp.

venerdì, gennaio 27, 2012

Remotely debug tomcat on linux

Create this simple shell script: debugtomcat.sh

#leave this command for future reference
#export currentdir=`pwd`
export JAVA_OPTS='-Xmx1024m -XX:MaxPermSize=512m
-Xdebug -Xrunjdwp:transport=dt_socket,
address=8000,server=y,suspend=n'
echo JAVA_OPTS: $JAVA_OPTS
/$HOME/MyPrograms/apache-tomcat-6.0.35/bin/catalina.sh run


resource

mercoledì, dicembre 07, 2011

svn ignore list commands


  • % set SVN_EDITOR=notepad
  • % svn propedit svn:ignore .
  • % svn propget svn:ignore .

Decrease the double click speed for Java Applications on Ubuntu Linux

I couldn't properly use double click on idea so I found a great solution in this post.
To resume:
In your home directory create a file called .Xresources and add the following line

*multiClickTime: 400

Then from the commandline execute

xrdb ~/.Xresources


It's amazing that intellij doesn't take in account this issue.

venerdì, luglio 22, 2011

Serving jboss logs as static content

This configuration has been tested using red hat linux and jboss 5.1.x

  1. Edit the
    <jboss_home>/server/default/deployers/jbossweb.deployer/web.xml
    and change the servlet attribute listings from false to true.
  2. Edit the
    <jboss_home>/server/default/deploy/jbossweb.sar/servlet.xml
    and add the attribute allowLinking="true" to the Context element.
  3. Create a log folder in the path
    <jboss_home>/server/default/deploy/ROOT.war
  4. In the log folder create a symbolic link to the log folder of jboss
    $ ln -s ../../../log listAll
  5. Restart the jboss instance
  6. The logs will be available at this url http://myHost:8080/log/listAll

Links
Enable symlinks
Enable directory browsing

venerdì, maggio 27, 2011

The thin red line - quotes

quotes

We'll meet again some day.
People who have been as close as we've been
always meet again.

sabato, maggio 14, 2011

martedì, febbraio 22, 2011

Jboss - Port already in use: 1098

I got this exception after started jboss 5.1 on windows XP.


ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] (main)
Error installing to Start: name=jboss:service=Naming
state=Create mode=Manual requiredState=Installed
java.rmi.server.ExportException: Port already in use: 1098;
nested exception is:
java.net.BindException: Address already in use: JVM_Bind


I tried to understand which process was using that port by running this command:

$> netstat -a -o -n

But the result didn't show any port associated to 1098.
Finally I edited the file at <jboss_51_home>\server\default\conf\bindingservice.beans\META-INF\bindings-jboss-beans.xml
and changed the value of the port 1098 to 10980 and the error has disappeared.
Windows and Jboss ...such a nightmare.
Here the link where I found the solution.

Nice java client to execute remote ssh

http://www.journaldev.com/246/java-program-to-run-shell-commands-on-ssh-enabled-system
Just add this dependency at your pom.xml

<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.42</version>
</dependency>

lunedì, febbraio 21, 2011

Stop jboss in the case it's running

If you need to stop jboss inside a shell script this block of code could be useful.

if ps -ef | grep "<jboss_home>/bin/run.jar" | grep -v grep
then
echo [deploy] Stopping Jboss...
<jboss_home>/bin/shutdown.sh -S --server=localhost:1199
sleep 12s
else
echo [deploy] Jboss was already stopped
sleep 2s
fi

venerdì, febbraio 18, 2011

java.net.MalformedURLException: no protocol: and

I was trying to configure maven cargo plugin when I came across this exception:

Caused by: java.net.MalformedURLException: no protocol: and

I spent several hours trying to find the meaning of this error message when finally I found this link:


http://jackrabbit.510166.n4.nabble.com/jcr-rmi-problems-td534137.html


The author says:

The "and"
comes from the folder where your classes are which is probably something
beneath "C:\Documents and Settings"

So found the root of the problem, the maven local repository in windows is located at the path:
C:\Documents and Settings\<user>\.m2

So I have overridden the local maven repository folder adding this entry in the settings.xml maven configuration file:

<localRepository>c:/mavenrepository</localRepository>


After this change the error has disappeared.

giovedì, febbraio 10, 2011

Accesing to windows file system from cygwin


$ cd /cygdrive/c

That's pretty easy, but I always forget it...

martedì, febbraio 08, 2011

Spring - Referring to a String as a bean


<bean id="myString" class="java.lang.String">
<constructor-arg type="java.lang.String" value="Lucio"/>
</bean>

<bean id="myUser" class="com.benfante.User">
<property name="firstName" ref="myString"/>

</bean>

Thanks to Lucio for the example

lunedì, febbraio 07, 2011

svn client issue

After connecting to svn server using different users I got this message:

svn: Server sent unexpected return value (501 Method Not Implemented) in response to MKCOL request for

I have sorted out it deleting this folder on windows:

C:\Documents and Settings\myUser\Application Data\Subversion\auth

giovedì, gennaio 27, 2011

Enable access to local resources from remote desktop connection

How to enable access to local resources from the remote desktop connection in order to move back and forward files.

  1. Remote Desktop Connection
  2. Options
  3. Local Resources
  4. More
  5. Check Drives
  6. Mark Enrico$ on 'hostX'
  7. OK

lunedì, agosto 23, 2010

issue while accessing with IPhone to the d-link dap 1160 access point

If you are facing issue trying to connect with your iphone to the secure wireless network supplied by the access point d-link dap 1160, maybe this link can help you:
http://www.dlink-forum.info/index.php?topic=8.40.

Use: wp2, channel 6 and disable WMM from the advanced menu wireless.

In order to configure the access point type: http://192.168.0.50 from your browser. Connect network cable from your pc to the d-link access point.
If you don't remember the admin password just reset your access point from the back.
The default username for that access point is admin while the password is empty field.
If you are in a different subnet go to the TCP/IP properties of your windows network connection and be sure to have this settings:

  1. IP: 192.168.0.51
  2. SUBNET MASK: 255.255.255.0

lunedì, marzo 01, 2010

HQL Date Comparison

It appeared rather complicated to perform a date comparison using HQL. The only way is to use the native functions provided by hibernate: day(), month(), year(), current_date().
Here the named query used in JUGEvents for the scheduler reminder:

query =
"from Participant p where p.event.id = ? and (p.winner = null or p.winner = false)"),
@NamedQuery(name = "Participant.findParticipantsToBeReminded",
query = "from Participant p where p.confirmed = true and (p.cancelled is null or p.cancelled = false) "+
"and p.reminderEnabled = true and p.reminderSentDate is null and p.event.numOfDaysReminder >= 0 "+
"and (day(p.event.startDate) - day(current_date())) <= p.event.numOfDaysReminder "+
"and month(p.event.startDate) = month(current_date()) and year(p.event.startDate) = year(current_date()) "+
"and p.event.startDate >= current_date() order by p.event.id")})