Archiv der Kategorie: English

Unicode Man

Holy shit, this is awesome:

<deep portentous voice used for film trailers>When the fight for internationalisation hots up, mild mannered web developer Martin Sammtleben becomes Unicode Man, defender of diacritics, champion of challenging codepoints. Faced with an ASCII-fixated enemy, Unicode Man must free the badly programmed text engines of the world of their inability to implement international standards before all are assimilated by their failure to put the right glyph in the right place</deep portentous voice used for film trailers>

Highbrow Java

Here’s examples from my actual code of five lesser-known Java features, in increasing order of how much fun I had discovering they exist.

Anonymous classes

These are fairly well-known, so let’s go for a freaky example – an anonymous class declaration within the head of a (labeled!) for loop:

sentence : for (List children :
        node.getOrderedChildrenBySpan(
        sentence.getOrderedTerminals(), new Test() {

	@Override
	public boolean test(Node object) {
		return false;
	}

})) {
	for (Node child : children) {
		String tag = child.getLabel().getTag();

		if (tag.contains("-SBJ")) {
			break sentence;
		}

		tags.add(PTBUtil.pureTag(child));
	}
}

Enums

Boring, I know. I’m mentioning them here for completeness because I found out about them rather late and was like, hey, cool, that’s much nicer and cleaner than working with explicit integer constants.

public enum EditOperationType {

	DELETE, INSERT, SWAP, MATCH;

	@Override
	public String toString() {
		switch(this) {
		case DELETE:
			return "delete";
		case INSERT:
			return "insert";
		case SWAP:
			return "swap";
		default:
			return "match";
		}
	}

}

Generic methods

Luckily, the following code is no longer live.

@SuppressWarnings("unchecked")
public  T retrieve(
        Class type, int id) {
    return (T) getStoreForType(type).retrieve(id);
}}

Instance initializers

I know I discovered these once thinking I needed a constructor in an anonymous class and wondering how to do this, because how would one declare a constructor in a class without a name? It did not remain in my workspace, however, and I never used an instance initializer again. In the case of anonymous classes, I tend to use final variables outside of the anonymous class, or derive them from classes whose constructors already handle everything I need. So I’m pulling an example from someone else’s code:

_result = new ContainerBlock() {
    {
        setPanel(_panel);
        setLayout(LayoutFactory.getInstance()
                .getReentrancyLayout());
        addChild(unboundVarLabel);
    }
};

Multiple type bounds

public abstract class IncrementalComparator<
        T extends HasSize & HasID> {
    // ...
}

I wonder what’s next.

Ezri Dax

I’m a huge fan of Ezri Dax because she is the only character in Star Trek: Deep Space Nine who consistently stands up to Klingon crap. Observe:

EZRI: Stop it.
WORF: A Klingon would rather die than be held captive!
EZRI: What are you going to do? Kill yourself and leave me here alone?
WORF: This is no time for your jokes!
EZRI: It’s no time for Klingon chest-thumping either.
(’Til Death Us Do Part)

WORF: Now, tell me what you think.
EZRI: Okay. But I’m not sure you’re going to like it.
WORF: Tell me.
EZRI: I think that the situation with Gowron is a symptom of a bigger problem. The Klingon Empire is dying. And I think it deserves to die.
WORF: You are right. I do not like it.
EZRI: Don’t get me wrong, I’m very touched that you still consider me to be a member of the House of Martok, but I tend to look at the Empire with a little more scepticism than Curzon or Jadzia did. I see a society that is in deep denial about itself. We’re talking about a warrior culture that prides itself on maintaining centuries old traditions of honour and integrity, but in reality it’s willing to accept corruption at the highest levels.
WORF: You are overstating your case.
EZRI: Am I? Who was the last leader of the High Council that you respected? Has there even been one? And how many times have you had to cover up the crimes of Klingon leaders because you were told it was for the good of the Empire? I know this sounds harsh, but the truth is, you have been willing to accept a government that you know is corrupt. Gowron’s just the latest example. Worf, you are the most honourable and decent man I’ve ever met, and if you’re willing to tolerate men like Gowron, then what hope is there for the Empire?
(Tacking into the Wind)

Also, she hates gagh.

Developments in Desktop Environments, Part 2: The Glorious Future

