\lyxframeend Undefined when Using Beamer with Lyx

I’m using LyX for the first time with Beamer. Making the title page was smooth. But when I’ve tried adding a new frame (using BeginFrame) I was confronted with the following error

 \lyxframeend
                 {}\lyxframe{Outline}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

After comparing my document to example (working) beamer documents I’ve found out that you must have an EndFrame command after your last frame. Too bad it wasn’t documented anywhere I’ve found as this little thing drove me crazy.

Using Amarok Generated Playlists (m3u) on Sansa Clip

Few days ago, for the first time, I’ve created a playlist using Amarok for files on my Sansa Clip player. To my surprise (and disappointment) when I’ve unplugged my Sansa Clip and powered it, the playlist showed up empty, unlike playlists which originated in Windows. As I keep my music collection organized in Amarok, the situation seemed to be very uncomfortable.

I’ve decided to compare one of the working playlist files and the “empty” Amarok generated playlist. Two things were noticeable:

  1. Amarok uses forward slashes, like in a Linux environment, and the working playlist used backward slashes.
  2. The working playlist used relative paths without any prefix – directly beginning with the path. Amarok prefixed the relative paths with a dot-slash (./).

After noticing those things I’ve modified my Amarok generated playlist to look like the Windows generated one, and voila, it worked. I tried going through Amarok’s configuration dialogs to find some option controlling the format of generated m3u playlists, but couldn’t find any (I’m using Amarok 1.4.10). So with my newly found wits I’ve looked for a way to make using the playlists easier. I’ve came up with the following one-liner:

find -name "*.m3u" | xargs -I{} sed "s/^\.\///;s/\//\\\\/g" -i'' {}

The command should be run in the MUSIC directory of the Sansa Clip’s filesystem. It recursivey looks for m3u playlists and for each one strips any leading dot-slash and replaces forward slashes with backward ones. It can be used to easily convert all your playlists to the format understandable by Sansa Clip.

Emulating Kav-Mafrid (em-dash) for the David Font

The David font that is used in Culmus-LaTeX lacks support of Kav-Mafrid, the ligature that is created by two consecutive dashes, --. Because the regular Hebrew dash, Maqaf, is position near the top of the line, one can’t use it instead of the Kav-Mafrid and expect a graphically pleasant result (while Kav-Mafrid can replace Maqaf and the text would still look ok). To make things even more problematic, this ligature is supported by Culmus-LaTeX’s default font, Frank Ruehl, which means one can’t easily switch fonts without hurting the layout.
Continue reading Emulating Kav-Mafrid (em-dash) for the David Font

Upgrading All KDE Related Packages in Gentoo

Yesterday, Gentoo marked KDE 3.5.10 as stable on amd64. I looked for a way to upgrade all of the KDE related packages, without manually specifying each one of them. Normally one could do

emerge -avu world

but I encountered some nasty conflicts that I didn’t have time, nor will, to resolve at that time. So I’ve looked for a different solution. To my rescue came qlist for the great app-portage/portage-utils package. This package provides a set of very fast utilities to query portage. I’ve used qlist to list all of my installed packages, grep‘ed the list and piped the result as arguments to emerge using xargs.
Continue reading Upgrading All KDE Related Packages in Gentoo

Installing Lighttpd-1.4.22 on Ubuntu 8.04

I had some problems with the lighttpd-1.4.19 that comes with Ubuntu 8.04, mainly it’s problems of handling the HTTP header Expect: 100-continue (which older versions of Lighttpd return error 417). The problem was fixed in Lighttpd-1.4.21, but 1.4.22 is the newest version so I’ve decided to install it.

As I mentioned before, Ubuntu doesn’t have lighttpd-1.4.22 for 8.04, and it’s also not available in the updates or backports repositories. Fortunately, I’ve found that the package is available from Debuian Sid (unstable). Here are some instructions on how to install it.
Continue reading Installing Lighttpd-1.4.22 on Ubuntu 8.04

Re-distilling PDFs to Reduce Size

I decided to finally learn QT and started to read the “C++ GUI Programming with Qt 4” (first edition) which is available online. The book comes in a zip file that unzips to a huge, 51MB, pdf file. Even when considering the book is quite long (556 pages), the file size is very large compared to what one is used to except. The huge file size made reading the PDF less convinient, as one notices a considerable delay when opening it (especially if the PDF resides on some portable storage), so I’ve decided to play a little and see what I can do about it.
Continue reading Re-distilling PDFs to Reduce Size

Displaying Non-Builtin Math Macros in LyX

I believe LyX is a great tool for writing LaTeX document. It makes writing formulas very easy and it allows you to see the formula as you are writing, as opposed to seeing only LaTeX code. However LyX doesn’t support every LaTeX package and the macros it defines. Sure it doesn’t stop you from using these macros in your formulas, but it doesn’t display nicely, you see the name of the macro instead of a schematic preview.

While LyX doesn’t support many of the great packages out there like mathtools (which I really hope it will someday), you can add some support to your documents. At the beginning of the document insert a comment, via Insert->Note->Comment. Inside the newly created comment insert a math-macro via Insert->Math->Macro. In the name part, put the name of the command you want to add support for. In the second box (caption LyX), use existing LyX commands to mimic how the macro will look like. For example, this is what it looks like for the \coloneqq macro (from the great mathtools package):
math-macro

After adding the math macro in the comment, when you will use the macro inside formulas it will display nicely:
math-macro2

A little explanation how things work. When you define a math macro in LyX, LyX does two things:

  1. Inserts LaTeX code to create the macro.
  2. Displays the macro nicely when editing the document.

While the latter is desirable, the former is problematic. If LyX inserts LaTeX code to define the existing macro, it will cause errors. So when you put the LyX macro in the comment environment, the code LyX generates gets ignored and only the second, desirable, outcome is achieved.

Convert int to string (As Well As Almost Anything)

This is a little code snippet from Open Yahtzee‘s code base that converts all the built-in types and many custom classes (ones that override the << operator) to string.

template <class T> inline std::string stringify(T x)
{
	std::ostringstream o;
	o << x;
	return o.str();
}

I first wrote it to convert ints to string, but later I templatized it so it would work with other types as well. It’s a clean elegant snippet that I thought other might find useful too.

RTL Tiddlers in TiddlyWiki

Update – For TiddlyWiki 5 see RTL Tiddlers in TiddlyWiki 5.

I’ve been using TiddlyWiki for a while now, and it became a very useful tool for me. Today, I’ve decided to organize my various recipes (somehow cooking and especially making deserts has turned into an hobby of mine), and as you can expect I’ve decided to use TiddlyWiki for the tasks.

There was a slight problem as some of the recipes are in Hebrew, and it seems TiddlyWiki doesn’t have built-in support for RTL (right-to-left) tiddlers. However, such support can be added via custom stylesheets and the tiddlers’ tags. The idea for this method is taken from this TiddlyWiki.

Create a new tiddler called “StyleSheet” (without the quotes). This is a special tiddler (a shadow tiddler) that lets you add additional CSS code for your wiki. Insert the following code into the newly created tiddler:

/*{{{*/
div[tags~="RTL"].tiddler {
    direction: rtl;
}
div[tags~="RTL"].tiddler .subtitle {
    direction: ltr;
}
div[tags~="RTL"].tiddler .tagged {
    direction: ltr;
    float: left;
}
/*}}}*/

Now for every tiddler you want to be in RTL direction just add RTL to its list of tags. After you do it, the tiddler will appear correctly. Here is an example of what in RTL looks like after the fix:

A screenshot of an RTL tiddler
A screenshot of an RTL tiddler