debian, apache2.4 and libapache2-svn

I did a stupid thing yesterday: I upgraded the apache of a development server running debian. Doesn’t sound too bad, does it? Did you know that the debian maintainers kinda dropped the libapache2-svn library when switching from apache2.2 to 2.4? No? Me neither :oogle: Why on earth did they do that? Well, asking this kind of question never helps, so I digged into it a little and tried to fix it without asking Google right away :/
So after a little research, I ran into a pretty good description that worked out. This stackoverflow post roughly explains what you have to do:

cd /tmp
mkdir svn_tmp
cd svn_tmp
sudo apt-get install apache2-dev
sudo apt-get build-dep subversion
apt-get source --compile subversion

Stop when it’s checking for gcc etc and edit some files:

Let’s edit some files. First, subversion-1.7.9/debian/control. Make sure that apache2-dev figures in Build-Depends sections (around line 7):

Build-Depends: debhelper, libneon27-gnutls-dev, libserf-dev (>= 1), zlib1g-dev,
               libapr1-dev, libaprutil1-dev, libdb5.1-dev,
               libsasl2-dev, apache2-dev,
               ...

Then, check if theres a section for libapache-2. If it’s there, make sure to remove the apache2.2-common dependency. If not, add the complete section:

Package: libapache2-svn
Section: httpd
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Suggests: db5.1-util
Description: Subversion server modules for Apache
 This package provides the mod_dav_svn and mod_authz_svn modules for
 the Apache 2.2 web server.  These modules provide Subversion's WebDAV
 server backend, to serve repositories over the http and https
 protocols.  See the 'subversion' package for more information.

Then, edit subversion-1.7.9/debian/rules and make sure that ENABLE_APACHE is true:

ENABLE_APACHE        := yes

Now, we are ready to start the build process again:

cd /tmp/svn_tmp/subversion-1.7.9 && dpkg-buildpackage -b -uc

This process may take a long time. For me, has taken like 1 hour. Finally, we can install the package.

sudo dpkg -i /tmp/svn_tmp/libapache2-svn_1.7.9-1+nmu3_amd64.deb 
sudo a2enmod dav_svn
sudo a2enmod authz_svn
sudo service apache2 restart

iPhone 4 upgrade: Retina Display

After my girlfriend dropped her iPhone for the n-th time, at some point in late May the display shattered. I thought this might be my chance to finally replace it with something good but I was wrong. She insisted on keeping it. At least I could finally convince her a few weeks ago to replace the display – my second chance. A little different one but now I was able to replace it myself :P
I wasn’t very hard and the DirectFix Youtube Video also helped a little. Now it’s even better than before and it just cost about 40€ and roughly 1h of work fun :mrgreen:

iPhone 4 dissembled
iPhone 4 with Retina Display

Mac OS 10.8.4 & Vodafone Mobile Broadband Software

After the release the newest Mac OS update on Wednesday morning I wanted to install it quickly before going to work. That didn’t work out as expected… After the update was installed the reboot failed with a nice message like “An error occurred while installing the update…”. Clicking on “OK” to reboot and everything was fucked up as expected. The system didn’t boot up properly anymore and even in the verbose mode it didn’t give any usable clue about what happened. Luckily it still booted into the SafeMode. I tried a bunch of things but nothing, not even reinstalling the update manually (download on http://support.apple.com/downloads) helped. As my last backup was a few days earlier I was close to reinstall the whole system but had to do something else before. After getting back to the Mac, it came to my mind that I have had problems with the kernel extension installed by Vodafone’s amazing “Mobile Broadband” software before – the software is needed for the Mobile Stick. Because of that I knew how to get rid of the whole stuff and after the following steps, the update was installed correctly and the system was running again:

  • Plug the stick to access the Uninstaller and uninstall the software completely.
  • Download the update and install it manually again.
  • Reboot the system.
  • Be happy :)

As I need the Vodafone software, I had no choice but to reinstall it as well, but from now on, I’ll uninstall it before applying any Mac OS updates… If someone knows an easier way, please let me know!

QCon London & Better Presentations

