09.19.06
Yes, I’m still here…
People who have played Baldur’s Gate 2 might recognize the quote, but anyway, I’m still around and I thought I had some interesting things to tell, and a little explanation for some weird/pathetic behaviour over the past months…
I’ve bought myself three new IT related books:
- Aspect-Oriented Software development by Ivar Jacobson and Pan-Wei NG (Addison Wesley)
- Ruby Cookbook by Lucas Carlson and Leonard Richardson (O’Reilly)
- The Art of SQL by Stephane Faroult with Peter Robson (O’Reilly)
So I’ve got quite some extra reading to do
It’s been some time since I last really used Ruby and I must say that the language’s documentation has improved a lot over the last few years.
While we’re on the subject of Ruby, Thomas has announced that FvwmRuby is as good as finished, I’ve been looking forward to this ever since he announced he was working on it about a year ago, now I might finally get around to coding FvwmMpd as an FVWM module, yay
On a personal level I’m still struggling with what started nearly three months ago. I still can’t really grasp what happened and I’m still struggling with it on a daily basis. It’s really hard to understand how somebody you think actually cares about you, for which you think you mean something, can just replace you when the next best guy comes along. And then I haven’t even mentioned the amount of lies, half truths and whatsnot…
For some reason I always have to think about this song by The Crüxshadows (Even Angels Fall):
Sorrow sings her kisses in silence and adjusts the blinds to keep the light from mocking everything I feel She dances slowly a silhouette upon the curtains but her eyes seem to cry only empty tears I beg for comfort with inadequate verse it meant so much to me.... and so little to her and I am sinking into a mountain of self pity why can't I simply disregard all the things I feel? "where is my angel," "where is my angel," "where is my angel, when I need him most?" "where is my angel," "where is my angel," "where is my angel, tell me now where did he go?"
Oh well, it makes me think of a good number of other songs as well, but anyway… It makes you wonder who you can still trust if even the person you trust most on this planet treats you like … I dunno… like you’re disposable? Like you’re nothing or nobody?
Good thing I still have friends to support me and community work and projects to immerse myself in, keeps a man going through hard times. So thank you all, you know who you are!
09.03.06
Antialiased Emacs (using XFT)
There are a couple of resources describing how to get Emacs 23 (aka “the unicode branch”) display antialiased fonts (see here for starters).
So building on my previous post on installing Emacs 23 from CVS you need to use this configure command:
./configure --prefix=/home/theBlackDragon/local --program-suffix=.emacs-23 --with-gtk --enable-font-backend --with-xft --with-freetype
You’ll need to start it like this for example:
emacs-23 --enable-font-backend --font "Bitstream Vera Sans Mono-12"
You can use an Xresource for the font if you like, but the –enable-font-backend switch is mandatory.
08.02.06
Using MPD and Icecast to stream audio
So what prompted me to do this in the first place? I tend to switch back and forth between my laptop and my desktop quite often and since both are in different rooms I like to have the same music playing on both…
Since I already used mpd to play my music from a remote Samba share I decided I might as well use that box to play it too and use a webinterface to control mpd and just stream the audio so I could listen to it from basically anywhere.
To make this work you’ll need a couple of things that you can probably install in a distribution specific way:
- MPD from SVN (the release version won’t work at the time of writing)
- Icecast, I used version 2.3.1
- the Apache webserver with a working PHP configuration for phpMp
- phpMp itself
Let’s start by setting up Icecast, after you have installed it you’ll have to edit the configuration file, which is an XML file that by default resides in /etc/icecast2/icecast.xml. In this file you’ll want to replace all occurences of ‘hackme’ with decent passwords. You’ll also want to set hostname to the hostname of the box icecast is running on. You can also change the port icecast uses here if you want to, though the default should be just fine. So much for setting up Icecast, let’s move on to MPD.
First you’ll have to do the default configuring of MPD, set up your music directory etc. once that’s done we are going to configure MPD to send it’s output to our Icecast server.
audio_output {
type "shout"
name "DragonStream"
host "localhost"
port "8000"
mount "/stream.ogg"
password "hackme"
quality "5.0"
# bitrate "128"
format "44100:16:1"
#
# Optional Parameters
user "source"
# description "here's my long description"
# genre "jazz"
} # end of audio_output
Most of the options here are fairly self explanatory, name can be anything you want to call your stream and is what most clients will show you, the port is the port your Icecast server runs on. Mount defines the URL you can find your stream on, being icecast_hostname:icecast_port/mount. The quality option sets the quality of your stream, 5 is CD quality, alternatively you could set the bitrate option, but since this version of icecast only streams in Ogg Vorbis format it might be handy to just leave it as I suppose it’ll stream variable bitrate then (though I’m just wildly guessing here). There should be no need to change the format. Description and genre are optional and do what it looks they do: define the genre and description of your stream for clients that display use information.
I won’t go into the details of installing or configuring Apache and/or PHP as that’s such a huge and distro specific topic that I won’t even start to bother, so I assume you have a working Apache + PHP setup. So download phpMp, extract it somewhere in your webroot and open the config.php file, there are only two things of interest here: host and port, check if those are correct and close the file.
You should now be able to start playing songs from your phpMp interface and listen to them using some streaming client that supports Ogg Vorbis, like Winamp or XMMS, be aware that you can’t start listening to the stream if you’re not playing something, that’ll just give you an error.
You’re also not constrained to using phpMp, you can use any MPD client to connect to your MPD server, you just have to make sure you secure your server enough if you allow external connections. You can do this by disabling bind_to_address (just comment it out) and use the password directive to set a password.
All in all I like the flexibility this setup gives me, the only real issue is that pausing MPD disconnects Icecast clients.
08.01.06
FVWM & Last.fm
For some reason I couldn’t resist creating a last.fm FVWM group.
It’s kind of empty right now so all FVWM-using Last.fm-ers join me there!
06.29.06
Inactivity…
As some of you have no doubt noticed I’ve been pretty much inactive in all community efforts I’m normally active in, there are in fact multiple reasons for this.
Firstly, this was my final year, I’ve now graduated (couldn’t have happened soon enough either), but after my intership I had sort of a minor burnout (I hope it was minor), resulting in me not doing anything.
Well, that’s not to mention the things that happened during my internship (but not at my internship).
To ‘improve’ upon the situation my entire life kind of collapsed around me taking with it all my plans for the future and every shred of motivation I had been getting out of these.
So currently I’m just trying to grasp what has been happening, trying to get out of this bottomless pit and figuring where I will, should or could go from here.
05.12.06
Portable Emacs
While reading gmane.emacs.help I came accross this post where somebody asked how he could make a portable app out of Emacs' Windows version.
So since I'm still at my internship (where they use Windows) and just recently obtained an iAudio X5L portable media player which behaves like an USB2 harddisk to the OS I wondered if I could manage to make Emacs portable.
Short version: I could, the "hardest" part was in fact not even Emacs related, but my sheer lack of knowledge about Windows batch script.
I started by creating a "SOFT" folder on my external drive (named E: by Windows on this box) and extracted the altest Emacs build from the ntemacs project in this directory, thus creating "E:\SOFT\emacs" with all the usual subfolders.
Next I created a site-lisp/site-start.el file and added the following as suggested on usenet:
(let ((home (concat (substring (car command-line-args) 0 2) "/SOFT")))
(setq user-init-file (concat home "/config/.emacs"))
(setq auto-save-list-file-prefix (concat home "/config/.emacs.d/auto-save-list/.saves-")))
You'll need to adapt this to your particular environment of course.
This makes Emacs load my user-init-file (aka ".emacs") from "E:/SOFT/config/.emacs" and moves the auto-save-list to the external device as well, this should be superfluous though as I change the location of HOME as described later, but it accounts for the cases that you don't want to change your HOME.
This is in fact the entire Emacs side of the story, though you will probably have some work making your elisp packages work with relative paths if you didn't take that into account before.
Now you need to redefine HOME in Windows (well, you don't need to but I find it useful), you can either do that globally with the System Properties or autoexec.bat in DOS based Windows versions, but I preferred to make it dynamic by writing a wrapper batfile that sets this variable and then launches Emacs. I named it runemacs.bat (how appropriate;)) and put it in Emacs' bin directory, the content looks like this:
set HOME=%CD%\..\..\config
runemacs
That's it! You can now run Emacs entirely from your external drive!
05.11.06
Emacs tips #2 : linenumbers
A question that pops up pretty often is how you can add line numbers in the margin of your files the way most other editors do.
There are actually two ways of doing this:
- adding the numbers in the margin
- adding the numbers to your files, so that they get saved with your file, might be useful in certain cases (COBOL source?)
Unfortunately Emacs doesn't support either out of the box, but fortunately people have written modes that do exactly this. Modes for both the former as the latter can be found on the EmacsWiki.
Personally I (occasionaly) use setnu.el which works extremely well for my purposes.
05.04.06
Emacs tips #1
I've been using Emacs for some time now but have only recently started to heavily customize it. With this I've also started tracking (or more actively tracking) various Emacs related resources, picking up useful bits of information along the way. I'll try to share the most useful ones here with you on a (hopefully somewhat) regular basis.
I'll kick off with a very short one, the next line enables "focus follows mouse" on Emacs windows (not frames, frames are handled by the window manager).
(setq mouse-autoselect-window t)
So what is "focus follows mouse" anyway? Basically it means that the window your mouse pointer is over receives focus (input) so you don't need to click on it to give it focus (as you have to in, say, Windows). Some people find this confusing, most people can't live without it once they get used to it.
For more information on "focus follows mouse" see here.
05.02.06
Self-referential story
I came accross this post on Lambda the Ultimate, which made for quite an interesting read, and a fun one too!
Doubleclick in FvwmScript
FvwmScript is a scripting language provided by FVWM that allows you to create windows that can integrate perfectly with your FVWM configuration. Unfortunately it is also very limited. It for example doesn't support some sort of DoubleClic[1] event, even though this name pops up in the sources it doesn't seem to ever have gotten implemented.
I came accross this about half a year ago when writing FvwmMpd, an FvwmScript frontend to mpd where I wanted to start playing a file when one doubleclicked a song in the library as having your song change whenever you singleclick an item is obviously annoying…
So I worked out this little workaround:
Widget 1
Property
Position 0 24
Size 450 450
Type List
Title { }
Main
Case message of
SingleClic :
Begin
Set $item = (GetValue 1)
Set $clicks = (Add $clicks 1)
If $olditem == $item Then
Begin
If $clicks==1 Then
Do {Exec mpc play } (GetValue 1) { >/dev/null}
End
Else
Begin
Set $olditem = $item
Set $clicks=0
End
End
End
It obviously is somewhat of an ugly hack but it's about as good as it gets and since I've been asked how to do something like this a couple of times already I thought I might as well publish it here, it might just help someone
[1]The single click event is called SingleClic, which is probably due to the fact that the original author was French speaking.