Git on Windows is extremely slow (Wingit/msysgit)

Git is a great tool. The Windows implementation msysgit makes me unhappy: It is extremely slow on my machine, and if you search on the web, this is not an uncommon problem. Usually I use egit directly from Eclipse, however in one project I have to use git-svn and want more control over whats going on from the command line. (see update below)

But git kills my turnaround time. I found a somewhat bloated, but fast solution: I have a Linux-virtual machine (Ubuntu) that mounts my git directory as a shared directory. Now I am using the Linux shell in the vm. That is actually much faster than the windows git command line.

So if you are suffering from a slow Windows git, you might want to try this approach.

Update

It seem that the reasons for a slow msysgit are manyfold. I was able to fix it somewhat by commenting out the dynamic prompt in /etc/profile
#Comment the lines below
#PS1='\[33]0;$MSYSTEM:\w07
#33[32m\]\u@\h \[33[33m\w$(__git_ps1)33[0m\]
#$ '

However, git svn rebase is still faster in my VM.

 

Tools for the business nomad – mobile wifi hotspots

Today’s business is global and the Internet plays an important role in bringing all the parties together. However, when you actually travel physically around the world, access to the internet for business purposes can still be a problem. If you want to be online will traveling abroad, at business meetings or at customer sites, the horrendous roaming costs can easily spoil the fun. In your home country, you are used to permanent access, but just crossing one border can spoil it all.

Luckily, today it is very easy to get prepaid Internet access in many countries (postpaid / subscription is most often not an option if you are flying in and out temporarily). However, putting a prepaid Internet SIM into your phone stops you from calling and then you might not have a SIM slot in your PC our you might want to have several devices connected to the net at the same time.

One of the most useful inventions to me are the mobile Wifi hotstpots. You just put in a SIM card with an internet access and then that connection is shared through a WLan hotspot in a radius of several meters. And they are small enough to be carried.

So on your way to your business partner, you might find your way with the navigation software on your mobile phone, while still being able to accept and send phone calls. At the site, you open your notebook and are again instantly connected.

I found it easy to get a prepaid Internet in several countries, but you usually have to walk in to a store of one of the providers, because they usually require registration with an official ID (e.g.a passport). In most cases it took me around 15 to 30minutes to actually get my SIM card. Prices vary from country to country, e.g. around 15€ for 1,2GB in Bulgaria or 9€ for 48hours flat in France.

Some tips:

  • Bring your passport. Some countries require a local address: Bring your hotel address
  • Make sure that your name is correctly written on the application, otherwise you might not be able to recharge on the Internet (difficult in countries with alphabets different from yours)
  • Some providers do not support recharge with foreign credit cards through the web
  • Most important: Check the available tariffs before you leave, and print them out. The staff at the store might not fully understand your English or whatever and have a hard time figuring out what you want. Do not expect that they have English material available for you to just point at.
  • Check several providers  at your destination. Their tariffs and plan differ.
  • Some SIM card’s validity is limited. You might have to throw away the application procedure again with some providers the next time you visit the country. Some SIM cards are not limited, only the booked Internet access might be limited and you have to recharge it sometime.
  • Check the APN before (the address that the phone connects to) on the providers website or google for it – you’ll find the APNs on the web. If you buy a SIM card to put into an UMTS router, you have to configure it with the APN. As stores often sell cards mainly bundled with USB sticks, the staff might not understand what you are asking or they might not even know.

Enjoy. I have often found the bandwidth of my prepaid plans to be superior to the WLan of hotels.

European Job Crisis – Where is everyone?

German media is full with news about bad conditions on south European job markets. Young qualified people cannot find jobs. Meanwhile, in Germany, we are facing the opposite situation: Companies are desperately looking for new hires and have difficulties filling their vacancies. That makes me wonder why I don’t see a stronger pull generated from that imbalance. Some German cities are actively promoting their jobs, e.g. in Portugal.

However, I am not seeing a lot of applications for software development positions. That makes me wonder:

  • What is the situation of computer science graduates or young professionals in these countries? Maybe the situation is not that bad?
  • Do you know that German companies are having a lot of vacancies?
  • Does the company I work for, itemis, just not have enough visibility there?
  • Are you afraid of the language barrier? German is probably not one of the easiest languages to learn, but depending on the company, a lot of communication is done in English. Obviously, in consulting jobs, you’d have to learn the language sooner or later (Actually, I hear that German language classes are increasingly popular in Italy right now).
  • Heard bad things about the weather? Well, we are not Sicily, Crete or the Canary Islands. True.
  • Afraid that Germans are sullen careerists that work hard and don’t laugh the entire day? Think again. Actually, obviously we like to work for good results, but most companies I have worked for or consulted at had a very agreeable atmosphere and there was a good share of fun and laughter. And, contrary to what you might expect, we are not that hierarchically inclined. Actually, at BMW, I met an Italian colleague who quit his job in France to go to work in Germany, because he thought that German work culture fits his mentality better. That really surprised me (I like France very much). But then Munich likes to think of itself as “Italy’s northern-most city” ….

 

