Links

  • 1. Sogeti
  • 2. JBoss
  • 3. IBM
  • 4. Oracle
  • 5. SpringSource
  • 6. NL-JUG
  • 7. Java

Archives

Syndication  RSS 2.0

RSS 1.0
RSS 2.0

Bookmark this site

Add 'JCN Blog' site to delicious  Add 'JCN Blog' site to technorati  Add 'JCN Blog' site to digg  Add 'JCN Blog' site to dzone

Posted by Erik-Berndt Scheper at 17:10 on Wednesday 10 November    Add 'Using GIT over an authenticating NTLM (isa) proxy' site to delicious  Add 'Using GIT over an authenticating NTLM (isa) proxy' site to technorati  Add 'Using GIT over an authenticating NTLM (isa) proxy' site to digg  Add 'Using GIT over an authenticating NTLM (isa) proxy' site to dzone

Ever since Hibernate has moved to GIT, I’ve been looking for a way to fetch the latest updates from GitHub.  This is easy when you’re at home , or when your company does not use a Microsoft NTLM proxy. Just use EXPORT http_proxy=http://user:pass@proxyserver:port and you’re set.

However, Microsoft proxies does not accept this syntax. For most programs (java included) you’re safe with CNTLM, which is a very fast authenticating proxy. As a rule, you won’t see the difference in your browser. As a matter of fact, you can use CNTLM with Git, as long as you stick to the HTTP protocol. I.e. you’re using anonymous Git, and you won’t be able to push your code back to GitHub.

GitHub does support HTTPS and WebDAV to push your code, but if you try it with CNTLM, you’ll hit this bug in CNTLM. Basically what happens is that Git hangs forever. Fortunately, there’s another free authenticating NTLM proxy, called NTLMAPS and it’s written in Python. It’s a lot slower than CNTLM (which is written in C), so I wouldn’t recommend it for day-to-day usage but Git appears to works fine over it.

Read the rest of this entry »

Posted by Martijn van de Rijdt at 12:41 on Wednesday 20 October    Add 'Maven dependency:tree' site to delicious  Add 'Maven dependency:tree' site to technorati  Add 'Maven dependency:tree' site to digg  Add 'Maven dependency:tree' site to dzone

If you’re interested in getting a quick overview of your Maven project’s dependency structure, the dependency:tree plugin is a very useful tool. Just run the following:

mvn dependency:tree

and you’ll get a nice overview of all of the artifacts your project depends on, directly and indirectly, displayed as a tree structure.

Now say you have a parent project containing a lot of modules (perhaps even nested) and you still want an overview of all of their dependencies. You could just run dependency:tree on the parent project, but that would output a huge list of all of the dependency trees, cluttered up with Maven’s informational log messages. You could also run dependency:tree on each individual leaf project, but that would be a bit of a hassle.

A better solution is to run the following on your parent project:

mvn dependency:tree -DoutputFile=D:\temp\dependencies-${project.artifactId}.txt

This will create some text files in your D:\temp directory, named after your projects’ artifact ids. Each of these text files will contain the corresponding project’s dependency tree.

Of course you can also use other Maven variables (like ${project.groupId} and ${project.version}) in the filenames.

Posted by Hans-Jürgen Jacobs at 15:32 on Monday 4 January    Add 'Appliances for fun & work' site to delicious  Add 'Appliances for fun & work' site to technorati  Add 'Appliances for fun & work' site to digg  Add 'Appliances for fun & work' site to dzone


Het gebruik van virtuele servers om (nieuwe) software te gebruiken en/of te testen is ondertussen aardig gemeengoed geworden.  Echter het creëren van een nieuwe virtuele server vergt de nodige kennis en tijd. Het bijhouden van een  (basis) server kost de nodige inspanning. VMWare heeft een handige Virtual Appliance Marketplace, maar wanneer je een handige appliance hebt gevonden wordt die vaak onvoldoende of niet bijgewerkt.Via diezelfde marketplace kwam ik bij TurnKey Linux terecht. TurnKey Linux is een community-oriented open source project: 100% open source.

In de TurnKey Linux Virtual Appliance Library is een aantal zeer handige appliances beschikbaar. Behalve een LAMP appliance ook  appliances voor Tomcat, MySQL, Revisie Control, Zimbra etc. De appliances zijn gebaseerd op Ubuntu 8.04.3 LTS en voorzien van de nodige ondersteunde tools zoals webmin.

Het gebruik van deze virtuele server is nu nog eenvoudiger geworden, de appliances zijn te gebruiken met VirtualBox, VMWare en Amazon EC2. Ben je op zoek naar basis server of een kant-en-klare tomcat server, kijk dan eerst op de website van TurnKey Linux.

SUSE

Appliances zijn populair zo biedt SUSE via de SUSE Studio een online mogelijkheid om zelf een virtuele machine (desktop, server, jeos) samen te stellen. Uiteraard op basis van OpenSuse 10.1/10.2 of SUSE Linux Enterprise 10/11. De appliance wordt online gebuild naar een VM/Virtualbox, ISO, USB stick of Xen versie. Indien je liever gebrik maakt van SUSE is deze site een must.

Posted by Hans-Jürgen Jacobs at 12:24 on Monday 23 March    Add 'Bob the Builder Anti-Pattern' site to delicious  Add 'Bob the Builder Anti-Pattern' site to technorati  Add 'Bob the Builder Anti-Pattern' site to digg  Add 'Bob the Builder Anti-Pattern' site to dzone

Free your build! Lees meer op dzone.

Posted by Hans-Jürgen Jacobs at 17:53 on Monday 9 February    Add 'Apache Ivy 2.0 Final Released' site to delicious  Add 'Apache Ivy 2.0 Final Released' site to technorati  Add 'Apache Ivy 2.0 Final Released' site to digg  Add 'Apache Ivy 2.0 Final Released' site to dzone

Voor wie geen gebruik kan of wil maken van Maven. Apache Ivy 2.0, is een project dependency manager voor Ant. Ivy kan gebruik maken van Maven repositories.

Key features of the 2.0.0 release are

  • enhanced Maven2 compatibility, with several bug fixes and more pom features covered
  • improved cache management, including dynamic revision caching with fine grain TTL
  • improved concurrency support with cache locking and atomic publish
  • namespace aware validation, allowing to use validation with extra attributes
  • new ‘packager’ resolver added
  • better and more homogeneous relative paths handling
  • better support for local builds
  • numerous bug fixes as documented in Jira and in the release notes

[Download Ivy] [Ivy home]

Posted by Barend Garvelink at 23:08 on Thursday 28 August    Add 'maven-tstamp-plugin' site to delicious  Add 'maven-tstamp-plugin' site to technorati  Add 'maven-tstamp-plugin' site to digg  Add 'maven-tstamp-plugin' site to dzone

Since (almost) the dawn of time, ant has had the <tstamp/> task to define build date and time properties in your build for filtering resource files. Maven has no such thing. They do have a workaround which requires a temporary file on the filesystem. A google search on "maven bulid date" takes you to the maven-buildnumber-plugin, which I’m sure works fine but it does more than I need and a few things I don’t need (like access the SCM system). So I wrote a quick maven-tstamp-plugin to match the ant task. The configuration is a bit more verbose, but simple to understand.

Here’s a sample config…

<plugin>
  <groupId>nl.sogeti.jcn.maven.plugins</groupId>
  <artifactId>maven-tstamp-plugin</artifactId>
  <version>1.0</version>
  <configuration>
    <!-- All properties prefixed with 'build.' -->
    <prefix>build.</prefix>
    
    <!-- UNIX timestamp published as 'build.unix-timestamp' -->
    <timestamp>unix-timestamp</timestamp>
    <properties>
      <!-- Publishes build.sortableDate, default locale, default timezone -->
      <sortableDate>yyyy-MM-dd</sortableDate>
      
      <!-- Publishes build.prettyDate, Argentina's locale and timezone -->
      <prettyDate>EEEE d MMMM yyyy, H:mm</prettyDate>
      <prettyDate.locale>es_AR</prettyDate.locale>
      <prettyDate.zone>America/Argentina/Buenos_Aires</prettyDate.zone>
      
      <!-- Publishes build.utc-stamp (calendar-based timestamp) in UTC. -->
      <utc-stamp>yyyyMMddHHmmss</utc-stamp>
      <utc-stamp.zone>UTC</utc-stamp.zone>
    </properties>
  </configuration>
</plugin>

…which I think speaks for itself. Each of the properties defined can be used in ${filtering} expressions. I didn’t require the offset/unit feature in the original <tstamp/> task, nor did I require Joda-Time’s support for nonwestern calendar systems. I’ve reserved suffixed for both, but they currently just cause the property to be ignored.

Source code after the jump.

