React Native

React Native | Getting Started

Create App

Expo CLI Quickstart

Assuming that you have Node 12 LTS or greater installed, you can use npm to install the Expo CLI command line utility:

npm install -g expo-cli

Then run the following commands to create a new React Native project called “GettingStarted”:

expo init GettingStarted
cd GettingStarted
npm start # you can also use: expo start

React Native CLI Quickstart

npx react-native init GettingStarted

or create new project based on a template

npx react-native init GettingStarted --template react-native-template-typescript

Start App

Step 1: Start Metro

First, you will need to start Metro (Docs), the JavaScript bundler that ships with React Native. Metro “takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies.”

npx react-native start

Step 2: Start your application

Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:

npx react-native run-ios

Ansible | Getting Started


Install Python 3

Install Ansible

pip install ansible

Setup virtual machines

In this example, we use Vagrant. But using docker is also a good choice

Create Vagrantfile

Change IP Address and Hostname for each virtual machine

Vagrant.configure("2") do |config| = "hashicorp/bionic64" "public_network", ip: "", bridge: "en0: Ethernet"

  config.vm.synced_folder "./data", "/DATA"
  config.vm.hostname = "host1"

Start virtual machine

vagrant up
vagrant ssh

Configure virtual machine

Install required programm sshpass for running ansible commands as root on target machines.

sudo apt-get install sshpass

Setup SSH permissions

Create ssh key

ssh-keygen -t rsa

Add id_rsa_<user>.pub to virtual machines into $HOME/.ssh/authorized_keys

Setup config files




Create Ansible configuration file in current directory with this content:

interpreter_python = auto

Ansible searches for configuration files in the following order, processing the first file it finds and ignoring the rest:

  1. $ANSIBLE_CONFIG if the environment variable is set.
  2. ansible.cfg if it’s in the current directory.
  3. ~/.ansible.cfg if it’s in the user’s home directory.
  4. /etc/ansible/ansible.cfg, the default config file.

First Test

 ansible -i etc/ansible/hosts all -m ping -u vagrant

Set default Python version on Ubuntu

update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1

Working with Playbooks

Create simple playbook

Create file httpd.yaml

- hosts: webservers
  remote_user: ansible
  - name: Ensure apache is installed and updated
      name: httpd
      state: latest
    become: yes

Run playbook

ansible-playbook -i etc/ansible/hosts  httpd.yaml -kK


Allow SSH root login

$ sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

Frontend | Frontend Toolbox

Usefull Libraries

VideoJSHTML5 player frameworkVideoHomeGithub
Animate on ScrollAnimationHomemichalsnik/aos
HowlerJSAudio library AudioHomeGithub
RevealJSHTML Presentation FrameworkPresentationHomeGithub
granim.jsCreate fluid and interactive gradient animationsGraphicsHomesarcadass/granim.js
Multiple.jsSharing background across multiple elements using CSSHomeNeXTs/Multiple.js
choreographer-jsA simple library to take care of complicated animations.Homechristinecha/choreographer-js
cleave.jsFormat your <input/> content when you are typingHomenosir/cleave.js

More to read

Power BI | Importing multiple files

Getting Started

To import multiple files from a folder, the following two steps had to be done:

  • create a list of all files in the folder
  • for each file: read the file and add it to the result table

When importing files with Power BI, you can do both tasks together or each task separately.

The decision, which way to go, ist done after selection the folder:

You could choose between 4 posibilities. Strictly speaking, you have to possibilities, both with the same to final steps.

  1. Load or Combine files
    • Load means, the list of the files will be loaded as table
      Technicaly two things are done:
      • a connection is created in the model
      • the data (list of files) is loaded to the mode
  2. Just Load or Transform data
    • Transform means, you will end up in the Power Query Editor, so you can add additional modifications

In order to better understand the process, we show the two steps separately: one after the other

Load the list of files from folder

Start Power BI and close the start screen, if it is still visible.

Then, click on the Get Data Button in the Home Ribbon

If you click on the small down arrow on the Get Data Button, you have to select the option More

Now, select Folder and click on Connect

Enter the folder (or Browse…) with the files to be loaded and click Ok

After this, Power Query will create a table with all files in the folder.

Now, here is the point to decide, which way to go:

  • Combine
    • Read list of files and combine all files into on table
  • Load
    • Just keep the list of files and return to Power BI
  • Transform
    • Keep the list of files and open the Power Query Editor

We will choose to load the files, because we will do each step later separately

In Power BI Desktop, click on the Data Icon to show the resulting table.

Combine all files into one table

To add additional steps, we need the Power Query Editor.

So click on the 3 dots at the right side of the Query name Samples and choose Edit Query

Now, you are in the Power Query Editor

To combine all files, just click on the small icon beneath the header of the content column:

In the following dialog, you will see all files an a preview of the content for each file. For excel files, you will see the sheet names and the names of the intelligent tables in the sheets.

Click on OK to start the import.

When Power Query is done with this step, you will see the result:

The previous query Samples is still there, but now with the content of all files.

Additionally, you will see four other elements:

How combining the files is done

