Projection Painting Prototype

Combining traditional painting and projection mapping using processing and arduino for the ultimate interactive art experience.

Executive Summary

The structure of the canvas, mixing colors right on the canvas, layer after layer and letting the coincidence help is what makes traditional painting so powerful. However, as a nerdophile person I often miss the undo button and the color wheel of the digital world.

Luckily, I came across the processing movement turning code into art and vice versa. The perfect base to combine vivid richness of painted structure with the interactive and dynamic power of code. In fact, I had the idea of creating a painting hanging in a local club and each time someone enters or leaves  the room the color palette of the painting changes.

Continue reading “Projection Painting Prototype”

Twetterhäuschen

The Twetterhaeuschen is a monitoring tool fueled by an arduino, raspberry pi, node.js and socket.io showing the sentiment for a brand or topic on twitter.

The Twetterhäuschen is the world’s first Wetterhäuschen for visualizing the sentiment of a specific topic on twitter. It was built on a raspberry pi, a servo controlled by an arduino uno, using node.js in combination with socket.io. You can find the code on github to build your own: https://github.com/sektionschef/twetterhaeuschen

Implementation

  1. The Twetterhäuschen has its web form (index.html) to fill a brand or topic of interest
  2. The keyword is passed on to the server (app.js) which takes care of the API calls using the oauth module. The search is completed with some words to derive a basic level of sentiment, e.g. “love” or “hate”
  3. Taking the reach (number of followers) into account, the ratio between good and bad is calculated
  4. The arduino sets the servo between the angle of 60 and 130 in order to move the two characters Sepp and Susi out of the Twetterhäuschen.
  5. Whereas Sepp represents the dark force, Susi acts as a substitute for ecstacy and elation.

Here is an explanation in German:

Run shell scripts in gedit

Running scripts in gedit with the plugin external tools.

With the plugin External Tools you can comfortably run the script while you write it in gedit. After installing the plugin, go to Tools > Manage External Tools and create your own entrys and keyboard shortcuts.

For running a shell script I simply added:

#!/bin/bash
/bin/bash

and chose the Current Document as input. You’ll see the output in the bottom panel (Ctrl+F9).

For running an R script you simply add

#!/bin/bash
/usr/bin/R --no-save

and chose the Current Document as input. The output is as well shown in the bottom panel.

 

Raspberry NAS

Setup

the raspbian distribution comes with a basic menu helping with the initial setup. You can start it anytime

sudo raspi-config

My first steps were to

  • start the ssh server
  • customize the keyboard to German layout
  • boot to raspi-config off
  • password for the user pi
  • timezone change to my local time

and a password for the root user

 sudo passwd root

Networks

for all the networking stuff, you best set a static ip for the rasberry pi.

sudo nano /etc/network/interfaces

change the content to

iface eth0 inet static
    address 192.168.0.97
    netmask 255.255.255.0
    gateway 192.168.0.1

I had to change the dns entry as well. change it here:

sudo nano /etc/resolv.conf

in most cases the ip is the one of the local router

 nameserver 10.0.0.138

and now we should try it:

 ping www.google.com

if you get some numbers back, you can be sure it works!

cancel it with STRG+C

more info: http://www.penguintutor.com/blog/viewblog.php?blog=6306

wireless network

wpa supplicant is already preinstalled. You need to put your network credentials in /etc/wpa_supplicant/wpa_supplicant.conf.

network={
        ssid="network name"
        scan_ssid=1
        proto=WPA
        id_str="office"
        key_mgmt=WPA-PSK
        pairwise=TKIP
        group=TKIP
        psk="network key"
}

Protect your key and chmod the file to 0600.

Additionally, you can give it a static ip in /etc/network/interfaces. If you want to use a static IP for your networks, you need to define a string (id_str) in the wpa_supplicant.conf (see above). Then, you can define the details for this network the usual way using the string as a reference.

iface office inet static
 address 192.168.0.122
 netmask 255.255.255.0
 gateway 192.168.0.254

add a user

i did this with the following command:

 adduser stefan

an important thing I had to find out the hard way is the parameter for the shell. I had to add the right value and the path to the home directory with

 usermod -s /bin/bash stefan
 usermod -d /home/stefan stefan

and give me sudo permissions:

 sudo adduser stefan sudo

more info: http://www.cyberciti.biz/faq/howto-linux-add-user-use-adduser-command

rsync

install it by

sudo apt-get install rsync

Mounting the USB drive at startup

get a directory for the drive

mkdir Spatzenfest

find out the device UUID with the command

sudo blkid

edit the /etc/fstab file with

sudo nano /etc/fstab

and make an entry with the UUID and the mounting location in the form of

UUID=3bd33694-c3a5-4f90-a34a-26933fec8ab7 /home/stefan/Spatzenfest ext4 defaults 0 0

Samba

I wanted to create a public directory with write and read permissions. So first of all we do a little chmod and chown for the directory we want to share:

sudo apt-get install samba samba-common-bin

add the user:

sudo smbpasswd -a stefan
sudo chown -R USER:USER /home/stefan/Spatzenfest/
sudo chmod -R ug=rwx,o=rwx /home/stefan/Spatzenfest/

then we need to edit the samba configuration file: /etc/samba/smb.conf . At the end of the file insert:

[Spatzenfest]
  comment = Public
  path = /home/stefan/Spatzenfest
#  public = yes
  writeable = yes
  valid users = stefan

you can mount samba shares like this:

sudo mount -t cifs 10.0.0.1:spatzenfest/Music /home/stefan/Music -o user=stefan,passwd=password
sudo mount -t cifs //server/sharedfolder /targetfolder

if that doesn’t work maybe you need to install smbfs or newer cifs-utils package first for cifs to be recognized.

mount: wrong fs type, bad option, bad superblock on
sudo apt-get install cifs-utils

for the share being automatically mounted, I added this line to /etc/fstab :

//10.0.0.1/Spatzenfest/Music /home/stefan/Music cifs user=,passoword= 0 0

more info: http://elinux.org/R-Pi_NAS#Configure_a_public_storage_area_on_the_RPi

VNC Connection

install tightvnc server

 sudo apt-get install tightvncserver

start the server with

vncserver

and provide a password.

then connect to it on the remote machine by specifying the IP and the session number:

10.0.0.66:1

thank you to: http://www.neil-black.co.uk/raspberry-pi-beginners-guide#.UM3Ib1LzsUR

oder um auf den Standarddesktop zu kommen

sudo apt-get install x11vnc
x11vnc -storepasswd

Hostname

change the hostname by replacing raspberrry with the desired hostname:

sudo nano /etc/hostname 
sudo nano /etc/hosts

launch the changes with

 sudo /etc/init.d/hostname.sh start

thanks to http://elsmorian.com/post/23366148056/basic-raspberry-pi-setup

Deluge

for the installation of a headless torrent server you need to install:

sudo apt-get install deluge deluged deluge-webui

I did the configuration of the deluge daemon via ssh

ssh -Y IPOFSERVER
deluge

then the gui of deluge appears.

start the daemon with

deluged

and the web service with

deluge-web --fork

thanks to:

How to set up the Pentaho Business Intelligence Suite

Pentaho Business Intelligence Suite so far is the best freely available open-source Business Intelligence Tool. It integrates Kettle (data integration), Mondrian (OLAP server), Weka (data mining), jfreereport and a Tomcat Web server to publish business analytics.

Installation

  1. Download the latest version from Pentaho Community Web Site
  2. Extract it (e.g., ”/opt”)
  3. Grant execution rights to the BI folder and substructure

     chmod u+x bi-folder -R
  4. Make sure your JAVA_HOME variable is set properly and add it to your path by

     echo $JAVA_HOME
     export JAVA_HOME=/path/to/my/java/lib (e.g., /usr/lib/jvm/java-6-sun) 
     export PATH=$PATH:$JAVA_HOME

    Alternatively you can set your variables in .bashrc.

  5. Add BI paths (admin console & BI server) to your system PATH to be executable from everywhere
  6. Now you can start BI by executing start-pac.sh (only works if started within the admin-console folder) for the admin console and start-pentaho.sh for the BI server.

Database Connection

  1. Copy your data base JDBC driver into the BI folders, e.g.:

     /opt/biserver-ce-3.7.0-stable/administration-console/jdbc
     /opt/biserver-ce-3.7.0-stable/biserver-ce/tomcat/lib
  2. Optional you can migrate the sample repository into your DB. See the README.txt in biserver-ce/data/ in your BI folder.
  3. After starting the Administrator Console you can easily add a new data connection
    • Insert connection name
    • Select appropriate driver class
    • Insert DB user name & password
    • Define URL according to following syntax:
      jdbc:[DB-Type(e.g.mysql, postgresql)]://[host][,failoverhost...][:port]/[database] 
       # e.g.: jdbc:postgresql://localhost:5432/mydb

