Skip to main content

a silhouette of a person's head and shoulders, used as a default avatar

Using D-Bus in Java

I think one of the most fun things I've got to learn during Summer of Code is d-bus. I had to learn it to open instant message conversations in the Pidgin module. And I guess I can present a noobish tutorial to do something simple in Java using d-bus. Before you start, you can refer to this excellent manual here.

Pre-requisites-

1. you need JVM and JDK (the version I used was openJDK 1.6 taken from the standard repository)

2. dbus-java (which requires you to install libmatthew as well).

The task at hand is to make an empty note in Tomboy using a java program.

Step-1 Extend the required interface for the function you're looking to implement (you can use a software called d-feet which can help you analyze various buses, object paths and interface names)


package org.gnome.Tomboy;

import org.freedesktop.dbus.DBusInterface;
import org.freedesktop.dbus.DBusInterfaceName;

/**
*
* @author sourcemorph
*/

@DBusInterfaceName("org.gnome.Tomboy.RemoteControl")
public interface RemoteControl extends DBusInterface {

public String CreateNote();
}


[The annotation is important, and you need to mention the corresponding object path of the interface you're extending, here I have declared just one function that we needed, but you can choose from the available functions from d-feet].

Step-2 Write a main class to get an object of this interface type and execute the function.


/**
*
* @author sourcemorph
*/

import org.freedesktop.dbus.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;
import org.gnome.Tomboy.RemoteControl;

public class NewClass {

private static String ObjectPath = "/org/gnome/Tomboy/RemoteControl";
private static String ServiceBusName = "org.gnome.Tomboy";
private static DBusConnection conn;

public NewClass() {
try {
conn = DBusConnection.getConnection(DBusConnection.SESSION);
RemoteControl c = (RemoteControl) conn.getRemoteObject(ServiceBusName, ObjectPath);
c.CreateNote();
} catch(DBusException ex) {
ex.printStackTrace();
}
}

public static void main(String [] args) {
NewClass n = new NewClass();
}
}


Fairly simple. By the way its something really admirable about D-Bus because now my Java code can interact with processes which could have been coded in C sharp, Python etc. I am going to call methods on the Pidgin interface through Java code, and learning D-Bus was totally worth the effort.

PS: thanks to my mentor Stephen Shaw for patiently referring me to the README files when dbus-java wasn't compiling.. :) and also for d-feet, its awesome!

the avatar of Matthias Hopf

PowerPlayInfo V4.1

I finally spent a few spare minutes (underestimation of the week) to sort-of reverse engineer the PowerPlayInfo tables of newer ATI cards - and somewhat succeeded. But the information I found so far is not as encouraging as I'd like it to be.
Basically, you get a list of potential combinations of engine clock, memory clock, and core voltage, plus a number of unknown flags. So far so good, but on some (especially high class) cards the entries do not vary as much as I'd like them to do, and many combinations do not exactly make sense. Others are repeated over and over.

Examples (engine clock in Mhz / memory clock in MHz / core voltage in Volt):
  • RV770: 750/900/1.263 - 500/950/1.263 - 750/950/1.263
  • RV670: 669/829/1.214 - 300/829/1.014 - 300/829/1.014 - 300/829/1.214
  • RV635: 725/800/1.250 - 110/405/0.900 - 300/405/1.000 - 300/800/1.250 - 600/500/1.150
IMHO the RV635 values are the most reasonable ones - while the RV770 values are completely bogus.

Also, the PowerPlayInfo V4.1 still has quite a number of fields we don't understand - marked as unknown in my AtomDis disassembler and table dumper.
a silhouette of a person's head and shoulders, used as a default avatar

On kontact

I will go on holiday next week, so today is my last day in the office. I have decided that the things I have to do today are too many and I should work in the train in my way to the office.

All good, start the computer, of course no internet, so I had to shutdown kontact to stop him crying about not being able to connect.

Being able to easy go to an offline mode  would be a very nice and useful feature to have in kontact, and kde applications in general. Checking that before you want to communicate with some third party that you actually have the phone instead complaining that he is not answer, would be a very good design decision, too.

Now being the holiday season I hope at least one of the kde/kontact developers would get hit by this missing feature and soon we will have it.

a silhouette of a person's head and shoulders, used as a default avatar

API Design Matters

API Design Matters

I was reading a very interesting article called "API Design Matters" with the subtitle "Bad application programming interfaces plague software engineering. How can we get things right?". Very cool stuff.

In OpenOffice.org we have an API "plague" too: The ODF import/export is based on the "UNO-API" and so is the OOXML import for Writer. And developers hate these APIs.

So the question is why do developers hate the "UNO-API"? And the obvious --- but wrong answer --- is: "I hate the UNO-API because of UNO". Don't get me wrong here: This is neither about pro or contra UNO. But the statement that "UNO is the problem of the ODF import/export and OOXML import problems" is wrong. It's not UNO per se, but its the design of the API.
[In case you're wondering what "UNO" is: UNO=COM ;-) So UNO is OpenOffice.org's way of COM.]

And just to be sure I do not offend the wrong people: The UNO-API was not designed to be used in the import/export filters. It was designed to be the API for "OpenOffice.org BASIC" developers, i.e. it was designed to provide a similar API to what VBA developers have in Microsoft Office. It was never designed to be used for import/export filters.

The problem was the decision to base the import/export code on such a high-level API! And we suffer from this decision until now!

Anyway. How can we fix this?
a) We claim the current API is the best mankind can do and print T-Shirts with 1000 years of OOo experience.
b) We claim UNO and abstraction is the problem and use the internal legacy APIs, so that we never get a chance to refactor the internal legacy stuff since we're creating even more dependencies.
c) We come up with a better API.

