Older blog entries for Kay (starting at number 65)

Generic Jabber (XMPP) with webOS

WebOS (The operating system of the Palm Pre and Palm Pixi phones) has a built-in messaging application but unfortunately it only supports Google Talk and AIM out of the box. It's a shame that Palm has not enabled more protocols and especially generic XMPP support. The used library (libpurple) supports everything so it's only missing in the GUI.

Google Talk uses XMPP so in theory it should work with any other XMPP server but unfortunately Palm has put this nasty code in the LibpurpleAdapter (which is used as a connector between the GUI and the low-level libpurple):

if (strcmp(prplProtocolId, "prpl-jabber") == 0
    && g_str_has_suffix(transportFriendlyUserName, "@gmail.com") == FALSE
    && g_str_has_suffix(transportFriendlyUserName, "@googlemail.com") == FALSE)
{
    // Special case for gmail... don't try to connect to mydomain.com if the
    // username is me@mydomain.com. They might not have
    // setup the SRV record. Always connect to gmail. 
    purple_account_set_string(account, "connect_server", "talk.google.com");
}

This code means: If the protocol is Jabber (XMPP) and the entered username does NOT end with @gmail.com or @googlemail.com then the XMPP server is hardcoded to talk.google.com. So if you enter a username like johndoe@jabber.org then the Messaging app does not connect to jabber.org but instead it connects to talk.google.com because of the above code. So we must get rid of this code somehow.

With some knowledge about assembler you might be able to toggle some logic in the binary so the above if statement always evaluates to false but there is a much easier solution. You just need to replace the string "connect_server" with some invalid string. I use "nonnect_server". The result is that the line simply sets some unused property and therefore simply does nothing. But let me describe step by step:

Since WebOS 2 the LibpurpleAdapter program is renamed to imlibpurpletransport. In the following step-by-step instructions I will mention both variants for WebOS 1 and WebOS 2.


Continue reading "Generic Jabber (XMPP) with webOS"

Syndicated 2011-12-20 18:25:00 from K's cluttered loft

Fixing synchronization problems in fail2ban

fail2ban is a software which can be used to monitor service log files and ban IP addresses which executed a brute force attack or tried to use the mail server as a spam relay. In the default configuration in Debian GNU/Linux only SSH login attempts are monitored which works pretty nice. But when you try to add more services then you may run into the problem that fail2ban no longer starts up correctly. The log file contains errors like this:

fail2ban.actions.action: ERROR  iptables -N fail2ban-ssh
iptables -A fail2ban-ssh -j RETURN
iptables -I INPUT -p tcp -m multiport --dports ssh -j fail2ban-ssh returned 200

I searched on the net but only found more victims of this problem, no solution. So I analyzed what was going on here and I finally figured it out.


Continue reading "Fixing synchronization problems in fail2ban"

Syndicated 2011-09-13 17:37:43 from K's cluttered loft

Return a PHP array by reference

Looks like I'm using way to much Java in these days... I'm starting to forget PHP knowledge. Today I was searching for a function to clone an array but haven't found one. I was curious why PHP doesn't have an array_clone or array_copy function. But then I was nudged into the right direction: Arrays are always assigned by value, not by reference, so it simply doesn't need a clone function because a simple assignment already performs a clone (It's even some sort of deep clone (At least all values inside the array (Arrays are also values, not objects) are copied)). To assign it by reference you have to add an ampersand character:

$arr = array();
$arrClone = $arr; // A clone is created
$arrRef = &$arr; // A reference is created

I really forgot this basic PHP knowledge...


Continue reading "Return a PHP array by reference"

Syndicated 2011-07-28 11:39:37 from K's cluttered loft

Generic Jabber (XMPP) with webOS

WebOS (The operating system of the Palm Pre and Palm Pixi phones) has a built-in messaging application but unfortunately it only supports Google Talk and AIM out of the box. It's a shame that Palm has not enabled more protocols and especially generic XMPP support. The used library (libpurple) supports everything so it's only missing in the GUI.

Google Talk uses XMPP so in theory it should work with any other XMPP server but unfortunately Palm has put this nasty code in the LibpurpleAdapter (which is used as a connector between the GUI and the low-level libpurple):

if (strcmp(prplProtocolId, "prpl-jabber") == 0
    && g_str_has_suffix(transportFriendlyUserName, "@gmail.com") == FALSE
    && g_str_has_suffix(transportFriendlyUserName, "@googlemail.com") == FALSE)
{
    // Special case for gmail... don't try to connect to mydomain.com if the
    // username is me@mydomain.com. They might not have
    // setup the SRV record. Always connect to gmail. 
    purple_account_set_string(account, "connect_server", "talk.google.com");
}

