Re: Why PHP is so much more popular for web-development

2007-07-27 Thread Jon Ribbens
On 2007-07-26, Steve Holden <[EMAIL PROTECTED]> wrote: >> That sounds trivial to ameliorate (at least somewhat) by putting your >> uploads in a directory whose name is known only to you (let's say it's >> a random 20-letter string). The parent directory can be protected to >> not allow reading the

Re: Understanding mxODBC Insert Error

2007-07-29 Thread Jon Clements
w.nabble.com/Understanding-mxODBC-Insert-Error-tf4166125.htm... > Sent from the Python - python-list mailing list archive at Nabble.com. Apart from what John Machin has said, your SQL also looks like it's half trying to be an insert with a subselect clause (looking at the 'where&#x

Re: Web based Reporting tool for Python

2007-08-07 Thread Jon Rosebaugh
On 2007-08-06 23:29:16 -0500, Madhu Alagu <[EMAIL PROTECTED]> said: > Hi > I am looking template based report tools for python.It has the ability > to deliver rich content onto the screen, to the printer or into PDF, > HTML, XLS, CSV and XML files. I don't think this has been implemented in Pytho

Re: Web based Reporting tool for Python

2007-08-08 Thread Jon Rosebaugh
On 2007-08-07 23:35:26 -0500, Madhu Alagu <[EMAIL PROTECTED]> said: > Thanking so much for all the informations and links.I would like to > use Mako Templates(www.makotemplates.org).I like to use simple and > python default module... Mako is an excellent template system, but you'll have a lot of

Re: Web based Reporting tool for Python

2007-08-12 Thread Jon Rosebaugh
On 2007-08-12 06:08:49 -0500, Steve Holden <[EMAIL PROTECTED]> said: > Steve Holden wrote: >> Madhu Alagu wrote: >>> On Aug 8, 4:57 pm, Jon Rosebaugh <[EMAIL PROTECTED]> wrote: >>>> On 2007-08-07 23:35:26 -0500, Madhu Alagu <[EMAIL PROTECTED]>

Re: What order does info get returned in by os.listdir()

2007-08-15 Thread Jon Clements
To emulate the order of XP, you might be able to get away with something like:- sorted( myData, key=lambda L: L.replace('~',chr(0)) ) That just forces all '~'s to be before everything else. hth, Jon. On 15 Aug, 14:33, Jeremy C B Nicoll <[EMAIL PROTECTED]> wrote:

Re: Biased random?

2007-08-27 Thread Jon Clements
en create a sorted list based on the combined value of weight and the output of random(); from this take the first N many elements to meet your requirements. hth Jon On 27 Aug, 21:42, Ivan Voras <[EMAIL PROTECTED]> wrote: > Hi, > > I have a list of items, and need to choose several ele

Re: list index()

2007-08-31 Thread Jon Ribbens
On 2007-08-31, Erik Max Francis <[EMAIL PROTECTED]> wrote: >> I say the 'oll' in troll like the 'ol' in frolic, and pronounce roll >> and role similarly. >> >> My accent is probably from the East Midlands of the UK, but is not >> pronounced. > > _Troll_ and _frolic_ aren't pronounced with the same

Re: Generating HTML

2007-09-12 Thread Jon Rosebaugh
On 2007-09-11 23:33:18 -0500, "Sebastian Bassi" <[EMAIL PROTECTED]> said: > Hello, > > What are people using these days to generate HTML? I still use > HTMLgen, but I want to know if there are new options. I don't > want/need a web-framework a la Zope, just want to produce valid HTML > from Pyth

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Janto Dreijer wrote: > The Nokia Java SDK allows one to define multiple content-types in a > single HTTP header field. I'm not sure if it's standard, but it's > happening from some Java-enabled phones. > > The only reference to this "bug" I can find dates back to 19

Re: multiple content-types break cgi.py

