Unable to commit to subversion archive

This was quite annoying. I have tried several commits in a row blaming network connection and all kinds of gremlins. I have updated Ubuntu server, but still getting the same error:


svn: E175008: At least one property change failed; repository is unchanged
svn: E175002: Server sent unexpected return value (400 Bad Request) in response to PROPPATCH request for 'some file name'

What was suspicious that removing one file did not help. Then I have looked in the Apache log file on the server, where I found the following:


Could not get next bucket brigade ...

Searching further brought no direct cure except for an advice to switch antivirus off. Well, yeah, not for my setup.

So the solution was pretty simple. Split the commit in multiple chunks and submit them separately. Basically I have issued several svn revert commands on folders, and voila, it worked! Not very nice if you want to have one commit, but at least you’re not stuck anymore.

It seems that subversion has problems with large commits :(, although that does not result in a clear error.

I hope this helps somebody!

Pylab.show() does not show graph

Nothing showing up when using pylab.show()? Change the default non-interactive ‘agg’ backend to something that can actually show something:

import matplotlib
matplotlib.use('Qt4Agg')

If this fails, on Ubuntu you may need to install Qt first:


sudo apt-get install python-qt4

Enjoy!

Microsoft Surface 2 Pro

Introduction

I always take a portable with me on vacations, trips, visits, etc. One time I did not take anything with me turned to be one of the worst-vacation-ever, so I decided that I’d better take something with me and not use it than spoil another vacation in desperate search for something to work on :). Anyway, I already went through an old BSD-powered subnotebook, a black MacBook (ancient by modern standards, but still serving happily as a Skype station for my wife :)), an iPad (well, not really working machine lacking command line and any sign of development environment, but at least I was able to read/take notes/make kids happy with cartoons :)), Nexus 7 (when iPad went broken) and finally the last-of-the-breed Acer Aspire One D270 Ubuntu-powered netbook. I deliberately spared my MacBook Pro from travel for several reasons, but netbook proved to be a less versatile option, prompting to get a tablet along. Spoiled me. On one of the last business trips I had a business notebook (owned by client), my own one for other projects (I do not mix businesses) and a tablet for on the way. Well. That proved to be an overkill even for a week. So it was time to look for something different. But what?..
Continue reading “Microsoft Surface 2 Pro”

Adding basic logging to your Python script

Whether you like it or not, but there are many situations when you need to add logging information. It is easy to start with some print statements, but what if at certain point you want to put this information to a file? Redirecting output to a file will result in all-or-nothing situation since the contents of the file will be only visible at the end of execution. A more flexible and proper solution would be using a proper logging module.

Continue reading “Adding basic logging to your Python script”

Windows batch files arguments

Since Windows happen to be the platform of choice of my clients for business needs I tend to write also scripts for Windows. Many times I just create small batch files to mimic Unix commands like ls and ll as I forget to type dir instead. Anyway, many times I just want to pass any parameters provided to a batch file to the callee, and I used to have something like

@dir %1 %2 %3

Well, there should be a better way, and there is

@dir %*

and just in case you wander what other options are supported (and there are surprisingly many!), check out

call /?

in Windows command prompt, aka cme.exe.

Enjoy!

Moving to a new server: Call to undefined function: stripos() in /home/WP-LC/wp-lc.php on line 2

Moving to a new server is always a challenge. This time I wanted to have a proper version of Python for backend, but the current server only had version 2.4(!). As somebody put it "Wow, that’s ancient!". Anyway, as I wanted to have Django running my application I needed something at least 2.6’ish. I have asked for a new server and after some attempts my hosting provider (Lunarpages) provided me with one. OK, PHP and MySQL seem to be also OK (think of WordPress, etc), so I am settled. Right…

Continue reading “Moving to a new server: Call to undefined function: stripos() in /home/WP-LC/wp-lc.php on line 2”

Syntax highlight in vim

Although not being addicted to vim I do happen to use it on a regular basis as it is available on virtually all environments I do meaningful work with :). To get it a bit fancier you can add the following to your ~/.vimrc.

vim python coloring

syntax enable
set background=dark
colorscheme solarized 
set tabstop=4 
set shiftwidth=4 
set expandtab

Download and copy corresponding theme like solarized.vim to ~/.vim/colors

:wq

Small update
If you get annoying A/B/C/D characters when pressing arrow buttons either change .vimrc to get

set nocp

or type it in the vim prompt

:set nocp

Enjoy!

Upgrade Ubuntu server with boot partition full

At certain point my small silent server needed an extra package, but running apt-get only gave me errors. Digging further I found that my /boot partition (default Ubuntu server setup) was running out of disk space. After manually deleting old versions of images I finally got space, but that didn’t fix broken packages, e.g.:

$ sudo apt-get -f install
dpkg: dependency problems prevent configuration of linux-server:
linux-server depends on linux-image-server (= 3.2.0.53.63); however:
Version of linux-image-server on system is 3.2.0.58.69.
linux-server depends on linux-headers-server (= 3.2.0.53.63); however:
Version of linux-headers-server on system is 3.2.0.58.69.
dpkg: error processing linux-server (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
linux-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

The only fix I have found was downloading and installing the missing package manually:

$ wget https://launchpad.net/ubuntu/+archive/primary/+files/linux-server_3.2.0.58.69_amd64.deb
$ sudo dpkg -i linux-server_3.2.0.58.69_amd64.deb

Enjoy!