20 Apr 2007

Danish translation of tsclient

Posted by Jacob Emcken Comments (0)

When I came home from work today I read Planet Gnome, I usually visit Planet Gnome several times a day so nothing new in that. But this time I found the post “tsclient 0.150 – call for translators” post by Jonh Wendell.

I thought why not… even tough I always use the English language when ever I can get away with it. I use tsclient a lot at work so I guess it was about time I payed something back to this great program.

I found an old Danish translation back from version 0.106 in the SVN repository, and started from there. I used a Danish translation guide translation guide since this is the first time I’ve ever translated software. This guide linked to a nice word list for Danish translations which helped me a few places where I was unsure about which Danish word I should choose. About 2 hours later I was finished and had submitted the translation in a bug report.

I hope someone will find this useful out there.

14 Apr 2007

FLAC and Ogg/Vorbis in iTunes

Posted by Jacob Emcken Comments (1)

After buying my Squeezebox I wanted to rip all my music to a lossless music format to get maximum quality out of the little thing. And the Open Source lover that I am the choice fell on FLAC. One problem though…

The problem is that my girlfriend is using Windows with iTunes which isn’t compatible with FLAC or Ogg for that matter.

I googled around for FLAC/Ogg Vorbis support for iTunes and found xiph.org which has a FLAC/Ogg Vorbis plugin for QuickTime ( and therefor also iTunes). iTunes uses the QuickTimes components to playback different audio and video types.

To bad that their latest version 0.1.7 is released only for Mac. It seems that you need to have FLAC contained in Ogg containers to be able to playback FLAC.

This link: a blog about Xiphs development deserves attention as well.

29 Mar 2007

Squeezebox

Posted by Jacob Emcken Comments (4)

2 days ago I recieved my Squeezebox… finally I pulled my head out and bought one. I should have done this along time ago. This is one of the best investments since my IBM x40… and that says a lot. At first I got really disappointed because I couldn’t get the Squeezebox to connect to the wireless network. After a few hours tinkering with my wireless access point and the Squeezebox wireless settings I gave up. I plugged it to the network with a wire and installed the latest Slimserver on my Windows partition (I know, I know… Windows, not something I was proud of).

When the Squeezebox found the slimserver on the Windows box the Squeezebox asked me to allow it to update its firmware. After that the wireless ran without problem. Yay.

I’ve started ripping all our music to FLAC even though my girlfriend was almost finished with our over 300 CDs in mp3.

Right now I use Linksys NSLU2 (running Debian Etch) both as music storage and to run the slimserver. It feels a bit slow but it is really not that bad. I’m thinking of finding another NAS but it either has to as silent as the NSLU2 or it has to be wireless. If any of you guys know a good alternative the the NSLU2 let me know.

Back to the Squeezebox… Not only can you play all you digital music but you can listen to internet radio (there is a Pandora plugin). You can have it to wake you up, show RSS (news) feeds on the display, play you podcasts and much more. All you digital music needs gathered in one freaking cool looking, easy to navigate, low noise box in your living room. All in all the Squeezebox rocks! Period.

19 Mar 2007

My very own hackergotchi head

Posted by Jacob Emcken Comments (1)

Last week I found this Avatar while browsing the Ubuntu community forums. I really like the style and decided to make one myself which should also look kinda like me.

 

The result is my own personal “hand drawed” hackergotchi. I used a picture taken at work and Inkscape to do the magic. It might look even better if I applied an uneven stroke like the one from the Ubuntu forums. Right now Inkscape does the stroke which is kinda dull. But it will suffice for now.

26 Feb 2007

Gtk.TreeView right click part 2

Posted by Jacob Emcken Comments (0)

While on my winter vacation I played around with the Gtk.TreeView and the right click challanges. I found a way to extract the row which is clicked on and the data within. The following example shows how (it builds upon my last Gtk.TreeView right click example:

public class TreeViewExample {
    public static void Main ()
    {
        Gtk.Application.Init ();
        new TreeViewExample ();
        Gtk.Application.Run ();
    }

    public TreeViewExample ()
    {
        Gtk.Window window = new Gtk.Window ("TreeView Example");
        window.SetSizeRequest (500,200);

        MusicTreeView tree = new MusicTreeView ();
        window.Add (tree);
        window.ShowAll ();
    }
}

// Creating a new class MusicTreeView which is derived from the TreeView class
public class MusicTreeView : Gtk.TreeView {

        private Gtk.ListStore musicListStore;

        public MusicTreeView ()
        {
                musicListStore = new Gtk.ListStore (typeof (string), typeof (string));

                this.AppendColumn ("Artist", new Gtk.CellRendererText (), "text", 0);
                this.AppendColumn ("Title", new Gtk.CellRendererText (), "text", 1);

                musicListStore.AppendValues ("Garbage", "Dog New Tricks");
                musicListStore.AppendValues ("The Chemical Brothers", "Galvanize");
                this.Model = musicListStore;
        }

        // The TreeView has a build in function which is called upon a OnButtonPressEvent
        // We override the function to capture right clicks with the mouse
        protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
        {
                if(evnt.Button == 3) {
                        Gtk.TreePath path = new Gtk.TreePath();
                        // Get TreePath from the xy-coordinates of the mouse from the event
                        // GetPathAtPos is a function from the TreeView class
                        GetPathAtPos (System.Convert.ToInt16 (evnt.X), System.Convert.ToInt16 (evnt.Y), out path);
                        Gtk.TreeIter iter;
                        // Get iter from the path
                        if (this.musicListStore.GetIter (out iter, path)) {
                                // Get artist and title from the iter
                                string artist = (string) this.musicListStore.GetValue (iter, 0);
                                string title = (string) this.musicListStore.GetValue (iter, 1);
                                System.Console.WriteLine ("Artist: " + artist + ", Title: " + title);
                        }
                        return true;
                }
                // Now if we would ever get this far
                // we run the TreeViews OnButtonPressEvent function
                // to make sure everything else works as normal
                return base.OnButtonPressEvent(evnt);
        }
}

Notes I found in Monodoc:

  • TreePath represents a particular node of a TreeView
  • The TreeIter is the primary structure for accessing a tree row.

Whatever that means :)