2007-03-04 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Janto Dreijer wrote: >> It's not a bug - sending multiple content-types is just totally broken. >> What would such a header even be supposed to mean? It's like saying >> "this is an apple orange". > > Hmmm. Thanks! I suspected as much. > > Rough inspection suggests

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > The "JonPy" version: > http://jonpy.sourceforge.net/fcgi.html > Last revised in 2004. I'd recommend my one, but it's just possible I'm not impartial ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommended FastCGI module?

2007-03-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > Jon Ribbens wrote: >>> The "JonPy" version: >>> http://jonpy.sourceforge.net/fcgi.html >>> Last revised in 2004. >> >> I'd recommend my one, but it's just possi

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > As for "some modules not being maintained", it really is sad > that MySQLdb is kind of behind. If you're running Windows and need > MySQL, you're either stuck with Python 2.4 Looks like that's changed: http://sourceforge.net/project/showfi

Re: Database module & multithreading

2007-03-10 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: > Is the "egg" packaging gimmick considered mainstream Python, or just some > wierd idea from the "Peak" people? It seems to complicate installation > without adding much value. I don't know, but stock Python 2.5 seems to stick mysterious '.eg

Re: Database module & multithreading

2007-03-11 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: >> I don't know, but stock Python 2.5 seems to stick mysterious '.egg' >> files in the site-packages directory when you install things. > > Which "stock" Python? Not the one from www.python.org... Yes, the one from www.python.org. -- http:

Re: Database module & multithreading

2007-03-11 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: I don't know, but stock Python 2.5 seems to stick mysterious '.egg' files in the site-packages directory when you install things. >>> >>> Which "stock" Python? Not the one from www.python.org... >> >> Yes, the one from www.python.or

Re: Watching a file another app is writing

2007-03-12 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, John Nagle wrote: >> On Unix a quick shortcut would be to simply read the output of 'tail - >> f ' command... > > "tail -f" just checks the file size once a second. It's not doing > anything exciting. That's not actually always true these days. *BSD, at least,

Re: python noob, multiple file i/o

2007-03-16 Thread Jon Clements
to outfile? # Be explicit with file closures outfile.close() infile.close() [/code] Of course, you can change the wild card criteria in the glob statement, and also then filter further using regular expressions to choose only files matching more specific criteria. This should be enough to get you started though. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: python noob, multiple file i/o

2007-03-16 Thread Jon Clements
On 16 Mar, 09:02, "Jon Clements" <[EMAIL PROTECTED]> wrote: > On 16 Mar, 03:56, "hiro" <[EMAIL PROTECTED]> wrote: > > > > > > > Hi there, > > > I'm very new to python, the problem I need to solve is whats the "best/ > &g

CSV module and "fileobj"

2007-03-16 Thread Jon Clements
-- assume a constraint that I can't...) Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: String formatting with fixed width

2007-03-16 Thread Jon Clements
t be cut: 1021 -> 021) You can use something like this: >> print '%7.03f' % 21.1 ' 21.100' However, this will only make the string at *least* 7 long. If the length of the number exceeds this, you'll end up with it even longer; for instance: >> pr

Re: Boost Python properties/getter functions for strings

2007-03-19 Thread Jon Clements
ference? You might get some answers here; if not, can I suggest http://mail.python.org/mailman/listinfo/c++-sig ? I think a lot of the Boost.Python developers hang around on that list. hth, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Stargaming wrote: > from sys import version_info > if version_info[0] < 2 or version_info[1] < 4: > raise RuntimeError("You need at least python2.4 to run this script") That'll fail when the major version number is increased (i.e. Python 3.0). You want: if

Re: #!/usr/bin/env python > 2.4?

2007-03-21 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Sion Arrowsmith wrote: > Jon Ribbens <[EMAIL PROTECTED]> wrote: >> if sys.hexversion < 0x020400f0: >>... error ... > > "Readability counts." > > if sys.version_info < (2, 4): > ... error ... Ma

Re: #!/usr/bin/env python > 2.4?

