Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

A short way around a long question

City Desk is remarkable (good) software. And it is very clever in the way it makes the complex task of managing a site easy to do by hand. That makes it very useful.

However, many of the aspects of my site are automated. To give a simple example, I have filters that build tables of document size, date and time. And I have automated processes that produce some of the documents that I'd like to incorporate into my site <b>without</b> any `human' interference.

It strikes me that this would all be possible if the document database could be deconstructed, manipulated and then rebuilt. In my case it would be easy to guarantee that there was complete lock-out of other access during such a process so that would not need to be a consideration.

If this isn't possible, do you see any other approach that might help with my problem? I'd be happy to explain it in greater detail, but don't want to bore anyone with all of this detail if there happens to be an easy `end run' around the problem.

David Ness
Friday, December 07, 2001

You can always write code (in just about any language) that manipulates the CityDesk database directly. It's just an Access database. Rename the .CTY file to .MDB and open it in Access to see what's going on.

You don't even have to open it exclusively since it's a multiuser database (assuming Pro edition).

We haven't documented the schema of the database because we reserve the right to change it in future versions. If you're concerned about forward compatibility you may want to isolate the database access in one place so it can be modified for future versions of CityDesk.

Joel Spolsky
Friday, December 07, 2001

Well, that's pretty wonderful. I can see the various pieces as Access tables.

Now, my (only?) remaining problem is accessing `long binary data' somehow as I am having trouble doing that thru Access. I also note that, somewhat to my surprise, the `cbSize' field is 0 where I expected it to have something to do with article length.

Anyway, thanks for your quick response, and particular thanks for the good design that makes the answer to complicated things so simple.

David Ness
Saturday, December 08, 2001

I found I was able to get my hands on everything that I need (so far at least) by dumping my articles as a CSV. So now it's time to get serious. Thanks again.

David Ness
Saturday, December 08, 2001

Also don't forget that there's no reason your CityDesk templates and index files have to be HTML.

If you just want to get your data out of CityDesk in some machine-readable way, make an XML or even plain text file with CityDesk code in it.

E.g. for CSV, make a file called dump.csv

{$foreach x in (all) $}
"{$x.headline$}","{$x.author$}","{$x.name$}"{$next$}

Joel Spolsky
Saturday, December 08, 2001

Thanks. I'm (slowly) catching on. What about importing back from CSV into City Desk. Are there any equally terse `tricks'?

David Ness
Saturday, December 08, 2001

ack, that's a bit harder ;) I can't think of any way to do it offhand. But writing code to access Access (erp) is really quite simple in VB, VBScript, or JavaScript.

Joel Spolsky
Sunday, December 09, 2001

*  Recent Topics

*  Fog Creek Home