Donnerstag, 5. Februar 2015

LaTex, datatool and MS Excel: Troubleshooting

Recently I got the time to write some proof of concept LaTeX and tinker with packages that I hadn't played with before. I wanted to share a few of the experiences here that will probably help debugging for some of you easier:

XLSX to datatool
Theoretically datatooltk should be able to handle xls files and also umlauts and also newlines inside a cell. Practically it didn't work for me. That is version 1.4 from 2015-01-23. Since I didn't have too much time, I exported the table as csv from Excel and continued from there.

1. Encoding

Excel still hasn't gotten around to use UTF-8. So you need to do some re-encoding of your csv file to utf-8. Linux luckily has onboard tools to do so:

iconv -f ISO-8859-1 -t UTF-8 excel-export.csv > excel-utf8.csv

2. Special Characters

Datatool needs to load files with '}' etc. with \DTLloadrawdb and not with \DTLloaddb.

3. Import of Packages

By the way, loading package inputenc before datatool will throw you this following error:

! Package inputenc Error: Keyboard character used is undefined

and loading it before \DTLloadrawdb will likely throw you this error:

! Undefined control sequence.

4. Umlauts and Datatool

It looked like datatool should be able to handle umlauts, but it didn't. So I quickly replaced the umlauts:

sed '
s/ä/\"a/g
s/ö/\"o/g
s/ü/\"u/g
excel-utf8.csv > data.csv

If you have the German "sharp s", a French cedille or accents, this is the time to take care of it. Now there shouldn't be any problem left importing the csv.

5. Multicolumn

Drawing the table itself isn't a big deal, just once you start messing with multicolumns it can. It doesn't like if there is something infront of a multicolumn.

! Misplaced \omit. \multispan ->\omit                     \@multispan
is the error you'll see. Play around with what happens when you add \\ infront of it or \hline. Sometimes that's what does the job.

6. Vwcols, Multicols and Variable Width

I wasn't capable of easily having two columns with different widths and different colors easily with either of these packages. Minipages did the trick.

\begin{minipage}{0.6\textwidth}
\dots
\end{minipage}\hfill\color{red}{\vline}\hfill
\begin{minipage}{0.3\textwidth}}
\dots
\end{minipage}

As a friend once said, in LaTeX it's all about finding the right package.

7. Horizontal lines

An error I ran into from time to time:

! Misplaced \noalign.
\hline ->\noalign
{\ifnum 0=`}\fi \let \hskip \vskip \let \vrule \hrule \let...

This happened especially when the newline was in a conditional before the horizontal line. The problem was solved by moving the newline out of the conditional and infront of the hline

\\\hline

8. Cell borders

Unfortunately cell borders kept disappearing for no obvious reason when I used \cellcolor. After a bit of frustration and research I had to discover that this is not a LaTeX problem, but rather a pdf / pdf viewer problem. Printing the document gave me nice cell borders. You can also zoom in and out, and borders will show and disappear.


This is everything but the clean and real solutions, but it might come in useful while playing with any of those packages. If you have better solutions or comments, feel free to share!

Samstag, 19. Juli 2008

A dance is like a conversation

This text is directly copied from here


Non-dancing friends often ask me if dancing isn't anachronistic, in that men are always leading, asking the follower for a dance. My answer uses a metaphor that I've heard a couple of times: A dance is like a conversation.
Interestingly, this metaphor can be taken quite far. There are many parallels. It is the way I like to think about dancing even if it may not be the standard approach. In the following paper I want to discuss those aspects focussing on the parallels in leading / following and how to put them into dancing.
I will focus on lindy hop since it is the partner dance I mostly do :) and I'll address the leader as 'he' and the follower as 'she'. It's just a simplification, the same statements would apply if I address leaders and followers vice versa or if both are male or female.


A conversation isn't just there. It doesn't fall out of the sky and you start talking. So the conversation needs to be started. Someone needs to ask for a dance. I've almost never run into the situation in daily life that only men start conversations, so why should it be different in dancing? Anyone can start the conversation. To have a conversation you need a language in which you can talk. Technique would be the equivalent in dancing. There are a lot of techniques
including some that just don't work together, which is not to say that one is better than the other. Once the language is chosen you'll need a topic to talk about. The topic often happens to be the music.
Of course it can also be set by the leader or the follower.

We haven't yet started talking, which is considered helpful for a conversation. Let's start out with basics. Leading is talking and following is listening. Leaders, be aware that unclear leading is like mumbling. Your partner doesn't understand you and probably will be
annoyed trying to decipher what you want to say.

Clear communication in one direction is very basic. Usually conversations are much more complicated and so is dancing. A one-sided conversation, in which the leader talks and talks and just won't stop, is boring for the follower. An aspect that is often overlooked is that the leader probably doesn't even want to talk all the time. He'll feel like an entertainer. This is the point where leading and following starts to get interesting because the follower has to learn how to talk.

There are various ways in which a follower can talk. One way for followers to contribute is through stylings. Another, a somewhat more aggressive way would be simply taking over the lead, completely or just for a couple of beats. (Some leaders might be confused or dislike
having someone interfere in their leading; if you don't know in advance you'll need to try it out.) Taking over the lead might also be a good way to get the leader's attention if your leader just won't be quiet. Sometimes talking is a smile or an extra turn that wasn't lead. You have plenty of options here, followers; go and explore them. Finding new ones is very satisfying.

So now that the followers know how to talk we have a problem - we might have two people talking at the same time. Experience will tell you that this doesn't work. So leaders have to learn how to be quiet and to listen. How to be quiet as a leader? It isn't easy, especially
since you were probably taught to lead all the time; maybe the follower even expects you to. Your follower doesn't do any of the above? Well that might be because she has no space for it. Giving
space can be achieved also through various ways. A very common one is to give space in the swingout on the beats 7 and 8, or on 1 and 2 or both. To give space on 7 and 8 just let her continue the direction you started leading and she'll be free to move around, i.e. to
style. Beats 1 and 2 are also a good place; leading in on 3 will give her two more beats.

Followers, generally speaking if there is something you really want to say at that moment, go ahead. The same goes for leaders. Being quiet is definitely not the same as listening. Leaders, if you want to keep a good conversation going you'll need to listen and show interest in
what your partner tells you. Ever been in a class when the teacher told you to "pay attention to your follower"? Listening is exactly what he was talking about. What is she doing? Is she maybe switching styles? Did she just listen or did she talk? Did she switch to a new topic? Be aware also that not listening can easily be interpreted as rude.

Going further: Sentences from two different people do not alone necessarily make for a good conversation. What you need is not just pure talking, but the content of what you are saying should relate to what your partner just said. In a conversation, that can be an answer
to a question or a response to a statement. Responding can be done for instance by taking over the new style that your partner introduced (e.g. adding a bounce), but here again there are so many ways. Be alert and play around.

A careful reader might have noticed that I suggested 'smiling' as a way to talk. Smiling is not a lead, so how come I mentioned smiling? A good connection is not just physical. In a good conversation there are quite often emotions involved. This is nice to know when you are
speaking because it adds an extra communication level which will open a whole new mode of information transfer. It's not so much about the amount, which of course grows too, but you gain the possibility of transferring different types of information. There might even be
different information transferred simultaneously. This level has the nice feature that both of you can transfer information at the same time.

Something I've seen a number of times is the repetitive use of one styling. If you think of everything you do in dancing as talking then repeating yourself all the time is like telling the same joke over and over again. At some point that joke just isn't funny anymore. It is
hard, especially as a beginner, not to repeat oneself because to a certain degree things need to be repeated for learning purposes.So not repeating oneself is addressed more to advanced dancers. If you can listen to the music, try to get new things out of it or watch yourself
and when you find yourself repeating the same things be open minded, look at other dancers, be innovative.

The above addresses only the situation of two people interacting, specifically the couple that is dancing together. But hey, I'm sure you've had conversations with more than two people involved. Having more than two people can be difficult in dancing simply because it's
unusual and seldomly taught. These conversations are usable as well as totally in accord with the above. Stealing¹ is one of those situations. Assume you have one follower and two leaders. Yes, it's very likely that the leaders will communicate a lot trying to find even smoother ways of stealing the follower which doesn't mean nobody is paying attention to the follower anymore. It is a different way. The follower is now the topic of the dance and thus has quite a
lot of influence on the conversation. You can make it easy to be stolen or hard or.... It's a new situation, a new playground!
Another situation, maybe a little more likely, is two leaders doing the same by calling out moves. Of course the main conversation of the leaders is directed at each other and not at the follower. There are two ways of continuing from here. First, if the followers are advanced enough, they can start a conversation with each other. Or if they feel sort of left out, a polite leader will turn the focus back towards his follower. Other situations with more people involved can include
competitions, when the other people involved might not even be dancing. Stay open-minded on conversations with more than two people. They can be fun!

One last parallel, probably the one which will draw most disagreement: If you are asked for a dance it is usually considered impolite to refuse. But looking at the metaphor of conversation, I do think there is at least one good reason for declining a dance. Sometimes you get
asked by someone with whom you just have nothing to talk about. It happens. That conversation would turn out to be very one-sided or pure small-talk and therefore very unsatisfying. To turn down such a dance is in my opinion acceptable. This doesn't mean you should turn down
the dance, and one should keep in mind of course that you can never be 100% sure.


Having said all the above, I hope I was able to give you ideas or maybe simply a more detailed view of dancing. Feel free to pick those parallels that fit for you. I'm very interested in your views and feedback. Thanks to all the people who listened to me while I was still
trying to sort my thoughts on this topic, especially Rocío. Also thanks to Max for improving this paper quite a bit! Before finishing this paper I do want to remind everyone that when dancing, having fun is the highest goal you can aim for.

¹ http://www.gac.edu/~vhailper/docs/stealing.pdf is a little out-dated but will give you the idea of stealing if you don't know what it is

Samstag, 8. März 2008

Putengeschnetzeltes mit Bavette

Dieser Blog wird eindeutig multilingual werden und bleiben. Gestern Abend hatte ich spontan Besuch von Raphael und Folgendes ist was wir gekocht haben.

Putengeschnetzeltes mit Bavette
Zutaten: Putenbrust, Sahne, Zwiebel, Salz, Pfeffer, Champignons, Bavette, Oregano

Zwiebeln in Olivenöl andünsten bis sie glasig sind. Anschliessend Champignons hinzugeben, und anbraten. Putenbrust in Streifen geschnitten in einer anderen Pfanne anbraten bis sie Farbe wechseln. Die Zwiebeln und Champignons hinzugeben. Das Ganze mit Salz und Pfeffer würzen und anschliessend mit Sahne ablöschen. Ein paar Blätter Oregano hinzu und noch leicht ziehen lassen, damit der Oregano Geschmack weitergibt.

Bavette wie auf der Verpackung kochen.

Weitere Hinweise:
Rosmarin könnte sich unter Umständen auch gut machen.

Sonntag, 24. Februar 2008

External USB-HD in full speed

Probably the first reason to create this blog. Something that has bugging me for quite a while. Solving linux problems, and forgetting about them, instead of sharing how to solve them.

I bought an external usb-harddisc Trekstor Datastation maxi m.u. On amazon.com it said it supports USB 2.0. I plugged it into my machine, and it was recognized and mounted immediately. But while copying some data onto it, I saw the transfer rates where 5 MBit/s which is really slow for a USB 2.0 connection. So I checked the connection to find out it's using USB 2.0. To find out about what protocol your usb devices are using, you can use usbview. There should be EHCI host controller(s) and in the drop down menu you should be able to find your harddisc. EHCI modules need to be loaded.

lsmod | grep ehci

will tell you.

So but if it's using USB 2.0 why are the transfer rates so low? The answer is because it's using a sync-ed connection, that is standard mount option in many current distributions. A

mount -o async /dev/sda1 /media/mountpoint


solved the problem. To not have to mount the HD every time you boot manually, the following entry in /etc/fstab will help.

/dev/sda1 /media/disk-1 ext3 async 0 0

Important is the 0 at the end of the line! It'll tell the computer to continue booting even if it's not hooked or if it would encounter any problems with the HD. You'll also need to replace ext3 by the file system you are using.

veggy-pan with rice

Heyho,
This is the first post in my probably not too often used Blog. I'm a complete beginners cook. But I'll post the things I liked. I think it'd be great if you use the comment section to write about your experiences with posted recipes (maybe changes you made) and other solutions in linux posts.


Veggy pan with rice.

Ingredients:
Salt, Carrots, sweet corn, peas, cauliflower, broccoli, bell pepper, kohlrabi, zucchini, cashew nuts, orange/pineapple.

Chop carrots, broccoli, kohlrabi, bell pepper, zucchini and cauliflower. Fry them slowly in the pan. Carrots and kohlrabi first - they take longer, add broccoli, bell pepper, zucchini and cauliflower in a little later.
Chop orange in small pieces (1-2 cm long).
Add peas and sweet corn to the other vegetables.
While it's still frying slowly, fry cashew nuts in another pan. (If you use a little oil, it'll work better). Just do it very shortly, they get burned fast. Add them to the vegetables. Add in a dash of salt. When the vegetables are ready, add the chopped orange. About one more minute and it's done.
Serve it with some rice, that matches well.

Some small remarks:
1. You can use pineapple instead of orange. Tasted good as well. It is different though! Thanks to Steffi (where I had it with pineapple).
2. I personally like it in this case when the rice is everything but grainy. To get that, either use more water, or put a lid on it while it's cooked.
3. Of course you can add all sorts of other veggies.