Yesterday I looked at recent trends in the development of computer desktop environments and noted that the traditional desktop (+ windows + panels + menus) metaphor is being abandoned in favor of a simpler “one thing is on screen at a time” policy as already used in the graphical user interfaces of mobile devices. Like the developers of Mac OS X and GNOME Shell, I too think that the traditional desktop metaphor must die, but I want something completely different to replace it. Here’s some guidelines that should, in my opinion, be followed, to create next-generation desktop environments:

“Navigational” elements like application launchers and overviews over active applications have no business being full-screen monsters by default, as is the case with Mission Control in Mac OS X or with the Activities view in GNOME Shell. There’s nothing wrong with traditional panels and menus. Make them as lean as possible while staying intuitive. I think Windows (with the task bar in Windows 7) and Ubuntu (with the launcher in Unity) are on the right track by adopting the design pioneered by Mac OS X’s dock: frequently used and currently open applications are in the same place. This may first seem dubious conceptually, but it makes more and more sense as applications are becoming more and more state-persisting.

No desktop! When the traditional desktop metaphor dies, make sure the desktop dies with it. Sadly, no major desktop environment seems to be tackling this. The desktop is sort of like a window, but can only be shown by moving all windows out of the way. It lacks a clearly defined purpose and tends to clutter up one way or the other. Get rid of it!

Go tiling! Now that there’s no desktop before which windows can float, windows should float no more. What overstrains users’ (read: my) minds is not more than one window visible at a time. On the contrary, there are many tasks that require working with two applications simultaneously. What annoys users (read: me) is having to arrange windows themselves. Full-screen is a nice feature that moves and resizes one window so that it occupies the whole available screen space. I want that for two or more windows! They should always be arranged automatically to use the screen space optimally. The answer to this plea is tiling window managers, here’s one in action:

A tiling window manager with four windows open and one panel (screenshot by Jonathas Rodrigues)

Current tiling window managers are for technical users willing to do quite some configuration before it works, do a hell of a lot of configuration before everything works nicely, and memorize a lot of keyboard commands. So far all of this has been putting me off going tiling. There is no reason why it should stay that way. Complex GUIs like those of Photoshop or Eclipse already consist of multiple “subwindows” called views that can be rearranged, docked, undocked, grouped etc. freely using the mouse. The same principle could be applied to the whole desktop, for example in a Linux distribution that makes sure there’s a decent set of standard configuration settings, and that special things like indicator applets and input methods work as we’re used to from the traditional GNOME desktop. Monbuntu, anyone?

Developments in Desktop Environments, Part 1: The Awkward Present

Once upon a time, when computer operating systems learned to multi-task, their basic user interfaces started to reflect this ability: applications now ran simultaneously in a number of windows that could be freely opened, closed, moved around and resized on the screen. This was (an important aspect of what is) called “the desktop metaphor”.

Windows 95 with two open windows, task bar and start menu (screenshot by Microsoft)

Always-visible gadgets like “task bars”, “docks” and “menu bars” were introduced for basic tasks like managing open windows and opening new ones.

It took for the advent of super-user-friendly mobile devices (limited multitasking ability, limited screen space) for developers to notice that unlike modern desktop computers, people aren’t actually very good at multitasking. At least for the tasks they do with mobile devices, people are perfectly happy with only having one window, or menu, open at a time.

The new Mac OS X Launchpad (screenshot by Apple)

This trend is now coming to the desktop computer. Apple recently announced a new release of Mac OS X, explicitly stating that many of the new features are inspired by the iPhone and the iPad. The most striking one is Launchpad. It is nothing more than a menu of all available applications, but one that takes up the whole screen. Together with Dashboard and Exposé (now called Mission Control), that’s quite a long list of special-purpose full-screen gadgets taking over window managing/application launching functions traditionally fulfilled by task bars etc. And together with Mac OS X’s new full-screen apps (not quite your traditional maximized windows), it quite clearly marks a turn toward a one-window-is-visible-at-a-time principle.

The Activities view of GNOME Shell (screenshot by DanieVDM)

A similar thing is going on in GNOME Shell. They are cramming everything for which there used to be panels and menus into one full-screen view called Activities, including Exposé-like overviews of the desktop(s). If the multitude of full-screen gadgets in Mac OS X seems confusing, the GNOME approach of cramming so many things into one full-screen view seems bizarre. If upon clicking a button with the ultimate goal of, say, firing up the calculator, the contents of the whole screen change and hide my currently open windows, I consider this a high price to pay. In return, there should at least be a gain in focus, as with the Mac OS X gadgets, each of which shows more or less one kind of thing only.

So what is a desktop environment developer to do if she really wants to advance the state of the art instead of just haphazardly introducing new misfeatures (or taking it slow with moving away from the traditional desktop metaphor, as Microsoft does)? Is there a happy medium between overview and focus? Bear with me for Part 2: The Glorious Future.

Tags Suck

I feel a little schadenfreude about the potential demise of Delicious. Not for popularizing social bookmarking, I like that a lot. What I resent them for is popularizing tags. Tags since infest services like Flickr, many blogs and Mendeley. If you listen to their advocates, you will be told that tags are one of the cornerstones of the Web 2.0, and even more so of the coming Web 3.0. To me, it seems that tags are an essentially useless technology that has somehow managed to become a remarkably long-living fad.

Sure, you can tag things (webpages, videos, books, research papers…) with keywords descriptive of their content. That is a 20th century librarian’s approach to making sure stuff can be easily retrieved. We live in the age of fulltext search, machine translation and the AwesomeBar (I myself stopped using Delicious the very moment Firefox 3 came out), at the dawn of semantic search and object-class detection in images. A Web service that relies on users sitting down and tagging stuff must be failing to use and further develop this technological potential.

So as long as you just want to retrieve stuff from a big bag of documents, search is your friend and tagging is slave labor. But what, the song of praise for tags goes on, if you want to order things, to structure them, to gain a deeper understanding of their relations and to improve your overview over the knowledge they represent? For this purpose, I hear, 20th century people used folders and put everything into a tree structure. The 21st century digital native social media Übermensch, on the other hand, uses tags. The obvious reason is that folders are so one-dimensional and rigid and you can classify things by only one dimension (or you have to first classify them by what to classify them by). Ordering schemes for pre-enlightened world views, those trees! The earth is a disc and built around heavenly Jerusalem, and everything has its one place and purpose, that’s the kind of insight that fits in folders, isn’t it?

I beg to differ. The “ordering schemes” you get by tagging stuff are aptly depicted by one of the most popular visualizations for tags: a cloud. A vapor. Nothing the human mind can really make sense of. Nothing that represents relations or insights. The only structured views on this cloud are filters, showing all items bearing a certain tag or combination of tags. Lists which are in no visible relation to each other. Venn bubbles bubbling around in the cloud. An excessively primitive database that does little more than a search engine but involves a hell of a lot more tedious human work. Concerning the collective knowledge aspect of this work, here’s what: in the time it would take you to tag a collection of bookmarks concerning a topic, rather write a blog article or a new paragraph for a Wikipedia article and let Google’s algorithms do the keyword extraction part for you. I’m sure you’re doing humanity a greater favor this way.

What you get by carefully organizing things into a tree structure, on the other hand, really is an ordering scheme. In the process, you weigh dimensions, you pick one as the one to order by, and discard other dimensions that are less useful for organizing your knowledge, honoring the fact that unlearning is an important part of learning. You think hard about things in order to find the best ordering scheme. Often you will find that there is no single dimension by which all things can usefully be ordered, and you will split them up into collections in each of which a different dimension is more relevant. These splits will likely be driven by your needs for your current project, and your information bookkeeping becomes goal-oriented. And isn’t this what dealing with the stuff and organizing it is all about: learning something from it so you can do something with it? And with the way the human mind works, I claim boldly, you haven’t really “got” something (information doesn’t turn into knowledge) until you have succeeded in putting it into a tree shape. Folders rock.

LaTeX, PSTricks, pdfTeX and Kile

Many people writing scientific documents in TeX know the problem: on one hand, you want to use the more modern pdfTeX rather than LaTeX, for example because of the hyperref package or because you want to include pdf, png or jpg images. On the other hand, pdfTeX fails to produce figures that make use of PostScript, as is the case when using the very useful PSTricks. There are a number of possible ways around this problem. What is working well for me right now is a solution kindly provided by Wolfgang. Create PSTricks figures as separate documents using the following skeleton:

\documentclass{article}
\usepackage{pstricks}
\pagestyle{empty}
\begin{document}
% your graphics here
\end{document}

Then autocrop the document and save it as a PDF file using the following shell script:

#!/bin/sh