Use the reply button below. If you are from Germany, what is your experience. If you are from one of the not-so-well-off countries, what is the situation, what is holding you back?

Trac with Java and XML RPC

Trac can be a pragmatic and extensible issue tracking system. There is a large number of additional plugins. However, when it comes to reporting, I could not find a plugin that would create statistics as I needed them.One option would be to extend existing plugins – however, that has to be done in Python and creating charts and statistics is very nice todo in Excel. A pure CSV export didn’t help, because it would have required too much processing of the data in Excel.

So one approach is to extract the data with Java and the XML RPC interface. Since I could not find any real code templates for that on the web, here is an example that might be help others:

This can be used to create images like this:

Xtext End User / Domain Experts Cheat Sheet

The basic idea of domain specific languages is to provide domain experts with an easy to use language for their modeling needs. However, a domain specific language is always tied to a tool for editing the model. With Xtext, this is obviously Eclipse. Eclipse provides some rich editing features, especially for navigating in models.

Most existing cheat sheets refer to the Java IDE of Eclipse, which you cannot give to domain experts because it contains elements not relevant to them (debugging) or have a slightly different meaning.

So here is an attempt of a small cheat sheet for Xtext end users (domain experts):

 

Editing

ALT-Left and ALT-Right Back / forward Go back and forward in history of where you were in editors
CTRL-PgUp and CTRL-PgDown Cycle tabs  Cycle through tabs of open editors
CTRL-Up and CTRL-Down Scroll  Scroll line up and down
CTRL-M Maximize  Maximize / Restore current editor window
CTRL-W Close Close Current Editor
CTRL-D Delete Line Delete Current Line
CTRL-/ Toggle Comment Toggle Comment for line / selection
CTRL+SHIFT-F Format Auto format
ALT-UP / ALT-Down Move Move current line / selection one line up / down
CTRL-Q Last Edit Go to last edit location
CTRL-L Goto Go to line

Model Editing

