Re: Ron Grossi: God is not a man

2005-04-29 Thread AKA

"Donald L McDaniel" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> MC05 wrote:
>> "sheltech" <[EMAIL PROTECTED]> wrote in message
>> news:[EMAIL PROTECTED]
>>>
>>> "MC05" <[EMAIL PROTECTED]> wrote in message
>>> news:[EMAIL PROTECTED]

 "Donald L McDaniel" <[EMAIL PROTECTED]> wrote in message
 news:[EMAIL PROTECTED]
>
> 4) I doubt seriously whether God plays a guitar, since guitars are
> made by men, for men.  His Son could theoretically play a guitar. 
> Perhaps He does. Perhaps He doesn't.  Only the Father and His Holy
> Angels know.

 So then Lucifer was a wicked bass player whose sex and drugs and
 rock n roll alientated the rest of the band and was fired?



>>>
>>> "Fired"   good one
>>
>> Heh.  Can't take credit for an accident.  Your eye is better than
>> mine. :)
>
> The Devil has been fired...by God Himself.  Read the Book of Revelation in 
> the New Testament:  Satan's end is clearly outlined by the Angel Jesus 
> sent to St. John.  This end is very clear:  he will be cast alive into the 
> Lake which burns with fire and brimstone, where he will be tormented day 
> and night forever.
>
> Not only Satan and his angels will be cast into the Lake, but all those 
> who follow him and his servants.  I assure you, Satan won't be ruling 
> anyone in the Fire.  He will be in just as much torment as his followers. 
> Neither will he have any sort of job.
>
> I strongly advise you to stop making fun of things you have no 
> understanding of.  Your eternal destiny depends on the way you treat 
> others.
>
> -- 
> Donald L McDaniel
> Please reply to the original thread,
> so that the thread may be kept intact.
> ==
>
Just imagine if you actually had a coherent thought. 


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


help I'm getting delimited

2008-12-16 Thread aka
Hi, I'm going nuts over the csv.reader and UnicodeReader class.
Somehow I can't get this method working which is supposed to read a
csv file which name is inputted but here now hardcoded. What I need
for now is that the string version of the list is put out for control.
Later on I will only need to read the first column (id) of the csv
file to be able to fill in a session var with a list of all ids.
inp = c:/temp/test.csv
roles = []
try:
fp = open(inp, 'rb')
reader = csv.reader(fp)
for r in reader:
rollen.append(r)
except:
msg = "Er is iets mis met de UnicodeReader"

return dict(file=in,roles=str(roles))
Any help greatly appreciated!
Cheers
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-17 Thread aka
Hi John, thanks.
You're right, I didn't past the method header because I thought it
didn't matter when the input filename is hardcoded.
The try/except isn't very helpful indeed so I commented it out.
You're right I wrongly referred to the UnicodeReader
class in my first post because that's ultimately where I want to go
so
I outcommented it here for you to see.
The fact is that neither csv.reader nor the UnicodeReader will read
the file, while writing with the UnicodeWriter
works like a charm.
That's why I put str() around roles to see any content.
I simplified the csv-file by cutting off columns without result. The
file looks now like:

id;company;department
12;Cadillac;Research
11;Ford;Accounting
10;Chrysler;Sales


The dictionary on the return is because this code is part of my
TurboGears application.
The entire method is:


import csv
from utilities.urw   import UnicodeWriter, UnicodeReader


@expose(allow_json=True)
def import_roles(self, input=None, *args, **kwargs):
inp = 'C:/temp/test.csv'
roles = []
msg = ''
## try:
fp = open(inp, 'rb')
reader = csv.reader(fp, dialect='excel', delimiter=';')
## reader = UnicodeReader(fp, dialect='excel', delimiter=';')
for r in reader:
roles.append(r[0])
fp.close()
## except:
## msg = "Something's wrong with the csv.reader"
return dict(filepath=inp,
roles=str(roles),
msg=msg)


csv.reader results in: for r in reader: Error: line contains NULL
byte


Use of UnicodeReader results in: UnicodeDecodeError: 'utf8' codec
can't decode byte 0xff in position 0: unexpected code byte


Will post only complete code from now on thanks.

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


Re: help I'm getting delimited

2008-12-17 Thread aka
Hi John, thanks.
You're right, I didn't past the method header because I thought it
didn't matter when the input filename is hardcoded.
The try/except isn't very helpful indeed so I commented it out.
You're right I wrongly referred to the UnicodeReader
class in my first post because that's ultimately where I want to go so
I outcommented it here for you to see.
The fact is that neither csv.reader nor the UnicodeReader will read
the file, while writing with the UnicodeWriter
works like a charm.
That's why I put str() around roles to see any content.
I simplified the csv-file by cutting off columns without result. The
file looks now like:

id;company;department
12;Cadillac;Research
11;Ford;Accounting
10;Chrysler;Sales

The dictionary on the return is because this code is part of my
TurboGears application.
The entire method is:

import csv
from utilities.urw   import UnicodeWriter, UnicodeReader

@expose(allow_json=True)
def import_roles(self, input=None, *args, **kwargs):
inp = 'C:/temp/test.csv'
roles = []
msg = ''
## try:
fp = open(inp, 'rb')
reader = csv.reader(fp, dialect='excel', delimiter=';')
## reader = UnicodeReader(fp, dialect='excel', delimiter=';')
for r in reader:
roles.append(r[0])
fp.close()
## except:
## msg = "Something's wrong with the csv.reader"
return dict(filepath=inp,
roles=str(roles),
msg=msg)

csv.reader results in: for r in myreader: Error: line contains NULL
byte

Use of UnicodeReader results in: UnicodeDecodeError: 'utf8' codec
can't decode byte 0xff in position 0: unexpected code byte

Will post only complete code from now on thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly (sorry).
The intention is to parse a csv file and (ultimately) put values of
column 1 ("id") in a list (so I need to append in the loop) that will
be used to fill a session var.
The complete code is:

roles = []
inp = 'C:/temp/test.csv'
try:
fp = open(inp, 'rb')
reader = csv.reader(fp, dialect='excel', delimiter=';')
for r in reader:
roles.append(r)
## ultimately should be something like r.id
## first row of csv file should be skipped because of column
names
or r[0]
except:
msg = 'Something's wrong with the csv.reader'
return dict(file=inp,roles=str(roles))


The roles list isn't populated at all :(
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly (sorry).

The intention is to put values of column 1 ("id") in the roles list,
therefore appending within the loop, to fill a session var.

The complete code is:

roles = []
inp = 'C:/temp/test.csv'
try:
fp = open(inp, 'rb')
reader = csv.reader(fp, dialect='excel', delimiter=';')
for r in reader:
roles.append(r)
## ultimately should be something like r.id or r[0]
## first row of csv file should be skipped because of column
names

except:
msg = 'Something's wrong with the csv.reader'
return dict(file=inp,roles=str(roles))


The roles list isn't populated at all :(
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-17 Thread aka
John, this is the actual code I ran in TurboGears which is a Python
framework.
I should have left away the import statements. Trust me, the problem
isn't in there because the UnicodeWriter is functioning perfectly.
I did allready sanitate the csv file to these four lines in Notepad so
there isn't anything more than this:

id;company;department
12;Cadillac;Research
11;Ford;Accounting
10;Chrysler;Sales

The only possible problematic lines are marked # here:

> >     def import_roles(self, input=None, *args, **kwargs):
> >         inp = 'C:/temp/test.csv'
> >         roles = []
> >         msg = ''
> >         ## try:
> >         fp = open(inp, 'rb') #
> >         reader = csv.reader(fp, dialect='excel', delimiter=';') #
> >         ## reader = UnicodeReader(fp, dialect='excel', delimiter=';') #
> >         for r in reader:
> >             roles.append(r[0]) #
> >         fp.close()
> >         ## except:
> >             ## msg = "Something's wrong with the csv.reader"
> >         return dict(filepath=inp,
> >                     roles=str(roles),
> >                     msg=msg)

Yeah rdmur, I'll have a look at the Python commandline.
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-17 Thread aka
Due to being in a hurry I didn't paste correctly so I lost the try
clause (sorry).
The intention is to parse a csv file and (ultimately) put values of
column 1 ("id") in a list (so I need to append in the loop) that will
be used to fill a session var.
The complete code is:

roles = []
inp = 'C:/temp/test.csv'
try:
fp = open(inp, 'rb')
reader = csv.reader(fp, dialect='excel', delimiter=';')
for r in reader:
roles.append(r)   ## ultimately should be something like r.id
or r[0]
except:
msg = 'Something's wrong with the csv.reader'
return dict(file=inp,roles=str(roles))

The roles list isn't populated at all :(
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-18 Thread aka
On 18 dec, 00:06, John Machin  wrote:
> On Dec 18, 3:15 am, aka  wrote:
>
> Do you mean that this file was created by whatever.UnicodeWriter? If
> so, did you just now discover this information?
>
> How do you know that "the UnicodeWriter is functioning perfectly"?
> What does "functioning perfectly mean to you"? In particular, what
> encoding is it using?
>
> Which do you mean:
> (a) you typed those lines into Notepad yourself
> (b) you took a copy of a file created by whatever.UnicodeWriter,
> opened it with Notepad, trimmed off some rows and columns, and saved
> it again
> ?
> Here's a likely hypothesis: the file was written in utf16. In that
> case:
> either (i) you really want utf16 (why?), so:
>
> (1) the csv module will not cope with it, and is not expected to cope
> with it
>
> (2) the whatever.UnicodeReader should (in order of preference):
>(a) be allowed to find out for itself that 'utf16' is the go
>(b) be told explicitly that 'utf16' is the go
>(c) be served with a bug report
>
> OR (ii) you really want utf8, so:
>
> (1) the csv module should be happy
> (2) the whatever.UnicodeWriter should be told to use 'utf8'
> (3) the whatever.UnicodeReader should (in order of preference):
> [as above but s/16/8/]
>
The csv file originally was created by the UnicodeWriter class and was
used for a mailmerge function with Microsoft Word which all functioned
perfectly.
The reverse did not: read back the outputted file so at last I editted
it in Notepad, cutting off columns, but I didn't know that the
encoding would remain even after that because it still caused
problems.
Now after testing from the Python command line with a csv file
generated from Excel I could get it working so it had to be the
encoding.
Because the write side of my code, which uses the UnicodeWriter, was
ok I didn't pay attention to the fact that I had changed the UW class
from UTF-8 to UTF-16 because of difficulties with dutch characters
like ë and ö.
Then at last I tried changing back to UTF-8 and noticed both out -and
input was working, including those special characters, so it was my
unjustifiable conclusion that I couldn't get around these special
characters at the write side without UTF-16 which ultimately got me in
trouble with the read side.
With your help I got it straight. Once again minimizing the problem to
its bare basics and to prevent big steps is the key.
Thanks a lot for your help John.
BTW, the TurboGears code by the way is not very different from Python,
it just uses some extra identifiers.
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-18 Thread aka
On 18 dec, 00:06, John Machin  wrote:


- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -

> On Dec 18, 3:15 am, aka  wrote:

> Do you mean that this file was created by whatever.UnicodeWriter? If
> so, did you just now discover this information?


> How do you know that "the UnicodeWriter is functioning perfectly"?
> What does "functioning perfectly mean to you"? In particular, what
> encoding is it using?


> Which do you mean:
> (a) you typed those lines into Notepad yourself
> (b) you took a copy of a file created by whatever.UnicodeWriter,
> opened it with Notepad, trimmed off some rows and columns, and saved
> it again
> ?
> Here's a likely hypothesis: the file was written in utf16. In that
> case:
> either (i) you really want utf16 (why?), so:


> (1) the csv module will not cope with it, and is not expected to cope
> with it


> (2) the whatever.UnicodeReader should (in order of preference):
>(a) be allowed to find out for itself that 'utf16' is the go
>(b) be told explicitly that 'utf16' is the go
>(c) be served with a bug report


> OR (ii) you really want utf8, so:


> (1) the csv module should be happy
> (2) the whatever.UnicodeWriter should be told to use 'utf8'
> (3) the whatever.UnicodeReader should (in order of preference):
> [as above but s/16/8/]



The csv file originally was created by the UnicodeWriter class and
was
used for a mailmerge function with Microsoft Word which all
functioned
perfectly.
The reverse did not: read back the outputted file so at last I
editted
it in Notepad, cutting off columns, but I didn't know that the
encoding would remain even after that because it still caused
problems.
Now after testing from the Python command line with a csv file
generated from Excel I could get it working so it had to be the
encoding.
Because the write side of my code, which uses the UnicodeWriter, was
ok I didn't pay attention to the fact that I had changed the UW class
from UTF-8 to UTF-16 because of difficulties with dutch characters
like ë and ö.
Then at last I tried changing back to UTF-8 and noticed both out -and
input was working, including those special characters, so it was my
unjustifiable conclusion that I couldn't get around these special
characters at the write side without UTF-16 which ultimately got me
in
trouble with the read side.
With your help I got it straight. Once again minimizing the problem
to
its bare basics and to prevent big steps is the key.
Thanks a lot for your help John.
BTW, the TurboGears code is not very different from Python,
it just uses some extra identifiers around the Python code.
--
http://mail.python.org/mailman/listinfo/python-list


Re: help I'm getting delimited

2008-12-18 Thread aka
> On Dec 18, 3:15 am, aka  wrote:
> Do you mean that this file was created by whatever.UnicodeWriter? If
> so, did you just now discover this information?
> How do you know that "the UnicodeWriter is functioning perfectly"?
> What does "functioning perfectly mean to you"? In particular, what
> encoding is it using?
> Which do you mean:
> (a) you typed those lines into Notepad yourself
> (b) you took a copy of a file created by whatever.UnicodeWriter,
> opened it with Notepad, trimmed off some rows and columns, and saved
> it again
> ?
> Here's a likely hypothesis: the file was written in utf16. In that
> case:
> either (i) you really want utf16 (why?), so:
> (1) the csv module will not cope with it, and is not expected to cope
> with it
> (2) the whatever.UnicodeReader should (in order of preference):
>(a) be allowed to find out for itself that 'utf16' is the go
>(b) be told explicitly that 'utf16' is the go
>(c) be served with a bug report
> OR (ii) you really want utf8, so:
> (1) the csv module should be happy
> (2) the whatever.UnicodeWriter should be told to use 'utf8'
> (3) the whatever.UnicodeReader should (in order of preference):
> [as above but s/16/8/]


The csv file originally was created by the UnicodeWriter class and
was
used for a mailmerge function with Microsoft Word which all
functioned
perfectly.
The reverse did not: read back the outputted file so at last I
editted
it in Notepad, cutting off columns, but I didn't know that the
encoding would remain even after that because it still caused
problems.
Now after testing from the Python command line with a csv file
generated from Excel I could get it working so it had to be the
encoding.
Because the write side of my code, which uses the UnicodeWriter, was
ok I didn't pay attention to the fact that I had changed the UW class
from UTF-8 to UTF-16 because of difficulties with dutch characters
like ë and ö.
Then at last I tried changing back to UTF-8 and noticed both out -and
input was working, including those special characters, so it was my
unjustifiable conclusion that I couldn't get around these special
characters at the write side without UTF-16 which ultimately got me
in trouble with the read side.
With your help I got it straight. Once again minimizing the problem
to its bare basics and preventing too large steps is the key.
Thanks a lot for your help John.
BTW, the TurboGears code is not very different from Python,
it just uses some extra identifiers.
--
http://mail.python.org/mailman/listinfo/python-list


Do I need Python to run Blender correctly?

2007-01-25 Thread AKA gray asphalt
I downloaded Blender but there was no link for python. Am I on the right 
track?


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


Re: Do I need Python to run Blender correctly?

2007-01-27 Thread AKA gray asphalt

"John Nagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> AKA gray asphalt wrote:
>> I downloaded Blender but there was no link for python. Am I on the right 
>> track?
>
>Blender doesn't require Python, but if you have Python, you can
> write plug-ins for Blender.   Get "The Blender Book"; otherwise
> you'll never figure Blender out.
>
> John Nagle

Will do. Thanks.


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


Re: Do I need Python to run Blender correctly?

2007-01-27 Thread AKA gray asphalt

"John Nagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> AKA gray asphalt wrote:
>> I downloaded Blender but there was no link for python. Am I on the right 
>> track?
>
>Blender doesn't require Python, but if you have Python, you can
> write plug-ins for Blender.   Get "The Blender Book"; otherwise
> you'll never figure Blender out.
>
> John Nagle

I'm thinking about not upgrading "Strata 3D" because it still doesn't export 
textures with obj files and it just created an undo of more than one action, 
believe it or not... Am I expectiong too much of a $400+ program, to export 
textures with obj files? Does Blender do this? I see the BBook on Amazon for 
$30. That's probably my best bet, no?



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


Re: Do I need Python to run Blender correctly?

2007-01-28 Thread AKA gray asphalt

"John Nagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> AKA gray asphalt wrote:
>> "John Nagle" <[EMAIL PROTECTED]> wrote in message 
>> news:[EMAIL PROTECTED]
>>
>>>AKA gray asphalt wrote:
>>>
>>>>I downloaded Blender but there was no link for python. Am I on the right 
>>>>track?
>>>
>>>   Blender doesn't require Python, but if you have Python, you can
>>>write plug-ins for Blender.   Get "The Blender Book"; otherwise
>>>you'll never figure Blender out.
>>>
>>>John Nagle
>>
>>
>> I'm thinking about not upgrading "Strata 3D" because it still doesn't 
>> export textures with obj files and it just created an undo of more than 
>> one action, believe it or not... Am I expectiong too much of a $400+ 
>> program, to export textures with obj files? Does Blender do this? I see 
>> the BBook on Amazon for $30. That's probably my best bet, no?
>
>Blender has considerable power, but ease of use is a problem.  The
> hotkey listing in the manual is 29 pages.

Is the manual you refer to the group project on blender.org or the $ manual 
like the one on Ebay?


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


Re: Do I need Python to run Blender correctly?

2007-01-28 Thread AKA gray asphalt

I think you're right. I'll find a blender forum. Thanks for your help.
: -)

"John Nagle" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> AKA gray asphalt wrote:
>> "John Nagle" <[EMAIL PROTECTED]> wrote in message 
>> news:[EMAIL PROTECTED]
>
>> Is the manual you refer to the group project on blender.org or the $ 
>> manual like the one on Ebay?
>>
>The "Blender 2.3 Guide" book. Also, if you're going to program the 
> thing,
> the "Blender GameKit" book is a big help.
>
>Unless you have two screens, the online manual gets in your way.
>
>This really should go in a Blender newsgroup or forum.
>
> John Nagle 


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


Re: Continuations Based Web Framework - Seaside.

2005-01-02 Thread Valentino Volonghi aka Dialtone
Mike Thompson  wrote:

> I googled for the python spin-off but didn't find one. Closest I found

Get Nevow with wolf (flow backwards, in the svn sandbox).
http://www.divmod.org/cvs/sandbox/phunt/wolf/?root=Nevow

You will need stackless or greenlet if using CPython.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Continuations Based Web Framework - Seaside.

2005-01-02 Thread Valentino Volonghi aka Dialtone
Paul Rubin <http://[EMAIL PROTECTED]> wrote:

> Since Python doesn't have continuations, that would be a bit tricky.

Since I've already said Nevow with wolf works the same as borges.
The only thing that wouldn't work without continuations is the back
button. With greenlet module (from Armin Rigo) also the back button will
work.

I've also already posted an url to the svn sandbox with a working
example inside.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Nevow Tutorial and sample app

2005-01-06 Thread Valentino Volonghi aka Dialtone
<[EMAIL PROTECTED]> wrote:

> Can any one redirect me to a good nevow tutorial and/or a an appliction
> that is niether too big nor too small and can be help in learning
> nevow. Nevow tutorial with the distrubution is too simple and it

You should probably look at all the examples in the latest svn release.
I've made some changes on the way examples directory work and now you
can run all the examples by just running:

twistd -noy examples.tac

It will create a local webserver at http://localhost:8080/

with an index of all the examples (in difficulty order) with colored
browseable source code and the live example.

Plus you can access each sample application's (like the blog engine or
the interactive chat server, or the pastebin) source code.

Examples should scale well from very simple and basic hello world to
very sophisticated ones like the blog engine which uses also xmlrpc and
smtp protocols, or live pages like chatola.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Framework Reviews

2005-07-19 Thread Valentino Volonghi aka Dialtone
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I thought it would make sense to write up some of my experiences with
> python based web frameworks:
> 
> http://www.personal.psu.edu/staff/i/u/iua1/python_reviews.html

You've never used Nevow, have you?
Comparing it to Cheetah or ZPT means that you never used it.

Nevow is exactly what you define as a web framework, and it would be
quite interesting to know why you didn't put it in that section.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Framework Reviews

2005-07-19 Thread Valentino Volonghi aka Dialtone
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I have not used Nevow but I have seen a few examples of how it works
> and I kept track of it over the years.
> 
> It used to be very similar to how Cheetah or ZPT does its job. You had
> a template, and you filled it with data to produce an output. It seems
> that it has now more features such a form submission and validation.

Formless has been part of nevow since the very beginning. It has also
been part of woven (Nevow predecessor), just like liveevil (now enhanced
and called livepage). 

The only part of nevow that you can compare to ZPT or Cheetah is its
xmlfile template language. There is no way you can run Nevow on top of
any other framework.

Also you don't pass data to the templating engine. It's nevow that
parses the template and iterates over it to render the page. The
template is very stupid in nevow and everything is done in
nevow.flat.flattenFactory called by nevow.rend.Page.
 
> On the other hand I even in its current form I don't see how I would to
> the simple things that I need every day. Create a session, set a
> cookie, redirect to another url,  perform HTTP autentication, create
> filter,  use another templating language? This is also integral part of
> the  functionality that I expect from an web framework. Web specific
> things exposed in some python ic way.

Sessions are handled by default with twisted.web:

from twisted.application import service, strports
from nevow import appserver

from nevow import rend, loaders, tags as t, inevow

class RootPage(rend.Page):
addSlash = True
def display_session(self, ctx, data):
return inevow.ISession(ctx).uid

docFactory = loaders.stan(
t.html[t.head[t.title["Session example"]],
t.body[display_session]]
)

application = service.Application('Foobar')
site = appserver.NevowSite(RootPage())
server = strports.service('8080', site)
server.setServiceParent(application)

Save this in a .py or .tac and run it with twistd -noy filename.tac/.py
and open http://localhost:8080/ in your browser to see your session uid.

If you want autentication:
http://nevowexamples.adytum.us/sources/guarded.py
http://nevowexamples.adytum.us/sources/guarded2.py
There are 2 examples (in the standard nevow distribution) that show how
to handle authentication in an application transparent way (you don't
have to touch your application by any means to add user authentication,
which means you can write everything without taking care of this aspect
of the app and then add it later).

To redirect to another url just call IRequest(ctx).redirect(newurl)
before the rendering begins (like in rend.Page.beforeRender) or in
rend.Page.locateChild.

HTTPAuthentication is easily handled:
http://nevowexamples.adytum.us/sources/http_auth.py
just use that class as a base class for your blocked page.
(this example is part of the standard nevow distribution).

Nevow doesn't have filters because they are handled by twisted.web or
twisted.web2 (which is, hopefully soon, going to be one of the required
webservers to run nevow, the others are lighttpd, apache, any WSGI
application server, nevow was in fact the first framework to support
WSGI servers).

If you want to use a different templating language you just need to
write a custom loader. Somebody did this in the past (I don't recall the
url of the project) that used cheetah-like templates.

Then for the last point:
you can expose directories or files using
nevow.static.File

exposed objects are:
those set as a value in rend.Page.children dict, you can reach them with
an url like:
http://www.example.com/url/that/returns/a/page/inst/key_in_children_dict
Or assign an object to a child_foobar attribute like:

p = rend.Page()
p.child_foobar = static.File('/etc/')

Or return an object from a child_foobar method.

Or override rend.Page.childFactory(self, ctx, segment) to return an
object in a dynamic way depending on the value of the segment argument.

It seems to me that you really never tracked Nevow, your information is
very incomplete. I think you should complete it before talking about
Nevow :).

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Framework Reviews

2005-07-19 Thread Valentino Volonghi aka Dialtone
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I think you should take what you posted above and put it up on your
> main site, because right now there is no way to find any information
> like this.  Your entire intro is about templating and leaves one with
> no clues as to what else is there.

Right now there are at least 2 web sites: 
http://divmod.org/users/exarkun/nevow-api/   + file inevow.py in nevow.
http://divmod.org/users/mg/nevow-doc/

And a new one:
http://dictator.kieranholland.com/prose/Meet%20Stan.html

And the page I linked in my previous post:
http://nevowexamples.adytum.us/ 
this is a living site with the living examples distributed with nevow.
at least one example of formless does not work right now because of
changes that we are doing in trunk right now (only formless has some
problems, all the others work pretty well).

There are really a lot of examples, and you can learn a lot of stuff
from them. More documentation will be useful for sure, but by just
coming in the irc channel #twisted.web on freenode you would have
obtained all the answers you wanted to write a better review paper :).

> One remark regarding stan. For me it is inconceivable that one would
> build (and debug) any complicated webpage as stan does it, one element
> at a time:
> 
>  docFactory = loaders.stan(
> t.html[t.head[t.title["Session example"]],
> t.body[display_session]]
> )
> 
> The pages that I have to build invariably contain multiple nested html
> tables etc. I shudder to think that I would ever have to build them
> like that. I know you have an "inverse" ZPT like templates those are a
> lot friendlier on the eyes. For someone who is does not know what Nevow
> is seeing an example of Stan is very scary  because IMO it does not
> scale at all. This again is just an opinion.

I have a little project, developed during my little free time that is
linked in my signature (weever). It has over 2000 lines of xhtml
templates and you can see a living example here:
http://vercingetorix.dyndns.org:20080/

