Re: [Tutor] Pyhon Mac/Pc

2008-01-14 Thread Alan Gauld

"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote
>> Hendrik Verlinden wrote:
>>> Yes I'm using the files from this link
>>> http://relro.net/racer/dofexport.html :)
>>> 
>>> Do you now what the problem is with these files on a mac?
>>> Otherwise how do I have to change the carriage return or line 
>>> feed?
>>
>> Looking at the files, they seem to be in a binary format so my 
>> guess
>> about line endings is probably not correct.
> Are you reading/writing the files in binary mode?

Since the OP is not a Python programmer and doesn't know
how to modify the carriage return then I doubt he will know if
he is using binary mode. I think Kent's suggestion is best that
he contact the supplier - blind tinkering is more likely to cause
more damage than help.

The alternative suggestion is for the OP to learn Python
I suppose! :-)

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why Won't My Pizza Fall?

2008-01-14 Thread Alan Gauld

"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote

> Anyway Alan, what do you think about Pizza as a class? It has two
> properties, (x, y) that express it's position, but with respect to 
> what?

Any cartesian coordinate system.

> Pizza cannot exist by itself, it has a strong dependency on another
> object that will give context to Pizza.x and Pizza.y and in giving
> context then it would modify Pizza's behavior

Providing context does not necessarily imply modifying core
behaviour.

> happens and where is the floor). So Pizza is tightly coupled with
> another object. Isn't that questionable? I don't have an answer. 
> What do
> you think?

It is coupled in that it receives the x,y from an outside agency.
But it does not depend on that agency once intialised. The
coordinate system could be an 80x24 character display or
a 1024x768 GUI screen or a 4x6 virtuyal screen
or a purely conceptual mathematical model. Pizza doesn't
care it just knows where it is now and how to "fall". The only
context it needs is the initial x,y and the dx,dy values that
govern its fall rate.

If some other factor were to determine its behhaviour more
closely - such as determining whether the Pizza was within
the coordinate boundaries or in collision with another Pizza
then that could be implemented via a message protocol.
Thus the context object should respond to some message
from Pizza and in this case the Pizza should hold a reference
to its context manager(probably a screen or grid of some sort).
The context manager is responsible for tracking the objects
being managed, but the objects remain responsible for
managing their own state.

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Daemonizing Scripts

2008-01-14 Thread Alan Gauld

"Lawrence Barrott" <[EMAIL PROTECTED]> wrote 

> Thank you I have read through the rest of the replies 
> for this problem and was wondering if something similar 
> could be done in Windows (XP).

The equivalent to a daemon on XP is a service.
If you do a bit of googling you should find an Active|State 
cookbook recipe for making a python script into a service

HTH,

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] YouTube Python web framework

2008-01-14 Thread OkaMthembo
Dear Friends,

Does anybody know what Python web framework e.g. Webware or Web.py, etc
YouTube is built on/in?

Kind Regards,

-- 
Sithembewena Lloyd Dube

"The Stupidry Foundry"
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] YouTube Python web framework

2008-01-14 Thread Kent Johnson
OkaMthembo wrote:
> Dear Friends,
> 
> Does anybody know what Python web framework e.g. Webware or Web.py, etc 
> YouTube is built on/in?

There is a little info here, perhaps the referenced video has more details:
http://highscalability.com/youtube-architecture

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Read protection of python files for Abaqus

2008-01-14 Thread Ferruh KAYHAN
Dear Sirs;
Good morning.
I do not like abaqus users will read my python file codes.  How can I
protect my codes from reading ans still workable by Abaqus import??
 
Best Regards
Ferruh Kayhan

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Recieving emails in python

2008-01-14 Thread Shane Geiger
[EMAIL PROTECTED] wrote:
> I m trying to create something simple a mailing list similar to yahoo
> groups
> I m stumbling at the part where the python recieves messages via say
> [EMAIL PROTECTED] 
>
> how to make python recieve emails and process it
> after that it is straight forward processing in python inserting in db etc

Can you use POP to access Yahoo groups?

If so, this script will get you started:

#!/usr/bin/python
"""
Redirect the output to a file to capture the contents of the mailbox.
"""
host = 'foo.com'
account = 'jennyjenny'
password = '8675309'

import getpass, poplib
M = poplib.POP3(host)
#M.user(getpass.getuser())
#M.pass_(getpass.getpass())
M.user(account)
M.pass_(password)
numMessages = len(M.list()[1])
for i in range(numMessages):
for j in M.retr(i+1)[1]:
print j



-- 
Shane Geiger
IT Director
National Council on Economic Education
[EMAIL PROTECTED]  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read protection of python files for Abaqus

2008-01-14 Thread Kent Johnson
Ferruh KAYHAN wrote:
> Dear Sirs;
> Good morning.
> I do not like abaqus users will read my python file codes.  How can I 
> protect my codes from reading ans still workable by Abaqus import??

You can ship .pyc files instead of .py files, that will discourage 
casual readers.

I don't think there is anything you can do to stop a determined reader 
from understanding your code.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] YouTube Python web framework

2008-01-14 Thread OkaMthembo
Thanks Kent :)

On Jan 14, 2008 2:09 PM, Kent Johnson <[EMAIL PROTECTED]> wrote:

> OkaMthembo wrote:
> > Dear Friends,
> >
> > Does anybody know what Python web framework e.g. Webware or Web.py, etc
> > YouTube is built on/in?
>
> There is a little info here, perhaps the referenced video has more
> details:
> http://highscalability.com/youtube-architecture
>
> Kent
>



-- 
Sithembewena Lloyd Dube

"The Stupidry Foundry"
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read protection of python files for Abaqus

2008-01-14 Thread bhaaluu
Greetings,
On Jan 14, 2008 3:17 AM, Ferruh KAYHAN <[EMAIL PROTECTED]> wrote:
> Dear Sirs;
> Good morning.
> I do not like abaqus users will read my python file codes.  How can I
> protect my codes from reading ans still workable by Abaqus import??
>
> Best Regards
> Ferruh Kayhan


Abaqus is widely used in the automotive, aerospace, and industrial
products industries. The package is very popular with academic and
research institutions
...
These software products, especially Abaqus/CAE, extensively use the
open-source scripting language Python for scripting and customization.


Don't academics and researchers thrive on sharing information?
Also, this forum is geared towards learning Python, and sharing
source code is encouraged in order to obtain help.

Also, "many eyes" can find and fix bugs in your scripts,
as well as, others may find the scripts useful: ie. research
can advance more quickly.

Is there a particular reason why you don't want others to see your
Abaqus Python scripts?

Just curious.
-- 
b h a a l u u at g m a i l dot c o m
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read protection of python files for Abaqus

2008-01-14 Thread Ferruh KAYHAN
Thank you very much for your reply. 

-Original Message-
From: Kent Johnson [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 14, 2008 2:13 PM
To: Ferruh KAYHAN
Cc: tutor@python.org
Subject: Re: [Tutor] Read protection of python files for Abaqus

Ferruh KAYHAN wrote:
> Dear Sirs;
> Good morning.
> I do not like abaqus users will read my python file codes.  How can I 
> protect my codes from reading ans still workable by Abaqus import??

You can ship .pyc files instead of .py files, that will discourage
casual readers.

I don't think there is anything you can do to stop a determined reader
from understanding your code.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read protection of python files for Abaqus

2008-01-14 Thread Ferruh KAYHAN
Dear Sir;
Thank you for your reply.  Oftenly, especially in industrial companies,
codes are becoming very valuable and owner of the company likes to keep
that value as confidential in order to protect the company
competitivness.  Somr times, professionals are leaving companies and
starting new jobs in competitor companies.  Therefore, protecting some
codes are becoming important.

So in our case, we are not trying to stop anybody learning python
language but we are trying to protect what we are doing with python.

I hope my reply is sufficient.

Regards 

-Original Message-
From: bhaaluu [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 14, 2008 3:25 PM
To: Ferruh KAYHAN
Cc: tutor@python.org
Subject: Re: [Tutor] Read protection of python files for Abaqus

Greetings,
On Jan 14, 2008 3:17 AM, Ferruh KAYHAN <[EMAIL PROTECTED]> wrote:
> Dear Sirs;
> Good morning.
> I do not like abaqus users will read my python file codes.  How can I 
> protect my codes from reading ans still workable by Abaqus import??
>
> Best Regards
> Ferruh Kayhan


Abaqus is widely used in the automotive, aerospace, and industrial
products industries. The package is very popular with academic and
research institutions ...
These software products, especially Abaqus/CAE, extensively use the
open-source scripting language Python for scripting and customization.


Don't academics and researchers thrive on sharing information?
Also, this forum is geared towards learning Python, and sharing source
code is encouraged in order to obtain help.

Also, "many eyes" can find and fix bugs in your scripts, as well as,
others may find the scripts useful: ie. research can advance more
quickly.

Is there a particular reason why you don't want others to see your
Abaqus Python scripts?

Just curious.
--
b h a a l u u at g m a i l dot c o m
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] how to change the values of keyboard keys in TKINTER

2008-01-14 Thread brindly sujith
hi

i want to know how to change the values of keyboard keys(for example:
I want to set alt+f4 to enter)

do we have any modules in tkinter for doing this...

plz tell me how we can do this
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Read protection of python files for Abaqus

2008-01-14 Thread Michael Langford
I know there are a lot of people who are very much for code openness
in all cases. I'm from a couple worlds that's not even something you'd
think about doing (military software, where people die if the other
side gets your code, and embedded software, where a company in china
copies your design and puts you out of business), so you have to work
within this sometimes. That said, many companies *vastly* overvalue
their code base, especially the great balance of it, when really 4-10
modules are the only valuable parts.

There are obfuscators that generally work for python and then only
shipping .pyc files (as someone suggested above) helps as well.

If the code really is that valuable, I doubt you're going to be able
to hide it well enough a determined, an attacker with a skill level
equal to many of the people on this list, couldn't extract your
algorithms. I'm am not saying .NET is any more secure in that than
python is either. Just introspective languages (Java too), have this
issue where they're quite a bit easier to reverse engineer.

Assuming its only moderately valuable, then the steps above should be enough.

You may think about isolating the highly valuable algorithm in a C
module then highly optimizing it and running a stripper on it. Then
connect it up to your python code with SWIG. That will defeat the
introspection attacks (they'll only be able to see the interface of
the C module), and the high levels of optimization in the C code
(which you should strip) will hide the algorithm further.

Another possibility is refactoring your algorithm into a code
generating utility which you don't let leave your facility. The
generated code will work, but is not reverse engineerable, as its just
something like a massive lookup table, or a series of decomposed
functions.

I've been the guy attacking code before. It all boils down to the
safe/lock issue: Locks and safes aren't there to keep people out
forever, every good lock and safe has an amount of time they expect to
keep people out. You have to have a security guard or something else
at that point to safeguard your valuables. Pick locks that are good
enough, and try to remove the incentives and abilities to break in
other ways.

--Michael

PS: I would like to point out. These other people will be able to
*call* your highly proprietary code no matter what you do. So if
nothing else, a determined attacker can just call your code again
without understanding it.
-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com


On 1/14/08, Ferruh KAYHAN <[EMAIL PROTECTED]> wrote:
> Dear Sir;
> Thank you for your reply.  Oftenly, especially in industrial companies,
> codes are becoming very valuable and owner of the company likes to keep
> that value as confidential in order to protect the company
> competitivness.  Somr times, professionals are leaving companies and
> starting new jobs in competitor companies.  Therefore, protecting some
> codes are becoming important.
>
> So in our case, we are not trying to stop anybody learning python
> language but we are trying to protect what we are doing with python.
>
> I hope my reply is sufficient.
>
> Regards
>
> -Original Message-
> From: bhaaluu [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 14, 2008 3:25 PM
> To: Ferruh KAYHAN
> Cc: tutor@python.org
> Subject: Re: [Tutor] Read protection of python files for Abaqus
>
> Greetings,
> On Jan 14, 2008 3:17 AM, Ferruh KAYHAN <[EMAIL PROTECTED]> wrote:
> > Dear Sirs;
> > Good morning.
> > I do not like abaqus users will read my python file codes.  How can I
> > protect my codes from reading ans still workable by Abaqus import??
> >
> > Best Regards
> > Ferruh Kayhan
>
> 
> Abaqus is widely used in the automotive, aerospace, and industrial
> products industries. The package is very popular with academic and
> research institutions ...
> These software products, especially Abaqus/CAE, extensively use the
> open-source scripting language Python for scripting and customization.
> 
>
> Don't academics and researchers thrive on sharing information?
> Also, this forum is geared towards learning Python, and sharing source
> code is encouraged in order to obtain help.
>
> Also, "many eyes" can find and fix bugs in your scripts, as well as,
> others may find the scripts useful: ie. research can advance more
> quickly.
>
> Is there a particular reason why you don't want others to see your
> Abaqus Python scripts?
>
> Just curious.
> --
> b h a a l u u at g m a i l dot c o m
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Document Control System

2008-01-14 Thread ammar azif
Hello,

Is python suitable in developing web based document control system ? I was 
thinking of using python and mysql to create such system. Users can download 
latest document as well as upload drafts. Is this possible or i should use PHP 
instead?

   
-
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Document Control System

2008-01-14 Thread Kent Johnson
ammar azif wrote:
> Hello,
> 
> Is python suitable in developing web based document control system ? I 
> was thinking of using python and mysql to create such system. Users can 
> download latest document as well as upload drafts. Is this possible or i 
> should use PHP instead?

Document control can mean many things but it should be possible using 
Python. You might be interested in these:
http://www.python.org/about/success/ezro/
http://www.python.org/about/success/st-andrews/

Zope and Plone also might be of interest. Or maybe you want a 
revision-control system like Subversion (not in Python) (google them).

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Document Control System

2008-01-14 Thread Michael Langford
There are several ready made ones. Plone for instance: http://plone.org/
It's a very customizable zope project.

Look at Paste as well in building up your stack: http://pythonpaste.org/

I also suggest opting for use of  the WSGI interface for your
application (a python web-app interface which allows easy
collaboration between apps). There is mod_wsgi for apache deployment
and you can use numerous web servers for a development standard. I
really think it is the simplest thing available now, and the way of
the future.
http://www.wsgi.org/wsgi/Learn_WSGI
http://code.google.com/p/modwsgi/

I'm porting my mod_python stuff over


  --Michael

On Jan 14, 2008 11:43 AM, ammar azif <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Is python suitable in developing web based document control system ? I was
> thinking of using python and mysql to create such system. Users can download
> latest document as well as upload drafts. Is this possible or i should use
> PHP instead?
>
>
>  
> Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it
> now.
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>



-- 
Michael Langford
Phone: 404-386-0495
Consulting: http://www.RowdyLabs.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] how to change the values of keyboard keys in TKINTER

2008-01-14 Thread Alan Gauld
"brindly sujith" <[EMAIL PROTECTED]> wrote

> i want to know how to change the values of keyboard keys(for 
> example:
> I want to set alt+f4 to enter)

Can you be more specific?
Do you want to change Alt-F4 for every application on the
computer permanently or only on a single application?
Do you want Alt-F4 to become the Enter key or just to
act like one in a specific scenario?

> do we have any modules in tkinter for doing this...

Not specifically but some of it can be faked.
See my event driven programming topic in my tutorial
for example code for reading the keys - including Alt-F4.

However its worth pointing out that this kind of stuff, and
the other things that you are posting are really well outside
what Tk was designed for.

The Tool Control Language(Tcl) was intended to be an
embedded macro language for various lab tools. Similar
to Python in that it is a scripting language which can easily
interface with other languages and be embedded in them.

The Tcl Toolkit (Tcl/Tk) was intended to allow a simple
GUI front end to be added to Tcl projects. It was never
really intended for writing complex GUI applications, it
provides basic GUI capability in a very easy to use package.

Tkinter is a thin Python wrapper around Tcl/Tk and has
much the same purpose - to provide basic GUI wrapper
capability in an easy to use package. It is not a fully
featured GUI system like MS Windows or X windows.

If you want to do lots of low level control of a GUI you
would be better advised to look at toolkits like PyQt or
GTK. Even wxPython struggles to provide the low level
detailed control that you are looking for.

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Document Control System

2008-01-14 Thread Dave Kuhlman
On Mon, Jan 14, 2008 at 08:43:46AM -0800, ammar azif wrote:
> Hello,
> 

> Is python suitable in developing web based document control
> system ? I was thinking of using python and mysql to create such
> system. Users can download latest document as well as upload
> drafts. Is this possible or i should use PHP instead?

Also look at Silva:

http://infrae.com/products/silva

Silva, as well as Plone (http://plone.org), are intended for
*content* management.  They use workflow rules to control the
movement of on-line documents through the system.  Document
management, in contrast with content management might mean
something slightly different to you.

- Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Why Won't My Pizza Fall?

2008-01-14 Thread Tiger12506
[Background from Alan]
> If some other factor were to determine its behhaviour more
> closely - such as determining whether the Pizza was within
> the coordinate boundaries or in collision with another Pizza
> then that could be implemented via a message protocol.
> Thus the context object should respond to some message
> from Pizza and in this case the Pizza should hold a reference
> to its context manager(probably a screen or grid of some sort).


[disclaimer]
This email has particularly strong personal opinions about coding practices. 
I do not wish to personally offend anyone, and if you feel that you have 
been offended as such, or that you disagree, please do not bother emailing 
this list to tell me, excepting that you provide an excellent case promoting 
your views that someone may be able to apply to make their code more 
intuitive/sensible. This email was provided for just such a reason.
[/disclaimer]


> The context manager is responsible for tracking the objects
> being managed, but the objects remain responsible for
> managing their own state.

[rant]
This phrase right here is a dead giveaway to me that Pizza should have 
little control over how it moves. A Pizza must be completely aware of its 
current position (being part of its state) and at the very *most* a set of 
rules governing general falling behaviour. I like the idea of a context 
manager that is perhaps a container for Pizzas that oversees their behavior, 
but I dislike the idea that a Pizza knows specifics about its rules for 
positioning such as collisions or etc. that it has to communicate to the 
context manager and/or other Pizzas. Maybe I am becoming too used to lower 
level languages, not fully siding with abstraction. I just see that we have 
suddenly introduced to new levels of redirection to achieve the same result, 
like a company that must use interdepartmental communication by messages 
through possibly more than one department instead of just simply 
communicating directly. Or like the elements of a list changing each other, 
instead of the list changing the elements. Definite benefits for messaging 
models, but this /feels/ akin to filling out tax forms so that the 
government can tell you how you filled them out incorrectly.

A similar somewhat questionably connected problem involves my dealings with 
the Render method of the IPicture interface. Sure, you can directly apply 
the picture to the device context or if you like we have a Render method 
that will automatically change the coordinates so that you have to convert 
them back to display it. Abstraction isn't everything.
[/rant] 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor