-
Categories
-
Buy my book
-
Category: Programming
XMPP Scripting with Sluift
Did you ever want to find out what XMPP clients people in your contact list are using? Do you want to migrate your contact list from one server to another, but don’t want to provide your password to some on-line service to do that? Do you have some XMPP-related task you quickly want to write a script for, but don’t want to deal with complex asynchronous APIs? Well, Sluift may be just the thing you are looking for!
Sluift is a Lua-based script layer on top of the Swiften XMPP library. It provides a simple API to do common XMPP tasks, either interactively (through an XMPP console), or by running a script in batch mode. In this post, we’ll go through some examples of what you can already do with Sluift today.
Swiften on Lambdas
One of the cool new features of the upcoming C++ (0x) standard is support for
lambda
expressions, providing functional-style inline function declarations. After
seeing Herb Sutter’s PDC 2010
webcast on lambdas, I wanted to try this out on Swiften, the XMPP library
behind Swift. I adapted the introductory EchoBot
example from XMPP: The
Definitive Guide, and ported it from Python to a C++ application using
Swiften. The result is surprisingly clean.
Posted in Programming and Swift | Tagged C++, C++0x, CLang, GCC, Herb Sutter, Jabber, Lambdas, Swift, Swiften, Visual Studio, and XMPP
Eclipse CPPUnit Error Parser
I've recently been experimenting with using Eclipse CDT as IDE for Swift development. One of the handy things is that Eclipse CDT has support for parsing compiler error messages, allowing you to quickly navigate to the failing source code line by simply clicking on the error message. Although Eclipse CDT supports all the compilers we use for Swift out of the box, I was still missing the easy navigation for fixing failing CPPUnit tests. Since the error parser (just like almost everything else from Eclipse) is extensible, I wrote a small plugin for parsing CPPUnit error messages.
“XMPP: The Definitive Guide” Code Examples
Although the primary focus of XMPP: The Definitive Guide is explaning the XMPP protocol and all its extensions through text and illustrations, we also included a few Python code examples to help people get started with implementing their own ideas. In fact, we devoted a whole chapter to building an XMPP application, starting out with a simple bot implementation, but gradually extending the application into a full server component. For people who want to try this out for themselves, we’re releasing the source code of all code examples, including a simple echo bot, and different variants of the CheshiR microblogging platform XMPP interface.
Mixing Cocoa and Qt
Qt does a great job at abstracting out platform-specific features into platform-independent C++ APIs. However, sometimes you still need to write platform-specific code for features that are not in Qt (e.g. to access the platform's address book), or to access platform-specific applications (e.g. iTunes) or libraries (e.g. Sparkle). On Mac OS X, almost all interfaces are offered through the Cocoa Objective-C interface, and the interfaces that are written in C++ have been deprecated and will disappear soon in favor of Cocoa. Although the language of Cocoa is different from Qt's, Qt and GCC make it very easy to call these interfaces from within your application. In this post, I will show how this can be done by making an auto-updating application using Sparkle.
Basic Music Theory in Haskell
While doing some spring cleaning around my hard disk, I found a little Haskell program I wrote several years ago in an attempt to learn the basics of music theory. Now, I'm not a pro at writing Haskell, and I know even less about music theory, but I'm hoping that what I wrote down back then is a bit accurate. The program seems to summarize the basics quite consisely: by just having a glance at the program, I'm rediscovering some things I totally forgot about scales and chords.
:set noexpandtab
Google recently published a C++ style guide, containing all the rules that Google code adheres to. Many of the style tips are quite sensible, and well accepted by many developers out there. However, I was surprised to find the following rule:
Spaces vs. Tabs: Use only spaces, and indent 2 spaces at a time. We use spaces for indentation. Do not use tabs in your code. You should set your editor to emit spaces when you hit the tab key.I never really understood why so many people have such a hatred towards tabs. Is it just because they have seen code where some editor has mixed tabs with spaces (which of course results in a horrible mess)? Or do they have valid counter-arguments, even when tabs are used consistently?
Unit testing method overrides
It probably happened to most of us developers before: while refactoring, you change the name of a virtual method, but forget to change the name of the overriding method in one of your derived classes. Compilation works fine, all unit tests pass, but your program doesn't work: the overriding method is never called. Java (and C#) programmers can avoid this problem by putting
@Override (and override) in front of their methods, which causes the compiler to print out an error message if the method is not overriding anything. However, most other languages leave you hanging with this problem. Luckily, with statically typed languages like C++, you can avoid these bugs by slightly adapting your unit tests.
Qtopia Greenphone Grant
A month or 2 ago, I applied for the Qtopia Greenphone Innovation Grant Program, an initiative from TrollTech to promote the development of applications for their Linux-based Qtopia Greenphone. I probably won't surprise anyone by saying that I sent in a proposal about writing a good, cross-platform, mobile Jabber/XMPP client. Anyway, I was very excited to receive a mail from TrollTech yesterday, stating that my proposal was accepted by their review panel! As an applicant, I will be receiving a shiny new Greenphone, together with a Qtopia SDK to develop against. Deadline for submitting my application: October 31st. Let the coding begin.
Posted in Jabber, Programming, and Software | Tagged Greem, GreenPhone, Jabber, Qtopia, TrollTech, and XMPP
'The First 10 Prolog Programming Contests' available for downloading
Exactly one year after we finished it, our book `The First 10 Prolog Programming Contests' is now freely downloadable. On the home page of the book, you will also find the source code of all solutions presented in the book. Below are some pictures of the 'deluxe' edition of the book, hand-made by my mom.


