Skip to content

www.rolfje.com

Tag: programming

Why you should not use SOAP Headers

Posted on 2012-12-24 By rolfje 3 Comments on Why you should not use SOAP Headers

container

In the project I am working on right now we use apache XCF and Spring to provide a SOAP service to our customers. As part of the messages, there is a userid/password combo telling the application which user sent the request. I struggled with that today because I think that userid/password info should actually be in the SOAP Header, cleaning up my API, enable me to implement different authentication techniques in the future and generally be more “compliant” to the SOAP standard. Boy was I wrong.

Read More “Why you should not use SOAP Headers” »

Software

Make your buildserver talk

Posted on 2012-12-16 By rolfje No Comments on Make your buildserver talk

Jenkins talkingHave you ever started a shell script which takes a while and you keep monitoring that window because you really need those results? If you are working on a Mac, you can use the Mac’s power of speech to tell you a command is finished. Here’s how:

./yourreallyslowbuild.sh; say "really long build is finished"

With a little curl and shell scripting magic, I told my Mac to constantly monitor our Jenkins buildserver, and bug everybody in the office when the hourly build is failing:

Read More “Make your buildserver talk” »

Apple, Fun, Software

Why developers are never on time

Posted on 2012-06-28 By rolfje No Comments on Why developers are never on time

If you have worked in IT as long as I do, you probably have noticed that developers have a tendency to not be on time. They are late for meetings, late for lunch, and on other days they are in at 6am or (and) they work until 3am the next morning. If you ever wondered why this is, I might have some answers for you.

You might also find this post interesting if you are trying to figure out why you can’t get your time zones working in MySQL.

Read More “Why developers are never on time” »

Software

Distributed jMeter through VPN and SSL

Posted on 2012-02-16 By rolfje 19 Comments on Distributed jMeter through VPN and SSL

This week I created a jMeter test setup for distributed testing. I thought it would be straight forward but I ran into some interesting things you might want to know if you are considering distributed testing using jMeter.

In my case, I had to test an application which was inside our corporate network, while working from home through a VPN and a firewall. Normally that is no problem, but jMeter has this funny construction where the slave (jMeter server) wants to connect back to the master (jMeter gui). It took some fiddling with iptables, the jMeter configuration and ssh tunneling to get it to work. Here’s my setup:

Read More “Distributed jMeter through VPN and SSL” »

Software

Having fun at J-Fall 2011

Posted on 2011-11-03 By rolfje 3 Comments on Having fun at J-Fall 2011

J-Fall 2011This year’s Dutch Java Nerd event called J-Fall was held in Nijkerk, in a beautiful location called “Hart van Holland” . With plenty of sessions by speakers from all over the world it promised to be a great day for Java enthusiasts, at a great location for meeting friends and colleagues. I took a day off from work and it was well worth it.

Read More “Having fun at J-Fall 2011” »

Microsoft, Software

Add some magic to Eclipse

Posted on 2011-07-30 By rolfje No Comments on Add some magic to Eclipse

Templatus Expandum!The top feature of the eclipse IDE is the very impressive refactoring possibilities. It makes code feel like play-doh, allowing you to knead it in any shape way or form you think fits the current situation. A close second to that is the impressive templates and code assist. Yes, Java is verbose, but I think 80% of the characters which make up a Java program was never actually typed. All the readability without the labour, brought to you by eclipse’s powerful templates.

What many people don’t realize is that you can easily add to this magic by creating your own templates. One of the first templates I always add to the environment is the one which adds a private static final log4j logger. I thought it would be great example to share with you.

Read More “Add some magic to Eclipse” »

Software

Why Jenkins does not detect Failures

Posted on 2011-06-20 By rolfje 4 Comments on Why Jenkins does not detect Failures

Jenkins, the brilliant Continuous Integration build server, has a bit of a problem with the Maven surefire jUnit test plugin. Last sunday, I discovered that our Jenkins build server suddenly started ignoring test failures. While the logfile clearly states that the Unittests contain failures, Jenkins marks the builds as “stable”.

After some digging around, I found that even though Jenkins explicitly tells you in the logfile that it will fail the build, it will not do so if the Surefire XML reports are not generated. In our case, somebody in the team decided that the generation of the XML Surefire reports was taking too long and had disabled them in the Maven pom.xml.

