EML to PDF Converter

I just finished a new project, an EML to PDF Converting tool which i released for free under the Apache V2 License to github. This tool allows you to convert your E-Mails in the EML format to PDF’s, which is necessary for archivability. Since E-Mails reference external resources such as images they tend to be an impermanent medium. To deal with this they can be converted to a format which is permanent such as PDF.

You can download it for free or check out the source code at github!

Screenshot
Continue reading


How to install a (portable) JDK in Windows without admin rights

It recently happened to me that I was stuck at work on a Windows installation without access to admin privileges. While I could use a bunch of portable apps I could not find a portable JDK. To get a portable JDK without admin privileges in Windows you have to follow three simple steps.


Listen to some relaxing music while reading my blog post


1. Download

Download the JDK from Oracle (e.g. JDK 8 8u111).

2. Extract

If you want to use the x86 version simply open the .exe file with 7-Zip. It contains a single file tools.zip, which contains all the files we need.
Open with 7-Zip

For x64 the tools.zip can be found in .rsrc\1033\JAVA_CAB10\111\

Extract the tools.zip to the desired JDK directory (e.g. “D:\JavaJDK\”).
Continue reading


How to get the current windows wallpaper in C#

Being able to make software is great. Not only because you can make a living from it, but also because it helps you in everyday life. Like when you have to manage your 10k+ wallpaper library. I for once always get baited by these “575 awesome wallpapers you absolutely need” posts and download them right away into my library. Every now and then a black sheep sneaks in but i only see it after it pops up on my Desktop (as if i would review all of these 575 wallpapers).

And here it comes together: as a software developer i have the means to write a small piece of code that gets rid of these ugly wallpapers.

So i hacked this snippet that moves the current wallpaper out of its current folder and into a “reject” folder.
The current wallpaper path can be found in a registry entry “TranscodedImageCache” in “HKCU\Control Panel\Desktop” (at least in Windows 8.1). It’s encoded with unicode though and has to be cleaned a little bit.

Continue reading


String replace with callback in Java (like in JavaScript)

When you use JavaScript a lot you are more or less used to the callback-hell, but i hope you love the benefits of passing functions around as much as i do.

For example when replacing a portion of a string:

"test6test12test".replace(/\d+/g, function(str){
  return parseInt(str) * 2;
});

When doing such things in Java it can be a bit of a hassle, but Lambda-Expressions to the rescue!


Convert a ByteArrayOutputStream into a ByteArrayInputStream

Often while programming you find yourself glueing pre-existing code fragments together. This works out sometimes but even more often it is rather annoying. These days i had to encrypt a pdf and do some other stuff with it in java and therefore put together some libraries i found. One of these libraries offered a method to encrypt the pdf and write the result into a ByteArrayOutputStream. Later then i had to push the encrypted pdf into another method that needed it as a ByteArrayInputStream. First i simply copied the content of the ByteArrayOutputStream as byte array into the ByteArrayInputStream, but this didn’t satisfy me since i knew that the ByteArrayInputStream just needed to be initialized with the internal buffer of the ByteArrayOutputStream. Since this internal buffer is hidden from outside i made up the ByteArrayInOutStream which is a ByteArrayOutputStream that has an additional method that returns a ByteArrayInputStream which is initialized with the internal buffer of the ByteArrayOutputStream. This allows for a instant ‘conversion’ that does not use up more memory than required.

Continue reading


A broad look into the mobile network future

When i went through my files i stumbled over a paper i made at my university and thought maybe someone could find interest in it.

The paper features a summary of the history of mobile networks and tries to make a forecast about which technologies are most likely to play a role in next generation mobile networks.

I am going to quote the abstract here:

The ubiquitous access to information through mobile networks
changed our lives. These mobile networks are in a
state of permanent evolution. In this paper we identify the
most probable drivers for future mobile networks. We provide
an overview over the most successful commercial mobile
networks and point out the technologies used in these mobile
networks that will most likely be reused in future networks.
We discuss the difficulties and requirements for future mobile
networks that come with the deployment of billions of
autonomous Machine-to-Machine devices. While some solutions
have been proposed to deal with these Machine-to-
Machine requirements many problems remain unsolved.

Continue reading


@Asynchronous does not work from inside the same EJB

I recently needed to start a method asynchronously on the server start up.

I came up with this code (pseudocode):

@Singleton
@Startup
public StartupEJB {
   @PostConstruct
   private void postConstruct() {
      worker();
   }
 
   @Asynchronous
   public void worker() {
      // Do something heavy
   }
}

This approach failed, the worker() method was not executed asynchronously.

I then found out that the Application Server (in my case JBoss) calls the method directly when it is located inside the same EJB: source.

The solution was to use a seperate EJB that launched the worker Thread:

@Stateless
public class ExecutorBean {
 
   @Asynchronous
   public void execute(Runnable command) {
      command.run();
   }
}

and

@Singleton
@Startup
public StartupEJB {
   @EJB
   ExecutorBean executorBean;
 
   @PostConstruct
   private void postConstruct() {
      worker();
   }
 
   public void worker() {
      executorBean.execute(new Runnable() {
         @Override
         public void run() {
            // Do something heavy
         }        
      });      
   }
}

Beautiful CSS3 loading animation overlay with custom message

I recently stumbled over a beautiful loading animation that is completely done in CSS3 (link):

Loader Animation GIF

All i had to do was fixing a small bug (link), adding some JavaScript and adding an semi-transparent overlay, so all credits go to Hugo Giraudel.

I centered the loading animation div and added a field to display a text message.

To allow for easy display and hiding i cooked up some JavaScript that shows the overlay and puts the text message (or a default message) in the right place.

Demo:
link
Continue reading