I can guarantee you that when templates begin to be a bit too complex
stan is what saves the day. I usually use xhtml for everything (and
nevow has the best templating engine out there thanks to its flexibility
and simplicity, there are only 3 special tags and 3 attributes, and we
are working to make it even easier than that) but when xhtml gets
complicated stan is incredibly useful.

Anyway stan is also incredibly useful to write little examples without
requiring a new xhtml file (ok... you may use loaders.xmlstr but...)

And it does scale well anyway (Quotient is entirely built using stan and
it's very big).
Templating engines like ZPT prefer to put some code in the template,
Nevow prefers to put code in python and allow you to write some xhtml in
python too. python is easier to manage and less likely to be screwed by
any designer that doesn't know what python is.

> Thanks for the explanations. 

np :)

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web Framework Reviews

2005-07-19 Thread Valentino Volonghi aka Dialtone
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

> I think the difficulties will arise from the inability to visually
> track closing tags.
> ]]] versus 

You can do things like:

t.html[
t.head[
t.title["Foobar"]
],
t.body[
t.p["This is some content"]
]
]

This is not harder than normal xhtml tags to follow. plus you don't have
to remember what tag you are closing :)

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python for Webscripting (like PHP)

2005-08-18 Thread Valentino Volonghi aka Dialtone
Alessandro Bottoni <[EMAIL PROTECTED]> wrote:

> (Python has even been told to be used by Yahoo! and Google, among others,
> but nobody was able to demonstrate this, so far)

?
 
Google and Microsoft and Nokia had talks during PyCon 2005.
If you look at the GMAIL help system you would see that all the links in
there end in .py.
Blogger is almost completely built with python.
Google is also one of the members of the PSF.

What should be demonstrated?

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Release of PyPy 0.7.0

2005-08-28 Thread Valentino Volonghi aka Dialtone
Michael Sparks <[EMAIL PROTECTED]> wrote:

> Would it be useful for people to start trying out their modules/code to see
> if they work with this release, and whether they can likewise be translated
> using the C/LLVM backends, or would you say this is too early? (I'm more
> thinking in terms of it providing real world usecases in the hope of
> finding things that don't work - rather than anything else)

This is not how it works. Pypy doesn't translate your code to C/LLVM. 
Currently PyPy can only translate a pretty simple subset of python
called RPython which has a very C-like syntax (but without memory
management code). This is needed to allow type inference inside the
interpreter code.

The code in your application is application code and can be whatever you
want, you may try to translate it to C/LLVM but it won't be that good of
course because the annotator is not that intelligent.

Just In Time compilation a-la-psyco is planned before the 1.0 release of
pypy. 
Right now also the compiler/parser run in application level which means
it is rather slow because it is not translated like the rest of pypy
(which accounts for quite a bit of the slowness of the translated pypy)
[this is of course only true if they didn't manage to rewrite the
parser/compiler in RPython, which I admit I'm not sure]

More information is available on codespeak.net website :).

What's really cool in PyPy is how easily you can implement a new object
space and change semantics of operations done in python.
Writing a Python interpreter that can share data structures across many
computers will be hard but possible.
There are already 4 different object spaces implemented, the standard
one, the thunk one (which is a lazy evaluation object space), the
flowgraph object space and the trace object space that traces each
operation done.

> Either way, this looks like a great milestone - congratulations to the
> entire team. (I remember PyPy being met with skepticism as to whether
> it could even be done! :-)

Indeed.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python compiled?

2005-09-05 Thread Valentino Volonghi aka Dialtone
billiejoex <[EMAIL PROTECTED]> wrote:

> interpretation and compilation at the same time, should be a great 
> advantage.

Python is compiled and needs a runtime environment.
just like java does and like C needs the C standard library installed.

I can see no differences except one is compiled to native code, the
other is compiled to bytecode and JITted or interpreted and python is
compiled to bytecode and interpreted or (with psyco) JITted.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python Jabber client?

2005-09-08 Thread Valentino Volonghi aka Dialtone
Paul Rubin <http://[EMAIL PROTECTED]> wrote:

> If there's more than one, does anyone have a favorite?

twibber
http://slarty.polito.it:8069/~sciasbat/wiki/moin.cgi/twibber

Based on Twisted. Will probably be included in Twisted at some point in
the future. Twisted already has a jabber protocol implementation inside
it but it's very simple (and for example doesn't support SASL).

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re-entrancy question

2005-02-08 Thread Valentino Volonghi aka Dialtone
Tim Golden <[EMAIL PROTECTED]> wrote:

> No doubt there are more pertinent answers, but unless this is
> a learning exercise, you'd be better off investigating Pyro:
> http://pyro.sf.net

AFAIK pyro is just a RPC implementation for python whereas Twisted is a
completely different beast that happens to have its own implementation
of RPC.

How would the OP be better investigating something different, that he
probably doesn't even need?

Your comment would be pertinent only if it considered Perspective Broker
against pyro, and I admit I don't know how they compare.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: re-entrancy question

2005-02-08 Thread Valentino Volonghi aka Dialtone
Tim Golden <[EMAIL PROTECTED]> wrote:

> Now *where* is there any mention of Twisted, either in the original
> post or in my reply? As I read it, the OP is doing something which

Ya sorry. I thought this was crossposted but the OP posted 2 different
emails to both python-list and twisted-python ML. This very same message
was posted on the twisted mailing list.

The answer anyway was already given on the other list: there are no
re-entrancy problems :).

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.7
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and "Ajax technology collaboration"

2005-02-23 Thread Valentino Volonghi aka Dialtone
aurora <[EMAIL PROTECTED]> wrote:

> It was discussed in the last Bay Area Python Interest Group meeting.
> 
> Thursday, February 10, 2005
> Agenda: Developing Responsive GUI Applications Using HTML and HTTP
> Speakers: Donovan Preston
> http://www.baypiggies.net/
> 
> The author has a component LivePage for this. You may find it from  
> http://nevow.com/. Similar idea from the Javascript stuff but very Python
> centric.

As an example for that technology (LivePage) I have this:

http://vercingetorix.dyndns.org:20080/

Which is an online forum where the "Quote & Reply" function is done with
XMLHttpRequest and Python.

Implementing this stuff in the forum with Nevow ( the framework created
by Donovan who I help to develop ) was almost effortless. 

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.8
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python and "Ajax technology collaboration"

2005-02-24 Thread Valentino Volonghi aka Dialtone
Chris <[EMAIL PROTECTED]> wrote:

> Does anyone else have any Nevow examples?

Nevow SVN is full of examples ranging from a simple hello world to a
complete blog engine with xml-rpc, smtp and web interfaces for adding
new posts and an atom feed, or even a live chat or a pastebin or an
image uploader and so on.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.8
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Appeal for python developers