Each query consists of a list of steps, which are process one after another. Normaly, each step is using the result (data) of the previous step, performs some modifications and has a result (data) for the next step.

So, each step is modifying the whole data of the previous step. Describing some modifications means either

  • do one thing, e.g. add an additional column


  • do something for each row in the data
    This means, we need some sort of a loop, like “do xyz for each row in the data

Lets see, how Power Query solves this task.

In the query Samples, exampine the Step Invoke Custom Function1

The Step if performing the M function Table.AddColumn

This functions needs 3 parameter:

  • table: which is normaly the name of the prevoius step
    In our example #”Filtered Hidden Files1″
  • newColumnName: the name for the column to be added
    “Transform File”
  • columnGenerator: a function which is called for each row in the input table and creates the new column content
    each #”Transform File”([Content])

This results in the following procedure:

  • for each row of the list of files (output from step #”Filtered Hidden Files1″)
  • get the content of the column Content (this will be the parameter for the function call)
  • call the function “Transform File”([Content]) to create the column with one parameter: the value of the column ([Content] i

Helper Queries (Required)

This is the required function to create the column content for each file

Helper queries (Optional)

For the resulting query Samples to work, only the function definition is required.

But Power Query add some additional elements, to test the function and show the result

Create a parameter used in the query Transform Sample File and define the curent value Sample File

Define a value for the parameter. Here, the first row in the list of files is used.

Create a query and use an excel workbook as input. The name of the excel file is speficied as a parameter

In this query, the previously create parameter Parameter1 is used as parameter (to much of the word parameter, i know :))

Importing multiple files with different formats

If the selected folder contains files with different format, the result is not what you may be expect:

The list of files contains all files, both csv files and xls files

When combining the files, you can select between the files. So first take a look at an csv file:

The csv file looks as expected:

But the xls files looks strange:

But lets try. Click on ok to combine all files.

But, looking at the resulting query, the data of the xls files still looks strange:

To understand this, take a look into the create transfer function:

The crucial instruction is line 2:

Source = Csv.Document(Parameter3,[Delimiter=",", Columns=10, Encoding=1252, QuoteStyle=QuoteStyle.None]),

The source document (each file in the list of files) is interpreted as csv file.

So, the xls files are also read in as csv files. This leads to the strange result.

You can fix this by adding an additional filter step in the query to select only csv files:

Azure Databricks | Cookbook

Reading Data

Create Table from CSV file with SQL


CREATE TABLE quickstart
OPTIONS (path "/databricks-datasets/data.csv", header "true")

Create Table from CSV file with PySpark

quickstart="/databricks-datasets/data.csv", header="true", inferSchema="true")

Analyse Data

Group and Display

from pyspark.sql.functions import avg


Build an Fullstack Development Environment

In this post, we will describe how to setup a modern development environment, so that you can work with such tools as Git, GoGS, Jenkins, CI/CD, Unittesting using languages like Python, Groovy, Bash Scripting.


Working as a software developer today poses great challenges to know-how, especially due to the large number of existing products and technologies.

It is not easy to be always up to date.

The first step to achieve this is to have your own software environment in which you can work and play with the necessary products.

This post describes how such an environment can be built for a full stack developer. Components of the environment are:

Jenkins | Cookbook

Working with VS Code

Validate Jenkins File

Install VS Code Plugin Jenkins Pipeline Linter Connector

Add configuration in .vscode/settings.json

"jenkins.pipeline.linter.connector.crumbUrl": "<JENKINS_URL>/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)",
"jenkins.pipeline.linter.connector.user": "<USERNAME>",
"jenkins.pipeline.linter.connector.pass": "<PASSWORD>",
"jenkins.pipeline.linter.connector.url": "<JENKINS_URL>/pipeline-model-converter/validate",

Replace <USERNAME>, <PASSWORD> and <JENKINS_URL> with your values, for example

"jenkins.pipeline.linter.connector.crumbUrl": "http://localhost:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,%22:%22,//crumb)",
"jenkins.pipeline.linter.connector.user": "admin",
"jenkins.pipeline.linter.connector.pass": "secret",
"jenkins.pipeline.linter.connector.url": "http://localhost:8080/pipeline-model-converter/validate",

Working with Jenkins Client (CLI)

Download Client

wget localhost:8080/jnlpJars/jenkins-cli.jar

Working with Plugins

Create aPlugin

