Re: integer = 1 == True and integer.0 == False is bad, bad, bad!!!

2010-07-11 Thread Brendon Wickham
i had once considered you one of the foremost intelligent minds
within this group. However, after your display within this thread i am
beginning to doubt my original beliefs of you.

Oh ... grow a spine already, really. I can't help but thinking of the
spineless Robert Ford every time you open your mouth

@rantingrick : these comments among others fail to meet the standard
of engagement expected of, and traditional to, this list. Take a
breath, get some sleep and come back with a level head and a civil
tongue. If you have any valid point to make at all, your attitude so
far has failed to make it credible, and nor will it enable you to
enlist supporters.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Few questions on SOAP

2010-02-18 Thread Brendon Wickham
On 19 February 2010 08:07, Mark Lawrence breamore...@yahoo.co.uk wrote:
 Muhammad Alkarouri wrote:

 Your question is borderline if not out of topic in this group. I will
 make a few comments though.

 This might be a Python group, but threads often drift way off topic, which
 added to the language itself make this a great group to read.  If you don't
 like the way a thread goes, you can always skip it.


Perhaps...but he answered the question very well and with great, IMO, patience.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web development with Python 3.1

2009-10-25 Thread Brendon Wickham

 Anyway, for simple web programming, frameworks are not worth the
 hassle.  Just use the cgi module.


I can vouch for what Paul says. I started in Python 3 years ago, and I did
so with a web application (still working on it!). I'm using the cgi
approach, and it certainly teaches you the concepts. I fail to see how
starting with a framework is a good idea if you don't know how the
frameworks work (or what they're actually doing). It would be a bit like
doing a web page in Dreamw***er and thinking you understand HTML/CSS.

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


Re: IDE for python similar to visual basic

2009-09-11 Thread Brendon Wickham


 The interface really should be configurable by the user according to their
 needs. The code doesn't need to *know* the position or dimensions of
 a widget, or its label or colour or spacing, let alone dictate them.


Perhaps...but the user needs a framework in order to understand the
functions they find themselves in charge of once they've initiated a
program. As the designer, the programmer is best placed to provide
that framework, because they know, or they should know, what it is
(something I don't think can be taken for granted). Therefore,
fundamental decisions about the UI should be left to the programmer.
If customisation is possible, all well and good, but it should not be
the main goal of a UI. Usability principles should be.

 In most cases, the code shouldn't even get to dictate that specific
 widgets even exist. Rather, it should provide actions which can
 be bound to buttons, menu items and/or accelerators as the user chooses.


That would be an API.
-- 
http://mail.python.org/mailman/listinfo/python-list


Getting cookie expires value

2009-07-22 Thread Brendon Wickham
Hi there,

My web application uses a cookie to set/get a session id. This is
working fine. However, I'm unable to work out how to get the cookie
expires value.

Below is test code that replicates the problem. It creates a simple
web page and shows a cookie value if it's found, or creates a new one
(correctly setting the expires value) and indicates that it was
created:


#!/usr/bin/env python
import Cookie,os

def printHeader():
    print Content-type: text/html\n
    print htmltitleCookie test/title
    print body

cookies=Cookie.SimpleCookie(os.environ.get('HTTP_COOKIE'))

if cookies.has_key('test'):
    #If cookie was found:
    printHeader()
    print Found cookie:br/br/

    #Get cookie:
    c = cookies.get('test')

    #Print its value:
    print divValue: %s/div % c.value

    #Iterate through its items and print name/value:
    for k,v in c.items():
         print div%s=%s/div % (k,v)

else:
    #Define cookie:
    cookies['test'] = 1234
    cookies['test']['expires'] = 3600

    #Save cookie:
    print cookies['test']

    #Now print HTML:
    printHeader()

    print Cookie created.

print /body/html



This is what I get if the cookie exists:

Found cookie:

Value: 1234
comment=
domain=
secure=
expires=
max-age=
version=
path=


As you can see, the cookie attributes are valueless. Can anyone help?
Am I missing something fundamental?

Cheers,

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


Re: need to start a new project , can python do all that ?

2009-04-15 Thread Brendon Wickham
Python is a programming language, and like practically any programming
language it can do all those things. I'm not sure your requirements
are based on a full understanding of the implications. A health care
center' cannot be made with a few drag and drop, plug and play
modules that you manipulate within a GUI.

For example, importing pathology results: there is no international
standard for how such results should be formed. You will need to ask
the suppliers of the results to work out how they're going to give it
to you. And they will all be different. You will most likely need a
firm understanding of HL7 v2 and 3, XML, XSL (and probably web
services) etc.

In terms of cross platform, in the health context it's pointless being
anything other than a web application (IMHO).


Cheers,

Brendon


2009/4/15 Deep_Feelings doctore...@gmail.com:
 I want to start programming a new program (electronic health care
 center) in python and before start learning python i wanna make sure
 that python does have all the features i need to accomplish this
 project so i wanna ask you does python able to support these
 features :

 1- cross platform (windows + linux)
 2- mysql database access
 3- 2D graphs (curves)
 4- support of international languages
 5- can access a scanner and input pictures from it.

 and possibly be able to import data from labratory machines (such as
 CBC machines) to automatically register patient investigations result
 into the system (not mandatory)

 so can python (with any freely available libraries) do all that and
 still be cross platform ?

 thankx in advance :)
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Re: What IDE support python 3.0.1 ?

2009-04-15 Thread Brendon Wickham
 On IDE's, I'm afraid I'm not going to be much help because I don't use
 them.  I prefer to use a decent editor (Emacs in my case, others have
 their own preferences) and run my scripts from the command line.  That
 said, IDLE (which comes packaged with Python) is a perfectly decent
 little IDE.  It's surprising how little you really need given the
 flexibility and immediacy of working with Python.


I agree, no IDE needed. Just don't use Notepad! I'm on Mac, so spoiled
for choice of text editors, but I'm sure there's one or 2 good uns if
you're on Windows.
--
http://mail.python.org/mailman/listinfo/python-list


Re: python for loop

2009-03-31 Thread Brendon Wickham
Since when should a machine (that's what a computer is after all), be
forced to contort itself into something that is capable of reflecting
the laws of physical matter?

Better perhaps to look at it from another angle - it's
counter-intuitive to think that the digital should mirror the
analogue. The digital can *virtualise* the real world, but it doesn't
do that by *working like* the real world.

It's not theory, it's actually what it is.


2009/4/1 Lada Kugis lada.ku...@gmail.com:
 On Tue, 31 Mar 2009 19:29:56 -0700, Chris Rebert c...@rebertia.com
 wrote:


Sort of, but it's *really* not idiomatic. You'd have to declare the
arrays to be one longer than they actually are so that array[N] is a
valid index. And then you'd end up not using the true first element of
the array. Not to mention most library functions use 0-numbering, so
you'd have to work around that as well.

So, it can be done, but you're going against the grain of the language.

 I use fortran libraries, so that is not a problem for me. I only make
 the change once, while transferring the elements ... uhmm, make that
 twice.
 I wrote in my other post, 0 is weird to me, I have model of solution
 on paper ... if I keep 0 then all comes out different. And while
 comparing, I always get them mixed up. That's why I always try to
 adapt it to the paper situation.

 Lada



Cheers,
Chris
 --
 http://mail.python.org/mailman/listinfo/python-list

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


Accessing shell output from HTTP

2009-03-30 Thread Brendon Wickham
Hi there,

I would like users of my web application to be able to download a backup
file of a database (using* *MySQL's *mysqldump* command).

My strategy is to use *zipfile* to create a zip file object (with the *
mysqldump* output as the contents of the zipped file) and then use *
sys.stdout* to send the zip file object to the user as a file for them
download.

The zipping bit and file delivery is all sorted. Getting the output from *
mysqldump* is my problem and I'm not even sure (given that, as I understand
it, it's an asynchronous call to shell via an HTTP thread) it is even
possible.

This is as far as I've got:

import subprocess as sp
p1 = sp.Popen('mysqldump --opt
--user=[username]--password=[password]
[databasename]',stdout=sp.PIPE,shell=True)
backupfile=p1.communicate()[0]

If I type the above into a Python prompt and print *backupfile* I will get
the expected result, but when I'm going through CGI (the script, called from
a web browser, is supposed to capture the output into the variable) nothing
is being returned by communicate().

Is this possible? Or am I barking up the wrong tree?

Cheers,

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


Accessing shell output from HTTP

2009-03-29 Thread Brendon Wickham
Hi there,

I would like users of my web application to be able to download a backup
file of a database (using* *MySQL's *mysqldump* command).

My strategy is to use *zipfile* to create a zip file object (with the *
mysqldump* output as the contents of the zipped file) and then use *
sys.stdout* to send the zip file object to the user as a file for them
download.

The zipping bit and file delivery is all sorted. Getting the output from *
mysqldump* is my problem and I'm not even sure (given that I'm calling shell
via an HTTP thread/process) it is even possible.

This is as far as I've got:

import subprocess as sp
p1 = sp.Popen('mysqldump --opt
--user=[username]--password=[password]
[databasename]',stdout=sp.PIPE,shell=True)
backupfile=p1.communicate()[0]

If I type the above into a Python prompt and print *backupfile* I will get
the expected result, but when I'm going through CGI nothing is being
returned by communicate().

Is this possible? Or am I barking up the wrong tree?

Cheers,

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