California – places to visit

In June 2018 I went to Florida, Tampa and California, Palo Alto. In Tampa I was visiting the University of South Florida, where I was working together with prof. Glenn Smith on a joint research project. Related to the project I also visited Stanford University, Natural Language Processing group and Infolab, where a post-doc researcher Siva Reddy and Marinka Žitnik accepted me very warmly. During the stay in Palo Alto I had time for few getaways and also took a week off for a road trip. Below I quickly list places I visited, which can help others visiting the Bay area.

For travelling I did not need to have to use mobile data as there are many shops or Starbucks cafes where you can use a free wifi. I recommend to install Roadtrippers, where you can enter points of interest and plan the most efficient trip during the day. I used POIs from there as destinations in an offline navigation – HERE Maps works perfectly. Also, it is useful to have a Groupon application, where you can get some good deals – I got cheaper entrance fee for museums in San Diego, Warner Bros tickets and Computer history museum.

Palo Alto

In Palo Alto I rented a car, which is more convenient if you stay longer. Of course you can also use Uber or Lyft. I was staying at my sister’s apartment and below I list places that are nice to visit in the area.

  • Stanford – At the Stanford University visitor center they offer free walking tours around the campus. After the tour I also recommend visiting the Hoover Tower and Stanford Dish.
  • Bol Park – Nice short walk and option to see a donkey (with his own mailbox :)), which was a model for the Shrek’s animated donkey.
  • Cupertino – You should definitely visit Apple headquarters where you can get to look around their buildings in the visitor center’s (shop) roof.
  • Mountain View – If you know someone at Google, he can show you around the Googleplex’s offices, parks and invite you to theirs cafeteria.
  • Menlo Park – Similarly to Google, you can also see inside the Facebook’s offices. I was not very impressed about the working places but Facebook has a huge and fascinating park on the roof of their buildings.
  • Shoreline Park – A scenic park to walk in the afternoon, have a coffee and see some birds. At the time I was there it was very windy and cold.
  • Computer History Museum – Very good museum to explore the development of computers science/engineering field.

San Francisco

If you have a full day and a half you should visit San Francisco. It is better to have a sunny weather, which I did not have. Visiting from Palo Alto I would recomment to take the 101 Fwy in one way and 380 Fwy into another.

  • Union Square – If you park in the center, go near this park and also explore the neighbourhood. Next to the square is also a big shopping center – Westfield San Francisco Center.
  • Painted Ladies – In my opinion nothing special, just few houses of the same type, painted in different colours.
  • Lombard street – Famous street, for which you need some minutes to drive through. Just important to drive through, otherwise nothing special.
  • Pier 39 – At this pier you can walk through many shops or have a good fish meal. If you prefer fast food I would recommend to walk a bit further to the Fisherman’s Wharf, where you can get tasty fish-based fast foods.
  • Fisherman’s Wharf
  • Golden Gate Bridge – I have not crossed the bridge as it was foggy but you can get a good view from the Golden Gate Park below the bridge.
  • Twin Peaks
  • Ford Funston
  • Sutro Baths
  • Alcatraz – For visiting the island prison you need around three hours altogether. The complex is not that big but at the island you first see the movie about the development of the island and then you can walk around the cells. The self-guided audio tour navigates you through the stories of the prison. You will see how clever were those three guys that managed to escape.

Santa Cruz and Monterey

From Palo Alto this trip will take a a whole day.

  • Roaring Camp Railroads – I thought this would be some nice park but is more a railroad for the children amusement.
  • Court of Mysteries – A half-built building, which was closed for renovation at the time of my visit.
  • The Light House
  • Santa Cruz Beach Boardwalk
  • Santa Cruz West Breakwater Light
  • Capitola Beach
  • Monterey Old Fisherman’s Wharf
  • Pebble Beach
  • Carmel by the Sea – Very nice beach with cosy houses at the waterfront.
  • San Juan Bautista Mission – On the way back you can stop here to see a mission, which I could not explore as it was already dark when I was returning back to Palo Alto.

California Road Trip

For this trip I needed seven days – from 21st to 27th June 2018. The initial plan was also to visit the Sequoia Park but it would be too much, so I skipped it. If you have a day more, you should probably visit it. If you visit at least three national parks it is also cheaper for you to buy a full pass fee for all the California parks.

1. Santa Barbara

My first stop from Palo Alto was Santa Barbara, which really impressed me. I had a dinner at the Cold Spring Tavern, which is an old-fashioned tavern at the old road through the mountains (just 10 minutes from the city). On the way to Los Angeles I stopped in Thousand Oaks to find a place to sleep and the best price/performance in my opinion is to choose Motel 6. Comparing to other motels it has very nice and clean rooms without doors to neighbours. That is why I also mostly selected these motels further on the road.

  • The Courthouse – Old courhouse where you can see the machinery for the bells and the clock. On the roof you can also see the whole city.
  • Stearns Wharf – At the end of this wharf you can also try fishing (gear is available to rent). Just at the time I was there some guy caught so big fish he could not raise it to the wharf.
  • Mission Santa Barbara – In front of the mission is a small park where you can take a rest and lie down on the grass.

2. Los Angeles

  • Universal Studios Hollywood – First place I visited and after a walk in the Universal city I found out that tickets to enter the Studio’s tour cost around 130 USD, which it seemed too expensive for me and that is why I did not enter. At the Warner Bros they probably show similar stuff, maybe just a bit less but in my opinion enough to get a rough idea of their work.
  • Warner Bros Studios – The tour takes you about three hours and you see The Big Bang Theory setup, buildings and how are they used for shooting, small “safari” used for shooting in the woods, … It is also nice to see different costumes, Batman vehicles that are all driveable (but not for you as a visitor :() and a repository of different stuff from all the movies that producents use and also general public can lend.
  • Griffith Observatory – I recommend to park a car under the observatory because the walk is not that long and after sitting the most of the time it is also healthy. From the top you can see the Hollywood sign, telescope and a good view of the city.
  • Hollywood Walk of Fame – I expected much more from this street. From the shopping center you can also see the Hollywood sign. There is also a Museum of Failure there where you can see some interesting things.
  • Beverly Hills – I drove through Beverly Hills when there was dark already. It is nothing special but you can see that wealthier people live in the area.

I slept in Motel 6 – South El Monte in Los Angeles.

  • Citadel Outlet Shopping – Shopping here took me about 4 hours. Maybe also due to the fact that my wife was travelling with me :).
  • Long Beach – On the way to San Diego I stopped by at the Long Beach – typical Baywatch-like beach. Then I continued to San Diego.

3. San Diego

  • Black’s Beach – This was my first stop, from where you can see the beach and cliffs.
  • Old Town State Historic Park – If you are visiting San Diego, you should not miss the historic park. Here they have a nice setup of old city – bank, candy shop, restaurants, … Every building is also a small museum or shop and people are dressed in an old way. You can probably see more Wild west oriented city in Pioneertown which was also a setup for some western movies but I decided to skip it because of this park.

In the north I was buying groceries in Safeway but in the south area they have Vons. Probably one company took over another one as shops look the same. In these shops I especially liked self-service food that you can take and eat there. As there was still a lot to see in San Diego I slept at Motel 6 – Chula Vista.

  • USS Midway Museum – An incredible military vessel for which you will need at least three to four hours to see everything.
  • Maritime Museum – In the same street you also have some other ships and submarines to see. Also very exciting, especially old wooden ships that still sail. If you are lucky, you can also book a trip for one of them.
  • Mission Bay Beach – Before leaving San Diego I went to swim to the sea. In this area there is a small bay with warmer water and a lot of people having picnics and enjoying afternoons. The water temperature in June was about 21 degrees.

On the way to Las Vegas I slept at Motel 6 – Barstow.

4. Las Vegas

  • Outlet Shopping – About 60km before the city there is an outlet center where you can find some clothing to buy.
  • Welcome to Fabulous Las Vegas Sign – The most important thing (and probably interesting :)) is to take a selfie in front of the Las Vegas sign that you can see in movies.
  • The Strip – After the sign you should park somewhere at the Strip street, which is the main street. There you can get an impression of a party city – hotels, bars and casinos open to everyone. I wanted to see The Auto Collections which is sadly not there anymore.

