Introduction About Site Map

XML
RSS 2 Feed RSS 2 Feed
Navigation

Main Page | Blog Index

Archive for the ‘Programming’ Category

Music Log Files

Ever wondered how much you listened to a particular song?

XMMS possesses a great extent of flexibility. It provides facilities which, when customised appropriately, can dump complete song descriptions. XMMS can then progressively, accumulatively add song data to log files. Timestamps imply the duration of listening, which lead to possible future extensions, e.g.:

  • Automatically parse (scan, hash, then analyse) the log file/s
  • Compute an average listening time — that is before skipping to another track — for each individual song
  • Erase music that is frequently skipped or just output a ‘prospective deletion list’ to another file

Input/output operations are made quite simple. These can be invoked as command-line strings whenever a new track begins. It is a built-in XMMS plug-in, which can be found under Preferences » Song Change » Configure (see illustration below)

XMMS menu

Add the following line to the “Song change” Command field:

(date; echo %s) >> ~/My_playlists/playlist.log

XMMS KDEI am providing an example log file, assembled naturally (not artificially. Honest!) over 20 minutes or so. I still need to get rid of the doubly appearances, apparently caused by xmms-kde in my dock (screenshot on the right). As well as giving a minimal user interface, xmms-kde enables control of the player with CTRL+SHIFT+keypad even if the player is neither visible nor in focus.

A music log file results in even more redundant data to store. According to a rough calculations, I will see it growing by 1 megabyte every month or so. Compression, however, should make it only 10-20% of its original size.

UPDATE 26/06/2005: The following command, which can be set to become a nightly cron job, will slice the large log file so that it is composed of daily ‘chunks’:

mv ~/[Path]/playlist.log ~/[Path]/playlist-`date +%Y-%m-%d`.log

This can be extended to form an annual and monthly hierarchy of directories.

See the later extension: producing history spreadsheets

Open Source Problem

Sharing

One issue is particularly detrimental to OSS: the issue is branching. Implementation takes different directions (often due to third-parties involved) and compatibility begins to break. Linux and its distros are one valid example. Here is an example taken from skinning (AKA themes) to support the argument.

Different unique ‘skins’ for an application get distributed or different stylesheets written for a Web-based application. This gives a rich variety to choose from, but here is the snag:

  • The user gets accustomed to the new interface
  • A new version of the application comes out
  • The user might have to re-install a new ‘skin’
  • The user relies on the ‘skinners’ to carry on maintaining the project

Some may have heard of GIMPshop, which wraps the GIMP in a Photoshop-like environment. It can serve as a practical example for the pitfall.

The take home: it is safer not to be ‘distracted’ by minor components or release variants of main-stream systems.

One-Click Backups

Servers

There are fast and automated ways of backing up *NIX servers. Backups should include databases as well as home directories, of which there can be many.

Compressed Archives

If backups can be downloaded via links (e.g. under cPanel), a browser can have its default action for .gz files set to “save in home directory”. A little script can then timestamp all the archives and put them ‘in storage’:

    # Once back-ups have been put in home directory, move all
    # to a time-stamped directory in the back-up area
cd /home/user/
mkdir `date +%Y-%m-%d`
mv backup* /home/user/backup/Home_Directories
    # move home directories
mv *.gz `date +%Y-%m-%d`
    # move databases to the new directory
cp -rf `date +%Y-%m-%d` /home/user/backup/Databases/Recent
    # merge if required
rm -r `date +%Y-%m-%d`
    # clean up, NOTE: mv cannot merge

FTP

If your webspace host offers FTP access alone, there is no simple solution. Command-line ftp might be of use though.

SCP

Copy files from the server to your local machine. This step must be invoked from the server’s side. The form of the command resembles the following:

scp -r ~/public_html your_user_name@machine.domain.suffix:/home/user/backup

mySQL Dumps

Set up cron jobs on the server, e.g.:

0 23 * * 1,4 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase1.dump
0 23 * * 2,5 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase2.dump
0 23 * * 0,3,6 mysqldump --user [DB_username] --password=[DB_password] [DB_name]> ~/tmp/mydatabase3.dump

The code above keeps a stack of 3 databases, which can be used to rollback data shall something catastrophic happen. Databases can then be snatched along with home directories. The above code can be extended so that dumps are compressed and file destinations are remote.

The Death of Commercial Software

CD's pile

Open Source software might slowly conquer the market according to this item from IT Manager’s Journal:

Is the enterprise software business dying? Is anybody out there buying new licenses? Based on news from the past few weeks, it seems that there are very few buyers. The collapse of new licensing revenue isn’t news — it started five years ago — but the latest news makes it look like a permanent and accelerating fact of life for software vendors.

Regarding operating systems and the take on computers in general, Clayton Hallmark from Argentina predicts that low cost computers from Asia will bring Microsoft to its end.

MOBILIS
MOBILIS apparently goes for only $220 in India

Talk using Wiki

Wiki
The Public Wiki section on this domain

In a newly-added page I explain why have I moved correspondence from E-mail and IM to Wikis.

E-mail just did not seem like a natural form for exchange of messages. Long tails of quoted text appeared in messages and one could easily lose track of the conversation, which had intervals of hours or days in between. What’s more, backup, archiving and searching capabilities were poor.

This approach has more advantages, e.g. password-protected access which prevents spam, offers better customisation abilities, compactness, and inter-operability. Installation details have been included.

MATLAB Pinnacle

Pause/Resume Demo

Statistics for the month of April have just come out from MATLAB Central. I was ranked 1st world-wide, jointly with Luigi Rosa.

I am nearing 20,000 downloads and this figure should be exceeded later this month. It is rewarding to know that many programs out there have my DNA.

PHP-Nuke

PHP-NukePHP-Nuke is a free content management system, which is relatively difficult to install and involves a tedious learning curve. I spent the day investigating it in depth and eventually minimalised it to avoid unnecessary clutter a la Slashdot. The package was constructed by geeks and was intended for an audience of geeks.

My favourite example site is associated with Enemy Territory as I was badly addicted to the game (photographics evidence). PHP-Nuke is by far more sophisticated and complex than WordPress, for example,and I would rate it 9 out of 10.

The site I currently work on is titled The Computer Vision Digest. Also see:

Retrieval statistics: 21 queries taking a total of 0.322 seconds • Please report low bandwidth using the feedback form
Original styles created by Ian Main (all acknowledgements) • PHP scripts and styles later modified by Roy Schestowitz • Help yourself to a GPL'd copy
|— Proudly powered by W o r d P r e s s — based on a heavily-hacked version 1.2.1 (Mingus) installation —|