SIL LSDev Linux Development

Language software for Linux and Mac OS X

Controlling IBus with DBusSharp

Rationale

I wanted to be able to change the IBus (Intelligent Input Bus) keyboard programmatically. If a user went into an area of text that had say an Amharic style applied to it and typed, I wanted typing to automatically use the ibus Amharic keyboard/engine. If they then switched to a different area of text with a different style applied to it I wanted the ibus keyboard to again switch automatically. This blog entry shows the steps that I used to achieve this.

Read the rest of this post…

.NET LINQ to Firebird

Since we’re porting from SQL Server to Firebird, code that works on both RDBMSs is highly valuable. We want to connect to either using C#.

Microsoft’s ADO.NET Entity Framework does just that. One of the components is LINQ. Here is a beginner’s application to show how to do it with Firebird.

Read the rest of this post…

C++ accessing C# COM objects through CCW in Mono on Linux

Recently we had a couple developers from other offices join us for LSDev Linux Brainstorming Week to learn from one another, talk about technology choices, and do some pair programming.

Recognizing that parts of our C++ code need to be able to access and work with C# objects through COM (Component Object Model), Eberhard and I set out to test this in Mono on Linux.

We were successful in making a C# application create a regular C# object and a C++ object (via libcom and RCW), pass the C# object to the C++ object, have the C++ object modify the C# object from native code, and then back in C# code observe that our C# object was indeed manipulated successfully from C++.

This capability to call back and forth between C# and C++ using COM is very important for porting several SIL programs to Linux, and we were concerned about whether it would even be possible with Mono. We found out several months ago that C# calling into C++ using libcom and Mono RCWs worked, and I was pleased to find that going the other direction, C++ calling C#, elegantly Just Works.

This new test works thanks to Jonathan Chambers‘s implementation of COM Callable Wrappers (CCWs) in Mono, which was announced here.

Eberhard and I largely reused existing libcom test code and just made some additions. The steps to perform this test and an explanation of what is happening can be found on our wiki here.

Packaging for multiple platforms on Hydra vserver

HydraThere are a number of SIL projects which would benefit from an organized way of being packaged for multiple Linux distributions. In addition to supporting several distributions, we would like to support the current and previous distribution releases as well as both 32- and 64-bit architectures.

The way we have chosen to do this is to host each kind of system as a vserver guest all on one physical machine. VServer is more like an advanced chroot than a virtual machine, and is faster and closer to the hardware than other kinds of virtualization. A script could build packages for each platform by invoking each guest’s package-building process.
Developers could also log in to experience and test their software on any of the supported platforms without having to set up such a machine themselves.

Hydra, our multi-headed monster, named for its many guests on one base machine, is being set up to host these guests.

For more information, see the wiki page for Packaging and testing.

How to avoid being prompted for your ssh passphrase all the time

We use ssh a lot, especially for access to our source code repository (currently CVS). We use a public key system with ssh, and most of our server accounts don’t have a password at all; they can be accessed only with a key.

For security, we ask people to protect their key with a passphrase. However, it is very inconvenient to have to type in the passphrase on every single access to the repository. The solution to this is to use an ssh agent, but finding out the best way to do this isn’t all that clear from the documentation.

Read the rest of this post…

Access to the underlying C GtkObjects from gtkmm

gtkmm is the C++ API for development of GTK+ and GNOME applications. Its developers have made a great job of wrapping the underlying C API, making it relatively easy to use GTK+ and GNOME within a C++ application. However, in the interests of writing methods that can be readily invoked from a variety of languages, it is preferable to use objects from the underlying C implementation as arguments and return values rather than their object-oriented counterparts. It will then be possible to call those C++ methods from C# code.
Read the rest of this post…

Makefiles that use build products from other Makefiles

I’ve found what I think is the best way to use build products from another Makefile (“remote dependencies”). You want two things:

  1. To rebuild the current target if the remote dependency has changed
  2. To rebuild the remote dependency whenever this is needed

For example, suppose you are writing a test program for a library, libFoo.a, and that the test program is in a subdirectory of the directory where libFoo is built. Read the rest of this post…

Updating the nVidia kernel module when upgrading your Debian kernel

I’ve found it a big pain that Debian typically upgrades its kernels without upgrading commonly-used kernel modules at the same time. The result is that I have only a text login after the next reboot. Now I’ve found a relatively painless solution that works well every time.

Read the rest of this post…

COM in Linux

The core of SIL FieldWorks was written in C++. New development in FieldWorks is done in C#, and ties into the C++ core through COM.

After much looking all over the Internet in January 2005, I basically concluded that not only does no one use COM in Linux, but no one wanted to (outside of big enterprise application ports to UNIX).

When both porting FieldWorks to Linux and making it cross-platform, we lose access to Microsoft’s COM implementation in Windows. We were originally going to use SWIG to generate C# wrappers around the C++ core libraries. All C++ methods would then be P/Invoked, and COM would be bypassed.

Then I found that Jonathan Chambers had put a lot of good work into Mono‘s COM support. I was able to have a C# COM client access a C++ COM server in Windows using Mono.

Read the rest of this post…

Explorations in GTK# part 2

Glade and custom widgets

Glade and GTK# are a powerful combination. One that we are using for our Mono re-implementation of WorldPad. It’s quite possible to build a very functional application using just the standard widgets provided by GTK, but sometimes specific functionality is needed which is not found in the regular set of widgets.

In this instance, a "custom widget" can be inserted into a Glade interface. This is easy to do, but filling in the custom widget with something useful is a bit more tricky.

Custom widgets in Glade
Above: Custom widgets in Glade.
Below: Custom widgets being implemented as "ColorPickerButton"s in the application.
Custom widgets in use

How do we implement the custom widget?

Read the rest of this post…

« Previous Entries