In order to solve this, I re-enabled the XML reports and voila, Jenkins happily started reporting errors again. Here is the correct Surefire plugin configuration for you to use in your maven pom.xml file:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.8</version>
    <configuration>

      <!-- Please note that Jenkins needs Surefire
           XML reports in order for detection to work.
           Keep this property set to false. -->
      <disableXmlReport>false</disableXmlReport>
    </configuration>
</plugin>
Software

^H(eaven) key binding in Eclipse

Posted on 2011-06-19 By rolfje No Comments on ^H(eaven) key binding in Eclipse

Eclipse File Search WindowAs a long time user of Eclipse, I have never understood the any of the tabs of the Search panel in Eclipse. JavaScript search, Java Search, Remote Search, they all make no sense to a modern man who is used to a single search box which searches everything. So I always use the “File Search” Tab, which does exactly what I want 99% of the time.

File Search always requires mouseclicks. To open the Search window and select the correct tab. It was not until recently that I realized that I could actually reassign the ^H (Control – H) key combination to pop up the File Search tab. If you are an avid Eclipse user you’ve probably already done this, or know how to do this. If you are new to eclipse, or lazy like me, read on to see how you can re-map this key binding.

Read More “^H(eaven) key binding in Eclipse” »

Software

Your Maven Java WEB project in Eclipse WTP

Posted on 2011-01-29 By rolfje 12 Comments on Your Maven Java WEB project in Eclipse WTP

In our company, all Java projects are setup with Maven configuration so that after a “mvn eclipse:eclipse” any developer is generally good to go. One of these projects was a web project but would not transform into a WTP project. By running “mvn eclispe:eclipse” it became a Java project, but could not be added to a Server in Eclipse. It was not a WTP project.

I learned that the author of the project tried but never got the WTP plugin to work properly. Using the Google, I found more people who are having the same problem converting their existing Maven Java Web projects in Eclipse into a WTP project. There are even a few desperate articles describing how to edit your .project and .classpath files. Oh dear. This calls for an article on www.rolfje.com.

Read More “Your Maven Java WEB project in Eclipse WTP” »

Software

Simple Strict Date Parsing

Posted on 2010-03-06 By rolfje No Comments on Simple Strict Date Parsing

In Java, the DateFormat.parse() method is a funny little critter. It helps you by trying to figure out what date you actually meant when you typed in “35/12/2O10” (note the letter “O” in 2O10). In this case, it will parse the date without errors or warnings, and returns the date “11/12/04” (November 12th, 0004). That’s because it thinks “35” is a month, and “2” is the year, ignoring everything after the letter “O”.

DateFormat tries to convert the “35th month” into 2 years and 11 months, and correct the date accordingly. df.setLenient(false) prevents this, but that still leaves the problem of the parsing stopping at the first wrong character without warning.

I needed a much stricter way of parsing dates, and yesterday I found an elegant solution to this problem. It’s so small I was able to tweet it in less than 140 characters, but I thought it deserved a decent blogpost so here it goes:

public Date parseDateString(String inputDateString) 
         throws ParseException {
  DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
  Date parsedDate = df.parse(inputDateString);

  if (!inputDateString.equals(df.format(parsedDate))) {
    throw new ParseException("Invalid Date", 0);
  }
  return parsedDate;
}

The brilliance here is in the comparing of the formatted date with the original input. The method returns a normal ParseException so you can perfectly replace your original df.parse() calls with it, making them more strict.

Thanks to Bas for this elegant and simple solution.

Software

Posts navigation

Previous 1 2 3 … 6 Next
           

Recent Comments

  • rolfje on Methode Buijs uitgelegd
  • LinkedIn is at Peak Enshittifaction – Will Chatham's Blog on Linked-In not really Opt-in?
  • Hans j on 1N4148 diode as RF switch
  • Roaming Rhonda on DLNA on OSX, done right
  • Frans on How to fix a Krups XN2001 Nespresso machine

Tags

Anonimatron Apple backup design DIY DRM eclipse environment Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Keynote maven modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software Steve Jobs T-Mobile technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (105)
  • Divorce (1)
  • Electronics (3)
  • Fun (57)
  • Games (7)
  • Hardware (72)
  • Microsoft (18)
  • Racing (14)
  • Software (134)
  • Uncategorized (65)
  • Workshop (20)

Archives

Copyright © 2025 www.rolfje.com.

Powered by PressBook WordPress theme