Skip to content

WordPress wish: converting a post to a page

I wish there were a simple way to convert a WordPress post to page — that is without copying and pasting the content — but there doesn’t seem to be a way in WP right now (at least according to the convert post to page? thread).

Tagged ,

Getting started with Jython

Time to install The Jython Project. I installed both the current version (2.2.1) and the beta version (2.50b). Time to run through the Jython book and the Jython User Guide.

Tagged ,

Django hosting options?

Although it seems that you can host Django on dreamhost (Django – DreamHost and JeffCroft.com: Setting up Django on Dreamhost), I might be looking for another host for Django, such as (mt) Media Temple, which is what is used by Django creator Adrian Holovaty for his EveryBlock project.

Tagged , ,

SWIG

Although I plan to be programming primarily  in Python (and JavaScript)  this next year, I don’t want to forget about C/C++.  I hope to have an opportunity to use SWIG at some point to connect high-speed code in C/C++ with Python code:

SWIG is an interface compiler that connects programs written in C and C++ with scripting languages such as Perl, Python, Ruby, and Tcl. It works by taking the declarations found in C/C++ header files and using them to generate the wrapper code that scripting languages need to access the underlying C/C++ code. In addition, SWIG provides a variety of customization features that let you tailor the wrapping process to suit your application.

Tagged ,

Time to study Python 3.0?

I had been vaguely following Python 3 when Python 3.0 final was released on December 3, 2008. I decide to start coming to terms with what this new and intentionally non-backwards compatible version of Python means by printing out What’s New In Python 3.0 — Python v3.0 documentation and Linux.com :: Python 3.0 makes a big break. My current conclusion from reading the articles: I should learn Python 3.0 in the background but make mastery of Python 2.x the priority for at least the next several years.

Tagged

IronPython 2.0

In  the new year,  I would like to deepen my expertise in all-things-Pythonic.  One version I just installed today was Iron Python:

IronPython is a new implementation of the Python programming language running on .NET. It supports an interactive console with fully dynamic compilation. It is well integrated with the rest of the .NET Framework and makes all .NET libraries easily available to Python programmers, while maintaining full compatibility with the Python language.

My hope is to be doing a lot of programming in “generic Python” and then take advantage of specific platform libraries (such .NET using IronPython and the Java libraries using Jython). Let’s see how well that strategy works.

(BTW, I look forward to seeing the upcoming new book on IronPython: IronPython in Action by Michael J. Foord and Christian Muirhead.)

Tagged ,

Which version of pywin32 works with Ecco Pro DDE?

Two programs of which I am aware uses pywin32 (the Python for Windows extension) to access Ecco Pro‘s DDE interface:  EccoTools and classeccodde.py.  I have found that the current version of pywin32 (v 212) doesn’t work, and that the newest version that does work is version 207. (BTW, you can look at all the versions of pywin32 available at sourceforge.)

The problem comes when you try to create a DDE session with the following lines:

import dde
dde.CreateServer().Create('EccoSession')

If you use versions of pywin32 from v 208 up, you get a “The server could not be created” error.

Next steps:  I should report this error to Mark Hammond, the author of pywin32.  I wrote a message about this issue in the Ecco_Pro group to see whether others

Tagged , ,

Tracking Mr. Shelby

One of the project areas I’m hoping that some of my students in Mixing and Remixing Information 2009 (MRI 2009) course will take up is promoting government accountability and transparency in the new Obama era. (Interestingly enough, John Musser wrote last week on ProgrammableWeb about the Sunlight Labs Mashup Contest — something I’ll definitely have to mention to the class in January.)

This morning, while reading Banks Got Bailout; Are They Making More Loans? : NPR, I came across a quote from United States Senator Richard Shelby (R, Alabama) that made me wonder what his voting record has been on a number of recent bills.My first thought was whether anyone has fed this data to freebase — a quick look (Richard Shelby facts – Freebase) seems that no, not yet, anyhow.

My next thought was to turn to the Sunlight Foundation projects. It turns out that OpenCongress was able to list the voting record for Richard Shelby, including Nay on the bank bailout bill (H.R.1424 Emergency Economic Stabilization Act of 2008).

Is it possible to retrieve this type of voting data with an API?  Yes, with a  bit of digging based on the following pointer at GovTrack: Source Code, Data, and APIs

Vote Database API:  Get voting records in XML, too. To get an overall list, see the XML download link at the top of the votes page. To include the votes of members of Congress, first find the member, then follow the link to the votes database, and then grab the XML download link.)

I found an XML feed of Shelby’s voting record linked off GovTrack: Sen. Richard Shelby [R-AL]’s Voting Record.

Clearly there’s a lot more that we can do with this data — stuff to explore in class.

Tagged , ,

listing applications installed in Windows XP with Python

The end of 2008 is approaching, making it an appropriate time to take inventory of my life — which also includes a lot of  my computer-related stuff.   In addition to cleaning up my office, I’m also cleaning up my Lenovo Thinkpad T60p, my primary work computer, whose drive has been close to its 100 GB limit for some time now.  To help me spot the disk hogs, I’ve been running WinDirStat – Windows Directory Statistics.

I’m also looking through all the programs I’ve installed over the years, lot of which I’ve not used and should be uninstalled to save space!  Although I’ve been using Windows XP’s Control Panel’s Add/Remove Program, I would also like to have some automated way to inventory my system — hence I started looking for Python code to do so.

I found the following code in List of all installed applications (XP)?:

import win32api, win32con, pywintypes

appKey = win32api.RegOpenKeyEx(win32con.HKEY_LOCAL_MACHINE, \
           'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths', 0, win32con.KEY_READ)
sklist = win32api.RegEnumKeyEx(appKey)

for skey in sklist:
     print skey[0]

     try:
          wPath = win32api.RegQueryValue(appKey, skey[0])
          print '    ' + wPath
     except pywintypes.error,details:
          print '### Error [pywintypes.error]: ' + details[2]

win32api.RegCloseKey(appKey)

The code seems to work. The response to query for a better technique pointed to Tim Golden’s Python Stuff: wmi. WMI looks cool and worthwhile following up with, especially because of what seems to be excellent documentation in the form of wmi Tutorial and wmi Cookbook.

Tagged , , ,

I installed the coins-metadata plugin

I just installed coins-metadata plugin for my various WordPress blogs so that Zotero can pick up the embedded OpenURL ContextObject in SPAN (COinS).

Tagged ,