PDFTK

A great tool for dealing with pdfs is pdftk. It is a toolbox of the command line, which is able to split, merge, rotate, password-protect, change metadata, apply background and some more. I use it in combination with latex, which gives me some nice pdfs, which i want to merge in various ways. There is a way of including pdfs right into latex, but that’s not something latex is really good at. I also used it to split a serial letter longer than a page. I was able to print the serial letter of Microsoft Word just in one large pdf where all letters were included and with a script of pdftk i could cut them in separated files. pdftk is open source and available for Windows and Linux also Mac.

some examples:

merge pdfs in the sequence they appear

pdftk a.pdf b.pdf c.pdf cat output abc.pdf

the command for splitting some sites is

pdftk input.pdf cat 1-4 output pages_1-4.pdf

see the excellent man page for more!

PDF version and embedded fonts

If you need information about the PDF version or the embedded fonts in a .pdf file, you can use the commands pdfinfo and pdffontsrespectively. Information pdftk’s dump_data does not provide at the moment. Both are part of xpdf.

References

Making M-Audio’s 2496 work with Pulseaudio

I had problems with my M-Audio 2496 working with Pulseaudio, sound was working but the volume was too loud and envy24control was not working, after some search I found this bugreport. the comments #52 and #53 by muttnik solved my problems:

  1. install envy24control, if not already done:
    sudo apt-get install alsa-tools alsa-tools-gui
  2. Create the new udev rule in /lib/udev/rules.d/90-pulseaudio.rules. Here is the rule I added to the file to detect my 1010LT:

    SUBSYSTEMS=="pci", ATTRS{vendor}=="0x1412", ATTRS{device}=="0x1712", ENV{PULSE_PROFILE_SET}="via-ice1712.conf"

    The above rule is generic enough to match any pci card with the ICE1712 chipset. It defines a value for PULSE_PROFILE_SET that contains the name of the static profile definition to use with the card.

  3. Create the static profile definition file /usr/share/pulseaudio/alsa-mixer/profile-sets/via-ice1712.conf.

    # This file is part of PulseAudio.
    #
    # PulseAudio is free software; you can redistribute it and/or modify
    # it under the terms of the GNU Lesser General Public License as
    # published by the Free Software Foundation; either version 2.1 of the
    # License, or (at your option) any later version.
    #
    # PulseAudio is distributed in the hope that it will be useful, but
    # WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    # General Public License for more details.
    #
    # You should have received a copy of the GNU Lesser General Public License
    # along with PulseAudio; if not, write to the Free Software Foundation,
    # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
    
    ; Via ICE1712 multi-channel audio chipset
    ;
    ; This chipset has up to four stereo pairs of input and four stereo pairs of
    ; output, named channels 1 to 8. Also available are separate S/PDIF stereo
    ; channels (input and output), and a separate "system-out" stereo jack that
    ; supports 6-channel hardware mixing.
    ;
    ; The S/PDIF stereo channels can be controlled via the mixer for hw:0, and
    ; additionally, the 8 main outputs can be loop-routed to a separate stereo
    ; input pair, available as channels 11 and 12.
    ;
    ; Many cards available from vendors do not expose all channels from this chip
    ; to an external port, which effectively reduces the number of channels that
    ; are useful to the user. However, the ALSA driver still exposes all channels
    ; even if they are not connected.
    ;
    ; We knowingly only define a subset of the theoretically possible
    ; mapping combinations as profiles here.
    ;
    ; See default.conf for an explanation on the directives used here.
    
    [General]
    auto-profiles = no
    
    [Mapping analog-mch-in]
    description = Analog Multi-Channel Main Input
    device-strings = hw:%f,0
    #channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right,aux0,aux1,aux2,aux3
    channel-map = aux0,aux1,front-left,front-right,aux2,aux3,aux4,aux5,aux6,aux7,aux8,aux9
    direction = input
    
    [Mapping analog-mch-out]
    description = Analog Multi-Channel Main Output
    device-strings = hw:%f,0
    #channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe,side-left,side-right,aux0,aux1
    channel-map = front-left,front-right,aux0,aux1,aux2,aux3,aux4,aux5,aux6,aux7
    direction = output
    
    [Mapping digital-stereo]
    description = Digital Stereo Input/Output
    #device-strings = hw:%f,1
    device-strings = iec958:%f
    channel-map = left,right
    direction = any
    
    [Mapping analog-system-out]
    description = Analog Stereo System-Out
    device-strings = hw:%f,2
    channel-map = left,right
    direction = output
    
    [Profile output:mch]
    description = Multi-Channel Output Active (Digital Disabled)
    output-mappings = analog-mch-out analog-system-out
    input-mappings =
    priority = 90
    skip-probe = yes
    
    [Profile output:mch+input:mch]
    description = Multi-Channel Input/Output (Digital Disabled)
    output-mappings = analog-mch-out analog-system-out
    input-mappings = analog-mch-in
    priority = 100
    skip-probe = yes
    
    [Profile output:spdif]
    description = Digital Output (Multi-Channel Disabled)
    output-mappings = digital-stereo analog-system-out
    input-mappings =
    priority = 80
    skip-probe = yes
    
    [Profile output:spdif+input:spdif]
    description = Digital Input/Output (Multi-Channel Disabled)
    output-mappings = digital-stereo analog-system-out
    input-mappings = digital-stereo
    priority = 90
    skip-probe = yes
    
    [Profile output:system]
    description = System Output Only
    output-mappings = analog-system-out
    input-mappings =
    priority = 60
    skip-probe = yes

and then a restart…

Running Windows 7 on VM ESXi 3.5

Since VM ESXi 3.5 is officially not capable of hosting virtual Windows 7 machines, its not surprising that there are some problems if you try it anyway.

We found a way – thanks to several posts of the VMware Community – which we want to preserve here:

  1. Set up a new virtual machine using the Windows Vista (32 or 64 bit) template (some believe only the XP template works).
  2. After complete installation, Windows 7 hangs up while booting
  3. Power down the VM and turn off the network adapter
  4. Boot again and do an advanced install of the VMware Tools excluding SVGA drivers as well as drivers for performance measurement.
  5. Turn off the VM.
  6. Change network adapter option in the .VMX file from ‘ethernet0.virtualDev = “e1000”’ to ‘ethernet0.virtualDev = “vmxnet”’.
  7. Enable the network adapter at ‘power on’.
  8. Now it should boot without problems!

Additional Remarks

  • Migrating an existing or even fresh VM with Windows 7 onto a VM ESXi 3.5 did not work at all. VM ESXi tags the machine as ‘invalid’.
  • Detailed Information about VM network adapters can be found in the references.
  • We have not tested it for the 64bit version, though, the problem should be the same.
  • Another solution, of course, is upgrading your VM ESX to ESXi 5.
References

xbindkeys

Introduction

Shortcuts do not only reduce real-life ways but also our digital ones. Ubuntu features a Keyboard Shortcut Manager, which offers basic support for a given number of tasks. In contrast, a fundamental empowerment for your fingers is xbindkeys – a small program allowing to run commands independently from the Linux window manager. Sounds nice, in practice it is even nicer.

Installation

Easier than eating spaghetti:

sudo apt-get install xbindkeys

Configuration

The configuration file is located in your Home directory named .xbindkeysrc. If the file is not existing just create it. The entries are made with your favorite text editor in the form of:

# this is a comment explaining the keybinding
"the command"
   control+f #the key or combination of keys

Mind to put the code inside ””! For example, if we want to start gedit with Ctrl+Alt+f it would look like this:

#start gedit
"gedit"
   ctrl+alt+f

The easiest way of finding the code for your keypresses is to use xbindkeys options -k (for single keycodes) or rather -mk (for combination of keys). Open a terminal and run

  • xbindkeys -mk
  • press the desired combination, for example: Windows key left and q
  • it shows the output:
Press combination of keys or/and click under the window.
You can use one of the two lines after "NoCommand"
in $HOME/.xbindkeysrc to bind a key.

--- Press "q" to stop. ---
"NoCommand"
    m:0x50 + c:24
    Mod2+Mod4 + q

The line Mod2+Mod4 + q is your key combination, which should be copied to your .xbindkeysrc file.

You can even use your mouse keys for creating keyboard shortcuts. The codes are:

  • b:1 – left mouse key
  • b:2 – middle mouse key
  • b:3 – right mouse key

