Thursday, December 20, 2007

A project I would start if I could

LaTeX 2 ODT converter. Probably couldn't accept arbitrary LaTeX, but should at least be able to do headings, subheadings, lists and formulae/diagrams via images.

This could easily be run as GSoC or GHOP.

Tuesday, December 18, 2007

Interview -- "Why They Do Python"

I was recently asked to participate in an interview of a panel of Python experts by Odin Jobs, a recruitment site. Happy to help raise the profile of Python, I accepted. The interview, which includes ten other Pythoneers, is now available at http://www.odinjobs.com/blogs/careers/entry/python_experts_why_they_do.

Friday, November 9, 2007

My entry for James Tauber's Competition

I coded up an entry for http://jtauber.com/programming_competition/. Averaged across the categories, I'm coming about fourth/fifth. I may or may not try to refine my algorithm further, but it was fun taking part. Here's my unpolished code for the world to throw rocks at.

The algorithm is supposed to work on a reverse logic, considering which word affects the least number of verses and learning it last. It's too slow to handle the category four input file (I reckon it could take a week). I wrote a modified version which is much faster but does not perform as well.

The major time code is recalculating the word frequencies in each step. If this could be sped up, the algorithm would be tractable for larger inputs. The modified version runs in just a few minutes.


import sys


def remove_partial_verses(known_words, verseDict):
known_set = set(known_words)
for verseID, wordSet in verseDict.items():
if known_set.intersection(wordSet):
del verseDict[verseID]

def countWord(word, verseDict):
'''
This method counts the number of verses which contain the word
'''
count = 0

for verse in verseDict:
# count the number of verses
wordSet = verseDict[verse]
if word in wordSet: count += 1

return count

if __name__ == "__main__":
importFile = sys.argv[1]

inputFile = file(importFile, 'r')

wordDict = {}
verseDict = {}

for line in inputFile:
verse, word = line.split()

if verse in verseDict:
wordSet = verseDict[verse]
wordSet.add(word)

verseDict[verse] = wordSet

else:
verseDict[verse] = set([word])

if word in wordDict:
verseSet = wordDict[word]
verseSet.add(verse)

else:
wordDict[word] = set([verse])

totalWordSet = set(wordDict.keys())
known_words = []

learn_order = []

while(len(totalWordSet) > 0):
# print "Length: ", len(totalWordSet)

pairs = [(countWord(word, verseDict), word) for word in totalWordSet]
pairs.sort()

theWord = pairs[0][1]
learn_order.append(theWord)
known_words.append(theWord)
totalWordSet.discard(theWord)


remove_partial_verses(known_words, verseDict)

for word in learn_order[::-1]:
print "learn ", word

Wednesday, October 31, 2007

NVIDIA drivers when upgrading from Feisty to Gutsy

This mysteriously stuffed up on my system. The key, it turned out, is that there is a new package name for the nvidia drivers. The old package is not replaced during the upgrade, nor does it totally fail. It just doesn't work right.

The key is to turn off the proprietary driver, then turn it on again. This will trigger the de-installation of the old proprietary driver and the installation of the new package.

Monday, October 29, 2007

ExtJs and Python

It appears that extjs (http://extjs.com) is the greatest thing since sliced bread.

Since Python is also the greatest thing since sliced bread, they must be the same thing.

My goal is to start using a Python backend to support an extjs frontend application of some kind. I'd love to hear from anyone else who has used extjs, especially if they have tried to integrate it into a Python web framework.

I'll keep readers posted as I continue development of this application. It is likely to be very slow development, however, as I need to juggle a number of other responsibilities.

Cheers,
-T

First Post -- Newsgroup/Blog integration

As Editor-In-Chief of The Python Papers, it is not always appropriate to blog everything I would like to the official blog. I have decided that I need another blog. Everything that goes in pythonpapers.blogspot.com is said with my Editor-In-Chief hat on. Everything said on this blog is said with my own hat on.

I also ran melbournephilosopher.blogspot.com, but am no longer commenting on philosophical issues.

One thing which I'd really like is the ability to link my blog posts with a newsgroup. It would be rather awesome if everything I blogged here would get posted to comp.lang.python, and all replies to that message got left here as blog comments. That would be tres cool.

Thanks,
-Tennessee