Samstag, 27. April 2019

External monitor not showing correct resolution - fix it in Ubuntu



I always had problems with my old Benq FP222W monitor. It had it's issues under Windows and I had to tweak around a lot to get the correct driver and the cofiguration right. So I put it away until I recently found it when looking for an extensionfor my notebook screen.
I brought a HDMI cable and - back were the problems with screen resolution. I got a lower resolution which looses quality compared to the native one. This is how to solved this issue on Ubuntu 18.04:

First check the available modes for your displays:
xrandr

I found the right one 1680x1050 missing in that list. Next I asked Linux about the settings it recommended for that resolution:
cvt 1680 1050
# 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync

To fix this I put in the following commands:
xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode HDMI-2   "1680x1050_60.00"

But this does not permanently solve the problem. To enable these settings for a new session I added them to the .xprofile file:
nano ~/.xprofile

Donnerstag, 25. April 2019

Relational or noSQL - why to use documents

Recently I ran into this article and was wondering, why the author came to the conclusion that "NoSQL is the wrong tool". So I went through all the reasons why I like the document based approach so much. Here are my thoughts.

First I have to disagree with some statements in that article. I neither think that relational databases are easier to use nor perform better than NoSQL databases. I'm not going into detail on that, I have seen huge improvements with less complexity and much better performance when moving away from relational. I'd like to focus more on terms like ACID, BASE and this thing called eventual consistency. Of course there are other NoSQL based approaches like key-value stores, wide column stores and graph databases and many more. But here I'd like to focus on document stores.

But first, what are the advantages of the document based approach?
Simply the fact, that in object oriented programming languages an object can be serialized to a document without doing a lot of transformation to a database model like ORM (object-relational mapping). Also when it comes to locking the document based approach has it's benefits, there is only one document instead of multiple table rows spread over a couple of tables.

Schema

It is said that document databases are schema less. So what is a schema and what is it good for?
First it defines and groups data. This is what tables or views are about, but also relations and constraints, or triggers and stored procedures.
The other thing a schema is good for are authorizations. This can be done for the whole schema but also for specific objects like tables or rows.
In document databases there is no schema defined. But there are some fields known to the database. Each field that needs to be indexed also needs to be defined. But all the others are not handled and do not need to be handled by the database. I am fine with this because I have something like a schema defined anyway, in my application. I have strings, boolean or numeric fields there, I have object within other objects and arrays or collections. If I want to change this I must understand what I'm doing. For the fields also defined on the database I will have to do this twice. But If I have a schema I will always have to do this twice for every field and every document type aca table in the relational world. So for me the schema less approach seems more closer to what I usually need.

ACID vs BASE

The problem with ACID compliance comes from the nature of distributed systems. Storing multiple  documents in a distributed document store ends up in most databases as a series of independent writes. As a possible result, you might end up in saving only one instead of the all-or-nothing approach called "Atomicity".  Also in this case it is hard to get a guarantee for "Consistency" and "Isolation". Some document stores have a switch to enable the last one, "Durability". This means that after a successful write (commit) the data has been stored to a permanent storage. This slows down things but in case of a power fail the data will not be lost.

So if ACID can not be guaranteed, how to solve this problem? The answer is quite simple, use the "single document" approach and save the data in one document. If you have an accounting system and you want to move a specific sum from one account to another, save a document with one line for the first account and another one for the second one. You think that this is no good because you want your data stored per account stored in separate "entities"? Why? The entity is always the transaction, in this case the document.

Eventual Consistency

In a distributed system things can behave in a way you might not expect it. When saving 2 documents A and B, there might be a short time where one client will see only A and another one only B. But just a moment later all clients will see both, A and B. This means that the system guarantees a consistent state, but not immediately. This might add some complexity to applications in a form, that the application cannot rely on all data being available. E.g. there might be a scenario with an order document that has a relation to a customer document that you cannot see yet. It will be there, soon, but not yet. From my perspective this is not a big deal. Because if you add authorizations to your documents, what you very likely will need, you might end up any way in not seeing some documents. Even if that is just caused by wrong authorizations being set. And usually a customer is created some time before orders are placed. So in the real world this example may not apply. But in other cases you might end up with the need to create a solution for this.
If you want to know more, go here.

The CAP theorem

This theorem is for distributed system, and states, that out of three concerns only two can be met. 

consistency - every read sees the same data
availability - every read to some data will be fulfilled, even if  not on the same version of the data
partition tolerance - even if a (temporary) split of the servers occurs, the system is still operating

This is rather confusing, because when you hear this you might think, that you do not want any "trade off" on your system. But looking into detail you will see, that this is not as bad as you thought.
And one more thought on this: just think of what will happen in this case with your relational system. A server went down, a network connection is lost - in this case your relational database will not be available at all. 



Dienstag, 2. April 2019

Install a minimal Eclipse for ABAP that uses Java 11 on Windows


You will get the best performance out of Eclipse with ABAP by using a minimal installation without the Java IDE running on the latest Java version.

Install Java 11

e.g. the commercial one from Oracle or the free version https://adoptopenjdk.net/
Check the latest available Hana Tools version → currently 2018-12
https://tools.hana.ondemand.com/

Get minimal Eclipse

Eclipse versioning is a little bit confusing, currently release 2018-12 equals version 4.10. Got it?
Go to
https://download.eclipse.org/eclipse/downloads/
and download the Platform Runtime Binary for the release supported by Hana Tools. This installation is without Java IDE and therefore more slim and lower in resourcees.

Install ABAP tools

When eclipse is started, go to
Help → install new Software → Add, then sćhoose a name and add the link from the Hana Tools page
https://tools.hana.ondemand.com/2018-12

Change eclipse.ini

You might have multiple Java installations on your machine. In case Eclipse does not use the latest Java, which is in our case Java 11, we need to change the eclipse.ini file in the Eclipse folder. In the frist line add the -vm, in the second line goes the path to the Java executable.
-vm
C:/Program Files/Java/jdk-11/bin/javaw.exe

If you have a jvm.dll in the server folder, use this one. It will give you better Windows task bar integration with a work add to favorites.
-vm
C:/Program Files/Java/jdk-11/bin/server/jvm.dll


Run SAP GUI 7.50 on Ubuntu

SAP Pllatin GUI runs on Java. If you have installed the newest Java Java Release which is currently Java 11, SAP GUI will not work or at least have issues.

To solve this the following steps need to be done

  • install the OpenJDK version of Java 8 *
  • install JavaFX *
  • intall Oracle JRE 8 *
  • tell SAP GUI to use Java 8 instead of the newest version


To install use the following command
sudo apt install openjdk-8-jdk libopenjfx-java
Download and unzip the JRE 8 to /usr/lib/jvm/.

Now set the environment variable. Edit the user profile

gedit ~/.profile

and add the following line
export PLATIN_JAVA="/usr/lib/jvm/java-8-openjdk-amd64/bin/java"
export PLATIN_JAVA="/usr/lib/jvm/jre1.8.0_211/bin/java"

* unfortunately recently the JavaFX support for OpenJDK Java 8 has been removed from Ubuntu, therefore the simplest solution is to use Oracle JRE. Due to licensing changes this version is for productive use not free any more.