May 17, 2004

Cygwin X Server on Windows XP

Just a note to myself. To start the X server on Cygwin simply type:

startx

Check on the remote machine that the DISPLAY setting is pointing back to your local machine when the Cgywin X server is running. For some reason I thought it was going to be much more difficult. When the X terminal window comes up you can check the permissions of your local machine by typing

xhost +

Issues:

Cutting and pasting between X and Windows

Caveats:

Don't kill the terminal machine or all of your X applications will die.

Posted by stuartcw at 04:43 PM | Comments (0)

May 16, 2004

Cog: Simple Python Object Database

"Cog is the Checkpointed Object Graph object database, providing semi-transparent persistence for large sets of interrelated Python objects. It handles automatic loading of objects on reference, and saving of modified objects back to disk. Reference counting is used to automatically remove no longer referenced objects from storage, and objects will be automatically be attached to the database if a persistent object references them."

Looks like an interesting base for projects...if only I will be able to think of it when the need arises.

Posted by stuartcw at 03:09 PM | Comments (0)

May 08, 2004

New Approach to Photo Galleries

Now this just makes sense to me. Embed the explanation once and for all in the picture and let the CMS organize the pages containing the photos: photo gallery for Pyblosxom using RDFPIC

Posted by stuartcw at 11:55 AM | Comments (0)

Information mining and archaic texts

[via Matt Payne] Regardless of whether you are interested in the contents or not there is 2-3000 years of experience in labelling, indexing, annotating and organizing the contents of the information in the Bible.

leobard beat me to writing about this topic and it's application to mining information from large document collections today. I should write up my own ideas about sometime...

More links
Torah Study as Hypertext
Joel on Software: Reading code is like reading the Talmud

Posted by stuartcw at 10:50 AM | Comments (0)

Bitman

I knew it had to exist somewhere: A Java implemenation of Maywa Denki's Bitman

Posted by stuartcw at 12:58 AM | Comments (0)

May 07, 2004

Switch Statements in Python

Simon Willison posts an interesting example of how to code the equivalent of switch statement in Python.

The example is really neat and syntactly cleaner than the example of a more usual switch statement, however anyone coming across that code for first time would most likely be mystifed by it. Not mystified in the same way as having to decode read-only Perl which uses all the tricks in one line, but mystified in that it is so simple but uses constructs like lambda statements that you don't really need to know to understand most of the Python code you will ever encounter.

You can learn all the Java syntax that you will ever use in a couple of days however to master all of the Python syntax takes time. Most people don't use it all but Simon's example and a lot of the code in Dive into Python is a great example of how you can write concise Python using all the neat features of the language that beginners can easily overlook.

Posted by stuartcw at 09:01 PM | Comments (1)

May 05, 2004

Rename every file to filename.txt

Charm allowed me to download all my LJ entries this month as text files but unfortunately they were not named with .txt which PyBloxsom requires to pick them up as postings. Again, some googling found me some Unix find command examples from which I was able to adpat an example to write this code

find . -type f -name "*" -exec mv {} {}.txt \;

which renames every file under the current directory to .txt.

Posted by stuartcw at 08:24 PM | Comments (0)

Charm

After getting PyBloxsom working on my local machine (XP with Apache) I went off in search of a way to download all my old LiveJournal entries locally. My long term plan is to migrate everything on my site to PyBloxsom and retire both LiveJournal and MT.

By chance,I found an interesting tool: Charm: A command line livejournal client written in Python which should allow me to archive old entries into a text files.

I have one minor problem with it right now. It expects "vi" to be in the path. Not a big deal for me as I have Vim in the path. In the end I made a copy of vi in my cygwin installation and named it vi.exe. From reading the code I could have set one or more environment variables to indicate which editor to use.

I had one more problem. On windows, the environment variable HOME is set to c:\Documents and Settings\YOURNAME. The spaces in this path cause some UNIX tools to get confused so I made a wrapper batch file and set it to the safe 8+3 DOS style path which can be found by doing a DIR /X on the long pathname.

After that Charm worked as expected.

Posted by stuartcw at 06:24 PM | Comments (0)

May 04, 2004

Threading

While poking around various Python projects related to webcams I found an email threading module written in Python which implements JWZs threading algorithm.

Posted by stuartcw at 01:59 PM | Comments (0)

Python Webcam

After looking at a lot of webcam software, most of which basically seems to be a shell around a Windows DLL which does the hard work, I have decided to take a look at Video Capture "A Win32 Python Extension for Accessing Video Devices (e.g. a USB WebCam, a TV-Card, ...)". The example code looks really easy:
from VideoCapture import Device

            cam = Device()
            cam.saveSnapshot('image.jpg')
Posted by stuartcw at 01:46 PM | Comments (0)