Amarok: Recently added ablums

You probably noticed the "Recently added Albums" in the album-applet (to be more specific: the current-view) of the context view while Amarok stops playing. I always thought that this is the only way to track down which albums were recently added to the collection. The problem is, that this applet only shows the last 5 added albums. So I always wait a couple of minutes/seconds and copy the next five albums to the collection-folder, to add these to my daily playlist.

Today I was really upset of this behavior and decided to write my own amarok-script for this purpose. So I cloned the amarok trunk and took a look in the amarok scripting engine. After querying the lastest albums with the Amarok script console (see code-snippet), I asked on #amarok for some information about interacting with the context-view. I also find a wishlist entry on bug.kde.org concerning this topic: https://bugs.kde.org/show_bug.cgi?id=181660.

Amarok.Collection.query("SELECT artist.name, album.name FROM tracks AS track LEFT JOIN artists AS artist ON track.artist=artist.id LEFT JOIN albums AS album ON track.album=album.id GROUP BY album.id ORDER BY track.createdate DESC LIMIT 10")

The solution was easy ... this feature already exists: just use the collection filtering:

  • "added:today" show the tracks/albums added today
  • "added:<2w" in the last 2 weeks
  • "added:<1m" in the last month
  • "added:<2m2w" in the last 2 month and 2 weeks

amarok_filtering

Afterwards I found out that the feature was released in Amarok 2.1 Beta (see changelog) - so .. I really should read the changelogs. ;)

Amarok Scripting:

Setting up Dropbox in an KDE environment

Dropbox is an online storage service. It is free and provides you 2 GB of space (for free). Dropbox synchronizes one specific folder on your filesystem - with the counterpart on the Dropbox servers (... it is actually a Amazon S3 system). The good thing: they also have an implementation for Linux. The normal linux-client runs in the background and observes the folder you have selected to sync with the online one.

Here are the steps to get it running and automatically started during your KDE session login:
- register on getdropbox.com
- download and install the (closed sources) binaries:

# change to home
$ cd ~

# download dropbox x86
#   for x86_64 http://www.getdropbox.com/download?plat=lnx.x86_64
$ wget -O dropbox.tar.gz http://www.getdropbox.com/download?plat=lnx.x86

# untar
$ tar xzf  dropbox.tar.gz

# run dropboxd (first time - wirzard is starting)
$ .dropbox-dist/dropboxd

# start dropbox during login
$ ln -s $HOME/.dropbox-dist/dropboxd .kde/Autostart/dropboxd

Dropbox also uses the KDE Notification-System to display status message of the Dropbox-folder.

More informations:

  • To Install Dropbox In An Entirely Text Based Linux Environment (Dropbox running as service) here
  • Wikipedia-Article here

Gaussian Distribution with QGraphicsView

During my semester-break I've played around with the QGraphicsView component which was introduced a while ago. My goal was to implement the standard-experiment for the Gaussian Distribution (see schema).

gaussdistrI_schema

Imagine you have 1000 balls and throw these (in sequence) in the opening on top of this vessel (see picture). The sum of each stack of balls results in an Gaussian Distribution form (shown at the bottom of the picture: red ball stacks).

I've implemented this behavior with the qrand() function - to decide if the ball goes left or right. After running the application the embedded QGraphicsView animate the results (the ball-stacks) using a QGraphicsItemAnimation. After finishing this results-animation the applications also shows some statistic-values:

average value - μ: (x1+x2+...+xn) / n

standard degression - σ: sqrt((x1-µ)² + (x2-µ)² + ... + (xn-µ)²)

Here is a screenshot of the application GaussDistri:

gaussdistri

As you already suppose the program is written in C++/Qt and based on a qmake-project - using Qt Creator. I provide the source-code later ... ;)

Update: it seems that I've mixed-up μ and σ in the app (see screenshot) ... :)

Pathfinding with PathFinder

PathFinder is a Java-application for visualizing path finding algorithms. It was written by Dirk Reske an me while a course at our University.

The goal was to implement a hugh amout of path-finding algorithms and compare them against each other. Some of the algorithms which we build in are:

  • A*
  • Depth first
  • Breadth first
  • Hill climbing
  • Beam search
  • British museum
  • Branch and bound
  • Dijkstra
  • Depth limited
  • Great deluge

Dirk already wrote a detailed article about PathFinder:  http://www.dirkreske.de/pathfinder/