mkdir SamplePlugin
cd SamplePlugin
mvn -U archetype:generate -Dfilter="io.jenkins.archetypes:"
mvn -U archetype:generate -Dfilter="io.jenkins.archetypes:global-configuration-plugin"
[INFO] Scanning for projects...
Downloading from central:
Downloading from central:
Downloaded from central: (14 kB at 32 kB/s)
Downloaded from central: (20 kB at 44 kB/s)
Downloading from central:
Downloaded from central: (918 B at 18 kB/s)
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] >>> maven-archetype-plugin:3.1.2:generate (default-cli) > generate-sources @ standalone-pom >>>
[INFO] <<< maven-archetype-plugin:3.1.2:generate (default-cli) < generate-sources @ standalone-pom <<<
[INFO] --- maven-archetype-plugin:3.1.2:generate (default-cli) @ standalone-pom ---
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: remote -> io.jenkins.archetypes:global-configuration-plugin (Skeleton of a Jenkins plugin with a POM and an example piece of global configuration.)
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
Choose io.jenkins.archetypes:global-configuration-plugin version:
1: 1.2
2: 1.3
3: 1.4
4: 1.5
5: 1.6
Choose a number: 5:
[INFO] Using property: groupId = unused
Define value for property 'artifactId': com.examples.jenkins.plugins
Define value for property 'version' 1.0-SNAPSHOT: :
[INFO] Using property: package = io.jenkins.plugins.sample
Confirm properties configuration:
groupId: unused
artifactId: com.examples.jenkins.plugins
version: 1.0-SNAPSHOT
package: io.jenkins.plugins.sample
 Y: : y
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating project from Archetype: global-configuration-plugin:1.6
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: unused
[INFO] Parameter: artifactId, Value: com.examples.jenkins.plugins
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: io.jenkins.plugins.sample
[INFO] Parameter: packageInPathFormat, Value: io/jenkins/plugins/sample
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: package, Value: io.jenkins.plugins.sample
[INFO] Parameter: groupId, Value: unused
[INFO] Parameter: artifactId, Value: com.examples.jenkins.plugins
[INFO] Project created from Archetype in dir: /Users/Shared/CLOUD/Kunde.BSH/workspace/SamplePlugin_Config/com.examples.jenkins.plugins
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  45.525 s
[INFO] Finished at: 2020-03-01T17:28:27+01:00
[INFO] ------------------------------------------------------------------------

Verify Plugin

 cd com.examples.jenkins.plugins
mvn verify

Run Plugin

mvn hpi:run

Working with Groovy Scripts

Include a common groovy script in Jenkins file

1: Create a common.groovy file with function as needed

def mycommoncode() {

2: In the main Jenkinfile load the file and use the function as shown below

   def common = load “common.groovy”

Basic example of Loading Groovy scripts

File example.groovy

def example1() {
 println 'Hello from example1' 
def example2() {
 println 'Hello from example2'

The example.groovy script defines example1 and example2 functions before ending with return this. Note that return this is definitely required and one common mistake is to forget ending the Groovy script with it.Jenkinsfile

def code node('java-agent') { 
    stage('Checkout') { checkout scm } 
    stage('Load') { code = load 'example.groovy' } 
    stage('Execute') { code.example1() }


Processing Github JSON from Groovy

In this demo, we first show how to process JSON response from Github API in Groovy.Processing JSON from Github

String username = System.getenv('GITHUB_USERNAME') 
String password = System.getenv('GITHUB_PASSWORD') 
String GITHUB_API = '' String repo = 'groovy' 
String PR_ID = '2' // Pull request ID 
String url = "${GITHUB_API}/${username}/${repo}/pulls/${PR_ID}" 

println "Querying ${url}" 

def text = url.toURL().getText(requestProperties: ['Authorization': "token ${password}"]) 
def json = new JsonSlurper().parseText(text) 

def bodyText = json.body // Check if Pull Request body has certain text if ( bodyText.find('Safari') ) {
     println 'Found Safari user' }

The equivalent bash command for retrieving JSON response from Github API is as follows:Equivalent bash command

// Groovy formatted string 
String cmd = "curl -s -H \"Authorization: token ${password}\" ${url}" 
// Example String 
example = 'curl -s -H "Authorization: token XXX"'

Processing Github JSON from Jenkinsfile

Continuing the demo from the last section, we now put the Groovy code into a callable function in a script called “github.groovy”. Then, in our Jenkinsfile, we proceed to load the script and use the function to process JSON response from Github API.github.groovy

import groovy.json.JsonSlurper
def getPrBody(String githubUsername, String githubToken, String repo, String id) {
   String GITHUB_API = '' 
   String url = "${GITHUB_API}/${githubUsername}/${repo}/pulls/${id}" 

   println "Querying ${url}"

def text = url.toURL().getText(requestProperties: ['Authorization': "token ${githubToken}"])
def json = new JsonSlurper().parseText(text) 
def bodyText = json.body return bodyText } 
return this


def code node('java-agent') { 
    stage('Checkout') { checkout scm }
    stage('Load') { code = load 'github.groovy' } 
    stage('Execute') {

Best Practice

Flutter | Getting started

Create your first App

Copied from here and here

Step 1: Create the starter Flutter app

$ flutter create startup_namer
$ cd startup_namer
$ flutter devices
$ flutter run


Installation of Flutter

Instructions on

Installation of Dart SDK

Details are here

$ brew tap dart-lang/dart
$ brew install dart --devel

Run a flutter Application

$ flutter devices
$ flutter run [--verbose]
$ flutter emulators
5 available emulators:

Nexus_5X_API_28_x86      • Nexus 5X      • Google • Nexus 5X API 28 x86
Pixel_3_API_28           • pixel_3       • Google • Pixel 3 API 28
Pixel_XL_API_28          • pixel_xl      • Google • Pixel XL API 28
apple_ios_simulator      • iOS Simulator • Apple

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.
$ flutter emulators --launch apple_ios_simulator