Browsed by
Author: Sebastian Basner

Started into blogging again with a little help

Started into blogging again with a little help

simpleprogrammer

As this Blog is fairly old (I started it in 2006 and therefore it will have 10th anniversary later this year) I have to admit it wasn’t very active during the last years and at some point it was nearly forgotten. During the period from getting to my masters degree in software engineering to becoming a professional software developer I stopped blogging because I had so much to learn and so much work to do to get on track with all the technologies and methodologies that are wanted by the industry that I thought I couldn’t manage to write quality blog posts.

Now, some years later I still constantly learn a lot of new things but it adjusted to my normal everyday live and after going to some conferences and meeting people at local user groups etc. I read many blogs of speakers and attendees and it got me thinking that it would be a fun to reactivate my own blog. At first I decided to make some changes. Over the years the stats of this blog showed that the most read articles were how tos, problem solutions or technology reviews. As a result of this it makes perfect sense to write about my programming and technology experiences.

After that decision was made I coincidentally listened to an episode of “Software Engineering Radio” with guest John Sonmez wo is the founder of simpleprogrammer.com. Not knowing him until then I read some of his blog articles and watched a couple of his videos when I found his 6 week eMail course about creating a blog and decided to try this to see what a successful blogger has to say about what is important at blogging. The course is for free and to be honest it doesn’t give you information you have never heard of or couldn’t come up with by yourself but what it really does is it gave me motivation to give it an honest second chance and John makes very clear what he thinks are the most important things to be successful with a blog (obviously success can’t be granted but it seems clear that it is easy to make fundamental mistakes). If you are interested in creating a blog I can definitely recommend the course. It doesn’t take much time and is a good starter by an experienced blogger.

Scrolling issue with macOS Sierra and IntelliJ IDEA [UPDATE]

Scrolling issue with macOS Sierra and IntelliJ IDEA [UPDATE]

intellij-idea
If you rely on IntelliJ (or any other IDE based on the IntelliJ platform like WebStorm i.e.) for your daily work and use a touchpad (no matter if the Macbook internal or the magic trackpad) you should not upgrade to Sierra at the moment. The issue is that the scrolling behavior in IntelliJ is extremely sensitive which makes a controlled scrolling nearly impossible. IntelliJ seems to doesn’t know of a way to fix this at the moment and filed itself a radar at Apples bug tracker. As you can find complains from users of other Apps with the same problem as well (VLC and Minecraft i.e.) it seems plausible that the ball on this is in Apples field.

As Jetbrains obviously have done nothing wrong with its implementation to trigger this issue it would have been a good move from them to address the issue to their customers early (previous to the sierra release) so that they could have waited with the macOS upgrade until the problem is solved. If you are interested you can find a discussion about the problem at their bug tracker.

Not knowing how long it will take Apple or Jetbrains to solve the issue the easy workaround for the users is using a mouse as it affects the trackpad only. I use the magic mouse but every other mouse should work fine, too.

Update 03.10.16

Jetbrains has come up  with a solution for the problem which you can find here

eclipse workspace in use

eclipse workspace in use

eclipse logo

As I’m a huge fan of IntelliJ IDEA I don’t use eclipse very often during the last years but I have a dedicated project where I need to regularly use for creating deployments and connect with some remote test servers. So I have to deal with eclipse and its problems, too. A recurring problem for me with eclipse is that it stumbles upon its own not cleaned up metadata which causes problems that are not obvious to solve at first sight. Most of them are gladly quick to fix if you know what you have to do.

A common problem of that sort is when, after selecting the workspace, eclipse fires up a popup with the message “The default workspace … is in use or cannot be created. Please choose a different one”. Most of the time the workspace is not in use but the problem can be caused by an unexpected closing of eclipse which prevents it from cleaning up its metadata correctly. The solution for this is easy. Just navigate to the workspace folder and delete the .lock file in the hidden .metadata directory..

If you are using a mac like me the easiest way is to do it on the shell because the finder by default doesn’t show hidden folders.

cd ~/yourWorkspaceDirectory/.metadata
rm .lock 

Now eclipse should start with your workspace as expected.

Using CellUtil with POI to avoid too many cell styles in Excel

Using CellUtil with POI to avoid too many cell styles in Excel

https://poi.apache.org
https://poi.apache.org

When you create Excel documents with the popular Apache POI library it is possible that you encounter a problem where Excel tells you there are “Too many different cell formats”. A possible source for this is that you probably have a loop structure in which you define a new cell style for every cell you create.
poi-cellstyle-loop

Excel is limited in the amount of cell styles it can handle in a single document (4000 per document). Therefore the above code would break. The easy fix would be to define the cell style outside of your loop and reuse it.
But sometimes you want to create different cell styles depending on a line number for example. In this case POI comes with a handy utility class named CellUtil that allows you to modify existing cell styles without creating a new one. Internally it has to create a new cell style and saves it in a map. If you make the same modification at any other place in your code again it will iterate that map, find the previously created style and reuses it. Therefore the same style is only created once. The usage is quite simple and would adapt to the sample above as follows

poi cellUtil

The code above will add a border to the bottom of every second cell created but because it is every time the same modification CellUtil will only create one additional style and apply this every time again.