2007-03-22 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > I don't see any problem with:: > > if version_info[0] <= 2 and version_info[1] < 4: > raise RuntimeError() What if the version number is 1.5? -- http://mail.python.org/mailman/listinfo/python-list

Re: #!/usr/bin/env python > 2.4?

2007-03-23 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > Uh... I never thought it was an implied formula there - that F0 had to > come from 1.5 = 15 = 0xF. > I think it should be stated much more clearly. I'm not sure what you're saying. You are correct that the documentation is rather vague.

Re: What are OOP's Jargons and Complexities

2007-03-29 Thread Jon Harrop
simplifier written in OCaml/F# that is difficult and tedious to translate into many other languages efficiently (including C++, Java, C# and even Lisp). -- Dr Jon D Harrop, Flying Frog Consultancy OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/inde

Re: Requirements For A Visualization Software System For 2010

2007-04-05 Thread Jon Harrop
o. In the case of a DirectX-based visualization, you would probably need to write another back-end targetting OpenGL. -- Dr Jon D Harrop, Flying Frog Consultancy OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/index.html?usenet -- http://mail.python.org/mailman

python newbie beautifulSoup question

2007-04-11 Thread Jon Crump
'a', {'name' : re.compile('^it.*$')})]) Any clues, examples, or suggestions for further study, gratefully received. Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: python newbie beautifulSoup question

2007-04-12 Thread Jon Crump
Justin, Wow! I thought there might be a 'simple' way! thanks so much, you've given me a lot to chew on. Jon __ J.J. Crump Dept. of History 353560 University of Washington Seattle, WA. 98195 On Wed, 11 Apr 2007, Justin Ezequiel wrote: > On Apr 12, 4:15 am, Jon Crump

Re: smtp debugging methods

2007-09-14 Thread Jon Ribbens
On 2007-09-14, Sean Nakasone <[EMAIL PROTECTED]> wrote: > I'm having trouble with sending smtp mail. It's hanging after the > smtplib.SMTP() line. It doesn't works from home but not from work. What's > the best way to debug this? > > # Here's the error server = smtplib.SMTP("smtp.gmail.com

First class lexical closures

2007-10-14 Thread Jon Harrop
Just debating somewhere else whether or not Python might be considered a functional programming language. Lua, Ruby and Perl all seem to provide first class lexical closures. What is the current state of affairs in Python? Last time I looked they were just removing (?!) closures... -- Dr Jon D

Re: Get the instance name from a list by Reflection

2007-10-22 Thread jon vspython
May be, you could check against globals() dictionary looking for matching id()'s: def find_name(identifier): for k,v in globals().items(): if id(v) == id(identifier): return k -- http://mail.python.org/mailman/listinfo/python-list

Re: Iteration for Factorials

2007-10-23 Thread Jon Ribbens
On 2007-10-23, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > Yuk. Reminds me of one of the Hitachi processors that > has a single depth hardware "link register" that tells a > subroutine where it was called from. That's how ARM processors work, and they're everywhere these days. -- http://mai

Re: ocaml to python

