Category: Technology
svn2web
svn2web is a subversion hook script that uploads the committed files to a server by the ftp or sftp protocol. With this script it’s very easy to keep your local development branch of your web project synchronized with your server as long as you don’t make server-side changes.
Be aware that you complete the PATH variable as the script isn’t executed in an interactive shell. This means no .bashrc or .profile are read. So you have to set PATH by yourself. You also have to pay attention to the order of the binary locations. I had some trouble with the Leopard1 svn installation and the macports installation. The former was an older version which couldn’t work with repository created by the latter.
If you get one of these error messages
svnlook expected fs format '2'; found format '4'
or
Invalid change kind in rev file
take a look at the PATH before you start debugging svn2web
For those who want to set ftp/sftp options you can do this by setting the svn property svn2web-options. Unfortunately this is nowhere documented so if it’s not working properly you should contact the dev team or fix it by yourself. Don’t forget to spread the bugfix with the world.
- The cat I got from the Apple zoo ↩
How to use BackPress?
For my recent project I want to use some WordPress core functions but it’s too disproportionate to install the full system. Then I found BackPress which is exactly what I need. It’s a collection of WordPress, bbPress and GlotPress libraries.
The usage of this library collection requires some work. In fact you only need to include functions.core.php and the libraries you need. But to find out what files you exactly need can be hard because some functions have a lot of dependencies so my proposal is to include everything as you needn’t to care about any dependencies later on.
Furthermore some files have to be included exclusive-or what means that either the one has to be included or the other one. Download backpress.php and include the extracted file in your web project.
<?php
// this constant is needed for class.bpdb-multi.php
// leave the value empty
define('BACKPRESS_PATH','');
// the core functions
include_once('backpress/includes/functions.core.php');
include_once('backpress/includes/class.bp-log.php');
include_once('backpress/includes/class.bp-roles.php');
include_once('backpress/includes/class.bp-sql-schema-parser.php');
include_once('backpress/includes/class.bp-user.php');
include_once('backpress/includes/class.bpdb-multi.php');
include_once('backpress/includes/class.bpdb.php');
include_once('backpress/includes/class.ixr.php');
include_once('backpress/includes/class.mailer-smtp.php');
include_once('backpress/includes/class.mailer.php');
include_once('backpress/includes/class.passwordhash.php');
include_once('backpress/includes/class.wp-ajax-response.php');
include_once('backpress/includes/class.wp-auth.php');
include_once('backpress/includes/class.wp-dependencies.php');
include_once('backpress/includes/class.wp-error.php');
include_once('backpress/includes/class.wp-http.php');
include_once('backpress/includes/class.wp-pass.php');
include_once('backpress/includes/class.wp-scripts.php');
include_once('backpress/includes/class.wp-styles.php');
include_once('backpress/includes/class.wp-taxonomy.php');
include_once('backpress/includes/class.wp-users.php');
include_once('backpress/includes/functions.bp-options.php');
include_once('backpress/includes/functions.compat.php');
include_once('backpress/includes/functions.formatting.php');
include_once('backpress/includes/functions.kses.php');
include_once('backpress/includes/functions.plugin-api.php');
include_once('backpress/includes/functions.shortcodes.php');
include_once('backpress/includes/functions.wp-cron.php');
include_once('backpress/includes/functions.wp-object-cache.php');
include_once('backpress/includes/functions.wp-scripts.php');
include_once('backpress/includes/functions.wp-styles.php');
include_once('backpress/includes/functions.wp-taxonomy.php');
include_once('backpress/includes/interface.bp-options.php');
// Only include one of these two
include_once('backpress/includes/loader.wp-object-cache-memcached.php');
//include_once('backpress/includes/loader.wp-object-cache.php');
?>
Facebook Lite
I wrote a script for minimizing the facebook theme. For this you need the Greasemonkey firefox add-on.
To install the script click on this link Facebook Lite
Batch printing
I often upload some pdf files on a server to print them at my faculty. On the server I follow these steps:
1. Convert the uploaded pdf files to postscript
for file in `ls -1`; do pdftops $file; done
ls -11 lists all the files of the current directory, one file per line. pdftops actually converts the pdf files to postscript.
2. Delete the pdf files
rm *.pdf
We need to delete the pdf files to only list postscript files in the next command.
3. Put two pages on one page and print them
for file in `ls -1`; do psnup -2 -d0 $file | lpr -Pscit32411d; done
Again we walk through the file list but this time psnup prints two pages on one page and we pipe its result to the print command lpr. The argument P is the printer name of our destination.
I’m sure this can be done in only one line but I’m not a big shell scripter so I make the batch printing in three lines.
- The parameter is a one and not a l ↩
source url not under source root
I’ve tried to mirror a svn repository and svk (yes svk and not svn!) told me that the source url is not under source root whatever this means.
An escaped space character caused svk fail the check:
if substr( $source_path, 0, length( $source_root ), '') ne $source_root;
in line 162 in SVNRa.pm.
I fixed this problem while adding a line which replaces %20 by a space character because an URL with the file protocol must not be escaped. These resources are accessed directly from the disk and not from a webserver.
$source_path =~ s/ /%20/g if $source_path =~ m,^file://,;
# XXX: this shouldn't happen. kill this substr
die "source url not under source root"
if substr( $source_path, 0, length( $source_root ), '') ne $source_root;
