Blocking IP Range using UFW

Uncomplicated Firewall (ufw) is one of the greatest frontends to IPTables I’ve encountered. It is very simple to use and I just wish it was also available for Gentoo. Up until recently everything went smoothly for me and ufw, but we hit some rough waters when I’ve tried to block an IP range.

To block an IP or IP range in ufw you should do

sudo ufw deny from 188.162.67.197/21

Continue reading Blocking IP Range using UFW

An Early Release of the New cssrtl.py-2.0

It has been three years since I’ve released the original version of cssrtl.py (and two since it’s re-release). The old version did a nice job, but experience gained during that time led me to write from scratch a new version. I’ve detailed more than a month ago, the basic principles and ideas that guided me to design a better tool to help adapting 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 to the Fusion theme and in 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 will be completed. However, due to the apparent shortage of time in the present and foreseeable future, I can’t see myself complete 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 working state, but not polished, so it may be of benefit 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

Sometime 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 to it. Unfortunately, while AI engine interface I designed and a simple alpha-beta pruning engine was 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 what ever I’ll call the version after 1.9), I’ve written a simple histogram widget to be part of the new statistics dialog. I should emphasize the simple part, this widget was mean to display a simple histogram without requiring any special bloated ploting libraries. It doesn’t support all the fancy stuff, just plain histogram.

I’ve 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 a good example of a custom widget. So I’ve felt pity letting it fall into oblivion in Open Yahtzee’s SVN repository, and I’ve thought it might come handy to someone else (or at least for me) if it will be 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’ve 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 beeing the plugin’s maintainer, Joost de Valk, 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 seems benign, in my opinion its 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 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 a CSS RTL Convertor

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 lacks on several issues:

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

Continue reading Designing a Better a CSS RTL Convertor

Over Looking the Simple Solution

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 which 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 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 – no predefined format which 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 looked over much simpler, yet as powerful, solution – a simple text file. Porting my rowing log to a simple, old-fashioned, text file provided me all the relevant features of TiddlyWiki, such as search, flexibility and working from usb-stick, while using less space and editable using a basic text-editor (or the powerful vim). Using reStructured Text, I got a nice readable journal that can be later processed into even nicer looking html files.

We all want to believe that we know to match the right tool for 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 over looking 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’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.