Clean URLs (Permalinks) for WordPress on Lighttpd

I’ve moved my blog in the last few days to a new bigger dedicated server (as well as some other sites I own). After doing some benchmarks (I plan to post those soon) I’ve decided to switch to Lighttpd. While the exact migration notes are the topic of another post, I can say that I’m fairly satisfied with the move.

After setting up the server, I started moving the blog. Importing the files and the database was pretty straight forward. But when I thought every thing is ready and I transfered the domain to the new server I’ve found out that none of my inner pages are accessible. The reason, as it turned up pretty quickly, is that the WordPress depends on Apache’s mod_rewrite to create the clean URLs (the so called permalinks). This actually posed two problems:

  1. WordPress depends on Apache’s mod_rewrite.
  2. WordPress used .htaccess files for the clean URLs configuration

Continue reading Clean URLs (Permalinks) for WordPress on Lighttpd

radio.py-0.5 – An Easy Interface for Listening to Radio under Linux

This new release of radio.py brings more predefined stations and the much wanted recording feature. radio.py is a python wrapper for mplayer, designed to provide an easy-to-use interface for listening to radio from the command line. And indeed using radio.py is very easy, just pass the station name.

radio.py Classic FM

To read more about radio.py and the existing features go to radio.py – a Wrapper Script for Listening to Radio in Linux.

New stations in this release include Ram FM, Classic FM, Radio Caroline and update to all the radioIO stations. So overall this version of radio.py comes with 81 predefined stations. To see the full list of recognized station run radio.py --list. If your favorite station is still missing you can add via configuration files, ans described in here. If you will send a comment with the name of the stations and its website, I’ll add it to the next release.

The other important new feature is the ability to record radio streams to mp3 directly from radio.py. This is done using the --radio command-line switch. For example the following

radio.py CNN --record cnn.mp3

will record the radio stream of CNN to a file called cnn.mp3. To stop recording just press ‘q’. This option also be used with the --sleep and --wake-up to time your recordings. For example if you want to record a show that start in 30 minutes and is 60 minutes long you should do

radio.py BBC1 --record bbc1.mp3 --wake-up 30 --sleep 60

You can download the new version from here. Installation is pretty straight forward, just untar the archive and put the radio.py some where in your path (e.g. /usr/local/bin/) and the package is installed.

As always if you want new stations added to the next release, send a comment with the station details (at least name and website).

UPDATE 14/12/2008: I’ve changed the download link to point to radio.py‘s SourceForge project page.

WordPress Backup Script

This is a small script I’ve written to automate my server-side backups of my blogs. It creates a backup of both the database and the actual WordPress files.

#!/bin/bash

# (C) 2008 Guy Rutenberg - http://www.guyrutenberg.com
# This is a script that creates backups of blogs.

DB_NAME=
DB_USER=
DB_PASS=
DB_HOST=

#no trailing slash
BLOG_DIR=
BACKUP_DIR=


echo -n "dumping database... "
mysqldump --user=${DB_USER} --password=${DB_PASS} --host=${DB_HOST} ${DB_NAME} \
 | bzip2 -c > ${BACKUP_DIR}/${DB_NAME}-$(date +%Y%m%d).sql.bz2
if [ "$?" -ne "0" ]; then
	echo -e "\nmysqldump failed!"
	exit 1
fi
echo "done"


echo -n "Creating tarball... "
tar -cjf ${BACKUP_DIR}/${BLOG_DIR##*/}-$(date +%Y%m%d).tar.bz2 ${BLOG_DIR}
if [ "$?" -ne "0" ]; then
	echo -e "\ntarball creation failed!"
	exit 1
fi
echo "done"

Continue reading WordPress Backup Script

spass 1.1 – Secure Password Generator

This is a new version of my /dev/random based secure password generator – spass. The new version doesn’t have new features, it’s mainly a bug-fix release. The package now uses autotools, which means it has the standard configure script and makefile. I also fixed some typos in the help message. Overall the new version doesn’t offer anything new compared to the old one, except for easier installation.
Continue reading spass 1.1 – Secure Password Generator

mctext 0.2 – A Markov Chain Text Generator

This is the second release of my Markov Chain text generator – mctext. This text generator takes existing sample text, and generates a new text using Markov Chains.

The main new thing in the version in that it allows the users to specify via the command line how many words should be considered when generating the next one. The bigger the step number the closer the generated text is to the original one. The value used in mctext-0.1 was 2, and this is also the default in this one. The number of steps can be set using the --steps command line switch.
Continue reading mctext 0.2 – A Markov Chain Text Generator

Pull vs. Push MVC Architecture

I intended to write this post couple of months ago, when I worked on a pull based MVC framework for some site. Most web-developers are acquainted with the MVC architecture and almost all the major web-frameworks uses this concept, including Ruby on Rails, CakePHP, Django, Symfony and others. So what is MVC and what’s the difference between pull and push?
Continue reading Pull vs. Push MVC Architecture

Equality-at and Relation-at LaTeX Macros.

These are two useful LaTeX macros for creating equality-at and (the more general) relation-at signs. These macros depend on the mathtools package. As with all other macros you should add them to you preamble in order to use.

The general macro is the \relat. It takes two arguments, the relation and an expression where the relation takes place (the “at”). The equality-at macro, \eqat is a specific case of \relat. I’ve created it because it is commonly used and only requires passing the “at” argument.
Continue reading Equality-at and Relation-at LaTeX Macros.

A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Following comments in Fixing the Home Link in the Telem System (Open U) I’ve decided to fix the top bar links in the Sheilta system too.

The links in the top bar are javascript links that open in a new window when clicked. My Greasemonkey script turns them into regular links that you can open in a new tab.

Continue reading A Greasemonkey Fix to the Top Menu in Sheilta (Open University)

Notes About Using amsmath split Environment In Hebrew Documents

Recently I’ve worked on a Hebrew document in LaTeX and wanted to use the split environment to typeset some multiline formula. The document which compiled just fine till that point, failed to compile with the following error:

Package amsmath Error: \begin{split} won't work here.

Continue reading Notes About Using amsmath split Environment In Hebrew Documents

Hidden Spam Links in WordPress

About a week ago, I’ve decided to look at the HTML source of my blog. I was in total shock to find a spam link hidden there. This is how it looked:

<!-- ocadia theme credits, downloaded from wpthemesfree.com -->
<u id="ocadia" style="display: none">Buy some <a href="http://detoxbuddy.com/categories/191.html">marijuana drug testing</a> products</u>

Ocadia is the name of theme I’m using, so I guessed the hidden link came from there. I was partially right. The code indeed resided in the index.php file of the theme, but as I later found out, the theme had nothing to do with that. I removed link and the comment immediately, and went to see if the it was distributed this way from Beccary (the author of the theme.
Continue reading Hidden Spam Links in WordPress