It’s been a while since my last post but last weeks conference really deserves one. So, three colleagues and me went to London to attend the QCon London and to make it short: It was pretty good! Most talks I attended were really good and well, as usual, you can’t avoid to have a couple not so good ones anyway ^^ So, the main reason I’m posting here is Damian Conway’s talk Instantly better presentations. It was the best talk of all I went to, even though it had nothing to do with software development, agile or whatever. Nevertheless, I think everybody giving lectures, speeches, talks and alike should read his expose which is available on his website :)
Apart from this one, my no. 2 and 3 were both really good and amazing talks, but I can’t decide which one was better:

By the way, there are a ton of slides and more information available on the QCon Website!

Grails Unit Testing and a little fun with @Before

So, we’ve been using Grails at gibbon’s five for a while now and stumbled into different problems with our unit tests. One of the weirdest ones were occasionally failing tests on our Jenkins that never failed locally. So we digged into this a little and came up with a simple explanation, that I’d like to share with you.

Let’s assume we have a controller and want to test it. First thing you’d probably do is go to the Grails Guide, Chapter 10: Unit Testing Controllers and start with something like this:

import grails.test.mixin.TestFor

@TestFor(SimpleController)
class SimpleControllerTests {
    void testSomething() {
    }
}

Now, if you have multiple tests which need some variable set inside the (controller.)request and you have a little knowledge of JUnit, you’d probably come up with something like this:

import grails.test.mixin.TestFor
import org.junit.Before

@TestFor(SimpleController)
class SimpleControllerTests {
    @Before
    void initialize() {
        request.variable = "foobar"
    }
    void testSomething() {
        // some code here needs the request.variable
    }
    void testSomethingElse() {
        // some code here needs the request.variable
    }
}

This is bad.

Continue reading “Grails Unit Testing and a little fun with @Before” »

FindBugs & Reject.if* False Positives

In my current project we’re using Reject.if* (ifNull, ifNotNull, ifTrue…) methods for several validations, error management etc. As we’re also using FindBugs, we stumbled upon a problem with code like the following, in which FindBugs comes up with a NP_NULL_ON_SOME_PATH warning, in this case a false positive:

void foo(String bar) {
    Reject.ifNull(bar);
    bar.getBytes();
}

After searching for a solution and asking some people, we finally found a solution that works pretty well in this case: Passing a system property called findbugs.assertionmethods [1] through Maven to FindBugs. The code for it in the pom looks somewhat like this:

...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>2.5</version>
    <configuration>
        <effort>Default</effort>
        <threshold>Medium</threshold>
        <xmlOutput>true</xmlOutput>
        <findbugsXmlOutputWithMessages>true</findbugsXmlOutputWithMessages>
        <omitVisitors>FindReturnRef</omitVisitors>
        <jvmArgs>-Dfindbugs.assertionmethods=de.mopri.utils.Reject.ifNull</jvmArgs>
    </configuration>
</plugin>
...

By using the jvmArgs element the system property is properly passed down to FindBugs and telling it that the method Reject.ifNull is used as an assertion. Now FindBugs acknowledges that bar.getBytes() won’t throw a NullPointerException :)

Control flow with exceptions :D

Reminds me about some discussions I had about controlling your program flow with exceptions :mrgreen:

Using exceptions to control program flow is a bad idea. Creating exceptions requires taking a snapshot of the call stack, and that’s costly. – John Flinchbaugh Oct 16 ’08 at 12:17

Not if you override the method that generates the call stack in the exception you throw to do nothing. That’s the advantage of a custom exception. – shemnon Oct 17 ’08 at 14:03

The whole thread can be found here on stackoverflow.

Grails with time-based rolling logs

Logging in grails is somehow confusing me a little. I don’t know why but even though I’m familiar with log4j and never had trouble working with it, grails logging sometimes manages to make me feel like a total newbie. After looking for a nice and simple solution for a timebased rolling and archiving, I thought someone else might be interested in it as well and I don’t have to look for it again ;) So here is the daily rolling log configuration, which is also archiving (and zipping) the old log:
Continue reading “Grails with time-based rolling logs” »

1 2 3 4 13