Jeff’s Brain Dump

Sometimes the first duty of intelligent men is the restatement of the obvious.

Python and “the Nod”

Posted by Jeff August 04, 2006

Kathy Sierra writes about “The Nod” - the acknowledgement of another person’s good taste in making the same choices as you.

What does this have to do with programming languages? Programmers care deeply about language choice — How do python developers recognize each other?  There should be an obvious signifier - like a laptop sticker. The guy on the train might be a MOT (Member of the Tribe), too.

I’ve looked around on cafepress and see a few, but they’re the old logo. I want a sticker with the new logo.

,

Gobby for Clipboard transfer

Posted by Jeff August 03, 2006

Gobby is a cross-platform collaborative text editor: like SubEthaEdit, but platform agnostic (and encrypted too). I’ve found it to be pretty stable and useful.
I’m often in the situation where I’m remote-controlling a Windows-based machine and want to take notes/blog about what I’m doing - I need that remote error message into my local text editor.

Only Radmin does clipboard transfer.  VNC, NetMeeting, Windows Remote Desktop don’t even try.

So here’s the trick - setup a Gobby session between machines. Paste from one machine, Copy from another. It’s a hack, but it works.

 Update- Marcus points out that UltraVNC does clipboard transfer.

, , , ,

NO Connection Fees!

Posted by Jeff July 21, 2006

Hangman - nice lil game built with GWT

JavaAlmanac - switching between too many languages? This site has the snippets you need.

Rubik’s Cube Solving Robot video

Python on the Nokia S60 The geek in me wants this very much.

Fly Guy - Flash game. Strangely relaxing.

SqlObjectGuide : Best tips I’ve found for SQLObject, the Python O/R mapper.

, ,

Vacation’s All I ever wanted…

Posted by Jeff July 13, 2006

I’m in vacation, yet here I am on dialup, geeking out. Life moves slower here in the country..so do the downloads.

Textile your textareas with Greasemonkey

wikiPad - wiki app. Now open source. I’ve been using NoteLens for off-the-cuff notetaking, a little walled garden where I don’t have to worry about file names, but I’m jonesing for markup and hyperlinks…wikipad might do the trick.

Lumpy generates UML diagrams from a running Python program - darn, missed the presentation at the Boston Python meetup.

, ,

PyZine goes Free

Posted by Jeff June 22, 2006

Latest Issue
Issue 08
Issue 07
Issue 06
Issue 05
Issue 04
Issue 02
Issue 01

Technorati Tags: ,

No Tags

The Nose Knows

Posted by Jeff May 31, 2006

Titus has written a nice intro to nose with examples. I emphatically agree:

the most important part of having unit tests is that they can be run quickly, easily, and without any thought

Thus, I was suprised not to see something like Nosy, to automagically run tests when code changes. To me, running tests by hand requires thought, and a context switch. Nosy keeps me in the flow.

Pinocchio is an extension to filter out long-running tests so tests may be run quickly. This leads me to believe his test suite was too big to run automatically.

(What is it about nose that inspires bad puns? This blog title, nosy, pinocchio…well, what do expect in a language named after comedy troupe :)

,

, , ,

ShowMeDo vids are up

Posted by Jeff May 04, 2006

Using pyWinAuto to Control a Windows Application - this is an enhanced version of the animated GIF on the pyWinAuto Wiki.

Using Nosey for Python Testing - this is a movie of Nosy, which uses Nose to automatically run unit tests.

Ian makes a good editor :)

, , , ,

Keeping your Nose Green

Posted by Jeff April 27, 2006

Mark of pywinauto fame told me about nose, a unit testing tool with autodiscovery. I was slinging some python over the weekend, and needed coverage as my codebase got bigger.. so I whipped this up. I run this on a DOS window under windows. Basically every time you change any .py file, it runs tests. I call it nosy. (nosy.py)

import glob,os,stat,time

def checkSum():
‘'’ Return a long which can be used to know if any .py files have changed.
Only looks in the current directory. ‘'’
val = 0
for f in glob.glob (’*.py’):
stats = os.stat (f)
val += stats [stat.ST_SIZE] + stats [stat.ST_MTIME]
return val

val=0
while (True):
if checkSum() != val:
val=checkSum()
os.system (’nosetests’)
time.sleep(1)

A screencast is up at ShowMeDo. I’ve sent it to Jason for improvement.

Update: Windows Installer for Nosy.

, , ,

Scripting Eclipse with Jython and PyDev

Posted by Jeff April 26, 2006

I joined the Eclipse Monkey project Dashtime the other day, and spend the hour talking to Ward Cunningham (Wiki inventor)… very cool.

I had seen Monkey on Wayne Beaton’s Eclipse when he talked at NEJUG/BostonEdge, and scripting sounded interesting. I hadn’t even installed, and didn’t expect to be the only caller!

We had a good discussion, my notes are here. Apparently Rhino was selected because JavaScript is”nobody’s favorite language” :)

Monkey is useful but doesn’t yet have autocomplete or an interactive shell. I think that’s needed to learn the API’s, and delve further into Eclipse plugins and SWT. EclipseShell is interesting, but it’s not a straight interactive console like Python’s, where you can create and interact with objects. (Perhaps the Rhino console can be hooked up)

I use PyDev for Python development, and even sprang for the extensions, which allow an Interactive Console. I can fire up Jython within Eclipse and then import and invoke Java objects-

However, something is wrong.. I want to get the the active window (the window global in Monkey), but it is coming back null:

window = wb.getActiveWorkbenchWindow() print window None

Other API’s work fine…

for vd in wb.getViewRegistry().getViews():
print vd.getId()
byecycle.views.ByecycleView
com.kodeshare.search.ui.KodeSearchView edu.mit.csail.relo.console.ConsoleView

There’s more than one way to skin a cat–getWorkbenchWindows() works:

wnds = PlatformUI.getWorkbench().getWorkbenchWindows()
len(wnds)
1
window=wnds[0]

Great! Let’s try a HelloWorld..

import org
org.eclipse.jface.dialogs.MessageDialog.openInformation( window.getShell(), Hello”,”World”)
Traceback (innermost last): File “<console>”, line 1, in ? org.eclipse.swt.SWTException: Invalid thread access

At least this has a reasonable explanation (I’m on a worker thread).

So, you can use Eclipse API’s and objects interactively. Excellent. Next, I would love for Autocomplete to work. Ctrl-Space doesn’t work in the console. (Bug? I think so.. the console has the Jython nature now.)

For some wierd reason, the python dir() function isn’t working, returning an empty list even for a builtin class:

str = “Hello”
dir(str)
[]

Normally this would return a list of methods:

>>> dir(str)
[’__add__’, ‘__class__’, ‘__contains__’, ‘__delattr__’, ‘__doc__’, ‘__eq__’, ‘__ ge__’, ‘__getattribute__’, ‘__getitem__’, ‘__getnewargs__’, ‘__getslice__’, ‘__g t__’, ‘__hash__’, ‘__init__’, ‘__le__’, ‘__len__’, ‘__lt__’, ‘__mod__’, ‘__mul__ ‘, ‘__ne__’, ‘__new__’, ‘__reduce__’, ‘__reduce_ex__’, ‘__repr__’, ‘__rmod__’, ‘ __rmul__’, ‘__setattr__’, ‘__str__’, ‘capitalize’, ‘center’, ‘count’, ‘decode’, ‘encode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘index’, ‘isalnum’, ‘isalpha’, ‘isdi git’, ‘islower’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lower’, ‘lst rip’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’, ‘rsplit’, ‘rstrip’, ’split’, ’split lines’, ’startswith’, ’strip’, ’swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill ‘]

So close.. hopefully pydev extensions can enable autocomplete on the console. That would make for a truly interactive exploration of the Eclipse environment.

No Tags

• Newer blog posts »