Option a) was demonstrated at the OpenOffice.org conference in Beijing. [Does anybody have a picture of the T-Shirt?]

Option b) is the straightforward approach. E.g. in Writer the “.DOC”, “.RTF”, .”HTML” filters are based on the internal “Core” APIs. So lets use these APIs instead of the UNO-APIs.
Whats wrong with the approach? The problem is that these internal APIs do not abstract from the underlying implementation at all. Repeat: The internal APIs do not abstract from the underlying implementation at all.
Does this answer the question why using the internal APIs is the wrong approach? Obviously *not* having an abstraction between your core implementation details and your import/exports filters is ... [offensive language detected ;-)].

Option c) only has one problem: How should the API look like?

I have some ideas here, but before posting them maybe there are some strong believes out there?

a silhouette of a person's head and shoulders, used as a default avatar

How to build MonoDevelop with Visual Studio

How to build MonoDevelop with Visual Studio in five easy steps:
  • Install GTK# (get installer here)
  • Install the Mono Libraries (get installer here)
  • Get MonoDevelop from SVN (update: instructions here)
  • Open main/Main.sln in Visual Studio
  • Press F5 (update: make sure you have the configuration DebugWin32 and platform x86 selected).
a silhouette of a person's head and shoulders, used as a default avatar

Installation: Resizing Windows before proposing Linux partitions

While “selling” openSUSE to a friend of mine, I tried to explain him all the steps of the installation and all the configuration options which I had changed. He was not any geek and it was his first time seeing Linux.

While most of the installation did not need much explanations, I definitely spent most of the time on partitioning. Not that initial proposal was not fine, unless one has special requirements, but there is one elementar input, which even newbies may want to set: How to split disk between Windows and Linux. The installation proposal works just fine, but if one needs to keep more or less space for Windows than proposed and does not have any skills, he is doomed – and so would have been he.

There is a graphical dialog for resizing of the windows partition, but, sadly, there is no way to resize Windows and propose Linux partitions in the remaining disk space – which is something that would help new users a lot, they can say “I want 30% of my disk for Windows and the rest for Linux”.
Inserting additional dialog before proposing disk configuration was not that hard as I was afraid of — and, even more surprisingly, it also works in combination with LVM (see the images).

Resizing WindowsPartitioning proposalLVM Proposal

You can see it with 11.2 Milestone 2, where it is not enabled by default; to enable it, boot with start_shell=1 on kernel command line and uncomment the

<module>
<label>Disk</label>
<name>resize_dialog</name>
<enable_back>yes</enable_back>
<enable_next>yes</enable_next>
</module>

part of /control.xml.

What do you think of it? Is it worth it? Any ideas for improvement?

a silhouette of a person's head and shoulders, used as a default avatar

Report on F-Spot loading times


before: (on 0.5.0.3, averaged loading times on the first 10 items of my collection)
Loading image took 1.292241s

after: (current master, averaged on the same 10 items)
Loading image took 0.518812s



[UPDATE] Yes, that's on a dual core machine (Intel(R) Core(TM)2 Duo CPU L7500 @ 1.60GHz).
a silhouette of a person's head and shoulders, used as a default avatar

On KDE4.3

We are almost one month far away from the kde4.3 release. Yesterday the 4.3 rc1 was tagged and due to excellent work of our colleagues in OBS we have it already.

Personally, I would have liked it to go a little bit further away in terms of usability, we will speak about that later.  This release will mark the break with 3.5. I see no real reason for not using kde 4.3. All the functionality that people were crying after from 3.5 is finally up and running (a lot of time better) in KDE 4.3.

What more would you like then, people may ask.

I would like to be able to give a kde4 desktop to a secretary to use and to a teenager who is into Web2.0.

  • a features consistent kontact, a kalendar that actually can be used in a real life environment, avoiding silly design inconsistencies like you can spell check your popup notes but you cannot do it for your notebooks entries.
  • a kopete that actually supports video/audio features of protocols.
  • a rock solid kblogger may help.
  • a way to synchronize mobile devices.