Ctrl-Shift-G Find References Find all elements that refer to the current element
F3 or CTRL-MouseClick Follow Link Follow reference under cursor
Ctrl-O Pop up Outline Pops up an outline for easy navigation / filtering
CTRL-1 Quick Fix Quick Fix of Errors (where provided by DSL designer)
CTRL-SPACE Content Assist Get suggestions of possible values
ALT-SHIFT-R Rename Rename current element (will rename other occurrences as well.
CTRL-SHIFT-F3 Open Model element Locate a model element in your workspace (only exported elements are listed)
ALT-SHIFT-Up / Down Expand selection Expand selection to containing element

Xtext Global and Local Scoping – overview

Just recently I posted a small article with an overview on the Xtext scoping architecture. One of the things that took me a while to understand is the difference of global and local scoping. Several people I discussed this had their own ways to explain these. Here is my current way of explaining some types of scoping in Xtext.

Assume that we have a language that supports defining classes, much like in UML: A class can have a name, attributes and it can inherit from another class. And we want to support models that consist of several Xtext files.

Suppose we have the following two files:

A simple definition of two classes, with B inheriting from A. So, obviously we are having a reference from B to A (inheritance). In the grammar that could look like

and Xtext supports us by providing all the automatic linking when it sees “inherits”. But how does it know what to link? If all our models were restricted to be contained in one single file / resource, it would be easy: Just get the current resource and traverse all the contained model elements to find one that matches “A” and set up the link.

Global Scoping

But now, with models split over several files, what do we have to do:

  1. First, find all the model files candidates that could be relevant for our search
  2. Define a strategy to decide if a model file is really considered for traversal
  3. Traverse the model file and find all the candidates that could match our reference to “A”

We wouldn’t want to to this manually. Luckily, Xtext does it for you – actually, it does it a little different, since the approach above would be inefficient – traversing all the model files for each reference would be slow.

So, every time a file changes, Xtext collects the objects and the names that they are known by and puts this information into the index. So instead of traversing all models in all candidate files, Xtext just has to have a look if there is a matching entry in the index. Assuming that the classes above would be contained in a package called “P”. The index could contain:

name Object
P Package “P”
P.A Class A
P.A.a Attribute b
P.B Class B
P.B.b Attribute b

But would we want to see all the possible candidate elements in our reference (types are automatically checked). In most cases no. So Xtext provides several mechanisms to “restrict” the search. Please the the Xtext documentation for details:

  • URI imports: You can have import statements, that actually reference the full URIs of the other files to be considered.
  • Namespace import: You can define a namespace import. If you than provide something like “import P.*” in your grammar, the search will be restricted to those elements whose fully qualified name starts with “P.”
  • Java class path based

There is additional ways to tweak and modify Xtext behavior and there is more data stored in the index (references) etc. But I hope this gives you the general idea. However, the story is not finished.

 Local Scoping

Now suppose we want to have a second grammar, where we define instances of the classes and values for their attributes, just like this:

Since the classes are in a separate file, it is obvious that the link from the instance to its defining class is done in the way described above. But also the attributes values are linked to the attribute definition in the class model, so how is this done?

Obviously, we could also just use the index. But we have to restrict the possible references as well, since in instance “a”, a reference to attribute “b” would not be valid. So what we could do is to get the list of possible references from the index, traverse the class hierarchy and filter out all attributes that are not valid.

But, for finding all valid attributes, we are traversing all attributes in the class hierarchy anyway. So why not forget about the index, and just build up the list of possible references while we traverse the model? This is done by local scoping, which you can easily customize to modify the list of reference candidates. See the Xtext documentation on how to do that.

So, then why do we need the attributes in the index? Simple, we don’t. The list of possible attribute values is calculated by us, so we don’t need them there. For our own Xtext grammars, we can override the strategy of what is put into the index and what not. So we decide to not put attributes in the index. Xtext per default cannot know what you want to put in the index, so it puts in everything from your model that has a “name” attribute. It might be worthwhile customizing this behavior, since it could save us a lot of CPU and memory.

 Summary

For me, it is useful to divide scoping in two different aspects:

  1. I can find out the possible candidates of a link by traversing references in my model. The traversal can easily span multiple resources/files, as long as the traversal can be done by standard EMF means.
  2. To find the possible candidates, I would have to think about a strategy on which model files to load etc. I cannot access these candidates by traversing the references that I already have, because I might not even reach those models –> global scoping.

 

 

My mental Xtext high-level model

While Xtext is a powerful tool, it is sometimes easy to loose the big picture of the linking, scoping, global scope etc. For my own mental relief, I have made a little diagram, which might be useful for others (no guarantee for correctness or level of detail). It applies only to a specific configuration (using Xbase and Imported Namespace Aware Scoping).

 

So basically what happens is:

  1. Parsing: The framework parses the model files (Xtext-files). Links between elements are not resolved yet.
  2. Index Building: The model is traversed, and basically everything reachable that has a name attribute is packed into an EObjectDescription and that is put into an index. What is put there can be customized. Caveat: EObjectDescription allows you to have some user data stored with your description in the index. Often the first thought is, to store e.g. some type information or, e.g. in case of class models, some inheritance information. However, references are not yet set up / linked. So you cannot put anything in the user data that would traverse link references!
  3. Lazy Linking / Scoping: This is where the actual linking is done. In our case (Xbase-based language), this scoping is based on XbaseScopeProvider. This actually delegates to some Guice-configured class, which in our case is an ImportedNamespaceAwareLocalScopeProvider. This looks for model elements with the attribute “importedNamespace” in your model and pulls the objects from the index, that match any of the importedNamespace values (you can specify wildcards in the imports).
    In addition, in these classes you can add your own scopes, the local scopes, which are derived from the existing model information.
  4. Content assist: Uses the scoping data for suggesting alternatives.

The index is transient in memory and is loaded from / stored to disk on start / stop of Eclipse. During run-time there is no up-to-date representation on disk. The org.eclipse.xtext.ui.shared.Access class can be used as a handle to index data.

 

Learning foreign software terminology with Anki

Despite English being the lingua franca of software engineering, there are still good reasons to learn to talk in foreign languages if you are doing international business. Locals will often communicate in their mother tongue and not all languages use so many English technical terms like German. France’s académie française makes sure that there are technical terms in French and the sheer amount of Chinese speakers and their language structure calls for chinese words.

So, if you are going abroad and want to learn a language, memorizing the vocabulary is one of the most important parts. But instead of writing vocab lists on sheets of paper or on cards, there is a very nice software that supports you in learning: It is called “Anki” and it is available for PC, Android, iPhone and others.

It is a software supporting a spaced repetition system (SRS), which essentially means that you’ll see those entries that you are not good at more often than those which you know well. And you can sync all your cards between PC, Android, iPhone comfortably. A large number of word lists are available for several languages and you can easily define your own deck of cards, e.g. with software terminology or sentence patterns.

And you are not limited to using Anki for learning languages. You can use it for all kinds of studying: physics formulas, law, business, etc.

Anki has become one of my favourite tools.

 

 

ReqIF and Word Import

About a week ago we’ve uploaded the initial code contribution to  Requirements Modeling Framework (RMF). In addition, we’ve been using the tool and created some additional (not published) utilities.

Word documents are one popular way to document requirements. We too have some requirements in Word format to be imported into ReqIF format. It takes about one page of source code to implement a tool that takes a Word document and converts it to ReqIF (although we are currently not handling text formatting).

ReqIF uses xhtml to store formatted text. So quite some functionality of a Word to ReqIF conversion would go into this transformation.

We have been asked for a PDF to ReqIF conversion as well. However, my experience with commercial pdf to word conversion tools does not make me too optimistic about the feasibility, because the information in the .pdf is probably too low-level.

It turns out that our framework is a powerful tool to provide tools and functionality around ReqIF.

Icon from: <A href=”http://www.vistaico.com”>VistaICO.com</A>

Links for the ReqIF Talk at Eclipse Con Europe 2011

If you attended my talk at Eclipse Con Europe on the RMF project, here are a few links that might be useful:

Additional Topics

Next Chance to see: