This blog has been running on Caddy for the last couple of months. Caddy is a http server with support for reverse proxies and automatic https. The automatic https feature takes care of requesting, installing and updating SSL certificates which means that you need much less configuration settings or maintenance compared with e.g. lighttpd or Nginx. The underlying certmagicACME client is responsible for requesting these certificates.
Before, it was using lighttpd but the during the last decade the development of lighttpd has stalled. lighttpd version 2 has been in development for 7 years and the bump from 1.4 to 1.5 has been taking even longer. lighttpd started showing its age with limited or no support for modern features like websockets, http/3 and finicky configuration for e.g. https with virtual domains.
Caddy with Ruby on Rails
I really like Caddy’s sensible defaults and the limited lines of configuration needed to get things working. Below you can find e.g. a reusable https enabled configuration for a Ruby on Rails application. This configuration does file caching, compression, http to https redirection and load balancing for two local application servers. It also serves static files directly and only passes non-file requests to the application servers.
If you are self-hosting I think Caddy is a great match in all but the most exotic or demanding setups. I definitely am kicking myself for not checking out caddy sooner: it could have saved me countless hours installing and maintaining https certs or configuring lighttpd in general.
Fig: stable diffusion imagining a networked music performance
This post describes how to send audio over a network using the ffmpeg suite. Ffmpeg is the Swiss army knife for working with audio and video formats. It is a command line tool that supports almost all audio formats known to man and woman. ffmpeg also supports streaming media over networks.
Here, we want to send audio recorded by a microphone, over a network to a single receiver on the other end. We are not aiming for low latency. Also the audio is going only in a single direction. This can be of interest for, for example, a networked music performance. Note that ffmpeg needs to be installed on your system.
The receiver – Alice
For the receiver we use ffplay, which is part of the ffmpeg tools. The command instructs the receiver to listen to TCP connections on a randomly chosen port 12345. The \?listen is important since this keeps the program waiting for new connections. For streaming media over a network the stateless UDP protocol is often used. When UDP packets go missing they are simply dropped. If only a few packets are dropped this does not cause much harm for the audio quality. For TCP missing packets are resent which can cause delays and stuttering of audio. However, TCP is much more easy to tunnel and the stuttering can be compensated with a buffer. Using TCP it is also immediately clear if a connection can be made. With UDP packets are happily sent straight to the void and you need to resort to wiresniffing to know whether packets actually arrive.
In this example we use MPEGTS over a plain TCP socket connection. Alteratively RTMP could be used (which also works over TCP). RTP , however is usually delivered over UDP.
The shorthand address 0.0.0.0 is used to bind the port to all available interfaces. Make sure that you are listening to the correct interface if you change the IP address.
The sender – Björn
Björn, aka Bob, sends the audio. First we need to know from which microphone to use. To that end there is a way to list audio devices. In this example the macOS avfoundation system is used. For other operating systems there are similar provisions.
ffmpeg -f avfoundation -list_devices true -i ""
Once the index of the device is determined the command below sends incoming audio to the receiver (which should already be listening on the other end). The audio format used here is MP3 which can be safely encapsulated into mpegts.
Note that the IP address 192.168.x.x needs to be changed to the address of the receiver. Now if both devices are on the same network the incoming audio from Bob should arrive at the side of Alice.
The tunnel
If sender and receiver are not on the same network it might be needed to do Network Addres Translation (NAT) and port forwarding. Alternatively an ssh tunnel can be used to forward local tcp connections to a remote location. So on the sender the following command would send the incoming audio to a local port:
The connection to the receiver can be made using a local port forwarding tunnel. With ssh the TCP traffic on port 12345 is forwarded to the remote receiver via an intermediary (remote) host using the following command:
On Saturday the eight of April I gave a workshop on the ESP 32 micro controller at Newline, the yearly hackerspace conference of Hackerspace Ghent. The aim was to provide a hands-on introduction. The participants had to program to make the ESP execute the following:
Blink
Connecting to wifi
Sending data from the ESP32
Sending data using TCP
Broadcast data over UDP
Broadcast data using OSC over UDP
Broadcasting sensor data over UDP and OSC
Mesh Networking
At the start of the workshop I gave a presention as an introduction.
TarsosLSH is a Java library implementing Locality-sensitive Hashing (LSH), a practical nearest neighbor search algorithm for high dimensional vectors that operates in sublinear time. The open source software package is authored by me and is available on GitHub: TarsosLSH on GitHub.
With TarsosLSH, Joseph Hwang and Nicholas Kwon from Rice University created an Image Mosaic web application. The application chops an uploaded photo into small blocks. For each block, a color histogram is created and compared with an index of color histograms of reference images. Subsequently each block is replaced with one of the top three nearest neighbors, creating a mosaic. Since high dimensional nearest neighbor search is needed, this is an ideal application for TarsosLSH. The application somewhat proves that TarsosLSH can be used in practical applications, which is comforting.
The Starry Night, by Van Ghogh in Mosaic as created by the mosaic webapplication.
This post documents how to implement a simple music quiz with the meta data provided by Spotify and a big red button.
During my last birthday party, organized at Hackerspace Ghent ,there was an ongoing Spotify music quiz. The concept was rather simple: If music that was playing was created in the same year as I was born, the guests could press a big red button and win a price! If they guessed incorrectly, they were publicly shamed with a sad trombone. Only one guess for each
song was allowed.
Below you can find a small videograph which shows the whole thing in action. The music quiz is simple: press the button if the song is created in 1984. In the video, at first a wrong answer is given, then a couple of invalid answers follow. Finally a good answer is given, the song “The Killing Moon by Echo & the Bunnymen” is from 1984! Woohoo!
Allright, what did I use to to implement the spotify music quiz:
A big red Arduino button, attatched by USB to a laptop.
A system with Spotify.
A way to access the meta data of the currently playing song in Spotify.
A Ruby script to connect al the parts and checks answers.
The Red Button
A nice big red button, which main features are that it is red and big, serves as the main input device for the quiz. To be able to connect the salvaged safety button to a computer via USB, an Arduino Nano is used. The Arduino is loaded with the code from the debounce tutorial, basically unchanged. Unfortunately, I could not fit the the FTDI-chip, which provides the USB connection, in the original enclosure. An additional enclosure, the white one seen in the pictures below, was added.
When pressed, the button sends a signal over the serial line. See below how the Ruby Quiz script waits for, and handles such event.
Get Meta Data from the Currently Playing Song in Spotify
Another requirement for the quiz to work is the ability to get information about the song currently playing in Spotify. On Linux this can be done with the dbus interface for Spotify. The script included below returns information about the artist, album and title of the song. It also detects if Spotify is running or not. Find it, fork it, use it, on github
#!/usr/bin/python## now_playing.py# # Python script to fetch the meta data of the currently playing# track in Spotify. This is tested on Ubuntu.
import dbus
bus = dbus.SessionBus()
try:
spotify = bus.get_object('com.spotify.qt', '/')
iface = dbus.Interface(spotify, 'org.freedesktop.MediaPlayer2')
meta_data = iface.GetMetadata()
artistname = ",".join(meta_data['xesam:artist'])
trackname = meta_data['xesam:title']
albumname = meta_data['xesam:album']
#Other fields are:# 'xesam:trackNumber', 'xesam:discNumber','mpris:trackid',# 'mpris:length','mpris:artUrl','xesam:autoRating','xesam:contentCreated','xesam:url'
print str(trackname + " | " + artistname + " | " + albumname + " | Unknown")
except dbus.exceptions.DBusException:
print "Spotify is not running."
The Quiz Ruby Script
With the individual part in order, we now need Ruby glue to paste it all together. The complete music quiz script can be found on github. The main loop, below, waits for a button press. If it is pressed the sad trombone, invalid answer or winner sound is played. The sounds are attached to this post.
whiletruedo# Wait for a button press
data = sp.readline
# Fetch meta data about the currently# playing song
result = `#{now_playing_command}`# Parse the meta data
title,artist,album = parse_result(result)
#Title is hash key, should be unique within playlist
key = title
if responded_to.has_key? key
puts "Already answered: you cheater"
play cheater
elsif correct_answers.has_key? key
puts "Correct answers: woohoo"
responded_to[key]=true
play winner
else
puts "Incorrect answer: sad trombone"
responded_to[key]=true
play sad_trombone
endend
The Amsterdam Music Hack Day is a full weekend of hacking in which participants will conceptualize, create and present their projects. Music + software + mobile + hardware + art + the web. Anything goes as long as it’s music related
The hackathon was organized at the NiMK(Nederlands instituut voor Media Kunst) the 25th and 24th of May. My hack tries to let a phone start a conversation on its own. It does this by speaking a text and listening to the spoken text with speech recognition. The speech recognition introduces all kinds of interesting permutations of the original text. The recognized text is spoken again and so a dreamlike, unique nonsensical discussion starts. It lets you hear what goes on in the mind of the phone.
The idea is based on Alvin Lucier’s I am Sitting in a Room form 1969 which is embedded below. He used analogue tapes to generate a similar recursive loop. It is a better implementation of something I did a couple of years ago.
The implementation is done with Android and its API’s. Both speech recognition and text to speech are available on android. Those API’s are used and a user interface shows the recognized text. An example of a session can be found below:
To install the application you can download Tryalogue.apk of use the QR-code below. You need Android 2.3 with Voice Recognition and TTS installed. Also needed is an internet connection. The source is also up for grabs.
I have upgraded the operating system on my LG GT540 Optimus from the stock Android 1.6 to Android Gingerbread 2.3.4. I followed this updgrade procedure.
It is well worth it to spend some time upgrading the phone, especially from 1.6. Everything feels a lot faster and the upgraded applications, e.g. Gallery, are nicely improved.
The main reason I upgraded my phone is to get the open source accessory development kit (ADK) for Android working. I got the DemoKit application working after some time but need to do some more experiments to see if the hardware actually works: I am waiting for a USB Host Shield for Arduino. To be continued…
Vorige zaterdag werd Apps For Ghent georganiseerd: een activiteit om het belang van open data te onderstrepen in navolging van onder meer Apps For Amsterdam en New York City Big App. Tijdens de voormiddag kwamen er verschillende organisaties hun open gestelde data voorstellen de namiddag werd gereserveerd voor een wedstrijd. Het doel van de wedstrijd was om in enkele uren een concept uit te werken en meteen voor te stellen. Het uitgewerkte prototype moest gedeeltelijk functioneren en gebruik maken van (Gentse) open data.
Luk Verhelst en ikzelf hebben er TwinSeats voorgesteld.
TwinSeats is een website / online initiatief om nieuwe mensen te leren kennen. Met hen deel je dezelfde culturele interesse en ga je vervolgens samen naar deze of gene voorstelling. Door events centraal te stellen kan TwinSeats uitzonderlijke cultuurburen zoeken. Leden vinden die cultuurburen dankzij een gezamenlijke voorliefde voor een artiest of attractie of eender welke bezigheid in de vrijetijdssfeer.
Het prototype is ondertussen terug te vinden op TwinSeats.be. Let wel dit is in enkele uren in elkaar geflanst en is verre van ‘af’, het achterliggende concept is belangrijker.
With this post I would like to draw attention to the fact that remote port forwarding with OpenSSH 4.7 on Ubuntu 8.04.1 does not work as expected.
If you follow the instructions of a SSH remote port forwarding tutorial everything goes well until you want to allow everyone to access the forwarded port (not just localhost). The problem arises when binding the forwarded port to an interface. Even with GatewayPorts yes present in /etc/ssh/sshd_config the following command shows that it went wrong:
It listens only via IPv6 and only on localhost an not on every interface (as per request by defining GatewayPorts yes). The netstat command should yield this output:
in /etc/ssh/sshd_config remote port forwarding works fine but you lose IPv6 connectivity (this due to the AddressFamily setting). Another solution is to use more up to date software: the bug is not present in Ubuntu 10.04 with OpenSSH 5.3 (I don’t know if it is an Ubuntu or OpenSSH bug, or even a configuration issue.
I have been struggling with this issue for a couple of hours and, with this blog post, I hope I can prevent someone else from doing the same.
ssh-copy-id is a practical bash script, installed by default on Ubuntu. The script is used to distribute public keys. The following oneliner makes it available on Mac OS X:
It copies ssh-copy-id from this website to /bin/ssh-copy-id.
It makes sure that ssh-copy-id is executable, using chmod.
There is no three
The install procedure needs superuser rights because it writes in the /bin folder. Executing scripts from untrusted sources with superuser rights is actually really, really, extremely dangerous. But in this case it is rather innocent.
The ssh-copy-id script is the one provided with Ubuntu and Debian, I assume it is GPL’ed. I have not modified it for Mac OS X but it seems to behave as expected. I have only tested the install script and behavior on 10.6.5, YMMV.
This post describes a crucial aspect of how to connect an android phone, the LG GT540 Optimus, to an Ubunu Linux computer. The method is probably similar on different UNIX like platforms with different phones.
To recognize the phone when it is connected via usb you need to create an UDEV rule. Create the file /etc/udev/rules.d/29.lg545.rules with following contents:
On the phone you need to enable debugging using the settings and (this is rather important) make sure that the “mass storage only” setting is disabled.
Rooting the device makes sure you have superuser rights. Installing the android SDK is well documented.
This blog post comments on using the Marvell OpenRD SoC(System on a Chip) as a low power multipurpose home server.
The Hardware
The specifications of the OpenRD SoC are very similar to the better known SheevaPlug devices, so it has 512MB DDR2 RAM, an 1.2GHz ARM processor and 512MB internal flash. To be more precise the OpenRD SoC is essentially a SheevaPlug in a different form factor. The main advantage of this form factor is the number of available connections: 7xUSB, SATA, eSATA, 2xGb Ethernet, VGA, Audio, … which make the device a lot more extendable and practical as a mulitpurpose home server.
The Software
Thanks to the work of Dr. Martin Michlmayr there is a Debian port for the Kirkwood platform readily available. He even wrote a tutorial on how to install Debian on a SheevaPlug. Installing Debian on an OpenRD is exactly the same except for one important detail: the arcNumber variable.
Once Debian is installed you can apt-get or aptitude almost all the software you are used to: webserver, samba, ruby, …
The problem: There is a group of people that want access to Hackerspace Ghent but there is only one remote to open the gate.
The solution: Build a system that reacts to a phone call by opening the gate if the number of the caller is whitelisted.
What you need:
A BeagleBoard or some BeagleBoard alternative with a Linux distribution running on it. Any server running a unix like operating system should be usable.
A Huaweii e220 or an alternative GSM that supports (a subset of) AT commands and has a USB port.
A team of hackers that know how to solder something togeher. E.g. The hardware guys of hackerspace Ghent.
The Hack: First of all try to get caller id working by following the Caller ID with Linux and Huawei e220 tutorial. If this works you can listen to the serial communication using pySerial and react to a call. The following python code shows the wait for call method:
The second thing that is needed is a way to send a signal from the beagle board to the remote. Sending a signal from the beagle board using Linux is really simple. The following bash commands initialize, activate and deactivate a pin.
This is the scenario: you have a Huawei e220, a linux computer and you want to react to a call from a set of predefined numbers. E.g. ordering a pizza when you receive a call from a certain number.
The Huawei e220 supports a subset of the AT commands, which subset is an enterprise secret of te Huawei company. So there is no documentation available for the device I bought, thanks Huawei. Anyhow when you attach the e220 to a Linux machine you should get two serial ports:
To connect to the devices you can use a serial client. GNU Screen can be used as a serial client like this: screen /dev/ttyUSB0 115200. The first device, ttyUSB0 is used to control ttyUSB1, so to enable caller ID on te Huawei e220 you need to send this message to ttyUSB0:
The RING and CLIP messages are the most interesting. The RING signifies an incoming call, the CLIP is the caller ID. The BOOT and RSSI are some kind of ping messages. The following Python script demonstrates a complete session that enables caller ID, waits for a phone call and prints the number of the caller.
To make Tarsos more portable I wrote a pitch tracker in pure JAVA using the YIN algorithm based on the implementation in C of aubio. The implementation also uses some code written by Karl Helgasson and Teun de Lange of the Jazzperiments project.
It can be used to perform real time pitch detection or to analyse files. To use it as a real time pitch detector just start the JAR-file by double clicking. To analyse a file execute one of the following. The first results in a list of annotations (text), the second shows the annotations graphically.
Jobsopschool.be werd door 0110.be ontwikkeld in opdracht van scholengemeenschap Sperregem. Het doel van die webapplicatie is om de administratieve rompslomp bij het zoeken naar en aanwerven van kandidaten voor vervangingen in het onderwijs te vereenvoudigen. Zoek je vacatures in het basisonderwijs? Neem dan zeker een kijkje op Jobopschool.be.
Recently I bought a big shiny red USB-button. It is big, red and shiny. Initially I planned to use it to deploy new versions of websites to a server but I found a much better use: ordering pizza. Graphically the use case translates to something akin to:
If you would like to enhance your life quality leveraging the power of a USB pizza-button: you can! This is what you need:
A PC running Linux. This tutorial is specifically geared towards Debian-based distos. YMMV.
A big, shiny red USB button. Just google “USB panic button” if you want one.
A location where you can order pizzas via a website. I live in Ghent, Belgium and use just-eat.be. Other websites can be supported by modifying a Ruby script.
Technically we need a driver to check when the button was pushed, a way to communicate the fact that the button was pushed and lastly we need to be able to react to the request.
The driver: on the internets I found a driver for the button. Another modification was done to make the driver process a daemon.
The communication: The original Python script executed another script on the local pc. A more flexible approach is possible using sockets. With sockets it is possible to notify any computer on a network.
if PanicButton().pressed():
# create a TCP socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect to server on the port
s.connect((SERVER, SERVER_TCP_PORT))
# send the order (margherita at restaurant mario)
s.send("mario: [margherita_big]\n")
The reaction: a ruby TCP server waits for message from the driver. When it does it automates a HTTP session on a website. It executes a series of HTTP-GET’s and POST’s. It uses the mechanize library.
login_url = "http://www.just-eat.be/pages/member/login.aspx"
a = WWW::Mechanize.new
a.get(login_url) do |login_page|
#post login_form
login_form = login_page.forms.first
login_form.txtUser = "username"
login_form.txtPass = "password"
a.submit(login_form, login_form.buttons[1])
end
Some libraries are needed. For python you need the usb library, the python deamons lib needs to be installed seperatly. Setuptools are needed to install the deamons package.
Ruby needs rubygems to install the needed mechanize and daemons library. Mechanize needs the libxslt-dev package. You also need the build-essential package to build mechanize.
This blog post is about how to use the TouchatagRFID reader hardware on Ubuntu Linux without using the Touchatag web service.
An RFID reader with tags can used to fire events. With a bit of scripting the events can be handled to do practically any task.
Normally a Touchatag reader is used together with the Touchatag web service but for some RFID applications the web service is just not practical. E.g. for embedded Linux devices without an Internet connection. In this tutorial I wil document how I got the Touchatag hardware working under Ubuntu Linux.
To follow this tutorial you will need:
Touchatag hardware: the USB reader and some tags
A Ubuntu Linux computer (I tested 9.10 Karmic Koala and 8.04 )
SVN to download source code from a repository
The touchatag USB reader works at 13.56MHz (High Frequency RFID) and has a readout distance of about 4 cm (1.5 inch) when used with the touchatag RFID tags. Internally it uses an ACS ACR122U reader with a SAM card. A Linux driver is readily available so when you plug it in lsusb you should get something like this:
lsusb recognizes the device incorrectly but that’s not a problem. To read RFID-tags and respond to events additional software is needed: tagEventor is a software library that does just that. It can be downloaded using an svn command:
To compile tagEventor a couple of other software packages or header files should be available on your system. Te tagEventor software dependencies are described on the tagEventor wiki. On Ubuntu (and possibly other Debian based distro’s the installation is simple:
sudo aptitude install build-essential libpcsclite-dev build-essential pcscd libccid
#if you need gnome support#sudo aptitude install libgtk2.0-dev
Now the tricky part. Two header files of the pcsclite package need to be modified (update: this bug is fixed see here). tagEventor builds and can be installed:
cd tageventor
make
...
tagEventor BUILT (./bin/Release/tagEventor)
sudo ./install.sh
...
When tagEventor is correctly installed the only thing left is … to build your application. When an event is fired tagEventor executes the /etc/tageventor/generic script with three parameters (see below). Using some kind of IPC an application can react to events. A simple and flexible way to propagate events (inter-processes, over a network, platform and programming language independent) uses sockets. The code below is the /etc/tageventor/generic script (make sure it is executable), it communicates with the server: the second script. To run the server execute ruby /name/of/server.rb
#!/usr/bin/ruby# $1 = SAM (unique ID of the SAM chip in the smart card reader if exists, "NoSAM" otherwise# $2 = UID (unique ID of the tag, as later we may use wildcard naming)# $3 = Event Type (IN for new tag placed on reader, OUT for tag removed from reader)
require 'socket'
data = ARGV.join('|')
puts data
streamSock = TCPSocket.new( "127.0.0.1", 20000 )
streamSock.send(data, 0)
streamSock.close
The tagEventor software is made by the Autelic Association a Non-Profit association dedicated to making technology easier to use for all. I would like to thank Andrew Mackenzie, the founder and president of the association for creating the software and the support.
Ik heb in opdracht van scholengroep Sperregem een website gemaakt die het vinden van kandidaten voor korte vervangingen vlotter doet verlopen. Mensen met interesse voor vacatures in het onderwijs in West-Vlaanderen kunnen zich er op inschrijven.
De website heeft enkele voordelen voor verschillende scholen in de scholengroep:
Het zoeken van kandidaten is erg eenvoudig: na het invoeren van een vacature komt er een lijst met kandidaten met een geschikt profiel die tijdens de vacature beschikbaar zijn.
Er kunnen e-mail of SMS-berichten verstuurd worden om kandidaten op de hoogte te brengen van een vacature.
Profielen van kandidaten zijn altijd up-to-date: de kandidaten zijn er zelf verantwoordelijk voor en kandidaten lange tijd niets van zich laten horen worden automatisch op non-actief gezet.
De historiek van kandidaten wordt automatisch bijgehouden en kan opgezocht worden.
Ook voor de aspirant onderwijzers is de website handig:
De vacatures zijn publiek zichtbaar, kandidaten kunnen dus actief solliciteren.
Ze kunnen zelf hun profiel beheren en bijvoorbeeld een vernieuwde versie van hun C.V. uploaden.
Voor elke kandidaat is een gepersonaliseerde lijst met vacatures beschikbaar (ook via RSS), afgestemd op hun profiel.
Daarnaast is het ook voor de personeelsdienst een handige tool: die kan nu een beter overzicht bewaren over de vacatures en de invulling ervan in de verschillende scholen.
Vandaag is de vernieuwde vooruitwebsite gelanceerd:
We bieden je nog meer video’s, foto’s, audiotracks en tekstmateriaal en hebben ook jouw persoonlijke voordelen uitgebreid. Wanneer je lid wordt van www.vooruit.be, kan je nog steeds je kalender aanvullen, vrienden maken en reacties posten, maar daarnaast krijg je ook aanbevelingen op maat, kan je voorstellingen tippen en kan je berichten sturen naar vrienden *.
Waarschijnlijk heb je het al gemerkt: deze site gaat nu heel wat sneller. Dit is te danken aan een verhuis. 0110.be wordt nu gehost op een VPS.
De virtuele server heeft Ubuntu 8.04 LTS Server als besturingssysteem en draait op een Xen hypervisor. De fysieke server zelf bevat een achttal Intel® Xeon® E5440 @ 2.83GHz CPU’s.
De server staat in Amsterdam en is rechtstreeks verbonden met het grootste internetknooppunt ter wereld: AMS-IX.
Uit de lijst van postcodes van alle Belgische steden heb ik een SQL-bestand samengesteld. De gegevens bevatten de postcode zelf, de naam van de stad, de naam van de stad in hoofdletters en een veld “structure” waaruit de gemeente-deelgemeente relatie gehaald kan worden als er op gesorteerd wordt. Dit zijn bijvoorbeeld de deelgemeentes van Chimay.
Het sorteren kan in PostgreSQL met deze SQL instructie: order by translate(structure, ' ', 'z'). Het SQL-script zelf is een lijst van INSERT INTOSQL-Statements.
insert into cities(zipcode,name,up,structure) VALUES ('1790','Affligem','AFFLIGEM','1790 AFFLIGEM');
insert into cities(zipcode,name,up,structure) VALUES ('9051','Afsnee','AFSNEE','9051 Afsnee');
insert into cities(zipcode,name,up,structure) VALUES ('5544','Agimont','AGIMONT','5544 Agimont');
...
While working at the Vooruit Arts Centre I got the assignment to create a tool to query an Oracle database with ticketing data. There were a few requirements for the Query Tool, in the current version all of these are met:
First of all it had to be easy to execute complex queries, no knowledge of SQL should be required for the end user.
The results of the queries should be exportable to an easy to analyse format. * Editing queries or adding new ones should be doable, by someone knowledgeable with SQL.
The Query Tool should be easy to configure and database independent.
Should work on Windows, Mac OS X and Linux.
By publishing the Query Tool on my website I hope that the fruits of my labour can be enjoyed by a wider audience. To see it in action you can give it a spin. A recent version, version 6, of the JRE is needed.
How Do I Use The Query Tool?
The program supports two ways to query a database:
A number of predefined queries can be selected and executed. Depending on the selected query, zero or more parameters are required. E.g. the screen shot below depicts a query with one parameter: a product category. When the query is executed all the products in the selected category are fetched.
The tab “SQL” can be used to execute arbitrary SQL-instructions.
The two buttons below are self explanatory. When the button “CVS Export” is hit a CVS file is created in a configured directory.
Depending on the complexity of a query it can take a long time before results are returned. Because the application is multithreaded the user interface remains responsive and the query can be stopped at any time.
The contents of the tab “log” gives you an idea what the application does. When something goes awry while executing a query a message appears in this tab.
The tab “Config” can be used to set configuration parameters. The tab “Help” contains… helpful information.
How Do I Add My Own Queries?
The list of predefined queries is constructed by iterating over SQL-files in a configured directory. Adding additional queries to the program is easy, just add an extra SQL-file to the directory. An SQL-file should have the following format, otherwise it is ignored:
TITEL
----
DESCRIPTION
----
SQL-INSTRUCTION with zero or more !{PARAMETERS}!
In the screen shot above this query is visible:
Select products in category
----
Select all the products in a category.
----
SELECT * FROM
products WHERE categoryid = !{category}!
To make the queries dynamic the Query Tool supports different kinds of parameters. A parameter has this form: !{type name}!, the name is optional. If there is a name specified it is used as a label in the interface, otherwise type is used. There are three types of parameters:
Parameters that define a type. For each type a corresponding user interface is rendered. E.g. for the type string a text field is rendered. The supported types are:
!{string}!
!{boolean}!
!{double}!
!{date}!
!{integer}!
Parameters for raw SQL. A textfield is rendered, the contents is directly injected in the SQL-query. It has this format: !{sql}!
Parameters for lists. In the example above a list parameter is used. These lists are fetched from the database. E.g. a list of categories. The SQL-instruction and name of the list parameters can be configured.
If you want to use your own database you need to configure the database connection string. The program uses JDBC to connect to the database. It uses metadata provided by the JDBC layer. If your database has a JDBC driver with support for metadata the Query Tool will work correctly. The JDBC driver must be included in the classpath.
Na het bekijken van het onderstaande filmpje van een zwerm spreeuwen vroeg ik mij af of die bewegingen zich aan een bepaald algoritme houden en of ik een programma kon schrijven die dit gedrag simuleerde. Na wat onderzoek bleek dat zowat alle dieren die zich in kudde voortbewegen dit doen volgens gelijkaardige, relatief eenvoudige processen.
Er zijn drie basisregels waaraan onder andere scholen vissen, zwermen vogels en kuddes gnoes zich houden:
Voorkom botsingen met de dichtste buren door de andere kant op te gaan.
Beweeg ongeveer in de zelfde richting en even snel als het gemiddelde van de buren.
Beweeg naar het midden van de groep.
De paper Flocks, Herds, and Schools:
A Distributed Behavioral Model – 1987 van Craig W. Reynolds was de eerste die deze regels formeel omschreef. Aan de hand van die documentatie en een praktische omschrijving kon ik aan een implementatie beginnen. De boids implementatie in Python gebruikt pygame om een groep creaturen voor te stellen met een gekleurd vierkantje. De creaturen bewegen zich volgens de drie bovenstaande regels. Daarnaast proberen ze om binnen het zichtbare kader te blijven en begeven ze zich naar het midden van het kader. Om de boel wat interactiever te maken wordt de muisaanwijzer gezien als een gevaarlijk roofdier die niets liever lust dan vierkantjes. De vierkantjes proberen de roof-muis dus te ontlopen. De zesde en laatste regel legt een maximum snelheid op, zodat de bewegingen realistisch blijven.
De huidige implementatie is O(n²), terwijl het O(nk) zou moeten zijn, met k de grootte van de burenlijst. Een vloeiende simulatie van een zwerm van duizenden is dus momenteel niet mogelijk. De berekeningen voor een extra dimensie zijn erg eenvoudig te implementeren, helaas is de visualisatie van de resultaten dat niet. Ik heb geprobeerd om met de OpenGL bindingen voor Python te werken maar veel resultaat heeft dat niet opgeleverd. Dit is de 3D-versie, maar dan met een 2D visualsatie.
Ik heb een B-Tree en een Red-Black tree geschreven in Ruby. Om die datastructuren te testen heb ik een programma geschreven dat alle woorden uit een grote tekst inleest in een b-tree met het woord als sleutel en de frequentie als waarde en daarna een red black tree gebruikt als priority queue met als sleutel de frequentie en als waarde het woord. Op die manier kunnen de meest voorkomende woorden bepaald worden. De broncode is hier neer te laden.
Het programma is een ideale test voor Ruby VM’s: het is redelijk intensief en gevarieerd. IronRuby, JRuby, Ruby 1.8 en Ruby 1.9 werden getest op een Intel Core 2 Duo E6660 en dit zijn de resultaten:
De verschillen zijn dus erg groot. Zowel in geheugengebruik als in duur. Ruby 1.8 is blijkbaar erg traag maar gebruikt relatief weinig geheugen. JRuby is in deze test drie keer sneller maar gebruikt meer geheugen. Ook IronRuby is sneller dan de standaard Ruby VM maar gebruikt net niet het dubbele aan geheugen. Hierbij moet wel verteld worden dat IronRuby een alfa build is, de resultaten kunnen dus nog veel veranderen.
Ruby 1.9 werd later getest op Mac OS X, met dezelfde pc. De nieuwe Ruby lijkt toch enkele beloften in te lossen. Ter vergelijking werd de voor Mac OS X geoptimaliseerde Ruby 1.8 VM die standaard met het besturingssysteem meegeleverd wordt ook nog getest.
I have modified a bash-script to backup PostgreSQL databases, this is the original script. The modified version can be used to backup databases on a remote or local database server. Also this script does not need a trust relationship but uses a login and password. To get started you need to:
Modify the directory and database variables to suit your needs.
Add an entry to crontab to perform the backups nightly or whenever you wish.
Have fun.
The script empties ~/.pgpass and writes login info for the system databases. Then it logs in and fetches an up-to-date list of databases. For every database an entry is made in ~/.pgpass and every database is backed up. The results are logged to $logfile.
Gisteren werd de laatste hand gelegd aan de thesis over collaborative filtering (CF) waar Greet Dolvelde en ikzelf een jaar mee bezig zijn geweest. Als je hier meer over wilt weten dan kan je het werk Collaborative Filtering: Onderzoek & implementatie [pdf] downloaden. De intiemste details van verschillende CF-benaderingen worden er in geuren en kleuren uit de doeken gedaan. Uit de poster zou moeten duidelijk zijn waarover de thesis eigenlijk gaat:
Maandag heb ik een examen over A.I. Dat gaat onder ander over genetische algoritmen. Om dat principe in werking te zien heb ik een eenvoudig programmatje geschreven in Python: er zitten enkele beestjes (vierkantjes) in een omgeving. Als de beestjes opvallen, witte beestjes zie je goed zitten op een zwarte achtergrond, worden ze verslonden. De beestjes die minder opvallen overleven, muteren of planten zich voort. Overlevenden gaan een generatie langer mee. Bij het muteren verandert de huidskleur willekeurig. Bij voortplanten wordt er een kind gemaakt die het gemiddelde van de huidskleuren van zijn ouders als kleur heeft. Als het meerendeel van de beestjes uiteindelijk een goeie schutkleur aangenomen hebben kan de achtergrond veranderd worden en begint alles van voor af aan.
Om Python wat te leren kennen heb ik een “Text To Speech Recognition” programma geschreven. Het roept SAPI 5.1 aan om een tekst voor te laten lezen door Microsoft Sam. Het voorgelezen stuk tekst wordt daarna meteen via microfoon opgenomen en Sam probeert het zelf, via Speech Recognition, te verstaan. Het resultaat van de speech recognition wordt dan gelezen door Sam enzovoort… Dit is een voorbeeld van Sam in dialoog met zichzelf:
I am sitting in a room different from the one you are in now. I am recording the sound of my speaking voice and I am going to play it back into the room again.
I’m sitting in a room different from the one U.N. NA I’m recording the sound of my speak English and I’m going to play it back into the room against
I’m sitting in a room different from the one you could in a LAN recording the sound of my speak English and I’m going to clamp back into the room against
I’m sitting in a room different from the one you put in a LAN recording the sound and I speak English and I’m going to clamp back into the room against
I’m sitting in a room different from the one you put in a LAN recording the sound and I speak a Mac into ghent
I’m sitting in a room different from the one you put in a LAN recording the sound and I speak a match into ghent
Ik heb voor het vak Studium Generale een paper geschreven. De paper moet een kritische verwerking zijn van vijf bijgewoonde lezingen. Dit jaar was het thema
Het studium generale van de Hogeschool Gent zal zich dit academiejaar
buigen over de paradoxale werking van geheugen en vergeten voor de huidige
wereld. Ook blijkt het massale opslaan en toegankelijk maken van het collectieve
geheugen slechts voor een minderheid kritische meerwaarde te bezitten; het
toenemen van historisch besef en kritische inventarisatie gaat niet hand in hand
met de toename aan inzicht.
In deze paper wordt de aandacht gevestigd op één aspect van de brede waaier aan
mogelijke onderwerpen: De invloed van retorische technieken en de filosofie van
het dramatisme op de vorming van het collectieve geheugen. Aan dat centrale
thema worden de verschillende lezingen verbonden. De paper is te downloaden als pdf en ook de latex bron bestanden zijn beschikbaar:
Kunstencentrum Vooruit heeft sinds kort een nieuwe site opgericht. Aan de site is een community luik gekoppeld waarop gebruikers een profiel kunnen aanmaken en evenementen op een persoonlijke wishlist kunnen plaatsen. Daarnaast kunnen ze er ook tickets voor voorstellingen kopen. Ook kunnen de gebruikers relaties tussen zichzelf en vrienden leggen.
Aan de hand van die gegevens en de gegevens van in het back-office systeem zou het mogelijk moeten zijn om een cultureel profiel op te stellen van de gebruikers en ze gepersonaliseerde, relevante tips geven. De voordelen van zo’n Customer Intelligence systeem zijn legio:
Kunstencentrum Vooruit leert zijn klanten beter kennen
De klanten krijgen gepersonaliseerde tips en hierdoor wordt hun culturele interesse geprikkeld
Trends kunnen makkelijker ontdekt worden
Er kan gerichter reclame gevoerd worden
…
En dat C.I. systeem gaan wij volgend jaar ontwikkelen. Er zal een uitgebreid onderzoek gebeuren naar de manier waarop en daarna wordt een implementatie gekoppeld met de in Ruby on Rails ontwikkelde website.
Dit is een grafiekje waarop je de evolutie van mijn muziekale smaak kan zien tijdens de voorbije twee jaar. De dikte van de stroom toont de populariteit tijdens die periode aan. Onderaan staat er in het klein een tijdslijn. Klik voor de (erg) grote versie.
Voor het vak algoritmen hebben we enkele sorteeralgoritmes besproken en in c++ geïmplementeerd. Dit is mijn versie van de algoritmes het gebruikt een interface SortAlgorithm en het Strategy design pattern om zijn werk te doen.
In principe kan om het even wat gesorteerd worden maar sommige sorteeralgoritmes (Counting Sort) werken enkel met int’s. Om strings te sorteren kan gebruik gemaakt worden van de Nstring klasse.
Elk sorteeralgoritme kan getest en gemeten worden, dit is de uitvoor voor het shell sort algoritme met de Sedgewick incrementen:
Ik werk momenteel bij Encima. Encima maakt websites en andere toepassingen in Java. Mijn eerste week zit er al op en ik heb me bezig gehouden met een module voor www.weekendesk.com. Maandag wordt de module, samen met de nieuwe versie van de site, in gebruik genomen. Weekenddesk doet het volgende:
Weekendesk.com is een B2C e-commerce site die weekend- en dagtrips on line verkoopt en zich hierbij in eerste instantie op de Belgische en Nederlandse markt richt.
Weekendesk fungeert hierbij als tussenpersoon tussen de consument en de organisator van de vrijetijdsactiviteit.
De website biedt de klant op een frisse en overzichtelijke manier alle nodige informatie over de vrijetijdsactiviteiten.
De activiteiten zijn onderverdeeld in twee types: cadeaubonnen en weekendideeën. De prijs en beschikbaarheid van elke activiteit is steeds up-to-date. On line boeken is snel, eenvoudig en veilig. Betalen kan via creditcard of per overschrijving.
Via een on line content management module kan Weekendesk alle activiteiten en de gerelateerde informatie (beschrijving, fotoboek, prijzen, beschikbaarheid, promotie, ...) beheren. Een order management module laat hen toe de bestellingen on line op te volgen.
Ook de leveranciers (organisatoren) van de activiteiten kunnen via een private on line module de beschikbaarheid, prijzen en promoties inbrengen.
En net die module voor de leveranciers, organisatoren (meestal hotels) heb ik in elkaar gestoken.
Code and 0110.be
» By Joren on Saturday 08 July 2006
Hieronder staat een lijst van 0110 logo's in verschillende formaten die gebruikt kunnen worden voor verschillende doeleinden.
Web:
Hieronder staat een lijst met voorgebakken logo's voor op het web. Voor andere groottes, achtergronden (transparant), kleuren, formaten kun je je behelpen met het 0110-logo in photoshop formaat.
Ik heb voor BIT4, een cursus die ik hier volg een paper geschreven over onwaarneembare edutainment en wiskunde. De bedoeling ervan is aan te tonen dat edutainment meer is dan schooltelevisie of iets als een flash game over de Afrikaanse zwaluw. Ik probeer te bewijzen dat drie verschillende spellen spelenderwijs wiskunde aanleren en dus edutaining zijn. Right...:
Ik heb voor het vak Studium Generale een paper geschreven. De paper moet een kritische verwerking zijn van vijf bijgewoonde lezingen of een eigen verhaal rond het centrale thema. Ik heb voor het tweede gekozen en omdat het algemene thema nogal breed is:
Tijdens de volgende jaargang willen we nadenken over de vraag, hoe het gesteld is met onze zo geroemde individuele vrijheid in het licht van de globale netwerken die deze vrijheden zeggen te leveren.
Dacht ik van het aangename aan het nuttige te koppelen en over iets te schrijven wat me zelf interesseert en waar ik vaag iets over weet. Muziek en het internet en hoe smaak beïnvloed wordt door het internet. Mijn paper is dan ook getiteld Smaakmakers. De paper moet pas ingediend worden de 2e mei dus ik zou het appreciëren mocht er iemand feedback op geven. Hieronder staan links naar het document in verschillende formaten:
Mel en ik zijn bezig aan een systeem om war games te ondersteunen. War games zijn
grootschalige ramp-oefeningen.
Bijvoorbeeld een aanval van terroristen op een kerncentrale. Er wordt een bepaald scenario opgesteld: terroristen
gijzelen werknemers en dreigen de boel op te blazen. Er wordt op deze situatie gereageerd door iedereen die daar
in het echt ook mee zou te maken hebben: politie, swat teams, er worden fake nieuwsberichten gemaakt door de media,
de werknemers van de centrale zelf,....
Tijdens die simulatie wordt adhv vragenlijsten gepolst hoe goed (of slecht)
alles verloopt. Die vragenlijsten komen op een beveiligde website die wij aan het programmeren zijn.
Die data is dan de basis voor een rapport met de bevindingen: wat verliep er goed en wat kan beter.
We gebruiken het ASP.NET 2.0 platform in samenwerking met een sql express 2005 database én een object database: db4o. Daarmee zijn we aan het experimenteren. Daarbij horen unit tests en load tests. Daaruit blijkt dat Db4o zijn beloftes waar maakt:
Embed db4o's native Java and .NET open source object database engine into your product and store even the most complex object structures with only one line of code.
db4o slashes development cost and time, provides superior performance, and requires no DBA.
blijkbaar zijn we verplicht een access database te gebruiken, hoe 1994, zucht.
We zijn hier eergisteren (maandag) aangekomen. We namen het vliegtuig van Brussel naar Kopenhagen en dan de trein naar Halmstad. De reis is volledig volgens plan verlopen, we kwamen zoals gepland om 16.54 toe. Dus daar valt niet veel spannends over te melden. Bij deze: niets spannends .
Sinds kort, drie minuuten dus, heb ik draadloos internet op mijn kamer. Dat is praktisch omdat een groot deel van onze opdracht "maak een website" is. Aan die opdracht kunnen we ten vroegste vrijdag beginnen: vrijdag krijgen we een uitgebreidere briefing over wat we moeten doen. Gisteren kregen we al een oppervlakkige uitleg tijdens een lunch met onze mentor.
» By Joren on Tuesday 15 November 2005
Ik heb me, vorig jaar al, kandidaat gesteld om aan een Erasmus/Socrates uitwisselingsprogramma mee te doen. Ik had meteen interesse om naar Zweden te vertrekken. Ik ga dus waarschijnlijk vanaf begin maart in Zweden, meer bepaald Halmstad, te vinden zijn. Aan de "Högskolan Halmstad" zou ik dan een opdracht krijgen die vergelijkbaar is met een stage in een bedrijf.
Samen met Kris Welvaert en Dries Boone heb ik een eindwerk gemaakt over verschillende beeldschermtechnologieën. Dit is een pdf van het eindwerk over LCD, PDP & CRT. De inleiding maakt duidelijk over wat het precies allemaal gaat:
De televisie en de computer hebben in de 2 de helft van de twintigste eeuw de wereld totaal veroverd en op vele gebieden sterk veranderd. Dag na dag en in alle delen van
de wereld kijken mensen naar televisie; en dag na dag zijn miljoenen computermonitoren in bedrijf over een immens gebied in sterk verschillende toepassingen.
Schermen zijn een niet te verslaan medium geworden om elektronische informatie
(tekst of grafieken), stilstaande of bewegende beelden weer te geven. Geen enkel
ander medium heeft de veelzijdigheid, de snelheid en de interactie als die van een
scherm. Belangrijkste kenmerken van een scherm zijn de weergavekwaliteit en de
reactietijd. Ze bestaan in alle soorten, maten en gewichten. Afhankelijk van de
doelgroep ziet men dat er zich bepaalde weergavetechnieken profileren, zoals
bijvoorbeeld, voor grote groepen, zal er meer gebruik gemaakt worden van projectoren
dan van enig andere techniek. Net zoals met verplaatsbare schermen, hier ziet men
hoofdzakelijk maar flat panel displays (FPD). Deze kunnen nog wel onderverdeeld
worden in bepaalde technieken maar steeds zullen dit FPD’s zijn. Bij schermen voor
persoonlijk gebruik die stabiel moeten zijn is wel een grote verscheidenheid aan
weergaventypes. Men zal deze daarom nog onderverdelen in bepaalde
toepassingsgebieden zoals op het hoofd gemonteerde schermen, muurgemonteerde
schermen, bureauschermen…
Het zou onmogelijk zijn om alle beeldvormingprincipes voldoende te kunnen belichten,
daarom hebben wij ons beperkt tot het bespreken van drie beeldvormingprincipes,
namelijk CRT (Cathode Ray Tube), PDP (Plasma Display Panel) en LCD (Liquid Chrystal
Display) omdat dit tot op heden de meest courante beeldschermen zijn. Voorafgaand
aan deze hoofdstukken hebben wij de eigenschappen van licht en kleur en de werking
van het oog uitgelegd, dit om de werking van de verschillende technieken te kunnen
begrijpen. Vervolgens is er ook een hoofdstuk over modulatie in ons eindwerk
opgenomen, om de zendermodulatie van televisie te kunnen begrijpen en tot slot
hebben wij nog een hoofdstukje over teletekst.