An Early Release of the New cssrtl.py-2.0

It has been three years since I released the original version of cssrtl.py (and two since its re-release). The old version did a nice job, but experience gained during that time led me to write a new version from scratch. More than a month ago, I detailed the basic principles and ideas that guided me in designing a better tool to help adapt CSS files from left-to-right to right-to-left.

The guidelines weren’t just empty words; they were written while working on the Hebrew adaptation of the Fusion theme and at the same time writing a new proof-of-concept version of cssrtl.py. The original intent was to release a more mature version of that code when it was completed. However, due to the apparent shortage of time in the present and foreseeable future, I can’t see myself completing the project any time soon. So, following the “release early” mantra, I’ve decided to release the code as-is. As I said, the code is in a working state, but not polished, so it may be beneficial but may contain bugs. If you find any bugs or have any suggestions, I would be glad to hear.
Continue reading An Early Release of the New cssrtl.py-2.0

Simple AI Engine for the Oware Game

Some time ago I worked with a friend on building an Oware game. I was supposed to build the AI engine, and he was supposed to build the user interface for it. Unfortunately, while the AI engine interface I designed and a simple alpha-beta pruning engine were implemented, the project was never completed.

Screenshot of game session
Screenshot of game session

Continue reading Simple AI Engine for the Oware Game

Simple Histogram Widget for wxWidgets

When working on Open Yahtzee 1.10 (or whatever I’ll call the version after 1.9), I wrote a simple histogram widget to be part of the new statistics dialog. I should emphasize the simple part: this widget was meant to display a simple histogram without requiring any special, bloated plotting libraries. It doesn’t support all the fancy stuff, just a plain histogram.

I figured that a simple pie plot would better serve Open Yahtzee’s needs, so unfortunately this code will not be released as part of the program. While the code is not perfect, it’s functional and serves as a good example of a custom widget. So I felt pity at letting it fall into oblivion in Open Yahtzee’s SVN repository, and I thought it might come in handy to someone else (or at least to me) if it were easily accessible.

simple_histogram

Continue reading Simple Histogram Widget for wxWidgets

Sociable Plugin Doesn’t Play Nice

I’ve been using the Sociable plugin for adding easy “share” links to the bottom of my posts. Up until yesterday, I’ve been using the 2.x versions of the plugin, but yesterday I upgraded to 3.4.4. Today, I’ve noticed to my surprise that the plugin automatically adds a box to my admin dashboard with “The Latest News from Yoast,” Yoast being the plugin’s maintainer, Joost de Valk’s, blog. The plugin itself doesn’t feature any way to completely disable this “feature.” One has to hide it using the dashboard settings. While this may seem benign, in my opinion it’s pushing the limit. If I’m interested in getting updates from that blog, I would sign up to its RSS feed. I don’t like getting “free” functionality that’s not advertised in the plugin description.

I must add that as a user of the Sociable plugin, I’m more than satisfied. I probably won’t stop using the plugin just because of this issue, but it still seems to me like improper manners.

Designing a Better CSS RTL Converter

About a year and a half ago, I’ve released cssrtl.py, a script that translates CSS code to RTL. The script was designed to be fully autonomous; however, translating CSS code is a complex task, as not all the information needed to make the translation is available in the CSS files. While cssrtl.py did a very good job on some tasks, it falls short in several areas:

  1. When a design update is released, one cannot use previous translation work.
  2. When things don’t go smoothly, it’s hard to find out why.
  3. Complex CSS can’t be translated automatically, as it requires understanding the structure of the corresponding html files and how the CSS will be used by future code.

Continue reading Designing a Better CSS RTL Converter

Overlooking the Simple Solution

A few days ago, I’ve decided to start logging my rowing sessions. I disliked the idea of keeping the log on paper, so I’ve looked into a computerized solution. I ruled out Concept2’s online log book because I wanted something private that wouldn’t require me to register on yet another website (and sometimes internet access at my rowing club is broken). Soon, I’ve decided to manage the log using TiddlyWiki, a client-side HTML+JS wiki, which I wrote about in the past. It has some nice features:
1. It fits in a single self-contained file that is perfect to put on a USB stick.
2. It has built-in search features.
3. It allows great flexibility in how to log my sessions – there is no predefined format that I need to struggle to fit my sessions into.

The TiddlyWiki solution seemed great, and I’ve started using it. But as the title says, I merely overlooked a much simpler, yet equally powerful, solution – a simple text file. Porting my rowing log to a simple, old-fashioned text file provided me with all the relevant features of TiddlyWiki, such as search, flexibility, and working from a USB stick, while using less space and being editable using a basic text editor (or the powerful vim). Using reStructured Text, I got a nice readable journal that can later be processed into even nicer-looking HTML files.

We all want to believe that we know how to match the right tool to a task. But maybe, because we tend to adopt newer technologies and utilities all the time (because for a lot of tasks they do provide better tools), we end up overlooking simpler, “old-fashioned” solutions. If I take a moment now to look around, I can come up with several other places where new stuff is used instead of simpler solutions. Take a look around you, and I’m sure that you will be able to find some too.

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 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., `Ihbox'). 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 looked, as this little thing drove me crazy.

Using Amarok Generated Playlists (m3u) on Sansa Clip

A few days ago, for the first time, I created a playlist using Amarok for files on my Sansa Clip player. To my surprise (and disappointment), when I unplugged my Sansa Clip and powered it on, the playlist showed up empty, unlike playlists that originated in Windows. As I keep my music collection organized in Amarok, the situation seemed 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 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 I 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 come 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 recursively 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 the Sansa Clip.

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

The David font that is used in Culmus-LaTeX lacks support for Kav-Mafrid, the ligature that is created by two consecutive dashes, --. Because the regular Hebrew dash, Maqaf, is positioned 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