Each modification of the configuration file has to be followed by a restart of xbindkeys. Since version 1.8.3 this shouldn’t be necessary (haven’t confirmed this myself). Anyway, the restart is done by:

  •  pkill xbindkeys
  • followed by

     xbindkeys

Autostart

In order to start xbindkeys automatically during startup:

  • System > Preferences > Startup Applications
  • click on Add
  • give it a name: Xbindkeys would be a nice idea
  • for the command type: xbindkeys

MPD

Xbindkeys is a convenient way to communicate with your music player daemon using the mpc package which passes ordinary commands to the MPD. The shortcuts are global, which means while surfing the web or writing a document your keyboard shortcuts work without bringing the corresponding application to the front. Using mpd no window needs to be open in the background. The daemon can be controlled solely using shortkeys. First, install the mpc package and then select from the commands listed in the manual of mpc (command: man mpc) or here. I personally use the Windows sign with the arrow keys for play, pause, stop and seek. Have a look!

# For the benefit of emacs users: -*- shell-script -*-
###########################
# xbindkeys configuration #
###########################
#
# Version: 1.7.1
#
# If you edit this file, do not forget to uncomment any lines
# that you change.
# The pound(#) symbol may be used anywhere for comments.
#
# To specify a key, you can use 'xbindkeys --key' or
# 'xbindkeys --multikey' and put one of the two lines in this file.
#
# The format of a command line is:
#    "command to start"
#       associated key
#
#
# A list of keys is in /usr/include/X11/keysym.h and in
# /usr/include/X11/keysymdef.h
# The XK_ is not needed.
#
# List of modifier:
#   Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock),
#   Mod3 (CapsLock), Mod4, Mod5 (Scroll).
#

# The release modifier is not a standard X modifier, but you can
# use it if you want to catch release events instead of press events

# By defaults, xbindkeys does not pay attention with the modifiers
# NumLock, CapsLock and ScrollLock.
# Uncomment the lines above if you want to pay attention to them.

#keystate_numlock = enable
#keystate_capslock = enable
#keystate_scrolllock= enable

# Examples of commands:

#"xbindkeys_show" 
#  control+shift + q

# set directly keycode (here control + f with my keyboard)
#"xterm"
#  c:41 + m:0x4

# specify a mouse button
#"xterm"
#  control + b:2

#"xterm -geom 50x20+20+20"
#   Shift+Mod2+alt + s
#
## set directly keycode (here control+alt+mod2 + f with my keyboard)
#"xterm"
#  alt + c:0x29 + m:4 + mod2
#
## Control+Shift+a  release event starts rxvt
#"rxvt"
#  release+control+shift + a
#
## Control + mouse button 2 release event starts rxvt
#"rxvt"
#  Control + b:2 + Release

# mpd start
#"gnome-terminal --window-with-profile=mpd -e ncmpc"
#    c:237

# mpd start
"gnome-terminal --window-with-profile=mpd -e ncmpc"
    Mod2+Mod4 + y

# gnome terminal
"gnome-terminal"
    Mod2+Mod4 + t

#firefox
"firefox"
   Mod2+Mod4 + i

#mpd-----------------------------------

#play/pause
"mpc toggle"
    Mod2+Mod4 + Up

#stop
"mpc stop"
    Mod2+Mod4 + Down

#next
"mpc next"
    Mod2+Mod4 + Right

#previous
"mpc prev"
    Mod2+Mod4 + Left

#next
"mpc seek +5"
    Control+Mod2+Mod4 + Right

#previous
"mpc seek -5"
    Control+Mod2+Mod4 + Left

#archiv----------------

#state01 mit analog
#"alsactl -f /etc/asound01.state restore"
#    Control+Mod2 + KP_Add

#state02 ohne analog
#"alsactl -f /etc/asound02.state restore"
#    Control+Mod2 + KP_Subtract

#tvtime
#"/home/stefan/Documents/linux-scripts/tvtime+alsactl.sh"
#   Mod2+Mod4 + f

# mpd start mit tastatur und analog aus
#"gnome-terminal --window-with-profile=mpd -e ncmpc" ohne analog aus
#"/home/stefan/Documents/linux-scripts/mpd+alsactl.sh"
#    Mod2+Mod4 + s

##################################
# End of xbindkeys configuration #
##################################

References

http://www.nongnu.org/xbindkeys/ – project’s homepage http://wiki.ubuntuusers.de/xbindkeys – ubuntuusers article wiki