Science, web development, geek stuff and cat content. From time to time.

Video – Laupheimer Ansichtskarten

For www.laupheimer-ansichtskarten.de I created a short video, giving an impression of this extraordinary collection.

Connecting wordpress and moodle

For a current project I setup wordpress as CMS and community tool and moodle as e-learning platform (there are wordpress plugins available like sensei, but moodle is simply the most advanced software available right now).

One of the hardest parts was to bring the two systems as close together as possible. I thought about using LDAP for the user authentification (both systems can authenticate against a LDAP server) but while researching I found an awesome wordpress plugin: External Database Authentication Reloaded

This plugin lets you define a database table and columns you want to use to check a users logindata. You can simply input your moodle’s database credentials, select moodles user table (which was ‘learn_user’ in my case) and then select the username and password columns in the table (thei’re actually called “username” and “password” in moodle).

The right password encryption method is “phpass” (“pH-pass” not “php-ass”) for moodle v2.5 and later. You can add a role check and require the field “confirmed” to be “1” to only allow confirmed user accounts to login. Also some more userfields like e-mail, firstname, lastname, … can be mapped.

That’s it! When somebody tries to login to your wordpress site all user data will be taken from moodle’s user table.

This is not a complete single-sign-on solution, but for the effort taken it’s a quick and easy solution to only require one registration.

Smart Herb Garden (Click & Grow)

Just in time for christmas (on the 23rd) the smart herb garden that I backed on kickstarter arrived. The guys from Click & Grow did an awesome job sending out as many gardens before christmas. So one thing up front: congrats, great kickstarter campaign!

The garden is now planted since the 25th and I just want to give a brief review: awesome! It works very well, there are just three small things I would like to give Click & Grow as feedback:

Float indicator problems

Many people on kickstarter reported problem with the float indicator. This tiny pice of styrofoam is used to measure the water level and allows the plants to call for more water. Click & Grow gave some quick instructions on how to fix this (moving the lighter arm in a different position, checking the float indicator orientation), but none of them helped in my case. But there was a very easy fix for me: I pulled out the magnet from the styrofoam just a bit more. When putting the garden back together take care to put the float indicator into the right position, so that it does not get stuck! If the magnet is pulled out too much, you can easily damage the float indicator!

Instructions

The smart herb garden comes with very little instructions. Only some basic information is printed on the inside of the (great!) packaging. Click & Grow should provide some more instructions on how to add the seedpods, when to remove the lids, etc. Just to be sure, that you’re doing the right thing!

SOS!

That’s definitely one of the most bothering things: The very strong LEDs start to morse SOS when the garden needs water. This seems like a funny idea, but considering that we planned to place the garden in our window facing the street, I’m quite sure that some people will not think about a plant that calls for help, but (hopefully) will call the police if they see SOS signals morsed from an apartment. If the garden needs water in the middle of the night, it will blink SOS for the whole night – with quite strong LEDs that should be visible over a great distance.

So, to Click & Grow: Please, don’t play around with international emergency signals! For now I think I will disable the float indicator to make sure, that our (to be honest, it’s my Tamara’s) garden won’t signal SOS.

XBMC sleep mode playlist

XBMC offers a lot of cool features, most of them I still don’t really understand and don’t use currently. But one of them I just learned to love: smart playlists and python scripts.

I was looking for a plugin that would allow me to setup a playlist with random episodes of tv shows that runs for X minutes and then shuts down the media center (or in my case as I use openELEC just stop playback). To make this part short: I did not find any.

But I found smart playlists and python scripting. So I finally got what I wanted:

A one button solution (well, I extended it to two buttons for more flexibility) that starts a playlist and stops after a specified time. To achieve this, I needed three steps:

  1. Setup a smart playlist that randomly selects episodes from a given set of tv shows
  2. A python script that tells xbmc to play the playlist and starts a timer (asking you for the amount of time) that will stop playback or shutdown xbmc
  3. Mapping the python script to a button on my remote

Smart playlist

This one is quite easy. You can use the GUI version to create a smart playlist or just create a xml file inside Userdata/playlists/video/playlistname.xsp with the following content:

This creates a smart playlist with the name “playlistname” (change this!) with two rules. The first is to select the tv shows and the second one defines that only episodes that have a playcount greater than 0 should be selected (this will only add watched episodes to the playlist – just remove the rule block to disable this). It only adds 50 elements (which is enough for me) and orders them randomly.

You can test the playlist from inside XBMC under the video -> playlists menu.

Python script

This is easier than it sounds. Just create a file named “playplaylist.py” in our userdata folder:

The last three lines are important: The last one sets the timer (named “sleepmode”) and defines the action to perform at the end (Stop the playback – you can also use other XBMC functions here, like XBMC.ShutDown). The previous one starts playback of the playlist (check your playlist name here!) and the first one just cancels a previously started alarm, if available.

Remote control button

So the last step is to link the python script to a remote control button. I’ve added a remote.xml file to the keymaps directory (in your Userdata directory). This file will override the default mappings:

This tells XMBC to start run the python script when the blue button is pressed on the remote. Voila!

checking eu vat numbers with php

Validating VAT numbers in php is quite easy – simply sending a get request to the EU vies api and checking the response for a css class name. The following code gives an example of how to do this (in the easiest way possible – consider using more advanced methods for sending the request, but file_get_contents() is fine in most cases).

Flora & Fauna

Say Hi to Fauna! Flora’s best friend to be.

Leaving dropbox behind

Dropbox rocks. It’s a solid and awesome solution for file sharing and one of the best solutions for syncing files between various devices. But… storing personal or business files on external server – without any encryption and no control where your files go (hello NSA!) is probably not the best idea.

I had two major aims by using dropbox: full access to my files from everywhere and easy sharing of files with other people. But I noticed, that these two tasks never happen to apply to the same files. Moving away from dropbox for my “sync only” files was an easy step.

There are quite a lot of solutions for “personal cloud” services. OwnCloud is one popular example. But to make it short: it sucks. Sync is slow (webdav for syncing large files is just a bad idea) and it seems more like an alpha version than a software you want to use everyday.

I came across BitTorren Sync and gave it a try. It uses torrent technology for syncing the files (every folder you want to sync becomes kind of a torrent that will be downloaded/synced to other devices, running BT sync). The system generates a private key for each shared folder. On all other devices, the folder can be synced by giving BT sync the same private key.

So, what’s the difference to dropbox? Files are not stored anywhere else than on the devices with the folder key. No cloud server, no third party place. This is the most important feature and also the biggest “downside” of BT sync. Simply adding a folder to your notebook and pc will get you in trouble if both devices are not running the same time (files can only be synced if there is a device running with the synced folder). But there is a great solution for this: simply adding a 24/7 online device to your BT sync “cloud”. This could be any server or even better for private users: a NAS device like the Synology NAS series or just a raspberry pi with a large external disk.

Files will always be synced to this personal cloud server and can then be synced to all other devices.

I really like this solution – my files stay on my devices and I have full control where they go. BT sync runs quietly in the background, syncs files very fast and is a good everyday solution. The only downside: no direct sharing of files with other users and I’m missing the folder icons indication the sync status from dropbox. There is an iPhone and android app for BT sync and accessing my files from other devices is easy using FTP on my server.

Goldener Reis

Reis ist ein Grundnahrungsmittel in vielen Regionen der Welt. Vereinfacht gesagt, liefert er ausreichend Energie um den Körper am Laufen zu halten, an anderen lebensnotwendigen Stoffen mangelt es ihm jedoch. Einer dieser Stoffe ist Provitamin-A, auch Beta-Carotin genannt. Es handelt sich dabei um den schönen orangen Farbstoff wie man ihn aus den Karotten kennt. Als sogenanntes Provitamin bildet es die Vorstufe des essentiellen Vitamin A.

In vielen ärmeren Regionen ist die Ernährung sehr einseitig. Morgens: Reis. Mittags: Reis. Abends: Reis. Sofern es überhaupt drei Mahlzeiten gibt. Dass hier Mangelerscheinungen auftreten, ist naheliegend. Continue Reading…

Children and the interwebs

Kaspersky made some nice graphs showing most visited website categories from children (using their child safety filter stats). Well, it seems that all over the world children like three categories of website most: social network, pornography and webshops. The graphs also show the differences in many countries.

What are children doing online?

cat diaries