15 Feb 2007

XSLT: Search replace attribute values

Posted by Jacob Emcken Comments (3)

Yesterday I needed an xsl transformation which could replace a specific attribute value in a xml file and keep the rest intact. The following code is put together by pieces I found around the net (copy-paste FTW :) ):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:param name="attribute"/>
    <xsl:param name="oldvalue"/>
    <xsl:param name="newvalue"/>

    <xsl:template match="node()|@*">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
    </xsl:template>

    <!-- This is a generic search replace of attribute values --> 
    <xsl:template match="@*" priority="10">
        <xsl:attribute name="{name()}">
            <xsl:choose>
                <xsl:when test="(name()=$attribute) and (. = $oldvalue)"><xsl:value-of select="$newvalue"/></xsl:when>
                <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
            </xsl:choose>
        </xsl:attribute>
    </xsl:template>
</xsl:stylesheet>

Lets say that the above code is saved in a file called attribute_replace.xslt. Now with xsltproc you would be able to replace the vaule 5011 with 5015 in all attributes called port:

xsltproc --stringparam attribute port --stringparam oldvalue 5011 --stringparam newvalue 5015 attribute_replace.xslt server_config.xml > new_server_config.xml

I used this to manupulate with some JBoss configuration files.

08 Feb 2007

Heartbeat starting my resources twice… why?

Posted by Jacob Emcken Comments (0)

While working on implementing failover for a JBoss application in heartbeat I had it sometimes fail miserably. After examining the logs files for a while I noticed that it tried to start my service twice.. why?

This was due to multiple errors from my side:

  1. I hadn’t implemented the status call for my heartbeat resource script
  2. My script didn’t return true when asked to start and it was already started.

According to LSB standard your start / stop scripts should return true even though your service is already started.

Note to self: Learn to read the documentation and not just assume you know how it works (especially not with failover clusters… they are meant to have uptime you know.

Good readings about heartbeat and the resouces scripts.

07 Feb 2007

HTTP POST requests from command line with curl

Posted by Jacob Emcken Comments (0)

One of our customers have a JBoss application which they wanted to monitor with a script (in the long run Heartbeat2). By making a specific HTTP POST request to which the answer is known, it is possible to check if the server is running as expected. The HTTP POST request consist of a header and a body. The header is automaticaly generate from the parameters you provide curl and the body is provided in the --data parameter.

The following is an example close to what I used, and beneath a description of the parameters used parameters:

curl --insecure \
     --user monitor_user:heykcnhre \
     --header extra-header:12345678 \
     --include \
     --data '


    7
    get_email
' https://localhost:5011/check
  • --insecure ignores unverified SSL certificates
  • --user authentication information need to access the server and make the http request in the first place.
  • --header provides extra header information. You can add as many of theese as you need.
  • --include includes the header in the response (not only the body)

Curl takes many different parameters use man curl for more info.

06 Feb 2007

Website moved to new server

Posted by Jacob Emcken Comments (2)

As of right now I have moved my website to new server out in town on a 100MBit line, so it should be fairly fast. This is the first step in shutting down my server at home entirely. Lets see how it works out.

crossing my fingers and praying to the internet gods

Update: Now debianart.dk have been moved as well.

31 Jan 2007

Gaim: get back Ctrl + Enter to send message

Posted by Jacob Emcken Comments Off

Some time ago I think it was when I made the switch from Gaim 1.x to 2.x sending my instant messages with Ctrl + Enter stopped working. I have lived with it for along time but it kept annoying me… a good friend of mine found the solution on another website and today I took the time to actually do it.

The thing beneath is kinda ripoff / copy-paste :D

Create the file .gtkrc-2.0 in your home directory with the following content:

gtk-key-theme-name = "Emacs"
gtk-can-change-accels = 1
binding "gaim" {
    bind "Return" { "message_send" () }
    bind "Return" { "insert-at-cursor" ("\n") }
}
widget "*gaim_gtkconv_entry" binding "gaim"