2005-03-05 Thread Thomas Rösner aka TRauMa
BOOGIEMAN wrote:
Please include "goto" command in future python realeses
I know that proffesional programers doesn't like to use it, 
but for me as newbie it's too hard to get used replacing it 
with "while", "def" or other commands
Technically, as a newbie you shouldn't know about GOTO at all. So you're 
more a "Tainted by previous spaghetti code practices"-guy than newbie.

Have a look at "while ... else" and "break". Or use the april special 
release of python featuring goto. But expect to be called names :-).

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


Re: Python becoming less Lisp-like

2005-03-14 Thread Valentino Volonghi aka Dialtone
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:

> It is actually. Ruby's syntax is mostly consistent and coherent, and 
> there is much less special cases than in Python.

I'd be glad to know which special cases are you referring to.
Please note that you wrote "much less" which means there are probably so
many that you weren't able to count them.
 
-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.8
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python becoming less Lisp-like

2005-03-15 Thread Valentino Volonghi aka Dialtone
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:

> A few examples:
> - A statement is different from an expression (2 special cases instead
> of one general case).

> - You can't use statements in a lambda

Good reason to remove lambda, let's do this asap.

> - to get the length of a sequence, you use len(seq) instead of seq.len()

I can see nothing wrong with this.
seq.__len__() 
works equally well.

> - to call objects attributes by name, you use [get|set]attr(obj, name
> [,value]) instead of obj.[get|set]attr(name [,value])

this is the same as above. And I can see nothing wrong with this. This
is not a special case but syntax sugar. If you feel more comfortable use
the following:

seq.__getattribute__('append')


> - if x is a class attribute of class A and a is an instance of A, 
> a.x=anyvalue create a new instance attribute x instead of modifying A.x

How is this a wart? Do you understand mutable and immutable objects?

In [7]: class A(object):
   ...: a = {}
   ...: b = 5 
   ...: 

In [8]: a = A()

In [9]: b = A()


# Modifying an immutable object yields a new object, thus a new binding
In [10]: a.b = 3

In [11]: b.b
Out[11]: 5

# Modyfing a mutable object doesn't change the original binding:
In [12]: a.a['a'] = 4

In [13]: b.a
Out[13]: {'a': 4}

It would be a wart if it was like you thought it should be because the
behaviour of objects changed depending on where they happend to be.

> - sequence methods that modify the sequence in place return None instead
> of returning self - ok, I know the rational for this one, but I still
> dont like it, and still count it as a special case since when using a
> 'destructive' sequence method I can't chain it with non-destructive 
> method calls.

This has nothing to do with special cases... Your countless special
cases are coming out to be things you didn't really understand about
python.

> - object.__getattr__ (if it exists...) is called only when attribute 
> name is not found. object.__setattr__ (if it exists...) is always called.

This is because of the new object model. Agree here, there should be
only one: __getattr__ or __getattribute__.

> - functions are not methods

functions are functions and methods are functions that take the instance
of the object as their first argument. Anyway discussion is ongoing to
remove the bound/unbound difference. Though you can actually do this:

In [14]: class A(object):
   : def foo(self, a):
   : print "hello world"
   : 

In [15]: a = A()

In [16]: a.foo(1)
hello world

In [17]: def baz():
   : 
KeyboardInterrupt

In [17]: def baz(self):
   : print "hello world"
   : 

In [18]: a.foo = baz.__get__(a)

In [19]: a.foo() 
hello world

> - old-style classes vs new-style classes

Agreed. Backwards compatibility wins here. Again Python 3k will remove
this.

Of all your points I agreed on only 3 or 4. This strikes me as a very
well thought out language that in 15 years managed to only get 3 or 4
special cases.

> Also, Python enforce some coding style (indentation) but not some others
> (capitalization for example). So you always have to check, on a lib by

you are mixing oranges and apples here.

> lib base, what style has been used (I personnaly don't give a damn 
> whether I use underscore_all_lower or mixedCaps, but consistency is 
> useful, even more when there's such a huge stdlib). Worst, the base 
> class for new style classes is all lower ('object') when the usual 
> convention is to use CamelCase for classes.

Python standard library is consistent with this style. The only library
I am aware of that doesn't follow this style is wxPython with wax, and I
always discurage every python developer to use this library for this
very reason. I can agree with you here, but this is not a special case.

> I'm not able to count them all, since a good part of them are not carved
> in my poor little brain - I just deal with them day after day. I love

You are not able to count them all since there are almost not special
cases. But many things that could be done in a better way (this is for
sure, python is far from perfect, but it 'sucks' a lot less then
everything else).

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.8
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Lisp-likeness

2005-03-15 Thread Valentino Volonghi aka Dialtone
Thomas A. Russ <[EMAIL PROTECTED]> wrote:

> > >(defun addn (n)
> > > #'(lambda (x)
> > > (+ x n)))
> > 
> > The same as 
> > def addn(n):
> > def fn(x):
> > return n + x
> > return fn
> 
> Is this really equivalent?

yes

> What happens if you call addn more than once with different
> parameters.  Will you get different functions that you can
> use simultaneously?

yes

> The lisp snippet creates new functions each time the addn function is
> called, so one can interleave calls to the individual functions.

In [21]: a = addn(4)

In [22]: b = addn(5)

In [23]: c = addn(25)

In [24]: a(1)
Out[24]: 5

In [25]: b(1)
Out[25]: 6

In [26]: c(1)
Out[26]: 26

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.8
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Web forum (made by python)

2004-12-20 Thread Valentino Volonghi aka Dialtone
<[EMAIL PROTECTED]> wrote:

> Don't see anything in PyPI. Do I have to write everything myself? Gah.
> I need more beer.

I'm writing it in my spare time (which is not enough however).

You can find the url in the sign.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.3.6
Blog: http://vvolonghi.blogspot.com
http://developer.berlios.de/projects/weever
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Still Loving Python

2005-12-14 Thread Valentino Volonghi aka Dialtone
Paul Rubin <http://[EMAIL PROTECTED]> wrote:

> Glade also does something like that.

Indeed. I'd also add some lines on this.

There is a very nice designer for GTK+ applications called Gazpacho,
written in python and available here: http://gazpacho.sicem.biz/

It generates an XML file in the same Glade format (actually it's
slightly different for the Menus). It doesn't require libglade though
because it has its own .glade loader and thanks to this at load time it
can bind events using method names in your 'controller' class (which
inherits from gazpacho's Proxy class.

This means that, if you are using python, you don't even have to define
the actions and action handlers in the designer.

for example:

class LogsterClient(Proxy):

def on_connect__clicked(self, button):



def on_logster__destroy(self, window):



p = Proxy('my_ui.glade')

And it also provide an easy and flexible way to integrate additional
custom widgets in the design process.

Of course it's always possible to build powerful GUIs without using
designers at all:

http://www.lethalman.net/?p=21 

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
http://weever.berlios.de
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python to use a non open source bug tracker?

2006-10-04 Thread Valentino Volonghi aka Dialtone
Terry Reedy <[EMAIL PROTECTED]> wrote:

> As I understood B.C.'s announcement, that was one of the judging criteria,
> and the plan is for PSF to get a daily backup dump of the data.

This had nothing to do with the choice of not using Trac or Launchpad.

Quoting Brett Cannon from the original mail:
""
As for Trac and Launchpad, both had fundamental issues that led to them
not being chosen in the end.  Most of the considerations had to do with
customization or UI problems.
""

So clearly the 'get a daily backup of the data' is not the reason.
Backing up a sqlite database is pretty easy.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
New Pet: http://www.stiq.it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python to use a non open source bug tracker?

2006-10-04 Thread Valentino Volonghi aka Dialtone
Steve Holden <[EMAIL PROTECTED]> wrote:

> > So clearly the 'get a daily backup of the data' is not the reason.
> > Backing up a sqlite database is pretty easy.
> > 
> Do you have any idea fo the scale of the Python issue (bug) database? Do
> you really think SQLite would be a suitable platform for it?

Considering that trac can also run on postgres or mysql and also
considering that both of these databases have enough tools to deal with
backups I think it's a non issue.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
New Pet: http://www.stiq.it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python vs. Lisp -- please explain

2006-02-19 Thread Valentino Volonghi aka Dialtone
Steven D'Aprano <[EMAIL PROTECTED]> wrote:

> By that logic, all languages are interpreted. What do you think happens to
> the machinecode?

Interpreted to transistors state by an internal mapping in the CPU
opcode ==> input configuration.

-- 
Valentino Volonghi aka Dialtone
Now Running MacOSX 10.4
Blog: http://vvolonghi.blogspot.com
New Pet: http://www.stiq.it
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python 2.6: Determining if a method is inherited

2008-10-05 Thread Valentino Volonghi aka Dialtone
Fuzzyman <[EMAIL PROTECTED]> wrote:

> So how do I tell if the X.__lt__ is inherited from object? I can look

I don't have python 2.6 installed so I can't try but what I think could
work is:

>>> class Foo(object):
... def hello(self):
... pass
... 
>>> class Bla(Foo):
... def hello(self):
... pass
... 
>>> class Baz(Foo):
... pass
... 
>>> Baz.hello.im_func

>>> Bla.hello.im_func

>>> Foo.hello.im_func

>>> Foo.hello.im_func is Baz.hello.im_func
True
>>> Foo.hello.im_func is Bla.hello.im_func
False

Which to me also makes sense. If it's inherited I expect it to be the
very same function object of one of the bases (which you can get with
inspect.getmro(Clazz)). On the other end if you override it it's not the
same function object so it won't return True when applied to 'is'.

HTH

-- 
Valentino Volonghi aka Dialtone
http://stacktrace.it -- Aperiodico di resistenza informatica
Blog: http://www.twisted.it/
Public Beta: http://www.adroll.com/
--
http://mail.python.org/mailman/listinfo/python-list


Re: [ANN] Lupa 0.6 - Lua in Python

2010-07-19 Thread Fabrizio Milo aka misto
This is very very interesting.

Do you have any direct application of it ?
I know games like World of Warcraft uses Lua as scripting language.

Thanks.

Fabrizio
--
Luck favors the prepared mind. (Pasteur)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Code for generating validation codes (in images)

2005-09-04 Thread Giuseppe di Sabato (aka deelan)
morphex wrote:
> Hi,
> 
> does anyone of you know of some code I can use to generate validation
> code images?
> 
> Those images you can see on various login forms used to prevent bots
> for performing a brute-force attack..

take a look at the "pycaptcha" package:


later,
deelan.

-- 
deelan, #1 fan of adriana lima!

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


Re: - E02 - Support for MinGW Open Source Compiler

2005-02-18 Thread ? the Platypus {aka David Formosa}
Ilias Lazaridis <[EMAIL PROTECTED]> writes:

> Duncan Booth wrote:
[...]

> > It is GPL licensed with an amendment which prevents the GPL
> > spreading to other open source software with which it is linked.
> > "In accordance with section 10 of the GPL, Red Hat, Inc. permits
> > programs whose sources are distributed under a license that complies
> > with the Open Source definition to be linked with libcygwin.a
> > without libcygwin.a itself causing the resulting program to be
> > covered by the GNU GPL."
> 
> If I understand this right, I cannot produce commercial software with
> the cygwin toolset.

You cannot produce proprietary software with that toolset.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Range function

2005-05-15 Thread David Formosa (aka ? the Platypus)
On 15 May 2005 02:50:38 -0700, Xah Lee <[EMAIL PROTECTED]> wrote:
> Here's the Perl code.

Where did you learn to program?  Its highly unlikely that a Perl
programer would ever write a range function as there is a built in
Perl function that does the same thing.  If your intent is purely
accedemic then the first thing you should do is learn Perl to a much
higher grade.

> #! perl
> 
> # http://xahlee.org/tree/tree.html
> # Xah Lee, 2005-05
> 
> #_ Range _ _ _ _
> 
>=pod
> 
> B

Its considered poor style to have function names with capital
letters.  The normal convention is to use all lower case.

> Range($iMax) generates the list [1, 2, ... , $iMax].
> 
> Range($iMin, $iMax) generates the list [$iMin, ... , $iMax].
> 
> Range($iMin, $iMax, $iStep) uses increment $iStep, with the last
> element in the result being less or equal to $iMax. $iStep cannot be 0.
> If $iStep is negative, then the role of $iMin and $iMax are reversed.
> 
> If Range fails, 0 is returned.
> 
> Example:
> 
>  Range(5); # returns [1,2,3,4,5]
> 
>  Range(5,10); # returns [5,6,7,8,9,10]
> 
>  Range( 5, 7, 0.3); # returns [5, 5.3, 5.6, 5.9, 6.2, 6.5, 6.8]
> 
>  Range( 5, -4, -2); # returns [5,3,1,-1,-3]
> 
>=cut

sub range {

  return [1..$_[0]] if (@_==1);

  return [$_[0]..$_[1]] if (@_==2);

  my $lowest= shift;
  my $greatest  = shift;
  my $increment = shift;

  my $steps = ($greatest - $lowest)/$increment;
  my @return= map { $_ * $increment + $lowest } (0..$steps);

  return [EMAIL PROTECTED];
}

This does as you wish but it far shorter and I would argue easyer for
the typical perl programer to read.

> sub Range ($;$$) {
> if (scalar @_ == 1) {return _rangeFullArgsWithErrorCheck(1,$_[0],1);};
> if (scalar @_ == 2) {return
> _rangeFullArgsWithErrorCheck($_[0],$_[1],1);};
> if (scalar @_ == 3) {return
> _rangeFullArgsWithErrorCheck($_[0],$_[1],$_[2]);};
>};

I would suggest that If you have the case where your doing a one line
if stament then you should make use of the line modifing verent of
if.  Also since if produces a scalar context its not needed.

sub Range ($;$$) {
  return _rangeFullArgsWithErrorCheck(1,$_[0],1) if (@_ == 1);
  return _rangeFullArgsWithErrorCheck($_[0],$_[1],1) if (@_ == 2);
  return _rangeFullArgsWithErrorCheck($_[0],$_[1],$_[2]) if (@_ == 3);
}

See how much neater and more readable the code is after doing that.

> sub _rangeFullArgsWithErrorCheck ($$$) {
> my ($a1, $b1, $dx) = @_;
> 
> if ($dx == 0) {print "Range: increment cannot be zero."; return 0}
> elsif ($a1 == $b1) {return [$a1];}
> elsif ( ((($b1 - $a1) > 0) && ($dx < 0)) || ((($b1 - $a1) < 0) && ($dx
>> 0)) ) {print "Range: bad arguments. You have [$a1,$b1,$dx]"; return
> 0;}
> elsif ((($a1 < $b1) && ($b1 < ($a1 + $dx))) || (($a1 > $b1) && ($b1 >
> ($a1 + $dx {return [$a1];}
> else { return _rangeWithGoodArgs ($a1,$b1,$dx);};
>};

This would be a great place to make use of die.  Throwing an exection for an 
error.

sub _rangeFullArgsWithErrorCheck ($$$) {
  my ($a1, $b1, $dx) = @_;

  die "Range: increment cannot be zero." unless $dx;

  return [$a1] if ($a1 == $b1);

  if ( ((($b1 - $a1) > 0) && ($dx < 0))
|| 
   ((($b1 - $a1) < 0) && ($dx0))) {
die "Range: bad arguments. You have [$a1,$b1,$dx]";
  }
}


> sub _rangeWithGoodArgs ($$$) {
> my ($a1, $b1, $dx) = @_;
> my @result;
> 
> if ($a1 < $b1) {for (my $i = $a1; $i <= $b1; $i += $dx) { push
> (@result, $i);}; }
> else {for (my $i = $a1; $i >= $b1; $i += $dx) { push (@result, $i);};
>};
> return [EMAIL PROTECTED];
>};

Personally I don't like the c style while loop.  I didn't like it in C
and I don't like it in perl.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 20050111: list basics

2005-05-15 Thread David Formosa (aka ? the Platypus)
On 12 Jan 2005 08:22:04 GMT, Abigail <[EMAIL PROTECTED]> wrote:

[...]

> Wrong. Perl functions don't take memory addresses. Perl doesn't allow
> the programmer to do direct memory access.

Perl's pack function will allow you to do direct memory access if you
ask it to via the "p" and "P" templates.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are OOP's Jargons and Complexities?

2005-05-25 Thread David Formosa (aka ? the Platypus)
On Tue, 24 May 2005 09:16:02 +0200, Tassilo v. Parseval
<[EMAIL PROTECTED]> wrote: 
> Also sprach John W. Kennedy:
[...]

> Most often, languages with strong typing can be found on the functional
> front (such as ML and Haskell). These languages have a dynamic typing
> system. I haven't yet come across a language that is both statically and
> strongly typed, in the strictest sense of the words. I wonder whether
> such a language would be usable at all.

Modula2 claims to be both statically typed and strongly typed.  And
your wonder at its usablity is justified.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What are OOP's Jargons and Complexities?

2005-06-01 Thread David Formosa (aka ? the Platypus)
On Wed, 1 Jun 2005 06:09:43 +0200, Tassilo v. Parseval
<[EMAIL PROTECTED]> wrote: 

[...]

> I am only familiar with its successor Modula-3 which, as far as I
> understand, is Modula-2 with uppercased keywords and some OO-notion
> bolted onto it (I still recall 'BRANDED' references). 

Modula-2 also overused caps, I recall the irratation I found
programing it was irratating, streaching my finger to hit the shift
key or taking me hands of the home keys to bump the CAPSLOCK key
quick became phisically painfull.


-- 
Please excuse my spelling as I suffer from agraphia. See
http://dformosa.zeta.org.au/~dformosa/Spelling.html to find out more.
Free the Memes.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why stay with lisp when there are python and perl?

2007-05-04 Thread David Formosa (aka ? the Platypus)
Nameless wrote:
> Why should I keep on learning lisp when there are python and perl?

The more programing languages you know the better programer you will
be.  Lisp can teach you a number of key things that are required to
be a good programmer in any of the P* lanuages.

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


Re: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread David Formosa (aka ? the Platypus)
["Followup-To:" header set to comp.lang.perl.misc.]
On Thu, 26 Jul 2007 09:38:34 -0700, Paul Boddie <[EMAIL PROTECTED]> wrote:

[...]

> you'd show off your community a bit
> better by entertaining even the most naive questions - people have to
> start somewhere, you know.

However asking a good question doesn't take that much skill.  And if
you have come to a p* language as your nth programing language then
you should have had developed thouse skills.  Indeed its a basic skill
that anyone who regards themselves as technologically litrate should
develop.

I have found that often the prerequisite steps for asking a question,
working out exactly what behavour I desire, the behavour I'm seeing
and then isolating the code to a minimum required to express the
problem, often helps me solve the problem before I even have to post.

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


Re: TeX pestilence (was Distributed RVS, Darcs, tech love)

2007-10-22 Thread David Formosa (aka ? the Platypus)
["Followup-To:" header set to comp.lang.functional.]
On Mon, 22 Oct 2007 11:30:51 -0400, George Neuner  
wrote:
> On Mon, 22 Oct 2007 05:50:30 -0700, Xah Lee <[EMAIL PROTECTED]> wrote:

[...]

>>5. This is arguable and trivial, but i think TeX judged as a computer
>>language in particular its syntax, on esthetical grounds, sucks in
>>major ways.
>
> No one except you thinks TeX is a "computer language".

TeX is Turing compleate so it is quite valid to consider it a computer 
language.  Though
Xah Lee is correct more by co-incidence.

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