8 Nov 2010

Using cdpwavefile library

I wrote a script that uses the cdpwavefile functionality to parse the CartChunk information while it moves the data from the File Server to the ingest device. For testing, I don't do anything else but log it; in the future I might use the info to send an email or other notification when specific titles arrive. You can find the code here

13 Apr 2010

Google app engine login for Django

22 Mar 2010

Converting a database the hard way

So, I've been thinking about how I might pull information out of a big database and convert it to iSilo format in an automatable way. The database is such that I can't get to the data directly; but I can use the clipboard to copy and paste. And there is a keyboard shortcut to select all the information in a section. So how might I do it?
 
Well, my plan so far is to use pywinauto http://pywinauto.openqa.org/ to script the interaction with the database. I can send keystrokes to select information and copy it to the clipboard. Python pywin32 provides a clipboard object to get the data from the clipboard. It is in RTF format (ID 49298). So now I can get a section from the clipboard into RTF format. Then I might use pyth http://github.com/brendonh/pyth to read the RTF and write XHTML out to a file. After that, I can use the iSiloX command line utilities to generate the iSilo database.
 
I think I've got it figured out, I just have to try out the details.
9 Feb 2010

Turning a motor into a sensor with the Peppermill

4 Feb 2010

Using the XMLRPC interface of Confluence in Python

I was successful in creating a new page and in posting to the blog in my personal space thanks to some info here. Python comes with everything needed to use the interface. An example script consists of these parts:

from xmlrpclib import Server
s = Server("https://server/rpc/xmlrpc")
token = s.confluence1.login("user", "password")

Now you can use many of the API functions. For instance you can create a page:

newpagedata = {"title":"Python example New Page 2","content":content,"space":"spacekey"} 
newpage = s.confluence1.storePage(token, newpagedata)

where "newpagedata" is a dictionary that has at a minimum the keys "title", "content", and "space". You can also update an existing page by getting a reference of it and replacing the content.

page = s.confluence1.getPage(token, "spacekey", "Python example New Page") 
page["content"] = "Updated text" page = s.confluence1.storePage(token, page)

The same process works basically the same way for blog posts, except the functions are "storeBlogEntry" and "getBlogEntry" if you know the ID, or "getBlogEntryByDayAndTitle" if you know that.

Many more functions are available at the link above.

11 Dec 2009

On drinking coffee...

Just heard on @scifri that in a recent study, men who drank 6 or more cups of coffee a day had a 60 percent lower risk of aggressive prostate cancer than men who drank no coffee.

 

 

http://www.sciencefriday.com/program/archives/200912113