Software Developer

Category: Howto (Page 2 of 3)

Notes on Setting Up My Raspberry Pi

I recently purchased a Raspberry Pi 4 Model B for some projects at home. Here are some notes on how I set it up/what I did. They are mostly for my future self but might be helpful to others that try to do something similar.

Basically, the main goal was to use it for Pi-Hole (network-wide ad blocking on the DNS level), Gitea (self-hosted git service), and to set up a private cloud for all our data (using Nextcloud) instead of having them with one of the cloud providers. So far we used Boxcryptor to encrypt the data and store it in the cloud but it makes it a bit inconvenient for pictures since you can’t see a preview (thumbnail). Since there is potentially a lot of data I intended to store the data on an external drive. The Pi4 has USB3 so I mounted a solid state drive (SSD) using a SATA-to-USB3 enclosure/adapter.

Continue reading

Making EMF models serialized in XMI available in JSON with emfjson

This summer we had two interns in our team who started creating a web application for our TouchCORE tool. I have wanted this for a long time. Not only does it allow you to model in your browser, you can also do this collaboratively! For now class diagrams are supported but more supported will be added in the future (for example for sequence diagrams and feature models).

Re-creating the complete application right away was not feasible for this project. Also, we are all about reuse and I had envisioned in the architecture to reuse the backend parts when we build another user interface. Therefore, the goal was to keep our current backend based on the Eclipse Modeling Framework (EMF) and making it available through an API to the web application. Fortunately, there is already support for EMF and JSON by emfjson. The main use case however is to replace the XML/XMI serialization/deserialization with JSON.

There is a way to keep XMI on the backend and making it available through JSON. This allows to keep the XMI serialization which is still being used by the existing application. It requires to use unique IDs when serializing, otherwise you need to manage your own ID mapping (see below).

The emfjson-jackson setup is as follows:

ObjectMapper mapper = new ObjectMapper();
// Optional
mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
module = new EMFModule();
module.configure(EMFModule.Feature.OPTION_USE_ID, true);
// Optional
module.configure(EMFModule.Feature.OPTION_SERIALIZE_TYPE, true);

module.setIdentityInfo(new EcoreIdentityInfo("_id"));

The use of IDs along with the EcoreIdentityInfo ensures that the IDs used by EMF during serialization are used. Now, assuming you loaded an existing model from a resource for any EObject of that model you can get the JSON by calling:


To do the reverse, you can identify an object by its ID. To retrieve the EObject for a given ID EMF of course has a handy utility method. For this, you need the Resource of your model.


To get the ID of an object you can use resource.getURIFragment(eObject).

If you have cross-references in your models to other models, the URI you get is of the form “anotherModel.ext#id”. You can use the ResourceSet to get the resource of the other model or the cross-referenced object using the resource set’s getResource(URI, boolean) and getEObject(URI, boolean) methods.

You can also maintain your own ID mapping by passing a custom ValueWriter as a second parameter to EcoreIdentityInfo, for example:

module.setIdentityInfo(new EcoreIdentityInfo("_id",
    new ValueWriter<EObject, Object>() {
        public Object writeValue(EObject eObj, SerializerProvider context) {
            // TODO: return ID of object

Furthermore, you need to handle references between objects specifically by customizing the reference serializer:

module.setReferenceSerializer(new JsonSerializer<EObject>() {
    public void serialize(EObject eObject, JsonGenerator generator, SerializerProvider serializer) throws IOException {
        generator.writeString(/* TODO: Get the ID of eObject */);

There is one caveat though. That is when using EMF notifications on the backend to notify the frontend that something changed. If an object is deleted, EMF does not give you an ID for this deleted object anymore. That’s why we in the end used the custom ID solution.

As I researched some links for this post I noticed that there is now a whole Eclipse project to make EMF available in the cloud ( It would be interesting to evaluate whether these technologies (Sprotty as the web-diagramming framework and GLSP as the graphical language server protocol) are more suitable instead of a custom-baked solution. Currently we use Spring Boot on the backend with web sockets and Angular with mxgraph on the frontend.

iOS: How to fix/change Voicemail number

Recently, a friends voice mail “button” did not work anymore. Upon calling the voice mail, an audio error message appeared saying that the voice mail is not available or cannot be reached (something like that).

Unfortunately, Apple does not want you to just change the associated voice mail phone number that is called when tapping on “Voicemail”.

Fortunately, there is a shortcut:

  1. Go to the phone’s keypad
  2. Dial *#5005*86# and “call it”
  3. A phone number will appear, which is the one currently associated with the voice mail.  Write this down just in case.
  4. Now, call *5005*86*<insertPhoneNumber># and replace the placeholder with your phone number, starting with the country code (1 in this case for North America). For example, 14381234567.
  5. The voice mail button should now work.

This approach worked on the TELUS network (using Koodo). If it doesn’t work for you, revert the phone number to the one written down in step 3 and contact your provider.


Firefox close tab button on hover

There are probably extensions that allow to do that, however, this is not necessary as I will show in this post. Maybe you’ve seen the functionality in Safari or just wondered why the close button for tabs in Firefox can’t just always be there. In Safari, the close button appears when hovering over the tab itself.

The following modification adds this functionality to Firefox. You need to create a file called userChrome.css with the following content:

.tabbrowser-tab:not([selected]):not([pinned]) .tab-close-button {
        visibility: hidden !important;
        margin-left: -16px !important;

.tabbrowser-tab:not([selected]):not([pinned]):hover .tab-close-button {
        visibility: visible !important; 
        margin-left: 0px !important;
        display: -moz-box !important;

Place this file into the chrome folder inside your profile’s directory. Follow the directions from Mozilla to find out where to find the profile’s directory location. If the chrome folder does not exist, you need to create it first.

In the address bar, open about:config and change the following preferences:

  • browser.tabs.tabClipWidth to 99
  • New versions of Firefox (69+) don’t load the userChrome.css on startup by default. Make sure that toolkit.legacyUserProfileCustomizations.stylesheets is set to true.

Then just restart Firefox and you are done.

Update 1: It just tried this again myself due to a fresh installation and you also need to change the browser.tabs.tabClipWidth preference from it’s default value (140) to 99.

Update 2 (August 2017): As pointed out by Veto in the comments below, this functionality is broken since version 55.0.3. The above CSS has been updated to stay compatible with the new Firefox UI.

Update 3 (December 2017): As pointed out in the comments, pinned tabs were affected too. Thanks to Mike for the solution on how this can be avoided. The above CSS has been adjusted.

Update 4 (October 2019): As pointed out in the comments below, Firefox 69 by default doesn’t load the userChrome.css anymore for new installations.

Original Source: Post on Neowin Forums

Move more than one directory into a new repository

I just realized that my previous post on how to move one directory from one repository to another really only works for one directory.

Fortunately, there is a very easy solution to that using a nice little tool called git_filter.

Basically follow the instructions of it’s README. Then, all I did was put the two directories into the filter file. It is important to note here that this file had to end with an empty line in my case, otherwise the last directory will be ignored.

You will get a new branch, which can be pushed to an empty repository:

git remote add origin_repoB <url of repo>
git push origin_repoB <localBranch>:master

It also works for one directory and is a lot faster compared to the other method.

« Older posts Newer posts »

© 2022 Matthias Schoettle

Theme by Anders NorenUp ↑