latex $1.tex
dvips $1.dvi
ps2eps -l --nohires -f $1.ps
ps2pdf -dEPSCrop -dAutoRotatePages=/None -dUseFlateCompression=true $1.eps

Then you can include the graphics (in PDF format) from your main document, which you build using pdfTeX.

Since I use Kile for writing in TeX, I replaced the shell script with a build tool which I called IlluTeX. It amounts to the following additions in ~/.kde/share/config/kilerc:

[Tool/IlluTeX/Default]
autoRun=no
checkForRoot=no
class=Sequence
close=no
jumpToFirstError=no
menu=Compile
sequence=LaTeX,DVItoPS,PStoEPS,PStoPDFEPSCrop,ViewPDF
state=Editor
to=pdf
type=Sequence

[Tool/PStoEPS/Default]
class=Convert
close=no
command=ps2eps
from=ps
menu=Compile
options=-l --nohires -f '%S.ps'
state=Editor
to=eps
type=Process

[Tool/PStoPDFEPSCrop/Default]
class=Convert
close=no
command=ps2pdf
from=eps
menu=Compile
options=-dEPSCrop -dAutoRotatePages=/None -dUseFlateCompression=true '%S.eps' '%S.pdf'
state=Editor
to=pdf
type=Process

Like/Gefällt mir/Мне нравится

In a recent blog post, Geoffrey K. Pullum writes:

Twitter merely coined a verb meaning “send a message via Twitter”, but they didn’t specify what linguists call its subcategorization possibilities. They added the verb to the dictionary, but they didn’t specify its grammar. The verb tweet is gradually developing its own syntax according to what it means and what its users regard as its combinatory possibilities. That is a really interesting, though unintended, large-scale natural experiment in how syntactic change works. And it is running right now, every minute of every day.

If Facebook has, similarly to Twitter, coined a new verb, it’s probably like. Sure, that word existed before, but the way it’s employed on Facebook, it has developed an altogether new meaning. When you “Like” something on Facebook – i.e. you click the “Like” button – you thereby do not “like” it in the old sense – rather, you already liked it before and you now announce this to your friends. In the old sense of the verb, you are the experiencer of an affection. In the new sense, you are an agent, a deliberate performer of an action. The subject of the verb has a different thematic role in each case.

In the German translation of Facebook, the verb gefallen was chosen to translate like. This captures the old sense of like very well, much better than the perhaps more direct translation mögen. On the other hand, gefallen is having difficulties assuming the new sense, that of clicking a button to display one’s approval or enjoyment of something.

I think this is because gefallen assigns the experiencer role to its (dative) object rather than to its subject. For illustration, consider the English verb strike which does the same thing in sentences like “It strikes me that you are losing weight”: the verb is used to describe a situation where somebody experiences something, e.g. the striking perception that another person is losing weight, and the experiencer is described by the object of the sentence, e.g. me. Like is different; here, the experiencer is described by the subject of the sentence. Thus, when translating English like to German gefallen, the syntactic arguments need to be swapped: “I like this” becomes not “Ich gefalle das”, but “Das gefällt mir.”

Why does this prevent gefallen from assuming the new sense of its English counterpart like? Couldn’t “I recently liked that park on Facebook” analoguously translate to “Dieser Park hat mir neulich auf Facebook gefallen”? This sounds very weird to me, and I think the reason is a restriction on the mapping between thematic roles and syntactic arguments. Remember that the syntactic argument that was assigned the experiencer role in the old sense is assigned the agent role in the new sense. And to my knowledge, agent roles are only assigned to subjects in German (and also in English).1

If this were to change by gefallen acquiring a new sense where the dative object fills an agent role, this would pose many syntactic problems. How would you translate “Like this on Facebook!” or “I decided to like the park on Facebook” to German? Imperatives are always addressed to the (invisible) subject, and control always identifies the (invisible) subject of the embedded clause (“to like this park on Facebook”) with the subject or object of the embedding clause (“I decided”). One could construct “Der Park hat sich entschieden, mir auf Facebook zu gefallen”, but that would mean the park decided, not I.

So how do German speakers deal with the challenges posed by grammatically strenuous gefallen being the official translation of Facebook’s ubiquitous like?

