Server move

Just a little reminder for myself:

Next weekend will be maintenance-weekend. I need to move servers or upgrade this one.

I’m lacking some essential features here, mainly gd with jpeg support.

Obviously I didn’t need it 4 years ago when I set up this server but today it only annoys me since space is sparse on this ancient system.

Problem is that everything is compiled from scratch with a bunch of customizations.  Some of which are long forgotten but may prove essential.

I hope everything runs smooth

SynchroMarks – a firefox extension

A week ago I began my long and dangerous descent into the realms of horror and insanity – I started working on a firefox extension.

While FF-Extensions sounds like a lot of fun, there’s one thing that gives me shivers: JavaScript! Eons have passed since I stood face to face with the unspeakable evil. My memories almost vanished. But now, years later our paths shall cross again.

Nevertheless, brave code monkey I am, I started my journey.

I’m working on an extension to synchronize my bookmarks between my FF at home and FF at work. The projects current name’s: SynchroMarks. While there’s weave or xmarks (former foxmarks), I’d like to know where my bookmarks are stored and who views them.

So what I’m doing is to set up a frontend and an api on my webspace together with a bookmarks db similar to mozilla places.sqlite.

That will hold all my bookmarks&folders.

The actual extension to FF observes all bookmark events. If a new bookmark is added it will communicate with the synchromarks api. The api will insert the new link into the global database and will return a unique smarks-id. The extension then inserts the link in it’s own database using this id.

The good thing about this approach is, that I don’t need to modify the mozilla database and synchronization is a lot easier. We could even skip the local database. We could always get our links from the global online db. Who would need a local copy? Well I’m not quite sure about this yet. Maybe I’ll try both versions. But the whole FF development is kinda… meh. We’ll see.

Development status:

  • extension observes a specified folder(+subfolders) for bookmark events
  • once a event occurs it calls the api
  • api can create bookmarks and folders
  • html frontend to view and add bookmarks
  • xml export of bookmarks (via api)

ToDo:

  • figure out why some of my extension preferences are not saved
  • eyecandy for the interface
  • implement authentication properly
  • code cleanup
  • delete/edit/move support
  • mb implement local db or some kind of livefeed into the bookmars sidebar
  • opera?

Reducing filesize of PDFs (Linux)

I just scanned some documents on our Bizhub350 with a resolution of 400dpi.

I stitched them together using pdftk just to realize that 8 simple pages summed up to around 10MB.

Since I need to upload the documents somewhere and the maximum allowed filesize is 8MB I searched for ways to reduce the filesize.

gs -sDEVICE=pdfwrite -dCompatibility=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=certs150.pdf certs.pdf

reduced the filesize significantly to around 300K but the resulting quality was terrible.

convert -compress JPEG -quality 100 certs.pdf out.pdf

produced a file of 1.5Megs which sounds promising but the quality was even worse than before.

Skipping the output option of the ghostscript command finaly did the trick:

gs -sDEVICE=pdfwrite -dCompatibility=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=certs150.pdf certs.pd

5Megs, good quality and bellow the maximum filesize.

Interfacing VLC with conky

Conky is a nice, lighweight system monitor for linux X which can nearly display any information available on your system.

Recently I reinstalled debian at home (I have linux at work and when I’m at home I usually want to play some games – so windows was the system of choice).

I wondered how to show the song that’s currently playing in VLC. After some searches, trial and error, I finally found a solution:

Setting up VLC

  • open vlc, go to properties->Interface and enable the remote control interface (RC)
  • go to properties->interface->main interfaces->RC, enable extended options and set the unix socket to something like /tmp/vlc.sock
  • restart vlc
  • vlc should now create an unix domain socket in /tmp/vlc

Testing the socket

Play some file in vlc and issue the following command:

echo “status” | nc -q1 -U /tmp/vlc.sock

which should give you something like this:

status change: ( new input: /media/sda1/incoming/Doom OST/doom_-_12_the_end_of_doom.mp3 )
status change: ( audio volume: 102 )
status change: ( play state: 1 )
status: returned 0 (no error)

Creating the perl script

I have to admit that I do know nothing about perl and it’s regex syntax so I generated the pattern using this online regex generator.

Script:

#!/usr/bin/perl

$txt = `echo status | nc -q1 -U /tmp/vlc.sock`;

$re1=’.*?’;    # Non-greedy match on filler
$re2='(?:\/[\w\.\-]+)+’;    # Uninteresting: unixpath
$re3=’.*?’;    # Non-greedy match on filler
$re4='((?:\/[\w\.\-]+)+)’;    # Unix Path 1

$re=$re1.$re2.$re3.$re4;
if ($txt =~ m/$re/is)
{
$unixpath1=$1;
print “Playing: $unixpath1”;
}

#—–
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl
#—–

Call the script from within your ~/.conkyrc

${execi 10 perl /home/krishan/vlcint.pl }

Additional information

  • for a complete command syntax for the remote control interface of vlc invoke vlc from the commandline wiht the -I rc switch and type help (see also: NOT a blog)

Maalstrom: 18k lines of code and still counting

Today I added one of the last missing features of our maalstrom project. With this addition we hit 17.939 lines of code.

Only a small step left to seal the project and enter  state: FeatureFreeze.

Next days will be pure bugfixing and polishing.

The project startet around November 2007. This makes roughly 28 month or 840 days or 21lines of code/day.

Not bad at all, since we have other things to do. Work, family, research, vast downtimes, lack of motivation, framework problems, …