Monday, September 14, 2015

Debian 8.2 "Jessie" - cryptsetup: lvm is not available

After rebooting my laptop, Debian 8.2 didn't want to boot but tells me:

cryptsetup: lvm is not available

The Hitchhiker's Guide to the Galaxy says: "Don't Panic". After about 3-5 minutes, the build-in shell is loaded (initramfs). You can directly leave the shell by typing exit and the system will boot normally. I don't know the problem yet, but it also says:

modprobe: module ehci-orion not found in modules.deb

Saturday, August 8, 2015

Installing Oracle JDK on Debian Jessie

Hi there. I just found out yet another way to install the Oracle JDK on your Debian. There's a nice article in the Debian Wiki and you only have to follow the five steps that are listed under the "Process" section. After you have installed the new .deb package, you can simply change from OpenJDK to Oracle JDK by using the update-java-alternatives command. In my case, its the following:

# update-java-alternatives --set jdk-8-oracle-x64

Thursday, April 16, 2015

Scala Future Callback for Apache HTTP Async Client

In a recent project, I needed an asynchronous HTTP client and due to some other requirements, I decided to use the Apache Async HTTP Client. The problem is, that the Async HTTP Client uses Java's Future implementation:
"The result can only be retrieved using method get when the computation has completed, blocking if necessary until it is ready." [Java Futures]
An example code snippet demonstrates how to send an asynchronous HTTP request. To make a long story short: accessing the result of the Future means we block the current thread. An alternative solution is to use the Apache FutureCallback interface, which also lacks the ability to access the result of the future in a non-blocking way (see example). Hence: the provided functionality does not scale well in highly concurrent environments.

After I discussed the problem with a collegue, he came up with a pretty cool solution that prepares the ground for Scala Futures. The trick is to implement the FutureCallback interface by using a Scala Promise:

class ScalaFutureCallbackImpl[T] extends FutureCallback[T] {
  private val promise: Promise[T] = Promise()


  def cancelled(): Unit = 

     promise.failure(new RuntimeException("cancelled!"))

  def completed(result: T): Unit = promise.success(result)


  def failed(ex: Exception): Unit = promise.failure(ex)


  def getScalaFuture: Future[T] = promise.future
}


Its interesting to see, how perfect the methods from the interface can be mapped to the corresponding Promise methods. The additional method getScalaFuture is necessary to give the caller access to the underlying Scala Future. With the new implementation, we are now able to use the Apache Async HTTP Client in a more convenient way:

val httpclient = HttpAsyncClients.createDefault()
val callback = new ScalaFutureCallbackImpl[HttpResponse]
httpClient.execute(host, request, context, callback)

for {
   httpResponse <- callback.getScalaFuture

}
yield httpResponse

Thursday, January 8, 2015

Thinkpad T410 Wireless (Intel Centrino Advanced-N 6200 AGN) and Debian Wheezy

It might happen that your T410 wireless doesn't work after installing Debian, because you didn't have the non-free firmware at hand.

You'll find the missing firmware at the packages site. After you downloaded and decompressed the tarball put the file iwlwifi-6000-4.ucode-9.221.4.1 into /lib/firmware and create a symlink:

# ln -s iwlwifi-6000-4.ucode-9.221.4.1 iwlwifi-6000-4.ucode

Now, its time to reboot!

Friday, December 19, 2014

Scala Maven Project including Specs2

Since I found no up-to-date Maven Project for Scala that includes everything I want (especially Specs2), I created my own one on GitHub. There's a problem with some versions of Specs2, because org.scalaz.stream cannot be found. Due to that issue, the project currenty uses Specs 2.4 (for Scala 2.11).

Tuesday, December 16, 2014

Updating Adobe Flash Plugin on Debian Wheezy

After my Iceweasel (Firefox) was telling me several times that the Adobe Flash Plugin is vulnerable and needs to be updated (Chromium wasn't complaining at all), I was wondering why no update is being installed when running APT?

Fortunately, the Debian Wiki explains how to update the Adobe Flash Plugin:

~# update-flashplugin-nonfree --install

Thursday, December 11, 2014

Published 'admintools' on GitHub

Some helpful scripts for system administrators are now available on GitHub.