First of all, as Facebook’s UI itself is concerned, “Like” and “Unlike” are translated quite freely with “Gefällt mir” (“I like”) and “Gefällt mir nicht mehr” (“I don’t like anymore”). This avoids using a new sense of the verb and rephrases things to use the old sense, by allowing the user to describe herself as an experiencer rather than explicitly offer her the possibility to become an agent. The description does not match reality perfectly, of course, for when I unlike something, that does not imply I don’t like it anymore, it just means I no longer want to commit to that on my Facebook profile.

In status updates about liking pages or links, the issue does not arise, as the English original itself talks about liking in the old sense, as an affectional state rather than an action. After all, it says “Peter Schwarz likes Conny Fuchs’s link”, not “Peter Schwarz liked Conny Fuchs’s link.” Interestingly, the relatively free word order of German makes it possible to keep the structure of such messages using gefällt, putting the dative object before the verb: “Peter Schwarz gefällt Conny Fuchs’ Link.”

Before the verb is even the preferred position for the experiencer in most contexts. Nevertheless, the prototypical main clause word order in German still starts with the subject. And person names are not marked for dative case.2 So the above could also be read with Peter Schwarz as the subject and Conny Fuchs’s link as the object. When Facebook’s “Gefällt mir” button started becoming ubiquitous on the German-speaking Internet, I actually expected people to start using gefallen exactly like like in the new sense, with an agent subject and a theme accusative object. It is not unusual for German verbs to assume semantic and syntactic argument structures from English counterparts, which is then bemoaned as an Anglicism once it has irreversibly settled in. An example is the verb erinnern (remember). The standard way to say “I remember this” in German is “Ich erinnere mich daran”, with an accusative reflexive pronoun and a prepositional object. However, recently “Ich erinnere das”, with the same structure as in English, is also frequently heard. Or maybe this non-standard usage has been around forever and I’m just interpreting it as a new Anglicism. (See johannes’s comment below.) To come back to my point, no, I haven’t seen or heard gefallen used with the argument structure of like yet. The new sense of like doesn’t seem to have a lexical counterpart in German yet.

Instead, gefallen is used with a slightly different sense in the context of Facebook – “Mir gefällt das” not meaning that I like it but that I made liking it part of my Facebook profile – but with the same argument structure (experiencer subject, theme dative object, no agent), still describing a state, not an action. As long as the context does not absolutely require an agent, gefallen in this sense is used rather consistently, as some of tonight’s first Google hits for „auf facebook gefallen“ show:

  • Wenn dir beispielsweise etwas wie ein Buch, ein Film oder jemand wie ein Sportler gefällt, wird diese Verbindung genauso Teil deines Profils wie dies der Fall ist, wenn dir Seiten auf Facebook gefallen. (Facebook Help Center)
  • High Live  würde sich freuen, wenn noch mehr Leuten „High Live“ auf Facebook „gefallen“ würde… (High Live’s page)
  • Die Seiten oder Produkte, die Mitgliedern auf Facebook gefallen, generieren automatisch entsprechende Vorschläge auf Amazon. (Social Media Pro)
  • Wir haben für euch auf Facebook eine einige Seiten erstellt, die für Spieler gedacht sind, denen unsere Seiten zu Blizzard, Diablo, StarCraft und Warcraft auf Facebook gefallen. (BlizzCon 2010)

There are some bewitchingly creative variations:

  • Gaggle ist auf diversen Plattformen präsent, über YouTube gibt es Gaggle-Videos, über Facebook werden neueste Nachrichten aus dem Gaggle-Kosmos ausgetauscht, 1253 Personen gefällt das. (Die Zeit)
  • 313’000 Personen finden auf Facebook gefallen an Swarovski. (fuellhaas.com)

And the ultimate solution to the problem that the one who clicks “Like” is not a subject in such constructions has been found by YouTube user Clixoom. He uses a “causative” construction with lassen, enabling him to use gefallen in an imperative statement:

  • lasst euch Clixoom auf FACEBOOK „gefallen“

This is also a creative new use of the phrase “sich etwas gefallen lassen”. The above invitation to like Clixoom on Facebook can also be read as a self-mocking invitation to put up with Clixoom on Facebook.

1 If you don’t count “logical subject” phrases in passive as objects of the verb, which you shouldn’t.

2 In Russian they are, and Facebook doesn’t seem to know how to do that yet even for Russian names written in Cyrillic, which is kind of lame and leads to lots of grammatically incorrect status updates, since the Russian like, нравиться, works pretty much exactly like gefallen.