2008/07/29

Google Calendar supports CalDAV

Google Calendar has added support for CalDAV. For Mac weenies, this means you can share calendars across multiple Macs, adding and removing events via iCal. And you can do it without paying for MobileMe.

Wonderful stuff!

2008/07/24

Terminal.app hangs at startup

I just got bit by this bug, under OS X 10.5.4. The symptoms are that sudo hangs, and Terminal.app hangs when opening a new tab or when starting up. Console.app shows messages of the form

7/24/08 7:04:44 AM kernel devfs: ttys001: name slot allocation failed (Errno=17)


rprr posted a workaround in the above thread which worked for me. I don't know how to link to specific messages in the discussion thread (or whether that's even allowed under the terms of use, egad), so here's a recap:
1. Started Terminal. It hung up. Did Force Quit and Sent Crash report to Apple.

2. Since I had a working X11 application, I used it to open about 10 xterms using the Applications->Terminal Menu of X11.app

3. I started Terminal again. Now it works.

Anarchogeek: Beyond REST? Building Data Services with XMPP PubSub

Anarchogeek: Beyond REST? Building Data Services with XMPP PubSub

Addresses a few problems which I've never had to face. Still, lots of interesting ideas to chew on. Hints at techniques that could be applied even to low-volume web services which involve long-running server-side computations.

Many little parasites add up to one big biomass - earth - 24 July 2008 - New Scientist Environment

The main point of the article is that parasites are much more populous than previously believed. But this quote was the most interesting:

Many little parasites add up to one big biomass - earth - 24 July 2008 - New Scientist Environment:

"Dobson says he has work in press showing that parasites contain between 10 and 1000 times more pollutants than their hosts. He suggests parasites might play an important role in cleaning up the animals they inhabit."


So they castrate you, but they also keep you clean...

2008/04/22

Served up in a fine china Meatri Dish

Love the Steak and Save the Cow:

"PETA offers a $1 million prize to whoever can come up with tasty, edible, lab-grown meat, an advance they say would save billions of animals while still satisfying our carnivorous cravings."


Of course there's another solution, courtesy of the late, great Douglas Adams:
The animal staggered to its feet. It gave a mellow gurgle.
'A very wise choice, sir, if I may say so. Very good,' it
said, 'I'll just nip off and shoot myself.'
He turned and gave a friendly wink to Arthur.
'Don't worry, sir,' he said, 'I'll be very humane.'

2008/04/17

Why Lockheed Martin signed on w. the Spaceport

From KRQE in Albuquerque: Spaceport launch tests future spacecraft




"It looks a bit like the space shuttle and would fly to space and return the same way. But even the big version would not carry people, just satellites.

The goal is to get to orbit faster and cheaper thanks to an automated reusable spacecraft run by its own computers and just a handful of people for a launch crew."

New Scientist: Revealed: the Asian source of the annual flu epidemic

Revealed: the Asian source of the annual flu epidemic - health - 17 April 2008 - New Scientist:

"Better surveillance in east Asia should lead to better predictions of how flu is evolving, and what is likely to be needed in next year's flu vaccine, says Smith."

2008/04/08

Thank you, wsgi

Thanks to all of the developers behind wsgi.

When I first heard about it, wsgi struck me as an unnecessary complication. Then someone showed me how it could simplify testing of web applications. And now:

High-Scalability:

Google App Engine supports any framework written in pure Python that speaks CGI (and any WSGI-compliant framework using a CGI adaptor), including Django, CherryPy, Pylons, and web.py. You can bundle a framework of your choosing with your application code by copying its code into your application directory.

2008/04/04

Visual Web Developer "Failed to start monitoring changes"

I keep forgetting about this...

I'd like to do development on an ASP.NET web application which resides in a VMware Fusion shared folder. Unfortunately, as noted in the Microsoft Forums, Visual Web Developer 2005 Express Edition (at least) does not support hosting on a UNC share.

So, AFAICT, the only option is to do development in a local folder. To access that folder from the host operating system, it needs to be shared from the Windows VM.

VMware Fusion, OpenSUSE 10.3 x64, copy and paste

I recently installed a 64-bit OpenSUSE 10.3 virtual machine under VMware Fusion. Everything worked fine except cut&paste -- the vmware-user executable was not launching when X11 started.

ldd showed a dependency on libexpat.so.0, in addition to libexpat.so.1. I installed that using yast, rebooted, and -- huzzah -- cut&paste now works.

yast_install_libexpat.png

More details are available in the VMware Fusion discussions forum.

2008/03/26

Five Open Tools for 2D Structure Layout (aka Structure Diagram Generation)

Five Open Tools for 2D Structure Layout (aka Structure Diagram Generation)

Good summary of several alternatives. I've been using CDK of late, but am partial to tools written for CPython. I wonder if any of the alternatives make it as easy to extract coordinates as does CDK?

2008/03/21

TUAW Terminal Tip: Safari 3.1 brings true one-window mode

Terminal Tip: Safari 3.1 brings true one-window mode:

...true one-window mode is finally, finally, here for Safari. All you need to enter is the command below into Terminal, hit enter, and you're sorted.

defaults write com.apple.Safari TargetedClicksCreateTabs -bool true


Yay!

Functest

Writing Functests:

"This is where functest really shines. When you run functest against any directory or file the collector actually compiles a dependency chain which includes any valid python modules in all the parent directories..."


Hm. So functest would let me dispense with this nonsense boilerplate in my test modules?
import sys
import os
thisdir = os.path.abspath(os.path.dirname(__file__))
def relpath(p):
return os.path.abspath(os.path.join(thisdir, p))
sys.path.insert(relpath("../"))



I wonder if nose does/will provide similar facilities? It's pretty nice in other respects...

Twill, CherryPy 3 and testing with internal servers

Twill can test CherryPy web servers "in process", without having to run them as servers. I've used twill this way with CherryPy 2, but when I recently tried to do the same thing with a CherryPy 3 server everything broke.

I had based my code on an old CherryPy 2 tutorial by Titus Brown, and was trying to grep through the CherryPy 3 code tree to figure out how to patch it up. Bad idea :)

Yesterday Google finally turned up a solution, from a talk Titus gave at PyCon 2007.

The upshot: don't use cherrypy._cpwsgi.CPWSGIApp. In CherryPy 3, your application itself is already a WSGIApp. What's more, I think cherrypy._cpwsgi.CPWSGIApp may be broken. For sure, it and twill have incompatible ideas about the correct type of the 2nd constructor argument.

Anyway, thanks to Titus, here's an example of how to connect twill to a CherryPy 3 application for in-process testing:

import twill
import cherrypy
...
wsgi_app = cherrypy.tree.mount(myApp, "/", myConfig)
cherrypy.engine.start(blocking=False)
twill.add_wsgi_intercept('localhost', 8080, lambda: wsgi_app)


[Update 2008/03/24] Ditched the cherrypy.server.quickstart() invocation, per fumanchu's comment. Reported as Ticket #801.

2008/03/10

waf build errors

I'm evaluating waf to see if it's easier to use than SCons (especially for Qt projects). So far the results are encouraging. In particular, waf reports many kinds of problems using straightforward (color-coded!) error messages, rather than Python tracebacks.

target 'build_info' does not exist

Sometimes waf does spew an unintelligible Python traceback reminiscent of SCons. For me, these typically end with a KeyError:

File "/path/to/.waf-1.3.2-blah/wafadmin/Task.py", line 290, in must_run
prev_sig = tree.m_sig_cache[key][0]
KeyError: -214303645


This error always translates to "you are trying to build a file which is part of your source tree."

My SConscripts work in situ, creating object files etc. in the same directories where the source code resides. waf prefers to put build products in a separate build/ subdirectory. When waf is instructed to generate an output file in its build tree, and when that file already exists in the source tree, waf fails with the KeyError traceback.

I'd bet this problem is most common in software projects which started life using build systems like Make or SCons -- tools which default to building in situ.

For example, I'm trying to use waf in a subversion workspace where I've been doing SCons builds for years. To make matters worse, one of the build products is a header file, containing revision number and date for the current build. This looks like a source file, so it's likely that I never checked whether it was properly removed by scons -u -c.

In retrospect, I should have started with a clean check-out...

2008/03/07

Rogue Amoeba: Code Signing and You

Code Signing and You:

"Code signing itself is a neutral technology, but it gives incredible power to the system vendor, and that power is just waiting to be exercised and abused."


It's possible that Apple intends to close off the OS X platform. If that happens, I'll go back to Linux.

2008/03/06

DailyTech - Researcher: Basic Greenhouse Equations "Totally Wrong"

From DailyTech:

"NASA refused to release the results.  Miskolczi believes their motivation is simple.  'Money', he tells DailyTech.  Research that contradicts the view of an impending crisis jeopardizes funding, not only for his own atmosphere-monitoring project, but all climate-change research.  Currently, funding for climate research tops $5 billion per year.
"

"The equations also answer thorny problems raised by current theory, which doesn't explain why "runaway" greenhouse warming hasn't happened in the Earth's past. The new theory predicts that greenhouse gas increases should result in small, but very rapid temperature spikes, followed by much longer, slower periods of cooling -- exactly what the paleoclimatic record demonstrates."

"Miskowlczi has used his theory to model not only Earth, but the Martian atmosphere as well, showing what he claims is an extremely good fit with observational results."


Hey, at least we still have peak oil.

2008/03/03

Intermittent Pickle Problems in Jython

The previous post mentioned "integrating" Jython and CPython by transmitting a stream of pickles between the two. I encountered one intermittent problem with this approach, and I'm unsure of its cause. (Hm, and I should probably post this to a Jython mailing list...)

Problem


In Jython I'd pickled the str() of a java.io.StringWriter, into which I'd just written the SD representation of a CDK molecule. Jython could create the pickle alright. But when I tried to unpickle it in CPython, sometimes, for some molecules, I got a traceback:
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pickle.py", line 970, in load_string
raise ValueError, "insecure string pickle"
ValueError: insecure string pickle


The error occurred consistently in my application code, always on the same input structure. But I couldn't derive a simple test script to demonstrate the problem.

Investigation


Examination of the problematic pickle data showed that a Python unicode string literal marker had somehow been inserted, and the type code for the item was somehow S (for string) rather than V (for unicode):
...
sS'sdf'
p3
Su'ZINC00000181\n CDK...
^ What the... ?


Workaround


Google turned up a usable workaround: encode the offending string as utf-8 before trying to pickle it.


import codecs
enc = codecs.getencoder('utf8')
...
sdf = enc(sdf)
...


Ted Leung: The Sun is going to shine on Python

Congratulations to Ted Leung (and to Frank Wierzbicki):
The Sun is going to shine on Python.

Their work at Sun will extend well beyond Jython, but Ted's post reminded me of my recent experiences. Jython 2.2 sure made it pleasant and easy[1] to get what I needed out of CDK, and to integrate the results into a CPython app via pickle and subprocess.

I did miss some language features such as yield which have appeared in CPython since 2.2. Maybe at some point Ted and/or Frank will have time to re-sync Jython with CPython?

[1] I had one intermittent problem with this approach. See the next post.

2008/02/26

New Scientist: Fatal brain cancer tamed by gene therapy

Fatal brain cancer tamed by gene therapy - 25 February 2008 :

Previous attempts to treat glioblastomas with gene therapy failed because some tumour cells survived and regrew. The new treatment overcomes this problem by permanently priming the immune system to pick off any straggler tumour cells.

A harmless virus that only infects fast-dividing cancer cells is injected directly into the brain... One gene, HSV1-TK, kills the cancer cells by activating ganciclovir...


And here's the cool bit:
...a second gene, Flt3L... summons immune "dendritic" cells from the bloodstream into the brain.


(How does it do that?)

[The dendritic] cells engulf the debris and transport it back to lymph nodes, where they re-prime the immune system to attack any remaining tumour cells during and after treatment.


Lymph nodes seem like a gunnery school for white blood cells: you go there to learn how to distinguish friend from foe. (BTW fevers seem to help lymph nodes do their jobs.)