importing as module when a file has a non-identifier name

June 12th, 2009

I need to reuse a function in a file. The usual way is just to import this file as a module. But what to do if the name is “bad”? The following doesn’t work:


import foo-bar as foo_bar
foo_bar.callme()

After trials and errors, the desired magic found:

Read the rest of this entry »

sharing files from linux to windows

April 27th, 2009

Yes, one installs and configures Samba. All I need is to access a big folder in the read-only mode. The quick and dirty solution is:

Read the rest of this entry »

calling batch files with ‘exit’

February 22nd, 2009

Consider ‘main.bat


call child1.bat
call child2.bat

What happens after ‘child1.bat‘ is finished?

Read the rest of this entry »

extending a virtual disk in vmware

December 26th, 2008

Extending a virtual disk in vmware

1. Backup!

2. Somewhere in the vmware installation directory, there is a tool named “vmware-vdiskmanager.exe“. There is a lot of options, for resize use “-x“:

vmware-vdiskmanager.exe -x 8Gb ...path.to.vm..../vm_disk.vmdk

(hint: type the command manually, do not copy/paste from web. Otherwise you can get typographical spaces or minuses instead of the usual ones.)

Read the rest of this entry »

wrong but fast fix

December 12th, 2008

After a small system upgrade an application started to crash with the message:

*** glibc detected *** sylpheed: double free or corruption (out): 0x0839e818 ***

The right thing is to trace the application and submit a bug report to the author, but I found a fast workaround. Set an environment variable before running the program:

export MALLOC_CHECK_=0

upgrading a macport package

December 8th, 2008

Upgrading a macports (darwinports) package is not as easy as

$ sudo port upgrade something

In many cases I need the following command:

Read the rest of this entry »

chess tournament checklist

December 8th, 2008

In addition to the conference checklist, I now need a checklist for local chess tournaments.

Read the rest of this entry »

rsync server on mac os x

November 11th, 2008

For development purposes, I’d like to run a rsync server on a Mac.

People in forums recommend to avoid the default system rsync, which is accused of being buggy. Instead, they recommend RSyncX.

Read the rest of this entry »

local macports (darwinports) repository, granting a network access

November 11th, 2008

It’s quite easy to create a local MacPorts repository. Unfortunately, the documentation doesn’t say how to share the repository with others. After trials, errors and reading the source code, I’ve found the answer: the only way is rsync.

Read the rest of this entry »

XeLaTeX: change font for headers and footers

October 24th, 2008

I’ve noticed that headers and footers of the documents, generated by XeLaTeX, use some other font instead of Helvetica. After digging into the LaTeX code, the problem is solved.

Read the rest of this entry »

escape a TeX string in Python

October 17th, 2008

Do you generate [La]TeX files using Python? If yes, do you escape the special characters. Haven’t you forgotten to escape also empty strings?

To avoid reinventing the wheel, I tried to use TeXML libraries. This is the right choice, but one has to use a little trick.

Read the rest of this entry »

multimedia over network III: any ALSA-enabled application

September 30th, 2008

ALSA is the Advanced Linux Sound Architecture. The system can forward ALSA sound to PulseAudio.

Read the rest of this entry »

multimedia over network II: pulseaudio

September 27th, 2008

PulseAudio is a sound server. Applications feed music to PulseAudio, and PulseAudio decides what to do with it. For example, it can send the sound over network.

When I tried to use this feature for the first time, I failed. Therefore, I experimented with a more user friendly software (see multimedia over network I, and the second attempt was successful.

Read the rest of this entry »

python, win32, odbc, unicode, ascii, I hate it

September 26th, 2008

I need to get utf-8 (unicode) data instead of 8-bit from a Microsoft Access database (ODBC connection). It seems I’ve finally found the answer:

It’s impossible.

Read the rest of this entry »

fighting pstoedit

September 24th, 2008

I wanted to convert text to curves in PostScript. The well-known tool to do it is pstoedit (alternatives are welcome). Unfortunately, it worked only partially.

Read the rest of this entry »

multimedia over network I

September 24th, 2008

I want to:

* run a program on a work PC, and
* see and hear it in action on a leisure PC.

The first attempt is failed, therefore I started to search for a solution using the step-by-step approach. The first step is to make sure that multimedia over networks works at all.

Read the rest of this entry »

how to input diacritic characters

September 20th, 2008

I always used vim (for example, “Ctrl-K” “:” “u” for “ΓΌ”), but now I found a way to input such characters into any application, using the core feature of X11/xorg. The explanation and the table are here: “ISO-8859-1 compose keystrokes in Linux” (thanks Andrew Daviel).

Reminder for myself: on my system, it’s enough to add “compose:ralt” to the option “XkbOptions” in “xorg.conf” and use “Alt Gr” key.

alsa and HDA Intel SigmaTel STAC9227

August 19th, 2008

After upgrading my Linux, I’ve got sound lost. Everything looked ok — all the modules are loaded, all the special devices are created, no complaints in logs, — but no sound.

Read the rest of this entry »

if I were writing an XML editor

July 10th, 2008

There is a number of XML-editors, but there are no user-friendly ones (except FraemMaker). A standard XML editor is a tool for programmers, to play with XML. But technical writers need an user-centric XML editor, to play with a document, not with XML.

Read the rest of this entry »

Exeter Chess Club

July 8th, 2008

I’ve impressed by the site Exeter Chess Club, and especially Coaching page. A lot of useful resources.

Quicklinks for myself:

* Playing Black after 1.e4
* Playing Black after 1.d4
* The Italian Game for beginners