This code means: If the protocol is Jabber (XMPP) and the entered username does NOT end with @gmail.com or @googlemail.com then the XMPP server is hardcoded to talk.google.com. So if you enter a username like johndoe@jabber.org then the Messaging app does not connect to jabber.org but instead it connects to talk.google.com because of the above code. So we must get rid of this code somehow.

With some knowledge about assembler you might be able to toggle some logic in the binary so the above if statement always evaluates to false but there is a much easier solution. You just need to replace the string "connect_server" with some invalid string. I use "nonnect_server". The result is that the line simply sets some unused property and therefore simply does nothing. But let me describe step by step:


Continue reading "Generic Jabber (XMPP) with webOS"

Syndicated 2010-08-24 10:52:29 (Updated 2010-08-24 14:46:29) from K's cluttered loft

Palm Hot Apps Contest is over

The Palm Hot Apps Contest is finally over. According to the last available statistics Destroids reached rank #18 and won a $10000 reward in the Free Apps category. Thanks to all downloaders!

Now it's time for the third waiting phase. The first phase was waiting for the end of the contest (Which was delayed by one month). The second phase was waiting for the official results (Took another month). The third phase is waiting for the money. I wonder how much money will be left after thugs like Paypal and tax collectors opened their hands...

Syndicated 2010-07-29 17:29:34 (Updated 2010-07-29 17:45:42) from K's cluttered loft

Destroids on PC Mag

While I'm still waiting for the final results of the Palm Hot Apps Contest I just heard that Destroids is listed as number 2 in the Top 10 of free Palm webOS Apps 2010 of PC Mag. I'm not exactly sure what that means, probably nothing. Don't know how apps qualify for this Top 10...

Well, if you just came here because of this article then I guess you really want to go over here to read more about Destroids. There is also a forum if you have something to say.

Syndicated 2010-07-17 17:32:29 (Updated 2010-07-29 17:45:10) from K's cluttered loft

Destroids

Some months ago I published the first version of a little open source game called Destroids for webOS (The OS of the Palm Pre and the Palm Pixi smartphones) and I'm still improving it weekly. It's a simple Asteroid-like game where you fly a spaceship through an asteroid field and shoot asteroids and UFOs.

At the same time Palm started the Palm Hot Apps contest where app developers can win $100,000 (For the first rank), $10,000 (for rank 2-21) or $1,000 (for rank 22-221) in two categories (Free apps and paid apps). For the time the contest is running I placed a widget on the right side of my blog which shows the current position of Destroids. If you own a Palm Pre or Palm Pixi and you like the original Asteroids game then download Destroids now and make me rich.

More information about Destroids can be found on pre|central.net

Syndicated 2010-04-25 16:04:18 from K's cluttered loft

Java and the StartSSL CA certificates

Again and again I forget how to import the StartSSL CA certificates into Java. Everytime when I switch to a different workstation or install a new Linux distribution I can no longer access my StartSSL secured server with Maven. Then I have to search for a tutorial and for the download locations of the CA certs. Very time-consuming. This must stop once and for all. So I wrote a small script which imports the certs into the currently active Java installation.

Steps to install the certs:

  • Download import-startssl script.
  • Make sure JAVA_HOME environment variable is set correctly.
  • Run the import-startssl script.

The script runs the keytool program of Java with sudo so you have to enter your password to give it root access. If you have JSSE installed then the StartSSL CA certs are also added to the jssecacerts keystore. The script imports the root CA certificate and the four sub CA certs (Class 1-4).

If the script does not work for you (Maybe because you are using Windows or Mac OS X instead of a real operating system) then you can at least read it for instructions how to do it manually.

Syndicated 2010-04-11 13:20:52 (Updated 2010-04-11 13:33:36) from K's cluttered loft

CSS box model hacks

Consider that you want to display some DIV inside another DIV where the inner DIV always fills out the outer DIV completely:

<style type="text/javascript">
  #outer { width: 256px; height: 256px; }
  #inner { background: red; height: 100%; }
</style>
<div id="outer">
  <div id="inner"></div>
</div>

Width is already correct because the default value of auto keeps the inner DIV at maximum width. So only the height:100% style is needed for this scenario. But what if the inner DIV also has some padding or a border? Then the percent values will not work because according to the W3C box model the border and the padding is added to the width and height. So the inner DIV gets too large. In standard compliant browsers (Even in IE7) this can be solved pretty easy. IE6 needs a little hack. Read on...


Continue reading "CSS box model hacks"

Syndicated 2009-11-17 10:20:34 from K's cluttered loft

Ubuntu Karmic workarounds

Ubuntu 9.10 Koala Karmic is released and I immediately installed it. May be this was too early because it has lots of issues. So I'm going to collect some workarounds here which were necessary on my notebook to get Karmic running smoothly.


Continue reading "Ubuntu Karmic workarounds"

Syndicated 2009-11-05 06:57:27 (Updated 2010-07-29 17:45:30) from K's cluttered loft

56 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!