Read the rest of this entry »

Posted by Barend Garvelink at 21:11 on Wednesday 12 March    Add 'Lazily initialized PropertyChangeSupport' site to delicious  Add 'Lazily initialized PropertyChangeSupport' site to technorati  Add 'Lazily initialized PropertyChangeSupport' site to digg  Add 'Lazily initialized PropertyChangeSupport' site to dzone

Since the dawn of time, Java has offered PropertyChangeSupport, and implementing a class using it is dead easy. Often when you see a class that offers it, it’s managed via a private final instance, initialized right away. Altough PropertyChangeSupport is itself careful not to initialize any fields until they’re needed, if no listener ever subscribes, initializing it was a bit of a waste. What follows is an abstract base class that offers property change support using a lazily initialized instance.

Other tidbits about PropertyChangeSupport:

  • The serialized form is weird. Any listeners that happen to be serializable are included, all the others are skipped, so the list of listeners is pruned seemingly arbitrarily. Except for very rare cases, PropertyChangeSupport instance fields should be transient.
  • There really should have been a marker interface, now there’s thousands out there in the wild. I wrote my own too. Libraries like Glazed lists go through pains to divine whether property change support is present.

Sample code after the jump.

Read the rest of this entry »

Posted by Barend Garvelink at 12:25 on Sunday 3 February    Add 'Oracle thin JDBC to TNS name' site to delicious  Add 'Oracle thin JDBC to TNS name' site to technorati  Add 'Oracle thin JDBC to TNS name' site to digg  Add 'Oracle thin JDBC to TNS name' site to dzone

To establish an Oracle thin JDBC connection to a TNS alias (tnsname), make sure you pass the oracle.net.tns_admin system property to the JVM. Its value should be the directory in which your tnsnames.ora file is located. After that, you can just pass the TNS alias in place of the host name in the JDBC URL.

E.g. if you simply try to connect to jdbc:oracle:thin:@MYDB, which is in your tnsnames.ora file, you’ll get an SQLException with a detail message of Io exception: Unknown host specified. If you fire up the JVM with a -Doracle.net.tns_admin=/oracle/10g/NETWORK/ADMIN, or use System.setProperty(String,String) after startup, the connection will be established successfully.

Oh yeah? Well what’s this SQLException “Io exception: SO Exception was generated“, then? you ask? The exception message is a bit deceptive, as the “SO” suggests OCI when we’re really using thin. I encountered this exception with the ojdbc14.jar included with OC4J standalone 10.1.3.1.0. Using the JDBC driver from the Oracle client 10.2 package stops it occuring, but causes OC4J standalone to log a warning about a missing getStatistics method every few seconds, which is hardly any less annoying. I’m not sure what’s causing it to happen, but a version upgrade seems to fix it. If that’s not an option, you can always use good old jdbc:oracle:thin:@host:port/service, which is what I settled for in the end.

Posted by Marc De Graaff at 20:52 on Tuesday 18 September    Add 'Sorteren van diakritische tekens' site to delicious  Add 'Sorteren van diakritische tekens' site to technorati  Add 'Sorteren van diakritische tekens' site to digg  Add 'Sorteren van diakritische tekens' site to dzone

Het sorteren van diakritische tekens (ö , ú enzovoort) gaat niet automatisch corect bij het gebruik van de String.compareTo(Object) methode.

De java.text.Collator kan daar uitkomst bieden.


List list = new ArrayList();
list.add("Sörensen");
list.add("Sorbet");
list.add("Syber");
Collections.sort(list);
System.out.println("Sorted 'vanilla': " + list);
Collator collator = Collator.getInstance(new Locale("nl"));
Collections.sort(list, collator);
System.out.println("Sorted with Collator: " + list);

levert als output:

Sorted 'vanilla': [Sorbet, Syber, Sörensen]
Sorted with Collator: [Sorbet, Sörensen, Syber]

Wat in de nederlandse taal een logischere volgorde is

Posted by Barend Garvelink at 10:26 on Tuesday 4 September    Add 'JSON output using JAXB' site to delicious  Add 'JSON output using JAXB' site to technorati  Add 'JSON output using JAXB' site to digg  Add 'JSON output using JAXB' site to dzone

On the Sun web services blogs, Japod has posted a little sample demonstrating how to use JAXB to support output in both XML and JSON.

Json_representation_of_jaxb_object @ sun blogs


© 2019 Java Competence Network. All Rights Reserved.