2007-02-19 Thread Jon Harrop
implify/97 (field 0 match/131)) (apply simplify/97 (field 1 match/131 (apply (field 1 (global Toploop!)) "simplify" simplify/97 I suspect your best bet is to write an interface between the two (e.g. XMLRPC) and keep the OCaml as OCaml. -- Dr Jo

Re: Checking for EOF in stream

2007-02-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > So this is the way to check for EOF. If you don't like how it was spelled, > try this: > >if data=="": break How about: if not data: break ? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: count pages in a pdf

2007-11-27 Thread Jon Ribbens
On 2007-11-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > is it possible to parse a pdf file in python? for starters, i would > like to count the number of pages in a pdf file. i see there is a > project called ReportLab, but it seems to be a pdf generator... i > can't tell if i would be able

Re: Best way to protect my new commercial software.

2007-12-18 Thread Jon Ribbens
On 2007-12-18, Grant Edwards <[EMAIL PROTECTED]> wrote: > On 2007-12-18, Jan Claeys <[EMAIL PROTECTED]> wrote: >> No, it's only copyrighted when you _publish_ it. > > Interesting. So, in Europe, if somebody steals something you > wrote before you get it published, they're free to do with it > as t

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-18 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Aahz wrote: > On that front, I think that pysqlite is much more important because > it finally gets rid of the excuse for using Berkeley for simple > database purposes. Apologies if I'm being obtuse, but how does including the pysqlite wrapper module change anything

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Chris Lambacher wrote: > At least on windows. PySqlite is statically linked with the sqlite library. > This can be done because it is quite small. OK, well that makes sense, but why not on any other platform? -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: >> Apologies if I'm being obtuse, but how does including the pysqlite >> wrapper module change anything? You still need to download and install >> SQLite > > I'm pretty sure the distributors will do this for you, just as > they've included zlib,

Re: 2.5 excitement (was Re: Java Developer Exploring Python)

2006-04-19 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > these days, most end users get their Python either with their OS, > or by downloading a prebuilt installer. Oh, ok. I've just never heard such people referred to as "the distributors" before. It sounds like some sort of TV series! ;-) >> I gu

Push to Make (Single Pole) Button running a loop

2007-12-30 Thread Jon Todd
g this? And would it necessarily involve creating a custom widget? ... Also, while I'm here, what's the state of play regarding non-ASCII in Tkinter widgets. I've been trying to get our currency symbol, £, to display but didn't have much luck even playing with the

Paid subscription Python magazines

2008-01-08 Thread Jon Harrop
Are there any Python magazines that you can pay to subscribe to? (either paper or on-line). -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?u -- http://mail.python.org/mailman/listinfo/python-list

RE: Mysterious xml.sax Encoding Exception

2008-02-02 Thread Peck, Jon
Yes, the characters were from the 0-127 ascii block but encoded as utf-16, so there is a null byte with each nonzero character. I.e., \x00?\x00x\x00m\x00l\x00 Here is something weird I found while experimenting with ElementTree with this same XML string. Consider the same XML as a Python Unic

Re: Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Bernard <[EMAIL PROTECTED]> wrote: > #Fork and commit suicide > if os.fork(): > sys.exit(0) I'm pretty sure that should be os._exit(0) > #What to do in parent process This is now the child process. > sys.stdin =

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes <[EMAIL PROTECTED]> wrote: >> Although bear in mind it's pretty UNIX-y. > > IIRC you have to fork a second time after you have changed the working > dir and created a new session group. Why? I don't think you do. Neither does BSD daemon.c or glibc daemon.c -- http:

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Christian Heimes <[EMAIL PROTECTED]> wrote: > Jon Ribbens wrote: >> Why? I don't think you do. >> Neither does BSD daemon.c or glibc daemon.c > > The problem is well documented at > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66012

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Gilles Ganault <[EMAIL PROTECTED]> wrote: > I need to launch a Python script, and fork it so that the calling > script can resume with the next step will the Python script keeps > running. > > I tried those two, but they don't work, as the calling script is stuck > until the Py

Re: [2.4.2/Linux] Getting Python to fork?

2008-02-04 Thread Jon Ribbens
On 2008-02-04, Rolf van de Krol <[EMAIL PROTECTED]> wrote: > To create a deamon, you indeed need to fork two times. For more > information and a working example see: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731 . I'm > quite sure this works, because I used it several times to

Re: Regarding coding style

2008-03-07 Thread Jon Ribbens
On 2008-03-07, D'Arcy J.M. Cain <[EMAIL PROTECTED]> wrote: >> 2. You should use two spaces after a sentence-ending period. >> >> For heavens sake, why? I've always been obstructed by the double >> blanks but tolerated them. Now, that i read that it actually is a >> recommendation, i need to ask ab

Re: OCaml, Language syntax, and Proof Systems

2009-01-25 Thread Jon Harrop
on Hickey's book which, I believe, is due to be published by Cambridge University Press soon: http://www.cs.caltech.edu/courses/cs134/cs134b/book.pdf -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes with Compaq Visual Fortran 6.6B *.dll (Windows XP), passing of integer and real values

2009-01-27 Thread Jon Clements
er of functions >            2 number of names > >     ordinal hint RVA      name > >           1    0 1000 footst_mp_foo1_ >           2    1 10A6 footst_mp_foo2_ > >   Summary > >         1000 .data >         1000 .rdata >         1000 .reloc >  

Re: Why doesn't eval of generator expression work with locals?

2009-01-27 Thread Jon Clements
r): for x in ar: yield x == y Which doesn't work either, however, if you introduce a global y the function can access it (similar if you add y to your global_vars). It's basically one of those scope/closure gotcha's along with lambdas (which was discussed quite heavily recently). hth, Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: How to execute a hyperlink?

2009-01-27 Thread Jon Clements
system('http://somedomain.com/foo.cgi?name=foo&passwd=bar') > > but I got kicked out by the Python interpreter. I wonder somebody > knows the syntax of triggering a hyperlink? Thanks in advance! > > Muddy Coder The webbrowser module springs to mind. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: bigint to timestamp

2009-01-28 Thread Jon Clements
1 800 494 3119 > Holden Web LLC              http://www.holdenweb.com/ Bit hard to guess without the actual date to compare to... and I'm a bit busy, but thought I'd throw this in the pool: I'm guessing it's a MySQL database that's had data put into it via a .NET applicat

Re: Function Application is not Currying

2009-01-30 Thread Jon Harrop
language is > inherently able to take a function of more than one arg and > deconstruct it to several functions of single arg. That is incorrect. You only need a language with first-class functions. I believe you are confusing the syntactic support in OCaml and Haskell for something more. It

Number of bits/sizeof int

2009-01-30 Thread Jon Clements
how to get this in 2.5.2 as that's the production version I'm stuck with. Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Number of bits/sizeof int

2009-01-30 Thread Jon Clements
On Jan 31, 7:29 am, John Machin wrote: > On Jan 31, 6:03 pm, Jon Clements wrote: > > > Hi Group, > > > This has a certain amount of irony (as this is what I'm pretty much > > after):- > > Fromhttp://docs.python.org/dev/3.0/whatsnew/3.1.html: > > &qu

Re: Problems installing PySQLite, SQLite and Trac

2009-02-01 Thread Jon Clements
re information. >>> import sqlite3 >>> import pysqlite2 Are you trying to set up using 2.4 or 2.5? I'm just a little confused as to why if sqlite works on 2.4 which looking at the installation instruction [ref: http://www.installationwiki.org/Installing_Trac_and_Subversion#Python] is what's recommended, is what the problem is? As you're under a redhat derivative, perhaps it might be worth just getting the rpm(s) for pysqlite2 and that might well sort it out for you. Sorry to have not been of more help, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Source code for csv module

2009-02-02 Thread Jon Clements
s module is available. > > Is it possible to have a look at it? > > Thanks The csv module is a wrapper around a C extension. If you're happy reading C code then downloading the Python sources will let you take a goosey. Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Source code for csv module

2009-02-03 Thread Jon Clements
. Okies, so the sniffer is there as readable python, but the most interesting bit (which fair enough I made the assumption the OP was interested in) is the reader/writer functionality -- which is implemented as a shared library and thus, unless you have a source install of python somewhere, there is

Re: a regual expression problem

2008-11-30 Thread Jon Clements
ething like... >>> from urlparse import urlsplit >>> from os.path import splitext >>> splitext(urlsplit('http://a.b.com/aaa.jpg?version=1.1').path[1:]) ('aaa', '.jpg') ...and then it should be fairly flexible instead of having to change splitting etc.. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-01 Thread Jon Harrop
evel_, n_, ss_] := Block[{scene = Create[level, {0, -1, 4}, 1]}, Table[ Sum[ RayTrace[{0, 0, 0}, [EMAIL PROTECTED](x + s/ss/ss)/n - 1/2, (y + Mod[s, ss]/ss)/n - 1/2, 1}], scene], {s, 0, ss^2 - 1}]/ss^2, {y, 0, n - 1}, {x, 0, n - 1}]] AbsoluteTiming[Export["image.p

Re: Running a Python script from crontab

2008-12-02 Thread Jon Redgrave
On Dec 2, 2:35 pm, Astley Le Jasper <[EMAIL PROTECTED]> wrote: ... Try using the "screen" utility - change the line in your crontab: cd /home/myusername/src && python myscript.py to cd /home/myusername/src && screen -dmS mypthon python -i myscript.py then once cron has started your program attach

Re: Mathematica 7 compares to other languages

2008-12-02 Thread Jon Harrop
Xah Lee wrote: > On Dec 1, 4:06 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: >> Mathematica is a whopping 700,000 times slower! > > LOL Jon. r u trying to get me to do otimization for you free? > > how about pay me $5 thru paypal? I'm pretty sure i can speed it up. &

Re: Mathematica 7 compares to other languages

2008-12-03 Thread Jon Harrop
Xah Lee wrote: > On Dec 2, 5:13 pm, Jon Harrop <[EMAIL PROTECTED]> wrote: >> The Mathematica code is 700,000x slower so a 50% improvement will be >> uninteresting. Can you make my Mathematica code five orders of magnitude >> faster or not? > > Pay me $10 thru pa

Re: Mathematica 7 compares to other languages

2008-12-07 Thread Jon Harrop
Xah Lee wrote: > I didn't realize until after a hour, that if Jon simply give numerical > arguments to Main and Create, the result timing by a factor of 0.3 of > original. What a incredible sloppiness! and he intended this to show > Mathematica speed with this code? > > Th

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
Xah Lee wrote: > The result and speed up of my code can be verified by anyone who has > Mathematica. You changed the scene that is being rendered => your speedup is bogus! Trace the scene I originally gave and you will see that your program is no faster than mine was. -- Dr Jon

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
luation of In[1]:= Compile::fun: Compilation of (If[#1==0,1,#0[[#1 n-1]] #1]&)[Compile`FunctionVariable$435] cannot proceed. It is not possible to compile pure functions with arguments that represent the function itself. >> -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://w

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
ct to see a genuinely optimized version any time soon... ;-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
as other langs. No, you cannot. That is precisely why you just failed this challenge. You should accept the fact that Mathematica currently has these insurmountable limitations. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
l code.) You have not even made it 10% faster, let alone 70,000x faster. Either provide the goods or swallow the fact that you have been wrong all along. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-08 Thread Jon Harrop
[EMAIL PROTECTED] wrote: > For the interested, with MMA 6, on a Pentium 4 3.8Ghz: > > The code that Jon posted: > > Timing[Export["image-jon.pgm", [EMAIL PROTECTED]@Main[2, 100, 4]]] > {80.565, "image-jon.pgm"} That is not the code I posted: you are

Re: Mathematica 7 compares to other languages

2008-12-09 Thread Jon Harrop
e context of speed is > a major blunder. His denial makes him a stubborn moron. That performance issue only affects trivial problems and, in particular, does not affect the problem you were trying to solve. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to report progress at fixed intervals

2008-12-09 Thread Jon Morton
I think there is something I've run into, and it will only ever get _loaded_ once. See below for sour output of an easy example case of my problem. The wxPython lib is big, so it may have bugs, but pySer l and pure python (no C/C++ directly, event thought it uses os.open/ close & termios that

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Jon Harrop
Stef Mientki wrote: > Who said Mathematica was a high level language ? Xah is using what he calls "highlevelness" as an excuse for poor performance. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Jon Harrop
ruby > def norm a > s = Math.sqrt(a.map{|x|x*x}.inject{|x,y|x+y}) > a.map{|x| x/s} > end > > v = [3,4] > > p norm(v) # returns [0.6, 0.8] That is the correct answer. > The correct result for that input would be 5. No, you're confusing normalization with le

Re: Mathematica 7 compares to other languages

2008-12-10 Thread Jon Harrop
Xah Lee wrote: > Kaz Kylheku wrote: >> Really? ``50 or hundreds'' of lines in C? >> >> #include /* for sqrt */ >> >> void normalize(double *out, double *in) >> { >> double denom = sqrt(in[0] * in[0] + in[1] * in[1] + in[2] * >> in[2]); >> >> out[0] = in[0]/denom; >>

Re: Mathematica 7 compares to other languages

2008-12-11 Thread Jon Harrop
quot;. It is the same type (float *) and has the same dimension. That is idiomatic C. You could define a struct type representing a vector that includes its length and data (akin to std::vector<..> in C++) but it would still be nowhere near 50 LOC as you claimed. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Mathematica 7 compares to other languages

2008-12-25 Thread Jon Harrop
le should perhaps then accept a > sequence of numbers separated by space... In other words, you want a REPL. Why don't we have another challenge that involves handling a non-trivial input format, i.e. parsing? -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?u -- http://mail.python.org/mailman/listinfo/python-list

Re: Module caching

2009-04-03 Thread Jon Clements
so keeping module level variables around is going to be a gotcha. It's a kludge, but setting MaxRequestsPerChild to 1 in the Apache config basically forces a reload of everything for every request... that might be worth a go -- but it's nasty... Cheers, Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to add lines to the beginning of a text file?

2009-04-03 Thread Jon Clements
r, issue a delete for the old file, and a rename for new file to the old name. hth Jon. -- http://mail.python.org/mailman/listinfo/python-list

Re: Best way to extract from regex in if statement

2009-04-03 Thread Jon Clements
mpile('rx1'), re.compile('rx2'), # etc ] for line in lines: for rx in your_regexes: m = rx.match(line) if m: print m.group(1) break # if only the first matching regex is required, otherwise leave black for all Untested, but seems to make sense hth, Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: Using a decorator to *remove* parameters from a call

2009-04-13 Thread Jon Clements
On 13 Apr, 11:11, Michel Albert wrote: > A small foreword: This might look like a cherrypy-oriented post, and > should therefore go to the cherrypy group, but if you read to the end, > you'll see it's a more basic python problem, with cherrypy only as an > example. ;) > > From the decorator PEP (3

nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-05-27 Thread Jon Bendtsen
Hi I'm trying to expand cvsmail.py so it posts to newsgroups, but i constantly get this error message: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers If i put the test message into a file then i can post it just fine, no problems. But if i put the message into a StringIO, the

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-05-28 Thread Jon Bendtsen
Dennis Lee Bieber wrote: > On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen > declaimed the following in gmane.comp.python.general: > >> 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: >> \n\n\nfoobar\n\n\n.\n\n\n' >> > I bel

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-06-04 Thread Jon Bendtsen
Jon Bendtsen wrote: > Dennis Lee Bieber wrote: >> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen >> declaimed the following in gmane.comp.python.general: >> >>> 'From: r...@laerdal.dk\nsubject: testing\nNewsgroups: test\nBody: >>> \n\n\nfoobar\n\n\n.\

Re: nntplib.NNTPTemporaryError: 441 Article has no body -- just headers

2009-06-04 Thread Jon Bendtsen
Jon Bendtsen wrote: > Jon Bendtsen wrote: >> Dennis Lee Bieber wrote: >>> On Wed, 27 May 2009 14:25:58 +0200, Jon Bendtsen >>> declaimed the following in gmane.comp.python.general: >>> >>>> 'From: r...@laerdal.dk\nsubject: testing\nN

Re: generate all possible math expr of one term

2008-05-15 Thread Jon Harrop
.g. x, Sin[x], Sin[Sin[x]], ... > The above i wrote in 2002. If there are requests, i'll translate the > above code into emacs lisp. A correct definition of what the program is supposed to do with a correct implementation in any language would be a good start. If you are trying to

ftplib returns EOFError

2008-05-19 Thread Jon Bowlas
ib, line 221, in voidresp Module ftplib, line 207, in getresp Module ftplib, line 193, in getmultiline Module ftplib, line 183, in getline EOFError Any help in catching and ignoring this error would be greatly appreciated. Regards Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: The Importance of Terminology's Quality

2008-06-05 Thread Jon Harrop
> > Yeah, but why did you cross-post to so many newsgroups? Are you > trying to run a flame war between advocates of the various > languages? What would be the point? We all know that Java, Perl, Python and Lisp suck. They don't even have pattern matching over algebraic sum types if y

soaplib newbie question

2008-06-05 Thread Jon Hune
hi everyone, I'm totally new to SOAP. Can anyone help with this soap question. I'm trying to use soaplib. I can't find many examples on using soaplib and what I have below if the standard hello world example I find online. Say I want to call the zzz service at yyy. I know that the service inputs

Re: for x,y in word1, word2 ?

2008-08-11 Thread Jon Clements
ant. > > > I want: > > for x in y and for a in b: > > Something like this? > > >>> a = ['a','b','c'] > >>> b = [1,2,3] > >>> zip(a,b) > > [('a', 1), ('b', 2), ('c', 3)] I wou

Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
;, 'deptleveltext': u'', 'deptlevelheader': u'Level 2 Courses', 'subj_code': u'AE'}, {'mod_title': u"Man's Place in Nature 1750-1900", 'level': u'23', 'modcode': u'HMED3001', 'deptleveltext': u'', 'deptlevelheader': u'Level 2/3 Courses', 'subj_code': u'AE'}, {'mod_title': u'Medicine, Disease and Society, Antiquity to Renaissance ', 'level': u'23', 'modcode': u'HMED3003', 'deptleveltext': u'', 'deptlevelheader': u'Level 2/3 Courses', 'subj_code': u'AE'}, {'mod_title': u'Madness and Society', 'level': u'23', 'modcode': u'HMED3004', 'deptleveltext': u'', 'deptlevelheader': u'Level 2/3 Courses', 'subj_code': u'AE'}] For example I'd like to kow how many dictionaries there are with a level 1, 2 , 23 & 3 etc. How would one go about achieveing this? Hope someone can help. Cheers Jon -- http://mail.python.org/mailman/listinfo/python-list

Re: Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
Many thanks for all your reponses, much appreciated. I'll get back to you on which is the best for me. BTW - yes John thats exactly what I wanted. Cheers Jon Jon Bowlas wrote: > For example I'd like to kow how many dictionaries there are with a > level 1, 2 , 23 & 3 e

Re: Help counting the total number of dictionaries inside a list that contain a specified key value

2008-08-12 Thread Jon Bowlas
' I'm afraid I can't use Peters suggestion as I'm using python 2.3 and it doesn't have the collection module. Thanks anyway. Cheers Jon 2008/8/12 Jon Bowlas <[EMAIL PROTECTED]>: > Many thanks for all your reponses, much appreciated. > > I'll get back t

Re: who said python can't be obsfucated!?

2008-04-02 Thread Jon Nicoll
[EMAIL PROTECTED] wrote: > def s(c):return[]if c==[]else s([_ for _ in c[1:]if _ +s([_ for _ in c[1:]if _>=c[0]]) > > Anyone else got some wonders...? looks like one of castironpi's postings... J^n -- http://mail.python.org/mailman/listinfo/python-list

Re: Finally had to plonk google gorups.

2008-04-16 Thread Jon Ribbens
On 2008-04-16, Grant Edwards <[EMAIL PROTECTED]> wrote: > But that's not a battle you can win, so I broke down and joined all > the other people that just killfile everything posted via google.groups. I did the same about an hour ago. -- http://mail.python.org/mailman/listinfo/python-list

<    2   3   4   5   6   7   8   9   10   11   >