Re: math - need divisors algorithm

2005-03-30 Thread Ed Suominen
Philp Smith wrote:

> Hi
> 
> Does anyone have suggested code for a compact, efficient, elegant, most of
> all pythonic routine to produce a list of all the proper divisors of an
> integer (given a list of prime factors/powers)

Is this compact enough? :-)

def properDivisors(N):
return [x for x in range(1,N-2) if not divmod(N,x)[1]]

---
Ed Suominen
Registered Patent Agent
Open-Source Software Author (yes, both...)
Web Site: http://www.eepatents.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nevow examples

2005-02-24 Thread Ed Suominen
Travis, that's a very nice use of Nevow. I'm going to look into using it for
documenting my own stuff.

Here's another example, my boss's web site, which uses Twisted/Nevow to
implement virtual hosting, dynamic image generation with caching,
dynamically-updated parsing of a site-wide config file that determines
almost all the layout you see, and dynamic mark-up generation with
restructured-text parsing of plain text source files.

http://valuablepatents.com

A static vhost run under the same Twisted/Nevow server is at
http://eepatents.com.

I make new servers by simply adding a DNS entry in BIND and then making a
new directory in /var/www/ with a site.conf file in it if it's dynamic, or
just with static files if it's static, or with a side.mod file if it the
vhost's root resource is generated from a named module imported
from /var/www/_modules/.

I will be providing a release and possibly read-only public access to the
SVN repository for the underlying code soon. It will be distributed under
the LGPL.

---
Ed Suominen
Registered Patent Agent
Open-Source Software Author (yes, both...)
Web Site: http://www.eepatents.com

Travis Oliphant wrote:

> 
> There was a request for nevow examples.  Nevow is a fantastic
> web-development framework for Python.
> 
> I used nevow to create http://www.scipy.org/livedocs/
> 
> This site uses nevow and self introspection to produce (live)
> documentation for scipy based on the internal docstrings.   It would be
> nice to add the capability for users to update the documentation through
> the web-site.  But, that functionality is not complete.
> 
> The code itself is available in the util directory of scipy which can be
> checked out of CVS (or browsed).  Go to http://www.scipy.org  for mor
> details.
> 
> -Travis Oliphant

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scan document pages to a compressed PDF

2005-02-14 Thread Ed Suominen
Replying to my own post, this looks like a very promising tool:

"Pytiff is a library for using TIFF files and advanced imaging in Python."
http://pubweb.northwestern.edu/~omh221/software_projects/pytiff/pytiff.html

Ed Suominen wrote:

> I'd like to write a Python-based commandline tool that will scan pages
> with SANE, applying CCITT Group 4 compression during scanning, and produce
> a single PDF file. I would release it under GPL. Right now, I'm relying on
> a workable but inflexible shell script that pipes stuff between scanimage,
> tiffcp, tiff2ps, and ps2pdf.
> 
> What's the best way currently to do CCITT4 compression (e.g., of
> intermediate TIFF-format images) from Python? PIL doesn't seem to support
> CCITT4 compression, and the read-only patch [1] that's available won't
> help in my case. I'd like to incorporate as much as possible into the
> Python code and imported packages, rather than relying on pipes to a bunch
> of external programs.
> 
> Same question regarding SANE -- I can't seem to find the supposed PIL
> support for SANE in the release on my system. Anyone know about that, or
> alternatives?
> 
> ---
> Ed Suominen
> Registered Patent Agent
> Open-Source Software Author (yes, both...)
> Web Site: http://www.eepatents.com
> 
> [1] http://mail.python.org/pipermail/image-sig/2003-July/002354.html

-- 
http://mail.python.org/mailman/listinfo/python-list


Scan document pages to a compressed PDF

2005-02-14 Thread Ed Suominen
I'd like to write a Python-based commandline tool that will scan pages with
SANE, applying CCITT Group 4 compression during scanning, and produce a
single PDF file. I would release it under GPL. Right now, I'm relying on a
workable but inflexible shell script that pipes stuff between scanimage,
tiffcp, tiff2ps, and ps2pdf.

What's the best way currently to do CCITT4 compression (e.g., of
intermediate TIFF-format images) from Python? PIL doesn't seem to support
CCITT4 compression, and the read-only patch [1] that's available won't help
in my case. I'd like to incorporate as much as possible into the Python
code and imported packages, rather than relying on pipes to a bunch of
external programs.

Same question regarding SANE -- I can't seem to find the supposed PIL
support for SANE in the release on my system. Anyone know about that, or
alternatives?

---
Ed Suominen
Registered Patent Agent
Open-Source Software Author (yes, both...)
Web Site: http://www.eepatents.com

[1] http://mail.python.org/pipermail/image-sig/2003-July/002354.html
-- 
http://mail.python.org/mailman/listinfo/python-list