Telling WGET to ignore SSL-Certificates

During development of webapps, we keep running into situations where we have untrusted (selfsigned) certificates. And wget doesn’t really like that.

Fortunately it is easy to tell WGET to not check the certificates by providing “–no-check-certificate” switch as command-line argument.

This post is a remainder for myself, as I keep forgetting the name of the flag, and I am to lazy to open up the man pages ;-)

Delete all Eclipse project related meta information via shell

Today I was fighting some really annoying behaviour of Eclipse in combination with refactored multi module maven projects.

Whenever I tried to import the projects, I recieved the error

An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException

I tried to solve the problem by removing my eclipse projects and cleaning all eclipse related files, but that didn’t work. For some reason mvn eclipse:clean refused to delete my files. Thus I had to find a way to recursively delete all eclipse related information from my project. So here it is:


find . -name .classpath -exec rm -rf {} \;

find . -name .project -exec rm -rf {} \;

find . -type d -name .settings -exec rm -rf {} \;

 

Scala Meetup Hamburg – 11. Juli 2013

Am Donnerstag, den 11. Juli 2013, fand mal wieder das Scala Meetup Hamburg statt. Als eine Art Kurzprotokoll hatte ich versprochen hier ein paar Worte aufzuschreiben. Hier also der Inhalt des durchaus gelungenen Abends:

  • Markus stellt sein “Bastel-Projekt” Scalar vor. Neben vielen interessanten Einblicken in den Code, gibt es Kurzausflüge zu Heroku und WebJars
  • Mini-Hacksession zum Thema Macros in Scala 2.10
  • Planung eines Scala-Hackatons in Hamburg (wer Interesse an der Orga hat kann sich gerne direkt bei mir melden)
  • Viele interessante Gespräche auf der Sonnenterrasse

Wer Blut geleckt hat, hier gibt’s noch einen alten Blogeintrag zum Thema Play 2.0 + Heroku und seit ein paar Wochen gibt es auch Native Support für Play 2.0 bei  NewRelic, welches auch als Heroku Plugin bereit steht.

Last but not least, nochmal ein Großes Dankeschön an oose Innovative Informatik und inoio für Lokation, Kaltgetränke und Snacks!

Bis zum 15. August 2013!

Problems cloning git repository over https

Every once in a while I need to clone a git repository by using https as connection protocol. Unfortunately, there always seems to be trouble with this.

Here are some things to keep in mind when dealing with git over https.

Update your Git Version

First of all, make sure you are running an up-to-date version of git. There used to be problems with https in older git versions. Everything from 1.7.10 onward should be fine. But to be on the save side, I recommend to use 1.8.3 or later.

To find out which version you are running, type:

git --version

SSL Certificate Problems

If you see this:


error: SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed while accessing https://myserver/repositories/myrepo.git/info/refs?service=git-upload-pack
fatal: HTTP request failed

It means the client can’t verify the server’s certificate (e.g. self-signed certificate).
The easiest way to get around this, is to disable the SSL CERT verfiy by setting:

git config --global http.sslVerify false

Of course the cleaner solution would be to give the server a proper ssl certificate. Unfortunately, this is not always in your hands.

Using local GIT to access remote SVN repository

git is nice. Very nice. But as we are still using SVN for many projects, using git is not always possible. Or, is it?!

Luckily, git comes with very nice support for using it in combination with an SVN remote repository. By doing so, you can clone any SVN remote repository into a local git repository, create local branches, local commits, local reverts, etc… and finally push everything back to SVN.

Creating the initial clone
git svn clone -T trunk -t tags -b branches -A authors.txt {your_SVN_repository_url} {your_local_git_repsoitory_name}.GIT

Example: git svn clone -T trunk -t tags -b branches -A authors.txt http://myserver.com/svn/myrepo/ myrepo.GIT

Note: You need to have an authors.txt file in your local directory from where you execute the command. The file should contain all contributers from the SVN repository. On stackoverflow.com you can find a command to create such a file.

Get latest changes from SVN trunk and pull them into master
git checkout master
git svn rebase

Commit local changes back to SVN
Make sure to apply a git svn rebase first! (See above)

git checkout master
git svn dcommit

Three things I have learned from taking “Functional Programming Principles in Scala”

I have just handed in my solution the the last assignment of Odersky’s Functional Programming Principles in Scala. Time for a quick recap. Here are the three most important things which I have learned from taking the course:

1. Mutability sucks
So get rid of it. If you can design your algorithms by using immutable data structures, do it! It really does make reasoning, bug hunting and maintenance easier. Not to speak about the huge potential of the easy parallelization and scaleability when using immutable state. Speaking of good stuff and easy usage, I will defiantly miss pattern matching, higher-order functions and Scala’s excellent collection library in my daily hassle with Java.

2. The Scala community is strong
A strong language needs a strong community which drives future development and usage of it. The Scala community is growing very fast right now. Around 50,000 people took the course. But not only taking the course, but also communicating and exchanging very heavily. In the words of Martin “I was blown away by the level of interest and the high quality of your contributions in the assignments and discussion boards.” Thanks everyone for making the course such a sucess! Also a big thanks to Scala-Hamburg for organizing weekly Meetups and coding sessions.

3. Scala has a bright future (which is yet to come)
I have been working with Scala for some time now, and I have always been a fan of it. I am sure that Scala will have a bright future. On the other hand, there are still many obstacle to overcome. The tooling gets better, extremely fast I have to admit, but we are still far away from Java tooling qualities. Language stability and binary compatibility is a problem in the Scala universe, right now. With Scala 2.10 there will be many changes again. Many good changes, but binary compatibility needs to be taken more seriously. Once version 2.10 is out this will get better, and it is finally time for companies to adapt Scala.

To conclude, it was more then an interesting lecture. Many thanks to Martin Odersky and his team for pulling up this course! I can defiantly recommend it to anyone who wants to learn Scala or functional programming in general! So if there is going to be another class next year, make sure to enroll!

Downloading Sources of Required Libraries with Scala and SBT

This one is mostly a reminder to myself, as I keep forgetting what needs to be done, to download the sources of required Scala libraries into Eclipse.

Assumption One: You are already using SBT to build your project.

Assumption Two: You are already using sbteclipse to create eclipse project files.

And then: Add EclipseKeys.withSource := true to your build.sbt (more about Settings)

Einfach und effizient loggen in Scala

Seit fast zwei Jahren gibt es nun schon die Simple Logging Facade for Scala (SLF4S) von Heiko Seeberger bei github. Die Bibliothek legt sich als dünne Wrapper-Schicht über die bereits weit verbreitete Simple Logging Facade for Java (SLF4J) und bietet gerade in Punkte Einfachheit und Effizienz nochmal einen Mehrwert.

Die Benutzung von SLF4S könnte kaum einfacher ausfallen. Um einen voll funktionsfähigen und vorkonfigurierten Logger in einer eigenen Klasse zu bekommen, braucht man nichts weiter zu tun als das Logging Trait einzumixen. Auf dem so konfigurierten logger kann man dann die bekannten Methoden info(), warning(), error() etc. aufrufen.

class MyClazz with Logging {
logger.info(“Construction of MyClazz”)
}

Erfreulich dabei ist, dass die übergebenen Parameter erst dann ausgewertet werden, wenn tatsächlich geloggt werden soll. Im nachfolgenden Beispiel werden die teuren Methode someExpensiveMethod(42) und someHugheobject.toString nur ausgeführt, wenn der debug level auf dem logger eingeschaltet ist.

logger.debug("My values = " someExpensiveMethod(42) + " / " + someHugeObject.toString)

Zusammenfassend kann man sagen, das mit SLF4S eine sehr elegante und leicht zu bedienende Lösung für Logging in Scala existiert.

Double Challenge #5 – More Sports, More SUGH

Is it time again? Seems like it has been a while since I have started the last double challenge. So let’s have a quick retrospective and an outlook on the next challenges.

Retrospective:

In one word: successful. In nine words: successful, but still a lot of work to do. We managed to set up a Scala User Group in Hamburg and do our first steps together, but now the actual work begins. I am quite curios where we are going with this and I am looking forward to work on such a great topic with such a nice group of talented people. On the sports front, I was able to find some time in February and get myself a solid basis for next months training plan.

Upcoming double challenge:

So, what are my next goals? I am going to run the Half-Marathon in Kassel together with some friends of mine. The goal is to get physically fit to finish the run without pain in less then two hours. Should be possible, I guess. Regarding IT, I will try to put some more effort into the Scala User Group to establish a communication and discussion space of Scala (and related topics) in northern Germany.