Archive for September, 2007

Mini Searches with Answers

Saturday, September 29th, 2007

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

Vision Research – Slow Motion Video of Popcorn Popping
I did a search for high speed photography popcorn and this should have been the first result. I got curious for some reason why popcorn seeds turn into popcorn and not just explode. It turns out the heat turns the inside part into a foam-like material.

How to run python applications as NT service – comp.lang.python | Google Groups
This is the best explanation for how to create a Windows service from Python code using Python win32 extensions. It still sounds like too much work though. I’m just going to put my script in the windows startup folder unless anyone objects :-)

How to Catch Errors in SimpleXMLRPCServer – comp.lang.python | Google Groups
You have to register a class, and your class has to implement a _dispatch function. (see link for details).

Python – How to extract EXIF data with PIL
from PIL import Image
from PIL.ExifTags import TAGS

def get_exif(fn):
ret = {}
i = Image.open(fn)
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret

Convert File to be Embedded in a URI
I wonder how well this works. Could you embed an image in the URL instead of using image hosting?

Finding Unused Fields in GoldMine
This query will show you all user defined fields that are not used in any tab, or the top half of the screen:

select field_name from contudef where field_name like ‘U%’ and field_Name not in
(select fldname from fields5 where fldname like ‘U%’)

Tags: , , , , , , , , , , , , , , , , , ,

Mini Searches with Answers

Sunday, September 23rd, 2007

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

geopy – Geocoding Toolbox for Python
geopy makes it easy for developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other sources of data, such as wikis.

Why I ditched XMLRPC in favor of Pyro – O’Reilly ONLamp Blog
I was searching for "Pyro vs SimpleXMLRPCServer" since they both kind of do the same thing, I was curious how they compared. Here is at least one point for Pyro, it handles the None datatype.

Here is a Decorator I finally Understand
(formatting may not carry over from Del.icio.us)
>>> def addspam(fn): … def new(*args): … print "spam, spam, spam" … return fn(*args) … return new … >>> @addspam … def useful(a, b): … print a**2 b**2 … >>> useful(3,4) spam, spam, spam 2

ASPN : Python Cookbook : Module to allow Asynchronous subprocess use on Windows and Posix platforms
Here’s how to use subprocess in Python to read printed values from a launched process before it exits, and to interact with it in general. Apparantly the default action with subprocess is to wait until a process exits to read its pipe?

Python – how to kill a process without leaving zombies
os.kill(pid, signal.SIGKILL);
killedpid, stat = os.waitpid(pid, os.WUNTRACED) ;
if killedpid == 0:
print >> sys.stderr, "ACK! PROCESS NOT KILLED?";

Tags: , , , , , , , , , , , , , , , , ,

Python’s SimpleXMLRPCServer – How to Serve from a Different Machine

Friday, September 14th, 2007

It turns out that following the example from Python’s SimpleXMLRPCServer documentation of serving from localhost only works for well, localhost:

from SimpleXMLRPCServer import SimpleXMLRPCServer
# Create server
server = SimpleXMLRPCServer(("localhost", 8000))
#snip ...(register functions here, see example)
server.register_instance(MyFuncs())
# Run the server's main loop
server.serve_forever()

To make your server available to other computers on your network you should do something like this:

import socket
from SimpleXMLRPCServer import SimpleXMLRPCServer
# Create server
server = SimpleXMLRPCServer((socket.gethostbyname(socket.gethostname()), 8000))
#snip ...(register functions here, see example)
server.register_instance(MyFuncs())
server.serve_forever()

Open question, will this work for serving to the internet at large, or do I need to do something differently? I’m actually not sure why localhost doesn’t work across the LAN. Does anyone know?

I found this answer by a google code search for SimpleXMLRPCServer.

Mini Searches with Answers

Friday, September 14th, 2007

These are links associated with recent searches I’ve done. They’re not difficult enough to warrant to their own posts but still super useful.

Test your web design in different browsers – Browsershots
This site takes screenshots of any requested webpage in up to 10 different browers/platforms. It’s even open source (GPL) and it’s written in Python.. I’m impressed.

Download details: Internet Explorer Developer Toolbar - IEDevToolBarSetup.msi
A firebug for IE? Not quite probably, but it may be useful.

templatemaker – Google Code
This thing learns patterns from text you give and is then able to extract data. It looks really neat, I just wish I could think of a use for it.

PDF Editor
Free software to edit PDFs. Let me know how it works.

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

A Fix for When All Your Firefox Extensions Die

Thursday, September 13th, 2007

Enthusiast Answer My Searches reader, Jody writes in with this Firefox tip:

For some absurd reason (I believe PDF downloader – now incompatible with Firefox 2.0.0.6) all of my Firefox extensions stopped working. Upon opening the add-ons screen, every extension said “This add-on will be installed when Firefox is restarted.”

The simple solution is to close Firefox, and delete the following file. Everything should be fine after that. C:\Documents and Settings\[windows user]\Application Data\Mozilla\Firefox\Profiles\[PROFILE NAME]\extensions.cache

Thanks for the tip, Jody!