On the way to the Death Valley I slept in Best Western Pahrump Oasis.

5. Death Valley

As there were warnings about the temperatures in Death Valley I started my trip there in the morning. But until 2pm the max. was 44 degrees, which is two degrees less comparing to Las Vegas.

  • Zabriskie Point – This should be your first point to take some scenic photos if you are travelling from the east.
  • Furnace Creek Visitor Center – In the center I recommend to see a movie about the valley and talk to the rangers that can help you what to see and visit. Initially I had a plan to visit also some other points but then I decided not to.
  • Devil’s Golf Course – Seems like an agriculture field with salt on top of it.
  • Badwater Basin – The lowest place in US with 85.8m below the sea level.
  • Artistic Drive and Pallete – Some colorful rocks that changed its colour due to the oxidation.
  • Mesquite Flat Sand Dunes
  • Father Crowley Vista Point – You need to walk around 10 minutes to get a view over a large part of the valley. The most interesting things of all was a fly-over of F-18 fighter. At first I did not know what is happening as the sound was like I was in the middle of a huge storm. Then I saw an F-18 approaching me very low (like 20m above me) and I also saw a pilot inside. The fighter then turned back and went inside the canyon, flying on the side. This “show” is something you must see – if you google it, you can find out they “train” here regularly.

On the way to the Yosemite Park I slept in Motel 6 – Mammoth Lakes. At the time I was there a fire was happening few miles away and there was some smoke in the air. The city seemed nice, oriented into winter sports – in the hills there you could ski in the middle of June. There are also three lakes in the area – a drive around them will take you a half hour and are worth visiting.

6. Yosemite Park

The Yosemite Park is very scenic and worth visiting.

  • Tioga Pass – Driving to the village you can already observe some great mountains, stop by lakes and walk around.
    • Half Dome
    • El Capitan
    • Yosemite Falls
  • Yosemite Village – In the village I propose to see a movie about the park, which repeats every half hour. There is also a museum and store.

On the way back to Palo Alto I stopped for a coffee in Merced, which is a small city but I saw quite a lot of homeless men there – I do not know why so much.

As my final remarks I would say that I have seen many things and the nicest places are Santa Barbara (IMHO the best city of all the above), San Diego and Yosemite Valley. I was a bit disappointed about San Francisco – maybe also because of the cloudy weather or too big expectations.

Apache and forwarding a client certificate Id to WebSocket

Recently I came across a problem of forwarding a certificate Id to backend service for the authentication purposes. I also do not want to handle SSL at services.

Let’s say I have a server setup as follows: There is an Angular website on port 4200 and REST/Websocket services on port 3000. REST services are accessible over endpoint /kumuluz and Websocket connections via /v1/devices. As a common facade to access these services I set up Apache as a reverse proxy as in an example configuration below.

To extract a field from a client certificate (e.g. CN in my case) and forward request to a backend REST server with an additional header field is not a problem. I just extract property %{SSL_CLIENT_S_DN_CN}s and set a header field clientId.

The problem comes, when you would like to do the same for the Websocket connections – you cannot set header for these type of connections. But you can do a workaround (the point of this post): Tell clients to connect to the endpoint /v1/devices/CLIENT_ID and then check if the parameter matches the client id of underlying client certificate. Now you forced the client to use the correct ids in URL, which you can use for authentication as Apache forwards only requests where SSLRequire successes.

   Redirect permanent /


        DocumentRoot /var/www

        ProxyPreserveHost On
        ProxyRequests Off

        ProxyPass /images !
        ProxyPass /v1/devices ws://localhost:3000/v1/devices
        ProxyPassReverse /v1/devices ws://localhost:3000/v1/devices

        ProxyPass /kumuluz http://localhost:3000
        ProxyPassReverse /kumuluz http://localhost:3000

        ProxyPass / http://localhost:4200/
        ProxyPassReverse / http://localhost:4200/

        RedirectMatch ^/$

        SSLEngine on
        SSLCertificateFile /home/slavkoz/certs/
        SSLCertificateKeyFile /home/slavkoz/certs/

        SSLCACertificateFile /home/slavkoz/certs/CA.pem
        SSLVerifyClient none
        RequestHeader set clientId ""

                SSLVerifyClient require
                SSLVerifyDepth 1

                RequestHeader set clientId "%{SSL_CLIENT_S_DN_CN}s"

                SSLVerifyClient require
                SSLVerifyDepth 1

                SetEnvIf Request_URI "/v1/devices/(.*)$" CLIENT_ID=$1
                SSLRequire       %{SSL_CLIENT_S_DN_CN}  eq %{ENV:CLIENT_ID}

Creating a Mac OS .app from a runnable JAR file

Here we solve a problem that many developers face when bundling java applications into an .app. We are going to correctly set the current working path for your Java Application.

Mac OS applications (.app files) are basically packages with a specific folder structure. You can easily explore each app’s structure by clicking on it using right click in Finder and selecting “Show Package Contents”.

Screen Shot 2016-02-21 at 11.42.41

Screen Shot 2016-02-21 at 11.42.53


Creating a custom .app

Create a folder The Finder will ask you the following, which you will answer as add.

Screen Shot 2016-02-21 at 11.46.37

Now, show contents of you app and inside it create a folder structure /Contents/MacOS. Also create a blank script file (in my case, I am using Sociogram as a program name).

Screen Shot 2016-02-21 at 12.49.45
This script needs to be an executable, so open Terminal and run a command like this:

chmod a+x

Maybe you have noticed that your .app does not have an icon. Therefore you need an .icns icon. I used a web service ( to convert my PNG file to an appropriate ICNS file.

Now, create a folder Resources and copy your icon there:

Screen Shot 2016-02-21 at 12.51.25


The last step now is to create a config file Info.plist that will define, which is an executable file in your app and where is your .app icon:

Screen Shot 2016-02-21 at 12.54.14

After these steps, you should have prepared an .app file, which looks like as follows:

Screen Shot 2016-02-21 at 12.55.39

Creating a runnable script for a JAR

First, let use create a Java Application that will print out the current working directory and package it into a runnable JAR (sociogram.jar):

import javax.swing.*;
import java.awt.*;
 * Created by slavkoz on 21/02/16.
public class Runner {
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        JPanel panel = new JPanel();
        panel.setLayout(new BorderLayout());
        panel.add(new JTextField(System.getProperty("user.dir")), BorderLayout.CENTER);

If we now just run that jar from a launcher script, the default working directory for Java would be “/”, so we may have problem accessing resources, that are packaged inside our .app.

Therefore, let us create an executable socioRunner script that will accept current working dir and run our java application from there. We put the script in the same directory as the launcher script.

APP_NAME="Sociogram 5.0"
cd "$DIR"
java -Xdock:name="$APP_NAME" -Xdock:icon="$DIR/../Resources/application.icns" -cp "$DIR;.;" -jar "$DIR/$APP_JAR"

Now, we can update the launcher script, which will detect the directory, where it resides and run the socioRunner script with a parameter:

# Set the working directory
DIR=$(cd "$(dirname "$0")"; pwd)
# Run the application
exec "$DIR/socioRunner" $DIR

So, voila, now we get the following result when the .app application is run from Finder:

Screen Shot 2016-02-21 at 13.32.45

You can download the whole .app file from here:

A simple custom solution to multi-language support using JS

Recently, I needed to add a multi-language support to a website that was run using PHP. Sure, I could use some i18n PHP framework to deliver translated web-page directly from a server, but I decided to design a simple approach based on Javascript.

Here it goes …

The default language is supposed to be slovene, so visiting a page by url http://mywebpage would show a slovene version. To get a webpage in a specific language, you need to explicitly define the language using a parameter, like so: http://mywebpage?lang={sl, hr, en}. Of course, this is used in a header of a web page for a languages selection menu:

<a id="lang-sl" href="/?lang=sl">Slovenski</a>|
<a id="lang-hr" href="/?lang=hr">Hrvatski</a>|
<a id="lang-en" href="/?lang=en">English</a>

In the webpage, I introduced a “lang” HTML tag, which acts as a placeholder for a language-specific text:

<lang id="home" />

For each language I create a separate JS file that includes a map variable, whose keys are ids used in HTML placeholders and values are translated texts. For example, a file “” includes slovene translations:

var lang = {
    home: "Domov",
    about: "O programu",
    functionalities: "Funkcionalnosti",

Now, as we have everything prepared, we are going to write a JS script that (A) automatically detects a selected language from query string, (B)  includes an appropriate translation file and (C) automatically populates prepared HTML placeholders. I do this as follows:

$(document).ready(function() {
	$.urlParam = function(name){
		var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
		if (results==null){
		   return null;
		   return results[1] || 0;
	function loadJS(file) {
		var jsElm = document.createElement("script");
		jsElm.type = "application/javascript";
		jsElm.src = file;
	if ($.urlParam("lang") == "en") {
		$("#lang-en").css("font-weight", "bolder");
	} else if ($.urlParam("lang") == "hr") {
		$("#lang-hr").css("font-weight", "bolder");
	} else {
		$("#lang-sl").css("font-weight", "bolder");	
	function fillIn(key, value) {
		document.getElementById(key).innerHTML = value;	 	
	//Fill in translations	
	for(var key in lang) {
	  fillIn(key, lang[key]);

Additionally to that basic example I added some exceptions to insert language-specific values into some HTML tag attributes.

Such approach works like a charm for about 200 language keys – I have not tested for more. The whole site is served by an RPi and JS loading of language-specific texts is not noticeable on a client.

Part 3/3: Reading analog input using RPi

Continuing from the previous example, we would like our LED to turn on automatically, based on the light level of the environment.


First we need to read the value of the photocell that measures the value of light. Photocells (aka. photoresistor) acts as a dynamically-adapting resistor according to the light levels. In dark areas, the resistance is high and in bright areas the resistance is low.

As Raspberry Pi does not have an analog input, we can make a trick to read a value from an analog sensor (resistor-based sensor). We just use a small capacitor and measure time that is needed to fill the capacitor to the full level.

On Raspberry Pi we use 3.3V pin as power supply, GND as ground and pin 18 as an input pin that will be used to measure time to fill the capacitor. In the circuit we measure voltage levels using pin 18 between photoresistor and capacitor.

To get the light level, we need to:

  1. Set pin 18 as out and to LOW voltage.
  2. Set pin 18 as input to be able to read input voltage. Now we can just read if voltage is LOW or HIGH.
  3. Measure, how much time is needed until read voltage on pin 18 is HIGH.

Normally you can use a 1μF but we had just a capacitor of 100μF (if it is designed to higher voltage, it is okay). The difference is only you will need more time to fill the capacitor in darker conditions. In our case, we need about 800000ms to detect dark light and about 30000ms to detect twilight.

Automatic light switching

Above we got the information whether the light conditions are daylight, twilight or darkness. Now we set a LED that will be turned off in daylight, burn lightly in twilight and be very bright in darkness.

For this, we use two pins to turn on a LED and for each pin, we use different resistor to set the brightness of a LED. For darkness we use a 220Ohm resistor and for twilight we use 1120Ohm (2x560Ohm) resistor.

The script to control all of the above looks like:

#!/usr/bin/env python
import RPi.GPIO as GPIO, time, os
#Variables setup
class Light(object):
        DAYLIGHT = "Daylight"
        TWILIGHT = "Twilight"
        DARKNESS = "Darkness"
def LightInfo():
        # This takes about 1 millisecond per loop cycle
        repeats_to_full_capacitor = 0
        while (GPIO.input(LIGHT_STATUS_PIN) == GPIO.LOW):
                repeats_to_full_capacitor += 1
        if (repeats_to_full_capacitor < TWILIGHT_THRESHOLD):
                return Light.DAYLIGHT
        elif (repeats_to_full_capacitor < DARK_THRESHOLD):
                return Light.TWILIGHT
                return Light.DARKNESS
def TurnLEDOnOff(status):
        #Turn all off
        #Turn appropriate pin on
        if (status == Light.TWILIGHT):
                GPIO.setup(DARKNESS_LIGHT_PIN, GPIO.IN)
                GPIO.output(TWILIGHT_LIGHT_PIN, GPIO.HIGH)
        elif (status == Light.DARKNESS):
                GPIO.setup(TWILIGHT_LIGHT_PIN, GPIO.IN)
                GPIO.output(DARKNESS_LIGHT_PIN, GPIO.HIGH)
#Main program
status = Light.DAYLIGHT
while True:
        newStatus = LightInfo()
        print newStatus
        if (newStatus != status):
                status = newStatus

When we run the script as “sudo ./” in daylight conditions, the LED is off:


In twilight, the LED is not that bright:


Lastly in the darkness, the LED becomes very bright:


Part 2/3: OpenHAB + RPi + LEDs + Camera

We are continuing with the example from the first part of the tutorial:

In this part we are going to install OpenHAB platform on an RPi and remotely control LEDs.

OpenHAB (  is a software that is intended to connect to many sensors or devices for home automation. It works as a smart devices gateway and includes tools to design a custom GUI to control these connected smart devices. A GUI can be accessed using a web browser or from a nice mobile application (iOS, Android).

OpenHab Installation

We first installed OpenHAB core and then Demo from the official site: These are compressed packages which I unzip into /opt/openhab folder. Within the new directory, there’ll be a folder called configurations. Within this folder create a copy of the default configuration file openhab_default.cfg and name it openhab.cfg. This is where you’ll store all your settings for openHAB and any bindings you need.

To start the OpenHAB server, run /opt/openhab/

OpenHAB configuration

To control our LEDs we will need to create three files.

Create a file configurations/items/default.items. This will be an inventory for definition of our sensors. The file should look like:

Switch RedLight				"Rdeca luc"
Switch GreenLight			"Zelena luc"
Switch YellowLight			"Rumena luc"

The next file should define the rules and actions for these sensors. So, create a file named configurations/rules/default.rules to look like:

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.action.pushover.*
import org.openhab.action.pushover.internal.*
rule "RedLight changed"
 Item RedLight received command ON
 logInfo("RedLight", "Received red light command to turn on.")
 executeCommandLine("python /home/pi/")
 pushover("Rdeca luc je bila prizgana.")
rule "RedLight changed"
 Item RedLight received command OFF
 logInfo("RedLight", "Received red light command to turn on.")
 executeCommandLine("python /home/pi/")

As you can see I also configured the pushover service so that I am notified about the change via a push notification. It can also be observed that on some command received, a log message is created and a command line script is executed. These scripts look the same as in the first part of the tutorial, where we introduced how to turn LED on or off.

In the last file, named configuration/sitemaps/default.sitemap we will define the GUI for our application. Our file looks like this:

sitemap demo label="Raspberry demo"
 Frame label="Luci" {
   Switch item=GreenLight label="Zelena luc"
   Switch item=YellowLight label="Rumena luc"
   Switch item=RedLight label="Rdeca luc"
 Frame label="Videokamere" {
   Text label="Raspberry kamera" icon="video" {
     Frame label="Raspberry kamera" {
       Video url="http://localhost:8081?action=stream" encoding="mjpeg"
   Text label="Raspberry kamera" icon="garden" {
     Frame label="Raspberry kamera (snapshot)" {
       Image url="http://localhost:8081?action=snapshot" refresh=5000

For now you can skip the “Videokamere” part as it defines video stream and snapshot images of a camera that we will attach to the raspberry (below).

As you save the file and run the server, the GUI can be accessed via a web browser using URL http://RPi_IP:8080:

Screen Shot 2016-02-04 at 14.01.19

You can also use this URL in a mobile application and have a native interface – e.g. on your iPhone, which looks like this (for our sitemap definition):


You should now be able to turn on or off your LEDs using OpenHAB platform. Try it out!

OpenHAB and Raspberry Pi Camera Module

Now we would also like to check our lights remotely via a camera. We will use mjpeg stream for video streaming.

We have an RPi Camera Module, which we attached to the RPi. After that we run “sudo raspi-config” command and enable the camera module.

First we need to install some dependencies:

sudo apt-get install libjpeg8-dev
sudo apt-get install imagemagick
sudo apt-get install libjpeg62-dev
sudo apt-get install cmake
sudo apt-get install libv4l-dev
#create a symbolic link
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h

Then we download mjpeg repository and build the library:

# You can also choose to download some stable version instead of current master
git clone .
sudo make clean all

Now copy the directory of build files to /opt/mjpg-streamer and run mjpeg streamer using the following command (I am using parameter vf to vertically flip the image):

LD_LIBRARY_PATH=/opt/mjpg-streamer /opt/mjpg-streamer/mjpg_streamer -i " -fps 5 -q 50 -x 640 -y 480 -vf" -o " -w /opt/mjpg-streamer/www -p 8081" &

If everything is okay, a video stream should be accessible at http://RPi_IP:8081:

Screen Shot 2016-02-04 at 14.26.03

Also if OpenHAB is configured as above, videostream should be accesible over its GUI:

Screen Shot 2016-02-04 at 14.28.36

Part 1/3: Controlling LEDs using Raspberry Pi

In this post I will review, how to turn on or off LEDs using Raspberry Pi 2, Model B (RPi).

First we copy Raspbian linux to a microSD card, turn on RPi and connect to it using ssh.

We use three LEDs and each needs to be connected to each own positive supply of the circuit and ground, as well as, we needed laser cutting to get the perfect size. For the positive supply on RPi we use pins 18, 17 and 27 as seen on the scheme below:



As the current would be too high if we connect the LED directly into the circuit, we need to add a resistor for each LED. As it is written in the Raspberry Pi spec, it can safely allow up to 16mA current. Our pins can supply 3.3V. Therefore to allow the LED to be the brightest, we can use 210Ohm  or stronger resistor. Using stronger resistor will result in the LED not being so bright.

In this example I am using 560Ohm resistor. I am also attaching a nice scheme for calculating the resistance of 4-band resistors:

Screen Shot 2016-02-04 at 11.09.35


To control a specific LED, we can “turn on” a specific LED using a Python library. First we need to set a pin as output and then we can turn it on (GPIO.HIGH) or off (GPIO.LOW). An example of a script that turns on a LED:

import RPi.GPIO as GPIO
import time

Physical result:


Databases Summer School at Kyungpook National University

During July 2015 prof. dr. Marko Bajec and I held a one-month summer school on databases and database design at the Kyungpook National University (KNU) in Daegu, South Korea. The summer school was selected among hundred applied summer school programs and 35 international students have applied for the course.

About KNU

KNU is the best national university in South Korea. Its main campus is located in Daegu, where we led the summer school at the IT department. The campus is very strong in electronics, although they offer also other studies. They have three more campuses across the country, which also focus on medicine. The KNU 365 Medical Center, located near Daegu, is a new complex with modern equipment. They also own a machine that is able to heal moving cancer tissue without damaging other parts of the body.


The university has strong cooperation with local industries, such as Samsung, LG, Hyundai, Xinix, etc. They are very strong in the area of international affairs as they have some double degree programs with USA or EU universities. Slovene Faculty of Economics already has a double degree with KNU, while our faculty (Faculty for Computer and Information Science) will start offering the joint studies in 2015/2016.

About South Korea

South Korea is not that big country but still there live a lot of people and produce a large portion of electronic devices (Samsung, LG) or heavy industries (Hyundai) in the world. The only Slovene company that has headquarters in Korea is Kolektor, which we also visited in the industrial city of Gumi.


I was surprised that mobile phones are more expensive than in Europe, that there were no options to buy cheap prepaids in supermarkets and also electronic departments in stores were not that huge. Later I found out that most of the Koreans order such devices online.

Koreans mostly drive cars made by their local manufacturers such as Hyundai or KIA. Also buses, trucks and other vehicles are made by these companies. It was especially interesting to see some car models that are not available in Europe and would be very competitive to European cars.


At first I thought the Korean food would be more Chinese or Thai -like, but they have their own cuisine. They adore chicken meat – especially with beer during different occasions :). Traditionally most important food is Kimchi – special cabbage with red spicy sauce, Bulgogi – slices of beef meat grilled together with vegetables, Gimbap – korean sushi with no fish, and some cold soups. I especially liked their Korean BBQ way of preparing food as you can grill ordered meat at a table. The only downside is that sometimes I was disappointed because of their low level of cleanliness in kitchens.

The most popular party drink is Soju. For real parties the youngsters mix it with beer. Apart from the plain 20% alcoholic drink it is produced with several flavours. Next, also rice wine Makgeolli is also popular – in my opinion of taste not that good.

Koreans are personally very calm and highly respect a societal hierarchy – professors are really respected by the students. I was feeling very safe and there were no incidents. Also streets are clean and nothing is damaged by the vandals. On the other hand, I was surprised that car drivers are not that polite as in northern EU countries.

I really enjoyed the stay in South Korea and am really grateful to our student assistant HyukSang Kwon and vice-president of international affairs at KNU Lorne Hwan, who made our stay even better.

My PhD Defense

I started my PhD directly after finishing my undergrad study, as a Junior Researcher from industry at Optilab and Laboratory for Data Technologies at the University of Ljubljana, Faculty for computer and information science. Throughout the study I was guided by my supervisor prof. dr. Marko Bajec, to whom I am very thankful for all his contributions to my work.

My core research area was a subfield of information retrieval, called information extraction. I especially focused into high-level information extraction tasks, such as named entity recognition, relationship extraction and coreference resolution. I proposed a novel approach for solving coreference resolution and relationship extraction. Moreover I connected all the three tasks into an iterative method that uses an ontology and enables end-to-end information extraction. All of the contribution were also published in scientific journals or presented at scientific conferences.

On monday, 22nd December 2014, I successfully defended my PhD thesis, which was approved by prof. dr. Zoran Bosnić, prof. dr. Dunja Mladenić and prof. dr. Marko Bajec. Below you can see a video of my defense or read my submitted thesis.





The end of Lajkbuk (previously Likebook) platform

In the early days of 2013 a friend of mine Dean Virant had an idea of developing a state-of-the-art platform for automatic organization of prize-games on Facebook. He invited me to be the technical lead and developer, while he was about marketing and sales. And I’d like to say that he got the marketing support he needed and find reviews for white label seo at that link, you could to receive information and details to help you get more traffic, just click on the link. First, we were working on the Likebook app and later discovered that it is against the Facebook rules to name the platform like that. So, we bought another domain name, SSL certificate, … for the new name – “Lajkbuk” (i.e., slovene pronounciation of the word likebook in english). We also had many ideas, many initial design, but then we chose the most important features and selected the most user-centered design. While I was developing the application, Dean was reaching to our possible customers, which were at first slovene companies.

So, Lajkbuk is the platform that enables an organization to seamlessly organize a prize-game on Facebook. We are using social media marketing to reach a lot of people for our new platform, we are using the the Angie Gensler content posting schedule. Next to the features of liking it also supports sharing counters and commenting by which consumers can improve their rank to get the reward. After the end of the game, we offered the organization to conduct some research about the users that participated in the games using the data with their consent. We had quite some successes in Slovenia and we have conducted a handful of successful games. Just as we wanted to broaden our support to other countries, multiple languages and automate the buying process, the Facebook anounced the prohibiton of organizing the games in such a way. So sadly, this is how the story with the Lajkbuk ends. Several sites specialize in offering APK files for download. Some are better than others, so visit Android4fun if you want to discover the best site for downloading APKs safely.

But the most important: We had an idea, we buit a solution, we sold some  games and made some people happy and obviously the time for new ideas has come …

Some technical details about the platform:

The whole source code (public part) is available on GitHub repository The platform is developed as a JavaEE application using Spring Framework, Spring Social, Spring Data, Hibernate and other technologies. With a server certificate it ran on Tomcat 7.0, which was deployed in the DigitalOcean cloud using a domain name The plaftorm was alive and fully functional from May 2013 to August 2014.

The main features are:

  • Facebook application: fully Facebook-connected with automatic login/registration, Facebook Tab Page integration, Sharing and Like logging, comment retrieval.
  • Admin pages: creating prize-games, entering customer data, consumer Facebook data retrieval.
  • Personal pages: my games and coupons to claim a reward.
  • Reports: according to our rules, a game can be ended prematurely for multiple reasons (organization does not follow rules, longer periods without activities).
  • Three possible features: COUPON, SHARE, COMMENT – used for winner selection and prize retrieval depending on our customer wishes.
  • And more …

Feel free to use the code!

Some screenshots: