cgi relay for python cgi script

2005-10-04 Thread Amir Michail
Hi,

Is there an easy way to execute a python cgi script on a different
machine from the cgi server?

I could write my own server, but I was wondering if something is
available that would allow me to use a cgi script as is without
modification.

Amir

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


Re: cgi relay for python cgi script

2005-10-04 Thread Amir Michail
Fredrik Lundh wrote:
> Amir Michail wrote:
>
> > Is there an easy way to execute a python cgi script on a different
> > machine from the cgi server?
>
> http://www.google.com/search?q=reverse+proxy
>
> 

Is there an easy way to do this without modifying the configuration of
the cgi server and without running a cgi server on the other machine
where the script will actually run?

Perhaps someone wrote a simple server that provides the required
environment for the cgi script to run?

I'm looking for something simple that does not require root access.

Amir

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


Re: cgi relay for python cgi script

2005-10-04 Thread Amir Michail
Fredrik Lundh wrote:
> Amir Michail wrote:
>
> > Is there an easy way to do this without modifying the configuration of
> > the cgi server and without running a cgi server on the other machine
> > where the script will actually run?
> >
> > Perhaps someone wrote a simple server that provides the required
> > environment for the cgi script to run?
> >
> > I'm looking for something simple that does not require root access.
>
> you could of course use something like
>
> http://docs.python.org/lib/module-CGIHTTPServer.html
>
> or some other light-weight web server, but you should probably have in mind
> that doing things like this without coordinating with your server 
> administrators
> and security architects *before* you start tinkering can be a excellent way to
> get fired...
>
> 

I would like to do this to improve performance by avoiding nfs. (The
required data is not on the cgi server.)

The advice I got was to use something like MySQL with a client/server
architecture.

However, I thought it would be easier to simply run the core part of
the script off the cgi server, thereby avoiding nfs for data lookups.

So I guess the point is that such a solution is more likely to be a
security risk than MySQL?

Amir

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


deleting a parameter's name as it is passed to a function

2005-10-14 Thread Amir Michail
Hi,

I think it would be useful to delete a name of a parameter object as
the object is passed to a function:

dosomestuff(del a)

instead of

dosomestuff(a)
del a

The idea is to garbage collect the object as soon as possible, and this
may be sooner than when dosomestuff returns.

Amir

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


Re: deleting a parameter's name as it is passed to a function

2005-10-14 Thread Amir Michail
Paul Rubin wrote:
> "Amir  Michail" <[EMAIL PROTECTED]> writes:
> > The idea is to garbage collect the object as soon as possible, and this
> > may be sooner than when dosomestuff returns.
>
> If it's a parameter to dosomestuff, then there's still a reference
> until dosomestuff returns.  Simply getting rid of the name only frees
> a dictionary entry.

But dosomestuff can get rid of its reference before it returns (perhaps
it has a lot more to do before it returns and so you would want to
garbage collect the parameter object as soon as possible).

Amir

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


Make predictions about Python in a New Google Game

2005-01-08 Thread Amir Michail
Hi,

I have added over 50 Python related (Query, URL) pairs into the
Speculative Search Game -- a new Google game.

Just search for "python" to find them when making predictions:

http://www.cse.unsw.edu.au/~amichail/spec/

The Speculative Search Game allows you to predict which web pages will
rank more highly on Google in the future.  Your score will depend on
the actual ranking of those pages in the future.

The output of the game will be used to build a Speculative Search
Engine that ranks those web pages more highly today.

Note that such predictions can be helpful in managing a large project.
See for example this article:

http://www.time.com/time/insidebiz/article/0,9171,1101040712-660965-1,00.html

The python (Query, URL) pairs that I added have pretty general queries
such as "python" and "python bindings".  Feel free to add other sorts
of queries to those URLs (e.g., "gui framework", "scripting language",
"programming", etc.)

Of course, feel free to add other sites as well, including any of your
python sites that I have missed.

Amir

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


Open Course on Software System Design and Implementation

2005-02-22 Thread Amir Michail
Hi,

I will be teaching a course on software system design and
implementation.

Like last year, the course will be open meaning that anyone can
participate in online discussions -- not only UNSW students.

You can find a mind map of topics covered last year here:

http://cs3141.web.cse.unsw.edu.au/mindmap.html (Java required)

There is a significant python component.

Feel free to register and participate in the online discussions.

http://cs3141.web.cse.unsw.edu.au

Amir

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


ideal rankings for python related search engine queries

2005-04-09 Thread Amir Michail
Hi,

Google is good, but not perfect.

CollaborativeRank takes Google rankings as a starting point but allows
users to tweak them in a collaborative way to achieve something even
better.

Perhaps some people in this group might be interested in producing even
better rankings for python related queries?

http://www.cse.unsw.edu.au/~amichail/collabrank
http://www.cse.unsw.edu.au/~amichail/collabrank/collabrank.pdf

The system uses a hubs and authorities style analysis to encourage
timely and helpful ranking suggestions.  See the paper for details.

Amir

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


unpickling Set as set

2006-11-07 Thread Amir Michail
Hi,

Is there an easy way to unpickle the older Set as the newer set behind
the scenes when using shelve?

Amir

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


avoiding file corruption

2006-08-27 Thread Amir Michail
Hi,

Trying to open a file for writing that is already open for writing
should result in an exception.

It's all too easy to accidentally open a shelve for writing twice and
this can lead to hard to track down database corruption errors.

Amir

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


Re: avoiding file corruption

2006-08-27 Thread Amir Michail

Paolo Pantaleo wrote:
> 27 Aug 2006 00:44:33 -0700, Amir  Michail <[EMAIL PROTECTED]>:
> > Hi,
> >
> > Trying to open a file for writing that is already open for writing
> > should result in an exception.
> >
> > It's all too easy to accidentally open a shelve for writing twice and
> > this can lead to hard to track down database corruption errors.
> >
> > Amir
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
> Even if it could be strange, the OS usually allow you to open a file
> twice, that's up to the programmer to ensure the consistency of the
> operations.
>
> PAolo
>

But if this is usually a serious bug, shouldn't an exception be raised?

Amir

>
>
> --
> if you have a minute to spend please visit my photogrphy site:
> http://mypic.co.nr

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


Re: avoiding file corruption

2006-08-27 Thread Amir Michail
Diez B. Roggisch wrote:
> Amir Michail schrieb:
> > Paolo Pantaleo wrote:
> >> 27 Aug 2006 00:44:33 -0700, Amir  Michail <[EMAIL PROTECTED]>:
> >>> Hi,
> >>>
> >>> Trying to open a file for writing that is already open for writing
> >>> should result in an exception.
> >>>
> >>> It's all too easy to accidentally open a shelve for writing twice and
> >>> this can lead to hard to track down database corruption errors.
> >>>
> >>> Amir
> >>>
> >>> --
> >>> http://mail.python.org/mailman/listinfo/python-list
> >>>
> >> Even if it could be strange, the OS usually allow you to open a file
> >> twice, that's up to the programmer to ensure the consistency of the
> >> operations.
> >>
> >> PAolo
> >>
> >
> > But if this is usually a serious bug, shouldn't an exception be raised?
>
> executing "rm -rf /" via subprocess is usually also a bad idea. So? No
> language can prevent you from doing such mistake. And there is no way to
> know if a file is opened twice - it might that you open the same file
> twice via e.g. a network share. No way to know that it is the same file.
>
> Diez

The scenario I have in mind is something like this:

def f():
  db=shelve.open('test.db', 'c')
  # do some stuff with db
  g()
  db.close()

def g():
  db=shelve.open('test.db', 'c')
  # do some stuff with db
  db.close()

I think it would be easy for python to check for this problem in
scenarios like this.

Amir

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


Re: avoiding file corruption

2006-08-27 Thread Amir Michail
Grant Edwards wrote:
> On 2006-08-27, Amir  Michail <[EMAIL PROTECTED]> wrote:
>
> > Trying to open a file for writing that is already open for writing
> > should result in an exception.
>
> MS Windows seems to do something similar, and it pisses me off
> no end.  Trying to open a file and read it while somebody else
> has it open for writing causes an exception.  If I want to open
> a file and read it while it's being writtent to, that's my
> business.
>
> Likewise, if I want to have a file open for writing twice,
> that's my business as well.  I certainly don't want to be
> hobbled to prevent me from wandering off in the wrong direction.
>
> > It's all too easy to accidentally open a shelve for writing
> > twice and this can lead to hard to track down database
> > corruption errors.
>
> It's all to easy to delete the wrong element from a list.  It's
> all to easy to re-bind the wrong object to a name.  Should
> lists be immutable and names be permanently bound?
>

How often do you need to open a file multiple times for writing?

As a high-level language, Python should prevent people from corrupting
data as much as possible.

Amir

> --
> Grant Edwards   grante Yow!  I'm in a twist
>   at   contest!! I'm in a
>visi.combathtub! It's on Mars!! I'm
>in tip-top condition!

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


python vs java & eclipse

2006-12-01 Thread Amir Michail
Hi,

It seems to me that measuring productivity in a programming language
must take into account available tools and libraries.

Eclipse for example provides such an amazing IDE for java that it is no
longer obvious to me that one would be much more productive in python
for medium sized projects.

Sure, all that Java static typing can be painful, but Eclipse takes
some of that pain away. Moreover, static typing can result in better
on-the-fly error detection and refactoring support.

Any thoughts on this?

Amir

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


Re: python vs java & eclipse

2006-12-01 Thread Amir Michail

krishnakant Mane wrote:
> just used the py dev plugin for eclipse.
> it is great.

But isn't support for java better because the eclipse ide can take
advantage of explicit type declarations (e.g.,  for intellisense,
refactoring, etc.)?

Amir

> auto indentation and intellisence.
> and all other things.
> so now how does it look from this end?
> python + productivity and eclipse + productivity = double productivity!
> only problem with the plugin is that I find it difficult to manage the
> script running.
> I open a command prompt and run the scripts manually.
> any suggestion for this.
> for example I had name = raw_input("please enter your name") and the
> moment I type the first letter on the keyboard the code execution
> moves over to the next statement.  should it not wait for the return
> key as it always does?
> Krishnakant.

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


Re: python vs java & eclipse

2006-12-01 Thread Amir Michail
[EMAIL PROTECTED] wrote:
> ...
>
> Is there anything _useful_ that it'll bring that a good editor doesn't?
>  e.g. in vim I do get
> * automatic syntax checking (if I type "if a=1:" and hit enter, it'll
> immediately highlight the syntax error)
> * omni-completion (because Intellisense is trademarked)
> * refactoring (with BicycleRepairMan integration)
> * folding (which is more important than the above 3 combined, IMO)
> * online help (typing cmp( gives me the docstring for cmp in the status
> line, F1 to view the whole thing)
>
> As well as all the basics (tags/class browser/good regex support/syntax
> highlighting/autoindent/source control integration/etc).
>
> I'm not trolling here, I'm looking for interesting new features I can
> steal.

How about we try to find some papers on the subject?

Here's one to start things off:

http://pag.csail.mit.edu/~akiezun/companion.pdf

Amir

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


Re: python vs java & eclipse

2006-12-02 Thread Amir Michail
Hi,

Here's a blog post that is relevant to this discussion:

http://sixthandredriver.typepad.com/river_of_code/2006/01/automated_refac.html

Amir

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


editor for shelve files

2005-05-01 Thread Amir Michail
Hi,

Is there a program for editing shelve databases?

Amir

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


Re: editor for shelve files

2005-05-01 Thread Amir Michail
David M. Cooke wrote:
> "Amir  Michail" <[EMAIL PROTECTED]> writes:
>
> > Hi,
> >
> > Is there a program for editing shelve databases?
> >
> > Amir
>
> I doubt it. A shelf is basically just a file-based dictionary, where
> the keys must be strings, while the values can be arbitrary objects.
> An editor could handle the keys, but most likely not the values.
>
> If you have an editor for arbitrary objects, you could probably make
> an editor for shelfs easily enough :-)
>
> Do you have a specific use in mind? That would be easier to handle
> than the general case.

Such an editor could at least handle some basic types including nested
lists and dictionaries.

I've written an application that uses many shelve files.  Sometimes I
need to make a minor change to the data and don't really want to write
code just to make that change.

Amir

>
> --
> |>|\/|<
>
/--\
> |David M. Cooke
> |cookedm(at)physics(dot)mcmaster(dot)ca

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


random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
Hi,

Is it the case that the random module will always give the same
results if given the same seed across all configurations (e.g.,
architectures, compilers, etc.)?

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


Re: random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
On Mar 3, 10:05 pm, Chris Rebert  wrote:
> On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
> > Hi,
>
> > Is it the case that the random module will always give the same
> > results if given the same seed across all configurations (e.g.,
> > architectures, compilers, etc.)?
>
> Your question is vague. Define what you mean by "same results" in this 
> context.

In Python 2.5, if you use the same seed, will calls to randrange yield
the same numbers across all configurations?

Amir

>
> Cheers,
> Chris
>
> --
> I have a blog:http://blog.rebertia.com

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


Re: random module gives same results across all configurations?

2009-03-03 Thread Amir Michail
On Mar 4, 2:26 am, "Diez B. Roggisch"  wrote:
> Amir Michail schrieb:
>
> > On Mar 3, 10:05 pm, Chris Rebert  wrote:
> >> On Tue, Mar 3, 2009 at 6:59 PM, Amir Michail  wrote:
> >>> Hi,
> >>> Is it the case that the random module will always give the same
> >>> results if given the same seed across all configurations (e.g.,
> >>> architectures, compilers, etc.)?
> >> Your question is vague. Define what you mean by "same results" in this 
> >> context.
>
> > In Python 2.5, if you use the same seed, will calls to randrange yield
> > the same numbers across all configurations?
>
> What do you mean with "configurations"?
>
> Random uses AFAIK rand/srand from the stdlib.h of your platform (*nix,
> no idea how that beast is called in redmond).
>
> So whatever the behaviour, it will be driven by that, and I guess it
> varies between platforms.
>
> Diez

So far I get the same results under Mac OS X, Windows, and Linux
(Google App Engine).  I'm particularly interested in getting the same
results under the Google App Engine even as Google upgrades its
servers over time.

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


python library for web discussions

2006-03-18 Thread Amir Michail
Hi,

I'm building something like digg/reddit and would like to allow people
to have discussions on various items.

Is there a simple lightweight python library that I can use (as opposed
to a heavyweight web framework)?  Although not necessary, some sort of
scoring/moderation mechanism would be good also (e.g., like
reddit/slashdot).

Amir

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


Re: python library for web discussions

2006-03-19 Thread Amir Michail
Gregory Petrosyan wrote:
> reddit is written with webpy (webpy.org), maybe you should give it a
> try?

I'm looking for a library that provides commenting on items in a
similar way to reddit/digg/slashdot.  I would rather not write all that
code from scratch.

I don't think web.py comes with that functionality, although of course,
some free package may provide it on top of web.py.

Amir

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