The writings of Peter Stuifzand

Archive for January 2007

It looks like big buttons are in. Especially big buttons, that can be changed and be pressed.

The Nokia 770 (and N800 now too) needs an extensible remote control application, that will show buttons and start applications. It should be possible to start and stop music, choose a next song, call websites via wifi, open applications, connect my bluetooth connection. Just with a press of a button.

Is there anyone that knows an applications like this for the Nokia 770, or is there someone who knows how to write one.

I always wondered why vim didn't have the just-one-space function. It's one of the most useful functions that is available during coding.

So today I tried to write one myself, the newsgroups and searchengines didn't come up with something good. First of course it is a good idea to understand the effect of this operation. The just-one-space function removes all whitespace around the cursor and replaces it with one space character.

How can this be done in vim. The replacement part isn't that hard. It can be done with one :s///, something like: :s/\s+/ /. This will of course remove whitespace from the wrong place, at the start of the line.

The missing piece in this substitution is of course the place of the cursor. So I started looking for it. Most help text about the substitution operator can be found on :s helppage (:help :s). But there is no mentioning of the first part of the substitution. The description of the vim regexp engine can be found at the regexp help page (:help regexp). This contains a description of all the possible meta characters that can be matched. So I the meta character that will match at the cursor position (\%#). This solved the second part of the problem.

:s/\s\+\%#\s\+/ /

This will remove the whitespace surrounding the cursor. The only only problem that still isn't solved is the problem that the cursors moves to the beginning of the line. It would be better if it stays at the same or a the end of line if there is not enough room to go to the last position. Probably the best place to put the cursor is on the first character after the inserted space. I may have to look into that a little more.

The function is finished by adding the e flag at the end of the substitution. With the e flags the :s will be silent when the first part of the substitution doesn't match.

I bound the function to the spacebar in normal mode with the following command:

:nmap <space> :s/\s\+\%#\s\+/ /e

I will try this for some time and look how it works, could be good or better.

It looks like the internet is a giant lesson in synchronicity. Somehow it isn't strange that the internet of all places is the place where all these synchronous things happen. There are so many people already in there.

Last week I was boring my colleague about how to peel a banana. And today I read an blog entry about it: How to properly peel a banana The author did a bit more research than I did and found this How to Eat a Banana: a Design lesson

It also looks like 2007 is going to be a year with more pictures. Let's hope so!

Step 1

Take the banana in your hand with the stem (of steeltje) to the bottom.

Artistical banana

Step 2

The next picture shows the wrong way to peel a banana. This is the way of death and mushy banana.

Peeling the banana from the stalk

The actual step 2

Right way to peel a banana is from the bottom

As you can see the easy part is the peeling, but how to hold the other hand, of course no one likes to see the above in public. Maybe we have to get used to it.

Step 3

No picture here, the banana was already gone when our photographer wanted to take the picture. Nasty monkeys (or apes if you're into that kindof thing).

Next time: how to properly take photographs of bananas while holding the camera and banana far enough to get it actually pretty on the picture.

View archived entries