Saturday, August 28, 2010

My life with Ben, episode 1

I've been using (and abusing) my Ben Nanonote daily now for several weeks, simply to find out whether this little machine is just a little gadget or really a useful device. In the meanwhile, I found out several things:
  • The feet will come off, so maybe you'd better fix that before it happens, because the changes are you'll never find them again. Using it without feet is not an option, because it will wobble. Which is very uncomfortable and irritating.
  • When the screen fades to white, it hasn't given up. Relax, hook it up and it will recharge. The battery is dead, not the screen.
  • I will boot the Nanonote when I'm on the tramway and it will usually still have juice when I get home eight hours later, unless the screen has been heavily used - at least that is the impression I have. I haven't tested this under controlled circumstances yet.
  • Unlike the iPad, it does have multitasking. You can switch between consoles by pressing [CTRL]-[ALT]-[F1], [CTRL]-[ALT]-[F2], [CTRL]-[ALT]-[F3], etc. Even when you're using a graphics application. However, if you try to use two heavy-load applications at the same time (e.g. Gmu), strange things may happen, including a spontaneous shutdown.
So, you may ask, what am I using the Nanonote for all day? Well, first of all, Gmu makes it an excellent Ogg player. The Nanonote comfortably fits in ones pocket and has an excellent sound quality. The uSD card provides lots of space, so you can take all of your favorite songs along with you. Second, the "hnb" (a sort of KJots) is always just a few keystrokes away, so you'll never have to search for a piece of paper while on the phone. You can even create a spreadsheet using "sc" or 4tHs own "Tiny Commandline Spreadsheet".

I clearly stated "create", not "maintain". Why? Well, IMHO the screen of the Nanonote is just too small to manipulate large amounts of data. You simply don't have any overview. E.g. a line is only forty characters wide, so you can only see three columns at the time. I haven't worked with such small screens since the ZX Spectrum. And even in those days, I didn't feel a spreadsheet was a viable option on that machine.

Don't understand me wrong: it's alright to set up a spreadsheet while "in the field", but at some point in time, you want to transfer that file to a full blown workstation and continue work there. Fortunately, "sc" allows you to export a spreadsheet to a CSV-like format. "TCS" even supports exports to .FODS (OpenOffice), .XLS (MS-Excel), and .KSP (KSpread). "TCS" will be part of the up and coming 3.61.0 release of 4tH.

The same applies to wordprocessing: you simply don't want to maintain a large document on the Nanonote. But what you want to do is to create a document while on the road. I'm a regular columnist of the Dutch "IT Infra" magazine, so I really want to use these lost moments to do some work.

And there the trouble began: there is no wordprocessing package available for the Nanonote. Just a few editors. However, while looking for a "curses" based wordprocessor I stumbled upon "txt2tags", a formatting program written in Python - which is supported by the Nanonote.

The big advantage of "txt2tags" is that you don't have to bother yourself with technicalities like setting margins or papersize, you just type and add formatting instructions like section, bold, bulleted list, link, image, etc. When you're done, you simply render the document in the required format, like HTML, TeX, etc. Very much like how my favorite LyX works.

Now the quest for a suitable editor began. Fortunately, a list of suitable editors was available, most of which were already available on the Nanonote. "vi" was out of the question, because - although I like it for editing source files - it doesn't give me a wordprocessor feel. "nano" just fell short, especially the Nanonote implementation. So I decided to use "joe". "joe" has a "Wordstar" legacy which I do not particularly like (I'm still trying to get the knots out of my fingers while trying to type [CTRL]-[ALT]-[SHIFT]-K-Y-0) but it would have to do. There were three things I wanted to archieve:
  1. Wordwrap and reformatting paragraphs;
  2. Highlighting of tags;
  3. Rendering of the document within the editor itself.
Wordwrap and reformatting
You can customize "joe" by creating a .joerc file within your $HOME directory. Note you have to customize "joe" completely - you can't just single out the options you want to set. The nice thing about "joe" is that you can customize it for particular file types. My "txt2tags" files all have a .t2t extension, so that wasn't too difficult:
-rmargin 39

That did the trick! I could simply type away without scrolling to the right, so all the text remained on the screen. If I had created a gap while editing a quick [CTRL]-K-J would fix the formatting. Mission completed!

Highlighting of tags
This proved to be a bit more difficult. I created a ~/.joe/syntax directory and placed the txt2tags.jsf file there. I edited .joerc accordingly:
-rmargin 39
-syntax txt2tags

Nothing. I turned to the Nanonote mailinglist for help and David Kuehling and Mark Adrian Bell came to the rescue. Mark had been able to activate syntax highlighting by using Davids own "joe" package.

So I uninstalled the native "joe" package and installed Davids. Nothing. Nada. No highlighting. I asked David for help and he figured it out: the -highlight option was missing. He found that one out by incident when using another .joerc file. I would never had thought that because the -lightoff option was disabled.

And that is the problem with "joe". IMHO it is not sufficiently documented. You can surf the web for hours - like me - without finding any useful information. Sure, if you just want to make a quick edit there are lots of tutorials. But if you really want to do some serious customizing, you're very much on your own.

Rendering of the document
Integrating the "txt2tags" program was the last step. The only help you can get is the glossary here and a few odd examples scattered around the web. Fortunately, you can type in the commands at the prompt after typing [ESC]-X. I finally decided on:
:def render savenow,if,"!joe(sys,\"[path]txt2tags \",name,rtn)",then,msg,"*ERROR* file not generated",rtn,endif

This will save the current file, call the "txt2tags" program and print a message when an error occurs. I just needed to bind it to a key (I choose [ESC]-C) and that was it.
render ^[ c Compile
render ^[ ^C Compile

Now it seems quite easy but I hammered away for hours at the prompt before I got it right - sort of. Rendering is not particularly fast, but for short documents (about 500 words) it will do just fine.

Wordprocessing on the Nanonote
So now we're in for business. I will just scratch the surface, because "txt2tags" is very well documented.

The first three lines are reserved to the title, the author and the version. If one or all of these are missing just leave them blank. The next lines can be used for the configuration area, e.g. the format you want to render the document in. In the Nanonote implementation, the %!target: tag is required. You can put any supported format there, like tex (LyX) or html (OpenOffice). If you want to generate a Table of Contents, you can add:
%!options: --toc

After that your text follows. Simple tags like "**", "+", "//" are used to indicate bold, bulleted list, italic, others can be used to indicate numbered or unnumbered section headers. You'll get the hang of it soon enough, it's very intuitive.

When you're done, you simply hit the [ESC]-C key and within a few seconds you're done. You can now transfer it to your main machine by using the uSD card or scp. Done.

This is how it looks in OpenOffice:

And this is LyX:

Well, that's it for now, but I'll be back soon with some more unexpected uses for the Ben Nanonote that go beyond the "Barbie notebook for little girls with too much money". Have phun!


bsjones said...

Cool. Getting mine delivered in the next day or so primarily as a music player. Will keep following you for other uses and hopefully share mine

Roberto Alsina said...

Why not use restructured text? It can generate almost anything, is very powerful, and the plain text "source" is very readable.

The Beez' said...

Several reasons: first, it is a "one-script only" install. Second, I personally find txt2tags requires less typing and needs less space. Third, it provides highlighting. Fourth, if you want to use restructured text, you can interface it just as easily with my instructions. Capabilities don't seem to differ too much, at least not where basic formatting is concerned.

Alcy said...

This nanonote "series" is turning out to be good man. I have been playing with mine, and this little thing is really amazing. I have tried the official image, the debian one and also jLime. The last one is my favorite in terms of the best out-of-the-box experience. You should really check it out, I am pretty sure you'll like it ! :)