FAQ: Java Console Handling

As it is one of the FAQs on every Java newsgroup or Java Mailinglists: “How to handle console?”

I came across a nice library that supports console operations on Windows, Linux and Mac OS: JLine.

Check it out, if you really need to work with the console on the mentioned platforms. The libarary works using native features, but I find the handling quite nice: the required DLL for Windows for instance is dynamically extracted from the JAR and loaded, so there is no need for a special installation.

JLine does not provide curses features at the moment, but it is a good approach if you need to read a password from standard in.

Gnus & IMAP: a superb combination

Gnus, a (X)Emacs based news- and mailclient has been my favorite newsreader for some years now. I used to use it for NNTP based usenet reading only and I really liked it for several reasons:

  • adaptive scoring, it just raised the score of articles I read and lowered the ones I didn’t read
  • flexible and configurable
  • works within X11 and also on a shell
  • available for both, Linux and Windows

Not so long time ago, when I started to play more actively with Gentoo on my home box, I realized for the first time in my Internet-life that mailinglists could be a good supplemental for my usenet feeds and for information retrieval, especially the gentoo-user list. I’ve had always gone around mailinglists because I didn’t find them as appealing and comfortable as newsgroups and I didn’t like the idea of my mailbox being filled with hundreds of postings, mixing with my ordinary mail. Since I got my own mailserver for hosting my domain, I finally figured out that I could easily get around this problem with server-side SIEVE scripts; i.e. server-side mail filtering that sorts all incoming messages of a given mailing list in a certain IMAP folder.

Now, I’ve read several times that Gnus works well with IMAP so I thought I’d give it a try. Let’s say I didn’t regret it. Gnus handles an IMAP backend quite as well as an NNTP backend, in fact, despite some minor differences in handling the expiration of posts there is no difference for me if I am reading my local NNTP mirror maintained with leafenode or if I am reading a mailinglist stored on an IMAP folder. All powerful scoring features I adore so much in Gnus just work on the IMAP feed as well, opening a new world of information retrieval as well.

I keep Gnus running most of the time within a screen backed shell on my server, allowing me access to NNTP and mailinglists from quite everywhere I can/want to log into my box. This is some sort of freedom I really like very much and makes Gnus really a good choice for me.

I already can here Pine-fans and mutt-fans arguing that pine/mutt/whatever handles the job as well as Gnus. Well, that sort of religious discussion never was interesting to me and I can just say: yes, I believe you. But after 4 years of continiously tweaking my Gnus configuration, it just got “perfect” for me. I mean, it does exactly what I want it to do, fitting my needs and tastes. Maybe hardly anyone else could work with my configuration, but that is one of the points I like about Gnus: it’s configurable to hell… 🙂

I think I am going to publish some parts of my .gnus config file as maybe some parts may be interesting. I confess, I have hardly any Lisp-knowlege, so most parts of the file are just taken from the documentation or from other websites. But maybe there are some parts someone else wants to see as well 🙂 And getting a working configuration as a starting point could be the way for some people to try out Gnus as well.

Update (2005-06-14)
As requested in the comments, my .gnus is now available for download. I obfuscated some server entries, please look out for any .invalid domain and replace it with your domain or namespace before using this file.

One Keyboard, One Mouse — Multiple PCs: synergy2

I commonly work on a desk with two or more computers, each having its own monitor, keyboard and mouse. It often got confusing which mouse and which keyboard to use when.

To be my saviour, Erik (see his blog as well) has pointed out a software called synergy2 to me, a software that emulates a KM-switch (Keyboard-Mouse-Switch) across multiple plattforms. The user simply configures the arrangement of the monitors on his desk (M1 is left of M2, M2 is above M3, …) and the mouse can be moved from computer A to computer B. Keyboard input follows the mouse in this case.

Still, every computer needs its own monitor, but I now have one single keyboard and one single mouse to handle them all. To be honest, after using this software for two weeks now, I can’t imaging working without it any more.

synergy2 claims to work with heterogenious Microsoft Windows 95/98/ME/2000/XP/2003, Mac OS X 10.2+, and any Unix X Server 11r4+ with XTEST extension.

Besides the really nice fact that one needs only one keyboard/mouse any more there are two additional goodies in using this software:

  • synergy2 (if configured to do so) synchronized the content of the clipboard among the clients. This really comes in handy if you are using one PC for research on the web and another one to work.
  • A nice feature is to synchronize the screen savers on the various computers so that all screen savers turn on at once and none turns on while you are working on another computer.

synergy2 works quite simply by defining a server (the computer with the real keyboard and mouse) and attaching clients to this server. The protocol used is unencrypted so be sure to use it only within trusted networks. You could however tunnel it over ssh to have an encrypted channel.

During my two weeks of experience in heavily using this software I only found some minor bugs/itches in using it: sometimes when coming back from screen saver on a client computer running Windows XP Prof with an XP-greeting screen and activated password after screensavers, the virtual keyboard is stuck with a simulated key, resulting in not being able to enter the correct password. As this is my notebook I could always fix the problem by pressing Ctrl+Alt+Del manually on the notebook’s native keyboard. Another way to get around this without using a native keyboard is to unlock the server screen and tell the synergy2-server to “Force Reconnect”. Unfortunately in the latter case the reconnect process takes several seconds before the slave screens can be re-entered with the mouse.

So, if you are using several PCs on the same desk at the same time, each with its own monitor, you should definitely give synergy2 a try. I’m quite sure, it will revolutionize your everyday’s work just as it did in my case.

Short URLs: Future Loss of Knowlege

Short URLs, as provided for instance by TinyURL.com or MakeAShorterLink, are now commonly used when posting to newsgroups or mailinglists. These links are primarily used to get rid of the problem of wrapped URLs in many NNTP/Mail-Clients as well as to make the posts more readable.

Unfortunately, these links also provide a problem regarding future retrieval of information. Often, the short URLs are only valid for a certain amount of time, afterwards they cannot be resolved anymore. When searching newsgroups on the hunt of a problem, I sometimes come accross such invalid links. Nothing angers me more than when reading “just see http://xxx.xxx for the solution” and having no possibility to retrieve the information.

tinyurl promises on its front-page to create an URL that […] will not break in email postings and never expires. Quite some challanging promise, isn’t it? makeashorterlink.com is more conservative in their promise, they only tell that it is going to last a very long time.

I do not want to say that these services are not senseful, on the contrarary, there are many cases where they are senseful. Long links in mails, postings, and instant messages are quite a pain sometimes, but the problem, especially in support forums and newsgroups is, that in my opinion the chances are higher that the short URL service will discontinue than that all archived postings will expire.

Of course, one could argue that the chances are as well that the real URL hidden by the short URL is not valid any more. This will also result in loss of information, without any doubt. If such a commonly used service is discontinued, a lot of URLs become invalid at once where the hidden URL is lost forever while the service behind it might still be available.

There is another point about the short URLs as well: I usually want to know where I am going before clicking a link. That’s also impossible with short URLs.

So, what to do about it? In my opinion, whoever wants to should continue using the services; I sometimes use them as well. But one should also add the long URLs at least to the end of an e-mail or a posting. They might be unclickable due to line breaks, but in case the short URL expires, it is still possible to reconstruct the link by hand.

Hello World!


It seems, within the past months everyone started a blog, so I thought, hey, well, why not me too? And that’s the result…

I could now tell everyone that I think this will be interesting for everyone and that I hope you will find something useful here. But I’ll be honest: how likely is that? If you find something useful, that’s great, but if not, don’t blame me, I warned you 🙂