SAPUI5 Data Binding Examples

This post lists several examples of simple and more complex data binding use-cases in SAP’s web technology SAPUI5.

Select from Array of Objects

SAPUI5 sap.m.SelectThis sample code feeds a sap.m.Select element from an array of objects. The displayed text is an attribute of the object, in this example called name . On selection change the third snippet acquires a reference to the object that is bound to the newly selected item for further processing of other attributes, e.g. value .

<Select id="selectId" items="{modelPath>/arrayName}" change="onSelectionChanged">
  <core:ListItem key="{modelPath>name}" text="{modelPath>name}" />
// model
var model = new sap.ui.model.json.JSONModel();
  arrayName: [
      name: "First Item",
      value: 100
      name: "Second Item",
      value: 123

this.getView().setModel(model, "modelPath");

Getting the value attribute when the onSelectionChanged event is fired.

onSelectionChanged: function(oEventArgs) {
  var selectedItem = oEventArgs.getSource().getSelectedItem();
  var bindingContext = selectedItem.getBindingContext("modelPath");
  // get binding object (reference to an object of the original array)
  var arrayObject = context.oModel.getProperty(context.sPath).data;
  var value = arrayObject.value;

Continue reading “SAPUI5 Data Binding Examples”

Arduino 433 MHz Wireless Module

433 MHz Wireless Module
The 433 MHz wireless module. Transmitter: top-left. Receiver: bottom-right.

This post provides a quick reference for the 433 MHz wireless module, which is widely used in combination with the Arduino. The VirtualWire library is one possible way of utilizing the module.

Before you get started make sure you have attached antennas to both, transmitter and receiver. The wavelength can be calculated using the following formula.

$$\lambda = \frac{c}{f}$$

For $f=433\text{ MHz}$ this leads to $\lambda = 0.6923\text{ m}$.



VCC 3.5 – 12 V Power supply
ATAD Arduino pin 12 Serial data
GND GND Ground (0 V)

Continue reading “Arduino 433 MHz Wireless Module”

Typing Speed, Point Set Creator, and Poker Hands

This post summarises what I’ve been coding during the last week. That’s two new web tools for my Online-Tools webpage called Typing Speed and Point Set Creator, and in addition to that a mobile-first Poker Hands website.

Typing Speed

This web tool lets you determine how quickly you can type a character sequence of your choice. This could be for instance your name, email address, password (don’t worry, it won’t be transferred for further analysis), or just something like “hello there”, “hi”, or “abcdefg”. The fact that you can choose what you type distinguishes this page from many other typing game sites that are available.

Note that the tool counts keystrokes not correctly written characters. So you want to make sure you type things correctly. The tool can be found at The corresponding commit on GitHub: Simsso/Online-Tools

Type something in the input field, to see how fast you are.
Type something in the input field, to see how fast you are.

Point Set Creator

The second tool was created because I needed a set of data points to test clustering algorithms. It basically allows the user to click on a canvas in order to add a new point, to eventually get a list of all points in a usable format. This is especially helpful when a bulk of data points is needed in a roughly predefined shape.
Continue reading “Typing Speed, Point Set Creator, and Poker Hands”

Poker Terms Selection

This is a selection of entries from the Wikipedia article Glossary of poker terms.

  • bet The opening bet of a betting round.
  • fold To discard one’s hand and forfeit interest in the current pot.
  • walk A walk is a situation where all players fold to the big blind.
  • laydown The choice to fold a strong hand in anticipation of superior opposition
  • raise To raise is to increase the size of an existing bet in the same betting round.
  • reraisecoming over the top Raise after one has been raised.
    A reraise from a player that previously called in the same betting round.
  • check-raise Deceptive play whereby a player initially checks with the intention of raising should another player bet.
  • check To bet nothing.
  • call To match a bet or raise.
  • overcall To call a bet after others have called.
  • hero call Calling when a player has a relatively weak hand but suspects their opponent may be bluffing.
  • cold call To call an amount that represents a sum of bets or raises by more than one player.
  • flat callsmooth call A call, in a situation where one might be expected to raise.
  • all in When a player bets all of their chips in the current hand.
  • coin flip A situation where two players have invested all their money in the pot and have a roughly even chance of winning.
  • heads up Playing against a single opponent.
  • deep stack A stack of chips that is relatively large for the stakes being played.
  • short stack A stack of chips that is relatively small for the stakes being played.
  • dirty stack A stack of chips apparently of a single denomination, but with one or more chips of another.

Continue reading “Poker Terms Selection”

Microsoft HoloLens: First Impression

HoloLens TimoToday, 14. Dec 2016, I got the chance to try the new Microsoft HoloLens. This article explains briefly what that is and which impression I got.

The Microsoft HoloLens is a pair of augmented reality goggles. Opposed to virtual reality headsets you can still see your surroundings when wearing the HoloLens. What’s exciting about it? A transparent screen inside the headset adds 3D elements to you view. Pretty much as shown in Microsoft’s commercials.

HoloLens Space Shuttle 1
This Space Shuttle was flying around in our office. No matter how one would walk around it, it was staying in the exact same spot. Below the model is a little control panel.


The added 3D elements are not lagging behind when you move your head. That’s something I did not expect to happen. From VR goggles I got used to the fact that acceleration sensor based motion tracking lags at least a little bit. Not with the HoloLens – the screens, menus, and other 3D models were staying in the exact same spot within the room when I was walking around or moving my head. Very astonishing!
Continue reading “Microsoft HoloLens: First Impression”

Smart Home Security Camera

This post explains the technical background of the security camera system, shown in the following movie. The post will answer the questions: How to detect a thief, how to take a photo, how to get notifications on your phone, and whether the system would work in reality.

For cutting the movie I made use of iMovie.
iMovie was used for editing.

Links and Quick Facts

The source code is not publicly accessible. For the development I used this configuration.
Buy the system for your home / shed / garage.
Movie background music: LCMC music
Additional information about me.

Technical Details

How to Detect a Thief?

In order to detect a thief I made use of an acceleration sensor that I placed at the apartment’s door. The sensor listens for significant changes in the measured x-acceleration. This technique was so precise, that even the slightest knock triggered the motion detection.

bool motionDetected(float tolerance) {
  readMPU6050SensorData(&mpu6050Data, MPU_addr);
  int16_t accX = mpu6050Data.acceleration.x;
  return (accX > boundaries.max + delta * tolerance || 
    accX < boundaries.min - delta * tolerance);

Continue reading “Smart Home Security Camera”

Ambient Light (Arduino Project)

This blog post explains the technical details of my Ambient Light project. If you don’t know what this project is about, watch the following video first:

Video summary: Sometimes a screen is just a light spot in a dark room. To make the entire scenery more appealing, I created my own, Arduino-powered ambient light. A PC software (written in C#) reads color information of the screen, performs some processing and forwards the color information to an Arduino, which is connected via USB. The microcontroller then regulates one or more RGB LEDs.

System Architecture

Ambient Light System Architecture

  1. The C# Program starts two threads: UI thread and “Screen color reading” thread
  2. The “Screen color reading” thread samples the average screen color.
  3. The average screen color’s saturation is being increased by a user-defined factor.
  4. The RGB value is being transmitted through the PC’s Serial Port.
  5. The Serial Port forwards the data to the a Microcontroller (e.g. an Arduino) via USB.
  6. The Microcontroller makes one or more RGB LEDs shine in the received color.

Continue reading “Ambient Light (Arduino Project)”

Guess Solutions of Polynomials

For a given polynomial of $n$th degree

$$P_n(x)=\sum_{i=0}^n a_ix^i = a_nx^n+a_{n-1}x^{n-1}+…+a_1x+a_0$$

you can guess rational solutions $x$ for the corresponding problem $P_n(x)=0$ by applying the following two rules:

  1. $$x=\frac{p}{q}\text{, with } p \in \mathbb{Z} \land q \in \mathbb{N}\land p\mid a_0 \land q\mid a_n$$
  2. $$\lvert x\rvert\le2\cdot \max\left\lbrace \sqrt[k]{\frac{\lvert a_{n-k}\rvert}{\lvert a_n\rvert}}, k=1, …, n\right\rbrace$$


The equations above might be a little bit confusing so let’s apply them to the following example.



After stating $a_0=-2$ and $a_n=2$ we can determine $p$ and $q$. $p$ is every divisor of $a_0$ that is an integer. Hence possible values are:

$$p=\pm 1\lor p=\pm 2$$

For $q$ all positive integer divisors of $a_n$ are possible:

$$q=1\lor q=2$$

Rule 1. $x=\frac{p}{q}$ now leads to six possible real solutions:

$$x=\pm \frac{1}{2}\lor x=\pm 1\lor x=\pm 2$$

The next step is validating each of them with rule 2. For the given example that doesn’t reduce the number of possible solutions because the following equation is true for every determined value of x.

$$\lvert x\rvert\le2\cdot \max\left\lbrace 2,\frac{\sqrt{2}}{2},1\right\rbrace$$

Finally $f(x)=0$ can be tested for every value of $x$. That will lead to one real solution $x_1=-2$. After conducting e.g. a polynomial division the other two non-real solutions can be determined as well ($x_{2/3}=\pm\frac{\sqrt{2}}{2}$).

Install Node SerialPort on Raspberry Pi

Since I had a lot of trouble installing the npm package serialport on my Raspberry Pi B Rev 1 (and Rev 3), I want to share how it eventually worked.

When installing serialport I ran into a lot of errors.
When trying to install using npm install serialport you might see those errors.

Enable serial port usage by adding  enable_uart=1 to the file /boot/config.txt.

If the normal  npm install serialport doesn’t work for you try the following.

Install Node 6.x

curl -sL | sudo -E bash -
sudo apt-get install -y nodejs 
sudo apt-get install -y build-essential

Install node-gyp and node-pre-gyp globally Continue reading “Install Node SerialPort on Raspberry Pi”

Get into Orbit Without Lateral Acceleration

When I was about 6 years old, my dad explained to me that there was no possibility to shoot something right into orbit from the Earth’s surface. He said it was always necessary to accelerate sideways to reach orbit. At that time I did not really understand what he meant. However, later in physics class I did and I figured what he had told me was true. Now, 13 years later, I came up with a new thought: The Earth’s rotation adds lateral velocity to objects launched from its surface. This is also the reason why satellites, the ISS and pretty much every artificial object flying around Earth, orbits Earth counterclockwise and also, why most space flight organizations / companies launch their spacecrafts from locations as close to the equator as possible.

The European Space Agency (ESA) has its own space center in Guiana – close to the equator but far away from all the member states. Copyright: Guillaume Normand
Continue reading “Get into Orbit Without Lateral Acceleration”