I decided to benchmark rzip against bzip2 for my backup needs. The benchmark was performed on an 89M tar archive of a directory that I regularly back up using my Amazon S3 backup script. The directory contains mostly LaTeX, PDF, and OpenOffice files, so this benchmark may reflect very different results from what you would get if you tested it on other kinds of files.
Continue reading rzip vs. bzip2 – A short comparison
Category: Tips
usb 1-4: device descriptor read/64, error -71
When I try to connect my Sansa Clip MP3 player to the Linux box, I see the following error in dmesg:
usb 1-4: device descriptor read/64, error -71
and the device recognition fails. The player’s battery gets recharged, but I can’t mount it and transfer songs.
Continue reading usb 1-4: device descriptor read/64, error -71
Start Trac on Startup – Init.d Script for tracd
As part of a server move, I went on to reinstall Trac. I tried to install it as FastCGI, but I failed to configure the clean URLs properly. I got the clean URLs to work if the user accessed them, but Trac insisted on adding trac.fcgi to the beginning of every link it generated. So I decided to use the Trac standalone server, tracd.
The next problem I faced was how to start Trac automatically upon startup. The solution was to use an init.d script for starting Trac. After some searching, I didn’t find an init.d script for tracd that was satisfactory (most were poorly written). So I went on and wrote my own init.d script for tracd.
Continue reading Start Trac on Startup – Init.d Script for tracd
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 straightforward. But when I thought everything was ready and I transferred 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 WordPress depends on Apache’s mod_rewrite to create the clean URLs (the so-called permalinks). This actually posed two problems:
- WordPress depends on Apache’s
mod_rewrite. - WordPress uses
.htaccessfiles for the clean URLs configuration.
Continue reading Clean URLs (Permalinks) for WordPress on Lighttpd
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"
Pull vs. Push MVC Architecture
I intended to write this post a 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 use 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, more generally, relation-at signs. These macros depend on the mathtools package. As with all other macros, you should add them to your preamble in order to use them.
The general macro is 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
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 a multiline formula. The document, which compiled just fine until 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 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 the 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 the link and the comment immediately, and went to see if it was distributed this way from Beccary (the author of the theme).
Continue reading Hidden Spam Links in WordPress
Vim Syntax Highlighting for Google Gadgets
I started developing Google Gadgets for LabPixies, so one of the first things I looked for was syntax highlighting. Vim recognized the gadgets’ code as an XML file (which is correct), but I also wanted HTML syntax highlighting for the HTML part. So, after searching a bit for an existing solution, I found one, but I didn’t like it, as it required me to wrap the HTML code with a specific comment. As I don’t like this kind of solution, I’ve decided to create my own syntax highlighting file for Vim.
Continue reading Vim Syntax Highlighting for Google Gadgets