and the last

  • adding more work on making existing features working perfect rather than adding new ones.

Alin

a silhouette of a person's head and shoulders, used as a default avatar

SUSE Out Your Tweets!

Thanks to Raul Libório from the openSUSE Marketing Team, you can trick out your Twitter background with your openSUSE Project affiliation (member, ambassador, user). Check out the openSUSE Social Network marketing page to get yours (look under “Sidebars for Twitter”.

You can add the logo itself, or use a program like The GIMP or Inkscape to add the logo to your current background (much like mine, below)

Twitter screenshot

the avatar of Matthias Hopf

How to NOT replace your HTPC

I wanted to reduce heat, noise, and power consumption, and improve user experience when watching video - in my opinion a home theater PC is probably the least enjoyable multimedia device. Especially as it typically never does exactly what you want it to do, so you spend half your time configuring and expanding it.
Finally, there is a neat BluRay player LG BD 370 that plays Matroska container as well, which is the de-facto standard for fansubbed Animes nowadays. And it is reasonably cheap (<200€).

So I bought one and stress-tested it this weekend. Long story short, I'm unsure yet whether I will return it to the store or not. Because it doesn't exactly play everything - and yet I still somewhat like it .

Positive things first:
  • Fast bootup - the system is ready in something like 10 seconds.
  • Good BluRay performance - I don't have too many BluRays yet, but the ones I tested worked decently. It is the fastest BluRay player I have seen so far - but I still hate the BluRay engineers for choosing java as the menu language.
  • Does play and upconvert DVDs.
  • Does do 1080p@24 (untested), no issues at all with HDCP handshake, even on output device change and resolution switching with a cheap 15m HDMI cable.
  • Very good user interface - I miss buttons for 10s instant forward/backward skipping, otherwise it's clean, neat, and easy to use.
  • Never crashed on the approx. 50 disks I tested.
  • Trivial and fast firmware update over ethernet.
  • YouTube client - about the most useless feature IMHO.
  • No decoding artifacts, unless it had warned you that this might be possible.
  • Very good and accurate format description.
  • Able to switch between >2 audio streams and subtitles on the fly.
  • Does play matroska, avi, mp4, mov, mpg containers without problems. I have a single avi that doesn't play, but it's probably broken.
  • Does play most(!) subtitles, including embedded ass and external srt files.
  • Does play ac3, dts, mp3, aac audio streams.
  • Does play most(!) h264, some(!)divx, all xvid video streams.

The last points already indicates the major issues:
  • Has a hard limit of 720x576 for DX50 fourcc - this is unbelievable ridiculous, as XVID works without limits, and both are actually the same format.
  • h264 is only supported upto level 4.1 - many fansubs use level 5.0 or higher, in order to use more reference frames. The player warns if the level is higher than 4.1, but if less then 9 reference frames are used at 720p (limit at level 4.1), it will play fine. Unfortunately, this isn't the case for half the fansubs I have.
  • Newlines in subtitles are rendered as '\n'. Luckily, they almost break lines early enough when they are too long (few characters missing).
  • Some subtitles aren't rendering, not sure why.
  • Doesn't play m2p, ogm containers.
  • Doesn't decode ogg vorbis.
  • As with all commercial players I know so far: Doesn't allow to fix A/V synchronization. I have a DVD with audio lagging 500ms behind video (Ghost in the Shell, early pressing), and one with one audio stream being too early, and one too late (Fucking Åmål). Fansubs sometimes lag audio by up to +/-300ms, dunno why.
  • There is a region-free patch for DVD, but only few tests of it can be found on the net. Don't know whether this works for all firmware versions, but somehow I doubt so.
Less important nitpicking:
  • Switches 50fps - 60fps all the time (system menus are running at 50fps only - probably European model issue only). With the long HDMI switching times this is getting on your nerves.
  • Doesn't use embedded fonts in ass subtitles.
  • Doesn't decode flac.
  • dts recoding would be a nice feature for aac audio, but doesn't work at all (tested on sp/dif only). Either I get pcm(!) two channel, or dts mono(!) without(!) sound.
  • Doesn't detect VCD and SVCD.
  • Does do 1080p@24 only on DVD and BluRay. Don't care too much, my projector doesn't accept 24fps, but is very good at inverse telecine. So I don't notice that.

I also noticed too late that the BD 370 doesn't only support no UPNP - but also no playback of files via SMB, NFS, or any other network means, just YouTube. Sigh. But well, the BD 390 will be available in Europe shortly as well, and that should include UPNP. Because of this I haven't even started to test audio file playback.

So I have a lot of issues with quite a number of disks I tested. And cannot use it neither for local network playback nor for Apple movie trailers. Still I'm unsure whether to return it or not, because the disks it plays it plays almost perfectly, with a nice user experience. At least I will have to keep my HTPC in addition to it for now.

Sigh.