Re: Can Parallel Python run on a muti-CPU server ?
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Hi all, I'm interested in Parallel Python and I learned from the website of Parallel Python that it can run on SMP and clusters. But can it run on a our muti-CPU server ? We are running an origin3800 server with 128 CPUs. Thanks. I have tested that at least it could run sum_primes.py on our server. But it seems Parallel Python just launch one python process for each job, and if I let it use 12 CPUs for 8 jobs, Parallel Python launches 12 python processes, 4 of which just sleep until all 8 jobs are done. I've just downloaded it ,having a couple of M-CPU machines, it's quite interesting. At this moment I think that you should not see it as 'magical distribution' of your processing pool but more like the way threads work. So every function will stay on it's CPU while executing and will not use the process power of another CPU if available. So I guess you have to fine grain your program to take the advantage of multiple CPU's, just like you would do if you had 'real' threads. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Can Parallel Python run on a muti-CPU server ?
azrael wrote: On Feb 7, 3:13 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi all, I'm interested in Parallel Python and I learned from the website of Parallel Python that it can run on SMP and clusters. But can it run on a our muti-CPU server ? We are running an origin3800 server with 128 CPUs. Thanks. I see you got a problem. me to. how can i get such a little toy for my own and how much do i have to spend on it. i also want sometjing like thi. 128 cpu-s, 64 GB rainbowtables, oh my god. i want this. i am very close to have an orgasm. Rent it :-) Well you could do at Sara, just google for sara teras ;-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Dictionary inserts and threads
Hi all, I'm thinking to speed up a process, I like to use multiple threads to get data fractions from multiple servers and place those data fragments into a local dictionary for further processing, the dictionary will look like this: self.dic = {'thread_a':dict(), 'thread_b':dict()} The fragments will not overlap each other, since they will be subdictionaries within the dictionary, though it would be possible that multiple threads do something like this at the same time: self.dic['thread_a'] = data_from_a() and self.dic['thread_b'] = data_from_b() I assume that this is not a problem, but since assuming something gives a lot of room for screw-ups I rather ask beforehand if I should except all kinds of troubles when multiple threads update 'at the same time' a dictionary or that I should lock the dictionary, for each update? Thanks for your insights. -- mph -- http://mail.python.org/mailman/listinfo/python-list
How to comment code?
Hi all, I've been toying with python for about two years now. Not every day, just when I encounter something in my job (sysadmin) repetitively dull. The amazing thing is that like any other language (natural or not) learning it more gives you power to express your thoughts better and create something from nothing, for me this is something I can only compare to freedom. However since I'm learning more of python I've struggled with commenting, how should I've comment my code? I'm not talking about the style but more on the concept itself, things that where a couple of month ago a bunch of monkey poop is now as easy as reading a comic. I always give a brief description on what the code is supposed to do and I suppose that any serious coder knows way more then me about programming so I don't bother to comment that much since it mostly (in my eyes) just clutters up the code and makes it actually harder to read. Though this makes me uncomfortably, commenting so little, I was thinking that perhaps something like doctest (I'm not so much into unit testing or the equivalents at this moment) has the side affect to make my code more understandable and readable. Any practical experience you'd like to share with me, any other comments are welcome too of course :-) Thanks. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Would a Dutch speaker please check this wiki page please?
Stef Mientki wrote: [EMAIL PROTECTED] wrote: Got a note about a new page on the Python Wiki: Wade == Wade McDaniel [EMAIL PROTECTED] writes: http://wiki.python.org/moin/Selcuk_Altun I suspect it's junk since it doesn't seem to mention Python and the website it mentions doesn't seem to exist. Still, just in case... The only (incorrect) Dutch sentence on the whole site is: Welkom op me site www.keriwar.nl, which should have been Welkom op mijn site www.keriwar.nl but that could be explained, while his name Selcuk Altun is not orginated from the Netherlands. I just expect that he is trying to setup a wiki, but that's too soon to give it a judgement. cheers, Stef Mientki Thx, Skip Could be Afrikaans too, but the page is gone now so I can't check. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Would a Dutch speaker please check this wiki page please?
Stef Mientki wrote: [EMAIL PROTECTED] wrote: Got a note about a new page on the Python Wiki: Wade == Wade McDaniel [EMAIL PROTECTED] writes: http://wiki.python.org/moin/Selcuk_Altun I suspect it's junk since it doesn't seem to mention Python and the website it mentions doesn't seem to exist. Still, just in case... The only (incorrect) Dutch sentence on the whole site is: Welkom op me site www.keriwar.nl, which should have been Welkom op mijn site www.keriwar.nl Well actually in the next sentence De site is online als je vragen hebt lees eerst te F.A.Q. is incorrect too, te F.A.Q. is grammatical and logical incorrect, should be de F.A.Q.. Indeed it's not Afrikaans but just incorrect use of Dutch and not related to python. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Adding a directory to the Python System Path - Edit the registry?
[EMAIL PROTECTED] wrote: I have been trying to find a way to add a directory to Python's sytem path on my MS Windows XP computer. I did some searching online, but the only solution I found involved editing the MS Windows Registry. That seemed a little to hard core. Is there another easier way to do this? Thanks, Scott Huey Take a look at: http://docs.python.org/tut/node8.html Specifically 6.1.1 and 6.2, perhaps that might answer your question. Cheers -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: find login name of user?
Uwe Hoffmann wrote: [EMAIL PROTECTED] schrieb: Is there a function/module to find the login name of the user under UNIX environment? http://docs.python.org/lib/os-procinfo.html http://docs.python.org/lib/module-pwd.html Speaking of that, is there any reason why there isn't any syntactic sugar that gives the illusion of platform neutral fetching of the user name? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: db access
king kikapu wrote: Hi to all, is there a way to use an RDBMS (in my case, SQL Server) from Python by using some built-in module of the language (v. 2.5) and through ODBC ?? I saw some samples that use statements like import dbi or import odbc but neither modules (dbi, odbc) are present on my system... Any hint(s) ?? Thanks in advance Hey there, Take a look at this: http://www.python.org/doc/topics/database/ Cheers, -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: db access
king kikapu wrote: Hey Martin, thanks for the fast reply! I have already seen that link and i just downloaded the pyodbc module but isn't Python already containing a built-in odbc module so to allow for db communication ?? cut Not that I'm aware of, but it is possible to do odbc with the win32 extensions which are commonly installed on windows machines, perhaps you've seen something like that? -- mph -- http://mail.python.org/mailman/listinfo/python-list
your opinion about psycopg vs pygresql
Hi all, I'm playing a bit with PostgreSQL, in which I've set me the target to create a python script which with user input creates a new user role and a database with that owner (connecting to template1 since I know that at least that db exists). Ok so I installed PostGreSQL and pygresql since it looked like that this is endorsed by PG, I had some trouble with the DB-API2 (complains about there is already a connection to template1, even when I closed and deleted the connector) so I solved it by using the pg api. But I was intrigued by this problem and started googling and by that time I've noticed that python projects like Django seem to favor the psycopg module. So I installed that one (the 1.1 version, since Django uses that too) and it looked like it has the same problem of creating a user after a database, I'm sure that there is a user error in there somewhere :-) However, given the choice, what in your opinion would be the reason why someone would chose one over the other? Now I know this could easily get into a flamewar, so if you comment (but please do so) I'll still investigate that, since at this moment I don't even have a clue how they differ and on what reason, why does PostgreSQL seem to favour pygresql and Pythoneers psycopg? Thanks in advance. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: perl better than python for users with disabilities?
Dan Jacobson wrote: Can I feel even better about using perl vs. python, as apparently python's dependence of formatting, indentation, etc. vs. perl's (){}; etc. makes writing python programs perhaps very device dependent. Whereas perl can be written on a tiny tiny screen, and can withstand all kinds of users with various disabilities, etc.? Also perl is easier to squeeze into makefiles. Quite punny title though I assume you are really serious and mean people with a physical disability, I won't comment any further on this subject :-), if I already offended anyone, please excuse me, since I'm original from Germany I'm not supposed to be funny. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: why would anyone use python when java is there?
Aahz wrote: In article [EMAIL PROTECTED], gavino [EMAIL PROTECTED] wrote: wtf Because programming in Python makes me feel happy and contented, while programming in Java just makes me want to scream in agony. Or in my case, Python made me code, Java made me brew java. ymmv -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Send to all clients using UDP in Twisted
Elliot Hughes wrote: Hi Everyone, I am trying to right a server that can receive a message and send it to all clients using UDP on twisted. I have got it so far that it can echo to the client that sent the message but not to the rest. I tried using multicast but that requires almost total rewrite, and the client which is not in python can't handle it. Are there any alternative methods or a workaround? Thanks alot for your time! Depends on you network topology and infrastructure, one possible option is that if the clients are on the same subnet you could send it to the broadcast address, however that wouldn't make your netadmin happy, if he didn't filter broadcast in the first place (many switches default filter that). -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: python under earthlink hosting?
mbstevens wrote: I keep chatting with the tech support people at Earthlink, asking where the location of the Python interpreter is. They don't seem to know where it is. They don't know if Python is running on my server, either. I know Perl is at /usr/local/bin/perl ...but when I use a similar address for Python I get a 500 internal server error. Has anyone succeeded in getting Python CGI scripts running on an earthlink hosted site? Maybe they didn't symlink it, try /usr/local/bin/python2.4 -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: sysadmin - python programmer
Dan Stromberg wrote: I've been a sysadmin for about 13 years, but I'm realizing that my favorite part of being a sysadmin are those moments where there's a reason to write some code - preferably in python. What might one do to make the transition from sysadmin to python programmer, aside from the basics like coming up with a python heavy resume and putting some python projects on the web? Thanks! Well not a programmer, but I learned that it works in every line of work: 'When you're capable to get from a cause and need to a solution, then whatever you do would be fruitful.' -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: ctypes wrapping libpam.so on FreeBSD 6.1 - Python Bus Error
Frederik Ganesan, Thanks for the explanation, it did me realize that I should learn some C first before I'm going to start wrapping something :-) At least I got a reason now to do something with C, though it should take me some time. But again, thanks! Martin -- http://mail.python.org/mailman/listinfo/python-list
ctypes wrapping libpam.so on FreeBSD 6.1 - Python Bus Error
Hey all, I'd like to wrap libpam so that I can use that for authentication and password management. I build ctypes (0.9.9.6) on my platform via ports. Now according to OpenPAM documentation all sessions start with pam_start(). According to the man page it should contain this: pam_start(const char *service, const char *user, const struct pam_conv *pam_conv, pam_handle_t **pamh) Where service in my case should be 'auth' and user 'martin' with pam_conv being 'PAM_PROMPT_ECHO_ON' for testing purposes (at least I assumed it works this way, but probably I'm doing something wrong, though I don't know what the correct way should be like). When I tried it, python dumps the core with a Bus Error, I also tried other combinations but it all ends in a Bus Error, any suggestion how I should proceed? I don't know much about PAM or C so any help is much appreciated. This (and other things) is what I've done: [EMAIL PROTECTED] /usr/home/martin]$ su Password: xinag# python Python 2.4.3 (#2, May 24 2006, 00:05:56) [GCC 3.4.4 [FreeBSD] 20050518] on freebsd6 Type help, copyright, credits or license for more information. from ctypes import * libpam = cdll.LoadLibrary('/usr/lib/libpam.so') libpam.pam_start('auth','martin','PAM_PROMPT_ECHO_ON') Bus error (core dumped) Thanks in advance, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.4 tutorial
subramanian2003 wrote: Hello All, From where I can get the detailed python 2.4 tutorial(other than python.org). Thanks, Subramanian. If you're willing to pay for it you can read many python books online at: http://safari.oreilly.com Although I like a paper version more (and most books are in my possession) but I still use it quite frequently. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Is there a python wrapper for OpenPAM?
Hi all, I'm busy with a personal project that does password synchronization between NT and BSD. By using a password hook/filter/notifier when password is changed (on NT PasswdHk and on BSD a modified version of pam_exec*) I can retrieve a changed password, however when I want to check the validation of the password or change it, I run into my limitations. On NT I can use the win32 extension to check and change the password. On BSD this is a bit of a problem, the PyPAM (a Linux package) is not compatible to OpenPAM (as used for example used in FreeBSD). At this moment I change the password by calling the passwd program and check the password by using my imaps service but I rather like to do it by accessing the pam libs itself. I checked out the dl function and I understand the syntax but I have no clue how I could implement a password change or check module with it (due to my limited knowledge of OpenPAM and the C programming language). Is there perhaps somebody who already created a wrapping for OpenPAM or has some pointers for me how I should proceed on this matter? On a side note, wouldn't it be a great module for python to have a platform independent authentication module that wraps these types of operations (password fetching, checking and changing) of the local system? -- mph * Yes I am well aware of the huge security risks on that matter ;-) -- http://mail.python.org/mailman/listinfo/python-list
Re: secure xmlrpc server?
Laszlo Nagy wrote: cut ssl for xmlrpc Have a look at: http://trevp.net/tlslite/ -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: secure xmlrpc server?
Laszlo Nagy wrote: Martin P. Hellwig wrote: Laszlo Nagy wrote: cut ssl for xmlrpc Have a look at: http://trevp.net/tlslite/ C:\temp\cccpython setup.py install running install running build running build_py running build_ext error: The .NET Framework SDK needs to be installed before building extensions f or Python. C:\temp\ccc In the installers directory is exe for windows installation. Does it mean that .NET framework is required for tlslite on Windows? Also can you please provide an example for tlslite/xmlrpc integration? The documentation of tlslite is very detailed, but it has many options and I could not find an example. SimpleXMLRPCServer uses SimpleHTTPServer for its transfer stuff, so you might want to look more in that direction. Thanks, Laszlo -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: secure xmlrpc server?
Laszlo Nagy wrote: cut http://trevp.net/tlslite/ - no exe installers. http://sourceforge.net/projects/tlslite/ - no file packages to download :-( Download the zip and unpack it: http://trevp.net/tlslite/tlslite-0.3.8.zip Then there is an installers directory SimpleXMLRPCServer uses SimpleHTTPServer for its transfer stuff, so you might want to look more in that direction. Yes, In fact I read the whole source code of SimpleXMLRPCServer and other examples like http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81549 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/165375 but I cannot combine the two. I see that the request handler is a customised HTTP request handler: class SimpleXMLRPCRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): but I have no idea how to use it with https. Do you know a small example (like the ones above)? That would help a lot. Laszlo Something like: import SocketServer import SimpleXMLRPCServer import tlslite.api # Overriding with ThreadingMixIn and TLSSocketServerMixIN # to create a secure async server. class txrServer(SocketServer.ThreadingMixIn, tlslite.api.TLSSocketServerMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer): pass But the above is untested (been a while ago, since I experimented with it, for my case it was more functional to use VPN's instead of SSL/TLS). For the rest you can follow the same principals as for the SimpleHTTPServer: http://trevp.net/cryptoID/docs/public/tlslite.integration.TLSSocketServerMixIn.TLSSocketServerMixIn-class.html -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: A critic of Guido's blog on Python's lambda
Bill Atkins wrote: cut How do you define scalability? http://www.google.com/search?hl=enq=define%3AscalabilitybtnG=Google+Search ;-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: A critic of Guido's blog on Python's lambda
Bill Atkins wrote: Martin P. Hellwig [EMAIL PROTECTED] writes: Bill Atkins wrote: cut How do you define scalability? http://www.google.com/search?hl=enq=define%3AscalabilitybtnG=Google+Search ;-) -- mph OK, my real question is: what features of Python make it scalable? Well I'm no expert, but I guess the ease of creating network services and clients make it quite scalable. For example, I'm creating a xmlrpcserver that returns a randomized cardlist, but I because of fail-over I needed some form of scalability , my solution was to first randomize the deck then marshal it and dump the file on a ZFS partition, giving back the client a ticket number, the client can then connect with the ticket number to receive the cardlist (read the file - unmarshal it). While this is overkill for 1 server, I needed multiple because of fail-over and load-balancing, in this case I have 3 'crypto' boxes (with hardware crypto engines using OpenBSD) doing only the randomizing and 4 solaris machines doing the zfs and distribution of the list. By using xmlrpc and DNS round-robin, I can just add boxes and it scales without any problem, The ZFS boxes are the front-end listening to the name 'shuffle' and are connecting to a private network to my crypto boxes listening to the name 'crypto'. So as long as I make DNS aliases (I have a little script that hearbeats the boxes and when not responding within 10 seconds removes it alias) and install the right scripts on the box I can scale till I'm round the earth. Of course when the machine amount gets over a certain degree I have to add some management functionality. Now I don't say that I handle this situation well and that its the right solution, but it worked for me and it was easy and fun to do with python, but I guess that any language in this sence should be 'scalable' and perhaps other languages have even better built-in networking libraries but I'm not a professional programmer and until I learn other languages (and are comfortable enough to use it) I'll keep on using python for my projects. For me python is easy, scalable, fun and by this the 'best' but that is personal and I simply don't know whether my opinion will change in the future or not. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: A critic of Guido's blog on Python's lambda
Paul Rubin wrote: Martin P. Hellwig [EMAIL PROTECTED] writes: and clients make it quite scalable. For example, I'm creating a xmlrpcserver that returns a randomized cardlist, but I because of fail-over I needed some form of scalability , my solution was to first randomize the deck then marshal it and dump the file on a ZFS partition, giving back the client a ticket number, the client can then connect with the ticket number to receive the cardlist (read the file - unmarshal it). This is a weird approach. Why not let the ticket by the (maybe encrypted) PRNG seed that generates the permutation? Because the server that handles the generate request doesn't need to be the same as the one that handles the request to give the client that deck. Even more, the server that handles the request calls the crypto servers to actually do the shuffling. So when the server fails before it has given the client the ticket, it could be possible that a deck is already created but not used, no biggie there. But if the ticket is given to the client, than any other server can serve back that ticket to give the shuffled deck, unless the ZFS dies of course but then again thats why I use ZFS so I can mirror them om 4 different machines in 2 different locations. While this is overkill for 1 server, I needed multiple because of fail-over and load-balancing, in this case I have 3 'crypto' boxes (with hardware crypto engines using OpenBSD) doing only the randomizing and 4 solaris machines doing the zfs and distribution of the list. I don't know what good that hardware crypto is doing you, if you're then writing out the shuffled deck to disk in the clear. It's not about access security it's more about the best possible randomness to shuffle the deck. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: A critic of Guido's blog on Python's lambda
Paul Rubin wrote: Martin P. Hellwig [EMAIL PROTECTED] writes: This is a weird approach. Why not let the ticket by the (maybe encrypted) PRNG seed that generates the permutation? Because the server that handles the generate request doesn't need to be the same as the one that handles the request to give the client that deck. Wait a sec, are you giving the entire shuffled deck to the client? Can you describe the application? I was imagining an online card game where clients are playing against each other. Letting any client see the full shuffle is disastrous. Nope I have a front end service that does the client bit, its about this (in this context, there are more services of course): crypto - ZFS - table servers - mirror dispatching - client xmlrpc access - client ( last one has not been written yet ) cut Depending on just what the server is for, access security may be a far more important issue. If I'm playing cards online with someone, I'd be WAY more concerned about the idea of my opponent being able to see my cards by breaking into the server, than his being able to cryptanalyze a well-designed PRNG based solely on its previous outputs. Only client xmlrpc access is (should be) accessible from the outside and since this server is user session based they only see their own card. However this project is still in it's early development, I'm doing now initial alpha-tests (and stress testing) and after this I'm going to let some audit bureau's check for security (probably Madison-Ghurka, but I haven't asked them yet). -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: This coding style bad practise?
bruno at modulix wrote: Martin P. Hellwig wrote: Bruno Desthuilliers wrote: cut Why not just use the call operator instead ? ie: id = IDGenerator(...) id() 01_20060424_151903_1 id() 01_20060424_151905_2 Because of: id = IDGenerator(01,99) id() Traceback (most recent call last): File pyshell#1, line 1, in ? id() TypeError: 'IDGenerator' object is not callable Of course - you have to overload the call operator for this to work. Just rename IDGenerator.__repr__ to IDGenerator.__call__, and I garantee this will work - and will be *much* more cleaner than abusing __repr__. Thanks! That was the thing I was looking for! -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: This coding style bad practise?
cut Thanks for the input folks! I adapted my script to the given suggestions and it's now far more 'logical', for reference I added it below. -- mph - script - import string import time class IDGenerator(object): (leading_id, subversion_length, tz) # tz = 'local' or 'gm' (default) Create an ID from a given string, a current datetimestamp and version number which wraps around at given subversion_length. Example usage: id = IDGenerator('01',2) id() '01_20060504_112304_1' id() '01_20060504_112306_2' id() '01_20060504_112307_1' id = IDGenerator(0005,99) # Note that an int will be cast to a string! id() '5_20060504_112324_01' id() '5_20060504_112327_02' id class '__main__.IDGenerator' previous ID is 5_20060504_112324_01 and current ID is 5_20060504_112327_02 def __init__(self,leading_id, subversion_length, timezone='gm'): self.id = str(leading_id) self.length = int(subversion_length) fill_length = len(str(self.length)) self.current = None self.previous = None def fill(number): return(string.zfill(number,fill_length)) self.fill = fill if timezone == 'local': self.timeset = time.localtime else: self.timeset = time.gmtime def __call__(self): # If the subversion length has been reached or the generator has not # been defined, (re)define it, otherwise return the next value of the # subversion. try: return_value = self.range_gen.next() except: self.range_gen = ( number for number in range(1,self.length+1) ) return_value = self.range_gen.next() # Create the version stamp. return_value = self.id +\ time.strftime(_%Y%m%d_%H%M%S_,self.timeset())+\ self.fill(return_value) # Copy the current ID to the previous and assign a new one to current. self.previous = self.current self.current = return_value # And return it. return(self.current) def __repr__(self): return(str(self.__class__) + ' previous ID is ' + str(self.previous) + ' and current ID is ' + str(self.current)) - script - -- http://mail.python.org/mailman/listinfo/python-list
Re: Can I use python for this .. ??
san wrote: Hi I am using windows xp and have installed python and win32. I am familiar with basic Python. I wanted to control some of the applications via python script. I would like to write a python script to say: 1. Open firefox and log on to gmail 2. Another firefox window to visit slickdeals 3. Open winamp and tune in to a shoutcast station 4. Open groupwise ... etc .. These are the task I do every day whenever I log on my computer .. it just seems repetitive and hence probably can be coded in python. Can I do this in python? Where do I find the COM objects/interfaces for all these different programs? Are there any sample codes ? Thanks. Santosh. What you want looks like a way to automate the windows gui using python. Since I never done this myself I gave google a try with this query: http://www.google.com/search?hl=enq=windows+gui+automation+pythonbtnG=Google+Search It looks like pywinauto seems to be a good candidate. hth -- mph -- http://mail.python.org/mailman/listinfo/python-list
This coding style bad practise?
Hi all, I created a class which creates a relative unique id string, now my program just works fine and as expected but somehow I get the feeling that I misused the __repr__ since I guess people expect to 'execute' a function in an instance instead of using it's representation string of the instance itself, could you elaborate whether you find this bad practice and if yes what would have been a better way to do it? TIA - script - import string import time class IDGenerator(object): (serverID,subversion_length) Create an ID from the server name, datetimestamp and version number. Calling the instance returns the ID using the __repr__ class function Example usage: id = idgen('01',4) id 01_20060424_151903_1 id 01_20060424_151905_2 id 01_20060424_151905_3 id 01_20060424_151906_4 id 01_20060424_151907_1 id = idgen(04,100) id 4_20060424_152043_001 def __init__(self,serverID,subversion_length): self.ID = str(serverID) self.length = int(subversion_length) fill_length = len(str(self.length)) def fill(number): return(string.zfill(number,fill_length)) self.fill = fill def __repr__(self): # If the subversion length has been reached or the generator has not # been defined, (re)define it, otherwise return the next value of the # subversion. try: return_value = self.range_gen.next() except: self.range_gen = ( number for number in range(1,self.length+1) ) return_value = self.range_gen.next() # Create the version stamp. return_value = self.ID +\ time.strftime(_%Y%m%d_%H%M%S_,time.gmtime())+\ self.fill(return_value) # And return it. return(return_value) - script - -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: This coding style bad practise?
Bruno Desthuilliers wrote: cut Why not just use the call operator instead ? ie: id = IDGenerator(...) id() 01_20060424_151903_1 id() 01_20060424_151905_2 Because of: id = IDGenerator(01,99) id() Traceback (most recent call last): File pyshell#1, line 1, in ? id() TypeError: 'IDGenerator' object is not callable But i do appreciate your comment, thanks! -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: This coding style bad practise?
keirr wrote: Martin P. Hellwig wrote: Hi all, I created a class which creates a relative unique id string, now my program just works fine and as expected but somehow I get the feeling that I misused the __repr__ since I guess people expect to 'execute' a function in an instance instead of using it's representation string of the instance itself, could you elaborate whether you find this bad practice and if yes what would have been a better way to do it? TIA Rather than comment on the style of using a class, I'll just suggest an alternative. You can use a generator function, which yields the next id when called; at least that's how I'd implement an IDgenerator. Cheers, Keir. Thanks for your comment, I do use a generator in my class because I wanted to wrap my subversion when its on its end I had a choice of looping in with an if check or using a generator with try except, this time I choose a generator, though mostly I directly use a generator for these type of functions. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: setting file permissions on a web server
John Salerno wrote: cut Most FTP servers do allow to use chmod in a ftp session, although you're client must support it. See for example a cli ftp client (and server) on FreeBSD. [EMAIL PROTECTED]:~$ ftp ftp.xs4all.nl Connected to ftp2.xs4all.nl. 220 XS4ALL ftpd DCLXVI Name (ftp.xs4all.nl:mhellwig): 331 Password required for mhellwig. Password: 230 User mhellwig logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp ls MHellwigCV_02_10_01.pdf 150 Opening ASCII mode data connection for file list -- 1 mhellwig user 211102 May 19 2003 MHellwigCV_02_10_01.pdf 226 Transfer complete. ftp chmod 400 MHellwigCV_02_10_01.pdf 200 SITE CHMOD command successful ftp ls MHellwigCV_02_10_01.pdf 150 Opening ASCII mode data connection for file list -r 1 mhellwig user 211102 May 19 2003 MHellwigCV_02_10_01.pdf 226 Transfer complete. ftp See? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: UDP performance
Paul Sijben wrote: I am stumped by the following problem. I have a large multi-threaded server accepting communications on one UDP port (chosen for its supposed speed). I have been profiling the code and found that the UDP communication is my biggest drain on performance! Communication where the client and the server are on the same machine still takes 300ms or sometimes much more per packet on an Athlon64 3000+ running Linux (Fedora Core 5 x64). I must be doing something wrong and would really appreciate feedback on my code below: I open the server port with self.s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.s.bind((myaddress, myport)) I then open a client port with self.s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.s.connect((host, port)) the client sends data with self.s.sendall(data) and the server with self.s.sendto(data,link.remoteaddress) both receive with buf, address = socket.recvfrom(8192) The sender and receiver are in separate threads (threading.Thread). Does anyone know what is going wrong here, the socket communication, the thread scheduling? Paul Sijben Is the connection 1:1 i.e. the receiving end receives data only from one sender at the time? And how do you handle lost packages in your application? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC server via xinetd
Jos Vos wrote: Hi, I'm trying to figure out how to implement a XML-RPC server that is called by xinetd i.s.o. listening on a TCP socket itself. I already have implemented a stand-alone XML-RPC server using SimpleXMLRPCServer, but I now want something similar, that is started via xinetd (i.e. reading/writing via stdin/stdout). Any hints or code examples? Thanks, Isn't this just a standard daemon functionality? So if you could wrap up your program in a daemon like fashion (e.g. http://homepage.hispeed.ch/py430/python/daemon.py) and then point the xinetd configuration to the right script, it should just work? Beware that I didn't try this myself yet ;-) though should do in the near future so if you could give a head ups on your progress I would appreciate it. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: XML-RPC server via xinetd
Jos Vos wrote: cut The problem is that the server initialization *requires* a server address (host, port pair), but I don't see how to tell it to use the stdin socket (and I'm afraid this is not possible, but I'm not sure). If I understood it correctly you want the python server bind be depending on whatever is configured in xinetd.conf and not be defined in the your program itself? I tested a bit around with my FreeBSD machine but indeed the OS environment gives me nothing interesting back, leaving that option out but I do can specify command line arguments so you could pick them up with sys.argv. I looked up how you can specify arguments in xinetd and according to various resources I filtered out (gotta over these gnu type documentation...) that you can use server_args in the per service configuration to specify arguments. Although not really elegant it is doable to do an on the fly port binding. Now I just hope I understood your problem :-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Python 2.5 licensing: stop this change
Fuzzyman wrote: cut From the site: Advanced Program for Research In Licensing, whose First Object-Oriented License string = Advanced Program for Research In Licensing, whose First Object-Oriented License for letter in string: if ord(letter) in range(65,91): print(letter), -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: To run a python script in all the machines from one server
[EMAIL PROTECTED] wrote: Hi Everyone I want to run a python script in all the machines that are connected through local network and collect the information about that machine such as HDD size, RAM capacity(with number of slots) ,processer speed etc. But i want to run a script from just the server, so that it should start scripts in all other machines, and get their local machines information and dump the same information in some FTP. Could you please let me know how can i do this?? Thanks Yogi You could create a xmlrpc server on all clients, that listens for such a request, then your server (which is an xmlrpc client) calls all the clients on the appropriate exposed function, then the client proceeds on gathering the required information and puts it using ftplib on the ftp share. It is also possible to return all info via the xmlrpc call and let the server do the ftp part, all depends on your requirements. If your on a NT only network a better route would be to use WMI. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: in-place string reversal
Sathyaish wrote: And that the extra-memory operation I've given above is expensive, I believe. Is there an efficient way to do it? If i recall correctly a string is an immutable list. I would do it this way: strTXT = foo strREV = strTXT[::-1] strREV 'oof' -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: don't understand popen2
Donn Cave wrote: cut Anyway, it seems unlikely he would get that INVARG error for this reason. That's an error from the host operating system, not the interpreter, and it mostly likely refers to the file descriptor. Since it works for me, I guess his problem is basically this: | (python 2.4 + win32 extensions on XPProSP2) Donn Cave, [EMAIL PROTECTED] Thank you for your suggestion. I shuffled it a bit around and executed it on my BSD box and there indeed it works, if I use that exactly program (well not the path var of course) on NT it has no error but it still not gives the expected results. So I guess that pipes,std-in, std-out std-err work that different on NT then on other POSIX systems. The lucky thing is that the code where I am exercising for must run on a BSD system so my immediately problem is dealt with, but I'm still curious how to get this working on NT. I posted my new code and the results under my sep. -- mph popen_test.py #! /usr/local/bin/python import popen2 std_out, std_in = popen2.popen2(F:\coding\pwSync\popen_test\testia.py) std_in.writelines(test\n) std_in.flush() std_in.close() x=std_out.readlines() print(x) - testia.py #! /usr/local/bin/python someline = raw_input(something:) if someline == 'test': print(yup) else: print(nope) - results on NT: F:\coding\pwSync\popen_testpopen_test.py [] results on BSD: %./popen_test.py ['something:yup\n'] % -- http://mail.python.org/mailman/listinfo/python-list
don't understand popen2
Hi all, I was doing some popen2 tests so that I'm more comfortable using it. I wrote a little python script to help me test that (testia.py): - someline = raw_input(something:) if someline == 'test': print(yup) else: print(nope) - And another little thing that does it's popen2 stuff: - import popen2 std_out, std_in = popen2.popen2(testia.py) x=std_out.readline() print(x) std_in.writelines(notgood) x=std_out.readline() print(x) - Now what I expected was that I got the return one the first line: something: and on the second nope, but instead of that I got: something: Traceback (most recent call last): File F:\coding\pwSync\popen_test\popen_test.py, line 8, in ? std_in.writelines(notgood) IOError: [Errno 22] Invalid argument I played around a bit with flush, write and the order of first writing and then reading, the best I can get is no error but still not the expected output. I googled a bit copied some examples that also worked on my machine, reread the manual and the only conclusion I have is that I don't even understand what I'm doing wrong. Would you please be so kind to explain my wrong doing? (python 2.4 + win32 extensions on XPProSP2) Thanks in advance! -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: don't understand popen2
gry@ll.mit.edu wrote: cut You gave it a single string, not a list(sequence) of strings. Try something like: std_in.writelines([notgood]) I got this output then: something: Traceback (most recent call last): File F:\coding\pwSync\popen_test\popen_test.py, line 8, in ? std_in.writelines([notgood]) IOError: [Errno 22] Invalid argument something: Traceback (most recent call last): File F:\coding\pwSync\popen_test\popen_test.py, line 8, in ? std_in.write(notgood) IOError: [Errno 22] Invalid argument It seems that it doesn't matter. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: How to recgonize an USB device in FreeBSD?
Geoffery wrote: I want to add some applications to Freevo. Let Freevo recgonize the USB device is the one. Thank u for your answer. Have a look at 'man 5 usbd.conf' -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 8 example of 'Function and method arguments'
cut Steven, Bruno, Terry Duncon, thank you for your insights, it really helped me a great deal. -- mph -- http://mail.python.org/mailman/listinfo/python-list
PEP 8 example of 'Function and method arguments'
While I was reading PEP 8 I came across this part: Function and method arguments Always use 'self' for the first argument to instance methods. Always use 'cls' for the first argument to class methods. Now I'm rather new to programming and unfamiliar to some basic concepts of OOP. However I wrote most of my classes in the new style way and by this I have always used 'self' for the first argument of an Instance method, but now I'm unsure what actually the difference is between an instance and a class method is and when to use it in which case. Could somebody please enlighten me (a rtfm/wrong newsgroup is just as welcome of course), preferably in a short code example? TIA -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Basic coin flipper program - logical error help
DannyB wrote: I'm just learning Python. So am I :-) I've created a simple coin flipper program - here is the code: [source] #Coin flipper import random heads = 0 tails = 0 counter = 0 coin = random.randrange(2) while (counter 100): if (coin == 0): heads += 1 counter += 1 else: tails += 1 counter += 1 coin = random.randrange(2) This line is you logic error because it's not part of your while loop the coin variables get the result of random.randrange(2) assigned only one time (before the loop). print \nThe coin landed on heads, heads, times. print \nThe coin landed on tails, tails, times. [/source] I'm sure the [source] tags don't work - I through them in there anyway. The program runs - however - it will give me 100 heads OR 100 tails. Can someone spot the logic error? Thanks ~Dan You could changed the program to this it works too and is just as readable (IMHO): #Coin flipper import random heads = 0 tails = 0 counter = 0 # removed random line while (counter 100): if random.randrange(2):# put random here heads += 1 counter += 1 else: tails += 1 counter += 1 # removed random line print \nThe coin landed on heads, heads, times. print \nThe coin landed on tails, tails, times. Take my advice with caution I'm also new to this :-) Btw, it is possible that the coins lands on it side if not catched with the hand (yes I have seen it happen) ;-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about xmlrpc and threading
David Hirschfield wrote: cut My question was whether this is allowed? Can two calls be made via the same ServerProxy instance while a request is already underway? Clearer? -Dave cut Much, and my preliminary answer is, I have no clue :-) But knowing that python will throw an exceptions when something is not allowed and that we can analyze if the logic of the program breaks we do can build a test case! I've taken the opportunity, but I might be as wrong was I am right (and still won't know which one it was): So, I expect that when something un-allowed happens it will throw an exception and otherwise that the workflow on the server should resemble the work flow on the client: So i created an async server with only one function (which is even worse then your question): def doSomething(self,threadID): randomWait= random.randrange(0,10) time.sleep(randomWait) print(Thread %s has slept for %s seconds % threadID,randomWait)) returnValue = Thread %s has slept for %s seconds % (threadID,randomWait) return returnValue and a threaded client: class testThread(threading.Thread): def run(self): xmlrpclib.server = xmlrpclib.ServerProxy(http://localhost:8080;) x=xmlrpclib.server print(x.doSomething(self.getName())) for i in range(100): testThread().start() So when I run that I except that the output on the server is the same as the one on the client with an error margin within the second range (which would indicate that a certain thread has been scheduled a little earlier then the other), guess what the output of the two was? Well I say this much, most of them where in sync (within the error margin) so I conclude that your question is answered with , yes you can have a call when another one is processed without intervening with each other( if you want that). -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Open Relay Test
D wrote: Nope, quite the contrary..I'm looking to write a simple program for a client of mine that will, among other things, verify that their clients' email servers do not have open relays. I usually test it like this: [EMAIL PROTECTED]:~ telnet mail.huygenslyceum.nl smtp Trying 172.16.64.12... Connected to mail.huygenslyceum.nl. Escape character is '^]'. 220 mail.huygenslyceum.nl ESMTP Sendmail 8.12.11/8.12.11; Fri, 17 Feb 2006 10:03:46 +0100 (CET) ~ helo 172.16.64.1 250 mail.huygenslyceum.nl Hello [172.16.64.1], pleased to meet you ~ mail from: [EMAIL PROTECTED] 250 2.1.0 [EMAIL PROTECTED] Sender ok ~ rcpt to: [EMAIL PROTECTED] 550 5.7.1 [EMAIL PROTECTED] Relaying denied. IP name lookup failed [172.16.64.1] To get a more verbose explanation, google for smtp + telnet. hth -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Question about xmlrpc and threading
David Hirschfield wrote: An xmlrpc client/server app I'm writing used to be super-simple, but now threading has gotten into the mix. On the server side, threads are used to process requests from a queue as they come in. On the client side, threads are used to wait on the results of requests to the server. So the question is: how thread-safe is python xmlrpc? If the client makes a request of the server by calling: result = server.doSomething() and while that is waiting in the background thread to complete, the client calls another: result = server.doSomethingElse() will they interfere with each other? Right now I'm avoiding this problem by queueing up calls to the server to be processed sequentially in the background. But I'd prefer to allow requests to go in parallel. Should I just make a new connection to the server for each request? Any advice appreciated, -David I'm not sure if I quite understand what you mean by interfere with each other but namespaces also apply to xmlrpc servers. But let's give a coding example say I have this async server created: === from SocketServer import ThreadingMixIn from SimpleXMLRPCServer import SimpleXMLRPCServer from time import sleep # Overriding with ThreadingMixIn to create a async server class txrServer(ThreadingMixIn,SimpleXMLRPCServer): pass # the Test classs class Test(object): def __init__(self): self.returnValue = Something 1 def doSomething(self): sleep(5) return self.returnValue def doSomethingElse(self,value): self.returnValue=value return self.returnValue # setup server and bind to the specified port server = txrServer(('localhost', 8080)) # register test class server.register_instance(Test()) # start the serving server.serve_forever() === And I call the function doSomething() and while it's waiting I call doSomethingElse(Else What!), doSomething() will return me:Else What! instead of Something 1 because it's a shared namespace of self. Now if I modify my example to this: === from SocketServer import ThreadingMixIn from SimpleXMLRPCServer import SimpleXMLRPCServer from time import sleep # Overriding with ThreadingMixIn to create a async server class txrServer(ThreadingMixIn,SimpleXMLRPCServer): pass # the Test classs class Test(object): def __init__(self): pass def doSomething(self): returnValue = Something 1 sleep(5) return returnValue def doSomethingElse(self,value): returnValue=value return returnValue # setup server and bind to the specified port server = txrServer(('localhost', 8080)) # register test class server.register_instance(Test()) # start the serving server.serve_forever() === doSomethingElse(Now what?) Will have no effect on returnValue of doSomething() because they are not shared. But say that I add the sleep part to doSomethingElse() and call doSomethingElse(First) and immediately after that on a other window doSomethingElse(other) What do you think will happen? Will the 2nd call overwrite the firsts calls variable? I'm not going to spoil it any further ;-), please try the snippets out for yourself (I bet you'll be pleasantly surprised). hth -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: how do you pronounce 'tuple'?
Roy Smith wrote: Erik Max Francis [EMAIL PROTECTED] wrote: (A 2-tuple is an ordered pair in mathematics.) If a 2-tuple is a pair, then it would seem to follow that a 1-tuple is a single. Yeah, but an *ordered* single :-) A more interesting question is what do you call ()? A none-tuple? empty? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: by reference
dirvine wrote: Yes I did I was trying to do something like (pseudo code) write: get files in path for each filename get size, type create dic called filename assign size:xx,type:y pickle to file read: open pickled file read dict name and contents (hoping unpickling file gives me the dict name as it was saved, which may not be true) do stuff with file and thats it. My prog is a bit more complex than this but this is the general idea basically read files - create dicts of files one at a time, very similar to bittorrent in that take a file smash to bits and store links to bits in a big file. Many thanls David Well, although I still think you should use nested dicts doesn't say that what you want isn't possible, take a look at this snippet: locals()['test']=dict() test {} It looks quite ugly too me but that is probably in the eye of the beholder. However even the faq has some info on that: http://www.python.org/doc/faq/programming.html#how-do-i-use-strings-to-call-functions-methods -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: hard disk activity
Paul Rubin wrote: VSmirk [EMAIL PROTECTED] writes: I am needing to synchronize the file on a remote folder, and my current solution, which simply copies the file if a date comparison or a content comparison, becomes a bit unmanageable for very large files. Some of the files I'm working with are hundreds of MB in size, or larger. Why don't you look at the rsync program: http://samba.anu.edu.au/rsync/ but for that much data, just plopping it all in a huge file is not a great approach if you can help it. Maybe you can use a database instead. Perhaps a cvs developer could also give some insight, you could check subversion's mailinglist (check their website for more info: http://subversion.tigris.org/) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: by reference
Rene Pijlman wrote: dirvine: I would like to create a dictionary based on a variable [...] And what seems to be the problem? I think that this is his problem: 'somename'={} SyntaxError: can't assign to literal But I'm puzzled why he wants that route, while I'm still pretty new to programming, I usually smell a design fault when I want to try to squeeze a literal name into a object variable (am I'm saying this correct?). Most of the time nesting dictionaries will do the trick for me: sharedDict=dict() sharedDict['somename']=dict() sharedDict['someothername']=dict() sharedDict {'somename': {}, 'someothername': {}} -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get Windows system information?
[EMAIL PROTECTED] wrote: thank you! from what I can see from the second website you listed, there is a way to get harddisk space information, but is there any way to get CPU load and RAM usage? Have a look at the snippet: # import wmi # t = wmi.WMI() # for i in t.Win32_PerfFormattedData_PerfOS_Memory(): # print(i) # #instance of Win32_PerfFormattedData_PerfOS_Memory #{ # AvailableBytes = 1683038208; # AvailableKBytes = 1643592; # AvailableMBytes = 1605; # CacheBytes = 89645056; # CacheBytesPeak = 358023168; # CacheFaultsPersec = 0; # CommitLimit = 4131782656; # CommittedBytes = 274153472; # DemandZeroFaultsPersec = 91522; # FreeSystemPageTableEntries = 150702; # PageFaultsPersec = 91522; # PageReadsPersec = 0; # PagesInputPersec = 0; # PagesOutputPersec = 0; # PagesPersec = 0; # PageWritesPersec = 0; # PercentCommittedBytesInUse = 6; # PoolNonpagedAllocs = 34580; # PoolNonpagedBytes = 19292160; # PoolPagedAllocs = 45037; # PoolPagedBytes = 28307456; # PoolPagedResidentBytes = 28053504; # SystemCacheResidentBytes = 59023360; # SystemCodeResidentBytes = 2568192; # SystemCodeTotalBytes = 942080; # SystemDriverResidentBytes = 0; # SystemDriverTotalBytes = 6234112; # TransitionFaultsPersec = 0; # WriteCopiesPersec = 0; #}; # # for i in t.Win32_PerfFormattedData_PerfOS_Processor(): # print(i) # # # #instance of Win32_PerfFormattedData_PerfOS_Processor #{ # C1TransitionsPersec = 0; # C2TransitionsPersec = 0; # C3TransitionsPersec = 65; # DPCRate = 0; # DPCsQueuedPersec = 0; # InterruptsPersec = 65; # Name = 0; # PercentC1Time = 0; # PercentC2Time = 0; # PercentC3Time = 95; # PercentDPCTime = 0; # PercentIdleTime = 100; # PercentInterruptTime = 0; # PercentPrivilegedTime = 0; # PercentProcessorTime = 0; # PercentUserTime = 0; #}; # # #instance of Win32_PerfFormattedData_PerfOS_Processor #{ # C1TransitionsPersec = 0; # C2TransitionsPersec = 0; # C3TransitionsPersec = 0; # DPCRate = 0; # DPCsQueuedPersec = 0; # InterruptsPersec = 65; # Name = _Total; # PercentC1Time = 0; # PercentC2Time = 0; # PercentC3Time = 0; # PercentDPCTime = 0; # PercentIdleTime = 0; # PercentInterruptTime = 0; # PercentPrivilegedTime = 0; # PercentProcessorTime = 0; # PercentUserTime = 0; #}; -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get Windows system information?
[EMAIL PROTECTED] wrote: Does anybody know how to get the: Free hard disk space Amount of CPU load and Amount of RAM used on windows? I am making an artificial intelligence program that has moods based on how much stress the system is under, based on these parameters. I think it could possibly be done via COM. I am not looking for a cross-platform solution- just something that will work on Windows. Thank you for your help! Have a look at WMI* , it's specifically designed to getthat kind of stuff, there is also a python layer for WMI**. * http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_reference.asp ** http://tgolden.sc.sabren.com/python/wmi.html hth -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Why it doesn't work?
Lad wrote: I have a list L={} Now I can assign the value L['a']=1 and I have L={'a': 1} but I would like to have a dictionary like this L={'a': {'b':2}} so I would expect I can do L['a']['b']=2 but it does not work. Why? Thank you for reply Rg, L. Hi, Perhaps what you try to do is something different than what I did here but it works for me: D={'a':{'b':''}} D['a']['b']=2 D {'a': {'b': 2}} -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: - E04 - Leadership! Google, Guido van Rossum, PSF
Anton Vredegoor wrote: cut description of modern western society Most people can survive (without damaging their souls so to speak) when working for corruption themselves in this way, but sooner or later one is asked to corrupt others (defending one's title during a promotion, leading a community and so on). This is the crucial point where corruption definitively occurs: where silence is not enough anymore to keep one employed. The human brain can withstand extreme amounts of conficting sensory data and still maintain a sense of continuity and order while from all sides things seem to fall apart. Such continuity is highly valuable because it is the only thing that keeps chaos at arms length. The same thing can be applied to whole societies (see for example the state American politics is in now). So that is the reason these kind of things normally are swept under the carpet. However for *me* personally, because I am deserted by my government, the university community, friends and family, and left to fend for myself, there is no pressing need to keep up the facade so I can finally see it for what it is. Modern life has modern problem, well that isn't quite true, the problems are actually the same since the moment organisms began to group to enlarge their chance of survival. The funny thing is that the problem, in its essentials, is still the same, how to enlarge the chance of survival, this time within the group. En zie daar (pardon my dutch) we have created hierarchy and within that the problem of the individuals identity versus the groups identity, mix it with diplomacy and unreal friendship (the ones that are based on a persons status) and you got enough material to create Hollywood and everything that comes from it. If you add take one for the group you got yourself an action movie. Now theory is all fine and dandy especially if its common sense but where does it leave us? Well most of the time, screwed, for the lack of a better word. But is it fair to negatively mark people because their personal identity for whatever reason fitted better to the common group identity? Sure it's bitter but don't be bitter about it, you know probably more then anybody else where that bitterness leads to. What we can do about it? I have no clue, I'll just use that frustration to work on a personal project or making a song on my guitar, but YMMV ;-). Perhaps being happy for somebody's else's luck is the key to ones own happiness, at least it works for me. Now luckily where on the Internet where anybody can be anybody or not if they like to, at least everybody got a chance (not an equal one but still) to show what they are worth of. Perhaps you could too? I wish you the best of wisdom and luck and I mean that most sincerely. cut rest -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Application architecture (long post - sorry)
Mike Meyer wrote: [EMAIL PROTECTED] writes: I have looked at the options for developing the client for these electronic job sheets and have decided upon Microsoft Pocket PC and the .net compact framework. It seems the easiest environment for developing and the PDA's can be obtained very cheaply as a package from a GSM/GPRS data carrier. That seems like overkill for this application. Problem 1 - Physical connectivity how would I make the actual network connection in to the server from the client Running a VPN connection over GPRS ? Connecting to the web on the client then using web services ? The physical connectivity isn't your worry. How you access it from software depends on your chosen platform. The above decisions probably depend on the answer to problem 2... How to connect to the data Or even simpler I could just export data for the engineers into XML or .csv files and expose them using a web server the client then just connects to the server and then downloads the job data , and uploads completed job information I've gone this route before, and this is why I say your .net solution looks like overkill. The phones that GSM providers *give away* have web browsers built into them, and it's been that way for years. No need for .net or Pocket PC or whatever on the mobile device - just get a web-enabled phone. This makes half the development trivial - you don't have to do *any* development on the mobile side of things. cut Somehow I immediately thought of the s60 platform, it even runs some form of python if you really need it to ;-) http://www.s60.com/ -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF
Ilias Lazaridis wrote: cut I'm suspecting that we have different definitions (or at least the implications of that) of used terms. I think it's important to first define these definition in a form acceptable to both of us. In the link you gave, the title was Efficiency Management. Now I believe that in _most_ implementations the words in the titles are mutual exclusive. So my first question is, please define Efficiency my second one is, please define Management. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF
Ilias Lazaridis wrote: Martin P. Hellwig wrote: Ilias Lazaridis wrote: cut I'm suspecting that we have different definitions (or at least the implications of that) of used terms. I think it's important to first define these definition in a form acceptable to both of us. In the link you gave, the title was Efficiency Management. Now I believe that in _most_ implementations the words in the titles are mutual exclusive. So my first question is, please define Efficiency my second one is, please define Management. * The terminology is not yet aligned to commonly used business or standards organisation terminology [like e.g. ISO]. * This will happen after the process definition has finalized. source: http://lazaridis.com/efficiency/process.html (V 0.8c - alpha) - I am a few steps from having the final diagramms ready, then I can align the terminology (e.g. asking for feedback, thus people can detect existent constructs and suggest terminology changes) I'll send you an email with some details (thus we don't discuss this off-topic in public). . Ilias Lazaridis wrote in email: Hi, just point me to a website you are related to (your personal one, your business one, ...) and I'll initialize the process, as defined in the draft-document: http://lazaridis.com/efficiency/textual.html - What I need at this point: - Website adress - your requirements constraints for my processing . Hey, I respond on your private mail and list in one and to both, I don't regard this as off-topic because it is still in regard of your OP, although that post can be seen as a bait to go OT. I didn't ask you for making an analyze, I asked you for your definitions because I think they are not the same as used in my contexts. Now definitions like the ones in the dictionary are all fine and such but it still doesn't say what the strings are, for example communication is a word used to describe the process of information transfer (by whatever means, could be smoke signals or drum sounds for my part). Information transfer is a broad term raising immediately the question: Transfer? . In what direction? The answer depends on the situation, if both parties are equal in terms of information authority, the transfer will resemble a dialog i.e. two way. If both parties are not on par in terms of information authority, the transfer will resemble a monolog i.e. one way. Now this is taken in the extremes, in reality there are usual more than 2 parties and the information authority can vary on the subject while the subjects are still related with each other (no wonder why there is so much miscommunication). An interesting note is that to describe the relation of communication I have to use another term, information authority, this term is IMHO very important and very difficult because you can not define this term in such a way that it's acceptable for all involving parties without being authoritative on that specific information piece. Unfortunately these kind of situations are all but rare just take a look at http://en.wikipedia.org/wiki/Bootstrap . Which leads to the interesting question, when is someone authoritative on information without the use of ipsedixitism. The answer is IMO actually quite simple: Never, your only authoritative if others accept you as being authoritative, of course this can be enforced by various means, like the use of hierarchy or religion. However more modern organization revert to the use of democracy (everybody has an equal vote) or play along (if you don't like, you are not enforced to stay, so accept it or beat it) because if you let people decide for them self who is authoritative for them it's easier for that authority to be accepted as such. Now I don't say that I'm right here and you are not, actually I'm still puzzled about what your intention of your original post was anyway. Thus what I said above should also apply to myself, so I do not have the authority by myself to say that I'm authoritative to say that I'm right and you are not, but what are your reasons to assume that you are authoritative over me? (This is a genuine question and not intended as rhetorical) So the sum it up my unanswered question to you so far are: - What is your definition of Efficiency - What is your definition of Management - What is you definition of Communication (to compare it with mine above) - What are your reasons that I should accept you as authoritative on the subject of Efficiency Management? - What has all that to do with Python except for that Guido is related to Google and Python? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF
Ilias Lazaridis wrote: Martin P. Hellwig wrote: Ilias Lazaridis wrote: cut So I guess you volunteer http://www.python.org/psf/volunteer.html ? I volunteer and contribute already (with a general validity and python specific analysis) A mediator should communicate the findings and suggestion (after verifying them) to the responsibles / community: http://lazaridis.com/efficiency/process.html#mediator This would include to pass the relevant ones to the list you've mentioned: http://www.python.org/psf/volunteer.html - TAG.efficiency.process.mediator Last time I checked a mediator otherwise known to me as a communication manager, is only effective when he/she is recognized as authoritative by the participating group _and_ him/herself. As from other posts I read that the last part is the issue, well since this is a voluntary bunch of people with a slightly social democratic architecture you fall back on spokesman and that can be anybody, including or perhaps even especially you. The only thing that holds you theoretically back is acknowledged authority by the participating group _and_ yourself and of course the resource for restricted information. For the first part you got my vote, for second, well that should grow in time. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF
Ilias Lazaridis wrote: cut The only thing that holds you theoretically back is acknowledged authority by the participating group _and_ yourself and of course the resource for restricted information. what do you mean by resource for restricted information? Well, I mean that you should know before the others that Guido is working for google otherwise such a publication is a bit late :-), nevertheless better late then never. For the first part you got my vote, for second, well that should grow in time. second part = resource for restricted information ? yup cut -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: [EVALUATION] - E04 - Leadership! Google, Guido van Rossum, PSF
Ilias Lazaridis wrote: cut So I guess you volunteer http://www.python.org/psf/volunteer.html ? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Guido at Google
rbt wrote: Alex Martelli wrote: I don't think there was any official announcement, but it's true -- he sits about 15 meters away from me;-). For Americans: 15 meters is roughly 50 feet. Well they could have used google for that ;-) http://www.google.com/search?hl=enq=15+meter+in+feetbtnG=Google+Search -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Xah's Edu Corner: Responsible Software Licensing
Xah Lee wrote: cut Nice rant, btw in most EU countries the software creator can not withdraw the responsibility of his/her/it creation, regardless of what the disclaimer says. The law is the leading authority and not some Disclaimer/EULA, that's why most US EULA's are unauthoritative in the EU. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Xah's Edu Corner: Responsible Software Licensing
Ulrich Hobelmann wrote: cut The piece that a European programmer can never withdraw responsibility could be a big problem to open-source software, though. I'm not sure I'd want to freely publish anything that could result in liability for me. Not that big of a problem, in EU a user is still primary liable for his own action unless he's deliberately been mislead without any possibility to know that, think in terms of trojans and viruses. So no suing over spilling hot coffee here unless the container it's carried in is faulty -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect character encoding
Mike Meyer wrote: Diez B. Roggisch [EMAIL PROTECTED] writes: Michal wrote: is there any way how to detect string encoding in Python? I need to proccess several files. Each of them could be encoded in different charset (iso-8859-2, cp1250, etc). I want to detect it, and encode it to utf-8 (with string function encode). But there is _no_ way to be absolutely sure. 8bit are 8bit, so each file is legal in all encodings. Not quite. Some encodings don't use all the valid 8-bit characters, so if you encounter a character not in an encoding, you can eliminate it from the list of possible encodings. This doesn't really help much by itself, though. mike I read or heard (can't remember the origin) that MS IE has a quite good implementation of guessing the language en character encoding of web pages when there not or falsely specified. From what I can remember is that they used an algorithm to create some statistics of the specific page and compared that with statistic about all kinds of languages and encodings and just mapped the most likely. Please be aware that I don't know if the above has even the slightest amount of truth in it, however it didn't prevent me from posting anyway ;-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Steven D'Aprano wrote: On Sat, 26 Nov 2005 21:39:13 +0100, Martin P. Hellwig wrote: The software was sold in 3 separates modules requiring a yearly renewal, The software is hardly sold if you have to renew that sale every year. That's more like a lease. I'd call it revenue from licencing, not revenue from sales. Of course you're welcome to describe it as sales. It is an arbitrary choice one way or another -- the main thing is to not talk at cross-purposes, as we obviously have been doing. I agree -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Steven D'Aprano wrote: On Thu, 24 Nov 2005 17:43:22 +0100, Martin P. Hellwig wrote: if I owned a company making profit on software sales (sale =! support) you sign a death wish for using GPL Apart from Microsoft, and possibly Quark (makers of Quark Express desktop packaging software), and perhaps a few console game developers, is there any company making a profit on software sales? Eehm, about hundreds of thousands customized software manufactures around the whole globe? Where not talking about off the shell software then of course, but for software used in a particular corner of a sector. Most prominent types are administration software, although most of them have a common base, implementation differs on your type of: products, customers, location, law, quality and quantity . Say about everything it can differ, ie you don't want to use your high-school student administration program for a pet shop or a cheese manufacture. -- ,ph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Steven D'Aprano wrote: cut I think you are over-estimating both the numbers and profitability of such niche software distributors, and misunderstanding the business models of them. Coincidently, I worked at a software company making a standard administration software for primary schools. Which concentrate on the national market. Because this in the Netherlands, not such a big country, the customer base is not that big. So on a population of 17 million people there are about 7.500 thousands primary schools, our market share was quit big we had 4.500 thousands customers, there where only about 7 other competitive products/companies in that market. The software was sold in 3 separates modules requiring a yearly renewal, the base module was required for all customers the other modules where add on packages, the base module cost about 500 EUR, then there where 2000 clients for 350 EUR module and about 500 clients for the third 250 module. They also sold administration software for the academic market with about the same annual income as that of the primary schools. So for a niche market on a small user base using non-consulting software, they had a quite profitable steady income. Perhaps not the billions of dollars you expect from a software company but for me and the 40 other employees it was enough to say that we didn't over-estimated both the numbers and profitability of such a niche software distributor and we sure didn't misunderstood the business model of that. Unfortunately the profitable company was merged by the VC's with 8 non-profitables companies because they had that this would make them all profitable. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Steven D'Aprano wrote: cut I'm FREE to use the software, FREE to redistribute it, FREE to give it away, FREE to make derivative works, FREE to transfer the licence, *and* I got it FREE of cost as well, but that doesn't make it free. Indeed, when I explain GPL to non-techies and what their (RMS) interpretation of free software is I usually ask first if they know what IP (Intellectual Property not Internet Protocol) is and what the difference is between that and other legals stuff like Copyright and Trademarks. Then I make sure we have the same definition about Software and what I mean with the word Public in the context of software. After that I define GPL as: Obligatory Public Intellectual Property Software If the non-techie is still interested, I'll rave on about that I understand why GPL is a good way to ensure availability of IP especially if the software is a collaborated effort in the academic scene. And that I probably use that if I made software for my employer (a Foundation founded by multiple High-Schools) but that deeply personal I'll stick to the beerware license, because I fully agree on PHK license vision. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Mike Meyer wrote: Martin P. Hellwig [EMAIL PROTECTED] writes: If the non-techie is still interested, I'll rave on about that I understand why GPL is a good way to ensure availability of IP especially if the software is a collaborated effort in the academic scene. Your comment about the GPL ensuring availability would imply that other-licensed software has a tendency to become unavailable. Do you know of any examples of such? mike Yes, it happens on a regular bases that *BSD's are ported to a particular platform or devices and that the necessary changes to make it work that way are not released back (eg Ironport mail systems). Other examples are extensions of other software to fill a particular need that are kept close for a binary only sale (eg Mammoth PostgreSQL + Replication). There are numerous other examples, most of them are company secrets. Note that I do not have any objections to it, if I owned a company making profit on software sales (sale =! support) you sign a death wish for using GPL, if it's coupled with a device then things are different. If you sell support, GPL is a wonderful way to maximize your income. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Mike Meyer wrote: cut Is that software really unavailable, or just unavailable for free? If the latter, then it's not unavailabe. If the former, the it didn't become unavailable, as it was never available in the first place. In the latter case, you could also use those examples to similarly prove that non-GPL'ed software is a good way to ensure the availability of IP, as the developers of those IPs obviously felt that the ability to restrict distribution in some way was needed to make the effort of developing and distributing the software in the first place worthwhile. I agree that your opinions are based on a valid points, however, not available for free means it has a price tag, which means that a normal 'small' price tag for western society excludes +75% of the world population for that product (sure most of them don't want/need it anyway, what good is software without hardware). Those who can not afford the software are excluded for that end product even though they may have worked on the source where 99,99% of the restricted licensed software is based on. However I make a poor defender for the GPL because, as you can read in my previous posts, I don't really believe in it. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython Licence vs GPL
Mike Meyer wrote: cut Well, they chose to make it available to others for reuse. But software unavailable to those who can't afford it is better than no software at all That I do not agree with, I think it depends on which your side of the fence you are. For instance I have a specific problem, there are currently 2 product available that come close to solving it, one costs $24,999 and the other is above that. That is about $23,999 above what I can afford to solve my problem, so I have the option to leave the problem as it is or try to tackle it myself. Stubborn that I am, I am currently creating my own solution, knowing well that other solutions exist and I can only make a poor copy of those already existing effort However I make a poor defender for the GPL because, as you can read in my previous posts, I don't really believe in it. The question is wether or not it believes in you :-) I believe in GPL'ed software - I use it regularly. On the other hand, I don't believe that it represents the best license to release software if the goal is to improve the lot of humanity. The restrictions are on distribution, not on use, so it doesn't really keep people from using said software commercially. For instance, one or more of your examples may have been worth developing for internal use. They then decided there was a profit to be made in distributing it commercially, and proceeded to do so because they could. Without the profit motive, they may not have done the extra work involved in preparing the IP for distribution and doing the distribution. Yeah well, GPL works reasonable well but perhaps not for what it was intended. Personally, I release stuff under a BSD-like license, historically having included requirements that I be notified of bug fixes, and/or that I be given copies of commercial software that included my code. I eventually gave up on them as unenforceable. Thats the trouble with restrictions, how do you enforce them, with license I don't found it worth the hazzle. BSD/MIT style license is a good substitute of no license at all. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: I need Motivation
[EMAIL PROTECTED] wrote: Martin P. Hellwig wrote: [EMAIL PROTECTED] wrote: I m not a python Expert or anythin i need help, i m losin my motivation to continue with python can anyone inspire me again.??? Ooh that is easy, start learning other programming languages, you'll go back continuing with python very soon after that! ;-) It seems that many people switch to Ruby and never look back, some other go to haskell as well. Yes that is also a possibility, however then the OP wouldn't wish to be motivated to continue pyhton :-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: I need Motivation
[EMAIL PROTECTED] wrote: I m not a python Expert or anythin i need help, i m losin my motivation to continue with python can anyone inspire me again.??? Ooh that is easy, start learning other programming languages, you'll go back continuing with python very soon after that! ;-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
Not Bill Gates wrote: [EMAIL PROTECTED] wrote... On Tue, 25 Oct 2005 15:35:47 +, Not Bill Gates wrote: Heck, I dunno. Like you, I don't even really care all that much. You don't care that innovation in desktop software has been crippled by the actions of the monopoly player Microsoft? You need to first prove innovation in desktop software has been crippled, don't you? How about their java implementation between 1998 and 2004? Sure killed the _easier_ write once run everywhere mantra, of course they where not alone in the killing, SUN helped a great deal. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
David Schwartz wrote: cut It's easy to point to things you think are mistakes and claim that if you had been in charge of the world, those mistakes would not have been made. If you are trying to balance completely different possible paths the universe might have taken, you need to make sure to include everything on both sides, and that's really really hard to do. Perhaps the desktop software is good enough that how much better it would have been wouldn't make much difference. And perhaps the lack of competition steered the innovators into other fields where their innovations made huge differences. Perhaps not -- perhaps the desktop software we would have had in a more competitive market would have made other people's lives majorly better. Who knows? I don't think it's possible or sensible to try to have a reckoning of this type. There are so many variables and unpredictable possibilities. DS I agree that it is hard, nearly impossible, to make the _one_ best decision in a situation. However it is quit possible to not make the very obvious wrong decision. Just that it is very hard to hit a specific tree with a small handgun from a 2 mile distant, that is nearly impossible. However, just avoiding your feet should be doable. BTW, I think you are management material... -- mph -- http://mail.python.org/mailman/listinfo/python-list
pyHook example.py brakes windows dead keys mechanisme
Hi all, I noticed that the dead keys* mechanism (XPSP2 NL, keyboard map US, input language Dutch) doesn't work when running the pyHooks (python 241) example. Instead of ö (o) I immediately get o. If I close the pyHooks example the expected behavior returns. Is there a way how I can get both working at the same time? -- mph * typing prints nothing the dead key, when continuing with o the character ö is printed, the same mechanimse applies for ' ~ ` in combination with most of the letters e.g. e(éëè), n(ñ), o(óõö) and c(ç). -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
Jeroen Wenting wrote: cut Without Microsoft 90% of us would never have seen a computer more powerful than a ZX-81 and 90% of the rest of us would never have used only dumb mainframe terminals. cut At the time you PC guys where hacking around monochrome green and a bit lighter green screens I was doing multi-media editing on my Amiga 600. So perhaps we should state that we would have been a lot further if not an incredible amount of cool technologies where bought by MS and then simply put in the freezer to protect their future market share. Although Commodore where never serious competitors, they had some intern difficulties, too bad but life goes on. To go on, stable version of truly free unix likes where released around 1994 that was in the same time MS was working on their super stable released windows 95 and a slightly better NT 3.5 and let me not forget OS/2 warp 3.0 . I'm not a MS basher, hey I make money of them administrating them, however to state that if we didn't had MS we would been in the IT stone ages is blatantly wrong, I think we would have been a lot further then where we are now. Perhaps we even had a other mainstream architecture like sparcs and powerpc's. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Microsoft Hatred FAQ
John Bokma wrote: cut You mean like the lamp that keeps burning forever, like Philips has? No more like all the hydrogen technologies that shell has in their possession for the last decades and only recently has begun to restart those projects. Although Commodore where never serious competitors, Because there programming skills were as worse as MS? I mean, their BASIC had only 2 instuctions: PEEK and POKE? eehm Amiga? cut Yet you call NT slightly better compared to Windows 95. So you have no clue what you're talking about. So I see you never worked serious with 3.5 . hey I make money of them administrating them, however to state that if we didn't had MS we would been in the IT stone ages is blatantly wrong, Now there is truth. I think we would have been a lot further No, since companies are just companies, not little gods like some want them to be. then where we are now. Perhaps we even had a other mainstream architecture like sparcs and powerpc's. But crippled like Intel. Yeah right sparc is crippled... -- http://mail.python.org/mailman/listinfo/python-list
Re: Daisy Daisy, give me your answer do
Michael Goettsche wrote: cut You're asking tech geekers and morons to do this job? Isn't that a task for somebody more professional like you? I think he's doing a shot to the position of open-source leader, judging on the replies he has got till so far, that shot was not really effective. In dutch we have a saying for these kind of people, it goes like this: 12 ambachten, 13 ongelukken. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Why do Pythoneers reinvent the wheel?
Stefano Masini wrote: cut reinventing wheel example Although I'm not experienced enough to comment on python stuff itself I do know that in general there are 2 reasons that people reinvent the wheel: - They didn't know of the existence of the first wheel - They have different roads Those reasons can even be combined. The more difficult it is to create a new wheel the bigger the chance is that you: - Search longer for fitting technologies - Adapt your road -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: determine if os.system() is done
Peter Hansen wrote: Martin P. Hellwig wrote: The only thing I am disappointed at his writing style, most likely he has a disrupted view on social acceptable behavior and communication. These skills might be still in development, so perhaps it is reasonable to give him a chance and wait until he is out of his puberty. He's 37 years old! How long should one be given to mature? Yeah well, eeh I guess that rules out the development part. Although puberty can take a long time (according to my SO) :-) -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: determine if os.system() is done
Lars Gustäbel wrote: [Fredrik Lundh] han har försökt, men hans tourette tog överhanden: IMHO it's more likely an Asperger's syndrome. http://en.wikipedia.org/wiki/Asperger_Syndrome I disagree, in his writings I found no evidence of autisme. Actually most of it can be classified as being stubborn against better knowledge, what actually a common thing is. But he does ask the question and by this does admits he is not knowledged in that topic. The only thing I am disappointed at his writing style, most likely he has a disrupted view on social acceptable behavior and communication. These skills might be still in development, so perhaps it is reasonable to give him a chance and wait until he is out of his puberty. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Should I move to Amsterdam?
Sybren Stuvel wrote: Martin P. Hellwig enlightened us with: Personal transportation sucks in the Netherlands, if you live in the Randstad (the area of the above mentioned cities) and you have to travel across the Randstad, you go with the bike and/or bus/tram/metro/train because that is the fastest way of transportation. And a bike isn't personal transportation? Yes it is, and it sucks too, or do you find it amusing to ride 15 clicks through rain and wind to get to your clients? Of course you go by car but then it will take you longer. Byt the way did you notice the travel across the Randstad part? By the way, the big cities are notorious for losing your bike fast. True. Unless you have two proper locks. In that case your bike will last a very long time. Yes that reminds me that I had 2 quite expensive abus locks on my rather cheap bike, the day after a hack was published on the Internet how to open this lock without damaging, the locks where stolen but my bike was further untouched, that pretty badly hurt my bikes ego I guess. That doesn't mean that public transportation is good, no actual since the public transportation is commercialized it sucks too. It's quite good actually. The Dutch Railways (Nationale Spoorwegen, NS for short) have a reputation of being late, but it isn't that bad. Trains run frequently, and if you have a serious delay, you even get part of your money back. They don't do it because they like the customer they do it because it's a law. My GF and I just got back from a holiday in Croatia. There, there is only a train every four hours, and then you're lucky. The track is so Croatia is hardley comparible to western europe. bad, going by bus is just as fast, except you can buy a ticket on the bus instead of having to buy a ticket + reservation in advance. On the way back, we used the ICE (intercity express) through Germany. It got delayed, so we missed our train to Amsterdam by 15 minutes. The Aah yes, ICE, always put in a extra half hour if you need to change trains, you don't wat to miss reserved trains, no realy you don't want to. It is just the same as with airplanes. delay was in Köln, because the pope paid a visit - well known to the Deutsche Bahn, but still they didn't do anything about it. We had to use another train which left two hours later. And we didn't get any compensation for this - not even for the reservation for the train we missed. Same as with airplanes. We had a delay of two hours. In The Netherlands you would at least get a significant percentage of your money back. Not in Germany. Strange, I very frequently go with rail like transportation across western europe and the only place where it sucks more then in the Netherlands is the UK or France when they doing another strike. I do not account major accidents like flooding, storm or earthquakes. After all, I think with the frequent trains (compared to Croatia) and reasonable refunds (compared to Germany), the NS isn't that bad after all. Comparing it to Belgium, France, Luxembourg, Germany, Spain, Norway, Swizz etc.etc. okay, but comparing it with a former Communistic country? They still have about 45 years of catching up to do and to there credits they develop much faster then the old western countries. I heard that in Swizz public transportation tend to leave on time and even arrive on time! Compare that with 12% delayed leaving and 27% delayed arrivals of trains in the Netherlands. A rule of thumb is that as soon as the weathere changes (it doesn't matter what from what and where too) you have at least a 15 minute delay between the major stations. Just don't plan to get anywhere special with public transportation after 2300h. There are night trains between the big cities in the Randstad. At least in Amsterdam busses go through the city all the night, every night. I don't know about other cities - I live in Amsterdam. There still alot of people living in cities like Gouda or surrounding villages in Het Groene Hart, and most of them can only get home after 23.00h when they go by car (or motorbike). cut Most people in here are non-believers or so lightly believers that you won't know the difference between them and the non-believers. The biggest part of the remaining believers are realistic and value life, moral and norms without compromising public safety, of course fanatics are every where in the world including the Netherlands. Here in Amsterdam, things are getting more nasty. A writer/critic/actor was killed in the name of Allah, just because he excercised his freedom of speech. Another man was seriously messed up while standing in his own front door opening, just because he's homosexual. In his street, sometimes people are shouting Go away you homo, you're not welcome here. This is a Macoccan street!. I'm not discriminating, but Maroccans telling Dutch people they aren't welcome in their own captial
Re: Should I move to Amsterdam?
Wade wrote: http://www.slate.com/id/2124561/entry/2124562/ Nice little series by Seth Stevenson for Americans daydreaming about emigration. Somewhere, anywhere ... maybe Amsterdam? I've never been to the Netherlands myself, but it sounds very civilized. Extra Python connection, besides the obvious one: Is gezellig related to the Zen of Python? ( http://wordcraft.infopop.cc/eve/ubb.x/a/tpc/f/6351024471/m/2041067571/r/3901049571 ) -- Wade Leftwich Ithaca, NY Well I dunno, I was born in Germany moved to the Netherlands and been quit around in the country. Personally I don't like city life, however from where I live I am within the hour in the center of Rotterdam, Den Haag, Utrecht, if you add half an hour I'm at the heart of Amsterdam. While coming back at home at a small but flourishing village. Of course this is all done with public transport and/or bike, not without reason. Personal transportation sucks in the Netherlands, if you live in the Randstad (the area of the above mentioned cities) and you have to travel across the Randstad, you go with the bike and/or bus/tram/metro/train because that is the fastest way of transportation. By the way, the big cities are notorious for losing your bike fast. That doesn't mean that public transportation is good, no actual since the public transportation is commercialized it sucks too. But it beats the hell out of being in the traffic jam every day for at least an hour wherever you want to go, not entirely true, between 11.00-15.00 and 21.00-05.00 then it's clear enough to switch lanes. Just don't plan to get anywhere special with public transportation after 2300h. Still you might want to go earlier if you go by car, perhaps then you can find that one parking spot close enough to your destination that you don't need to take the bus/tram/metro after all to finish the last 5 miles. Well politics, in the Netherlands is like politics in the rest of Western-Europe North-Atlantic-coast countries, excluding UK Ireland. Most of the time these politicians are social caring about everybody in the country including non-voters, non-payers and fanatic-believers of-whatever-you-can-imagine. Although that social caring is mostly out of a dark personal agenda or plain dumbness. In the Netherlands even the most right-winged (of any mattering size) parties are still liberal socialist in the US viewpoint. Somehow I think that if you want to become a politician you have to be able to shutdown at least 75% percent of you brain while making decisions and reactivate them when you have to find an excuse for the misstep, well at least the last part is true for the Netherlands, from what I see of US politics even that is not a requirement. In the Netherlands we still have (but watering away) tradition that people are responsible for their own deeds and do not sue some unrelated company when spilling hot coffee or microwaving your puppy or washing you baby in the wash machine. Most people in here are non-believers or so lightly believers that you won't know the difference between them and the non-believers. The biggest part of the remaining believers are realistic and value life, moral and norms without compromising public safety, of course fanatics are every where in the world including the Netherlands. We had some very difficult years but the economics is picking up again and because we made some serious budget cuts in social security and public health it is on a more stable bases then that of Germany and France. The only serious downsize is that in the Randstad the house prices are too high, the only way you can buy a reasonable row house house (3 bedrooms, average room = 4x3 meters) in a not too bad side of the city is when you and you partner work full time and are not planning to raise your kid(s) all by your self. Still I don't want to live anywhere else, Holland is big enough to find some country side with a slower pace of living (but still having adsl), if you prefer that like me. And with a bit of searching you can build up a social and work environment not filled with shallow and/or dumbed down people. All of the above is of course my viewpoint YMMV. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: What is Python?!
Magnus Lycka wrote: cut or what have you. How do you sell this without making it sound like snake oil? (Particularly with that name! :) cut JediMindTrick This *is* the languange you are looking for ... /JediMindTrick Stops the argument every time, although afterwards they look kind a funny at me. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Python -- (just) a successful experiment?
Kay Schluehr wrote: Eric Pederson wrote: Raise your hand if you think the best technology wins! Who is interested in such a matter? Is this a forum dedicated to some programming language or a popularity contest? If Python dies in a few years / looses attention but the Python Zen survives in another language I have nothing to complain. cut Ave! Although I think that the day that python is considerd dead is the same day that unix is truly dead. Ooh yes and I have heard for over two decades that unix-like systems are obsolete, so why is the install base only growing and has never been bigger? -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: The ONLY thing that prevents me from using Python
Kevin wrote: cut, can't get as many python web hosters as I want Well, for some strange reason I have never found that to be a problem. But that is perhaps because I'm an administrator and I want full root access, install the OS as I see fit and don't want others on the same (virtual)box. So hosting doesn't work for me I need colo or dedicated. Mostly I slap DragonFlyBSD( or NetBSD if the other doesn't run smoothly) with PostgreSQL, Mod_python/Apache and some other handy tools like tripwire. The advantage is that I am the administrator, the dis-advantage is that I am the administrator :-). Here in the Netherlands I can get 1HE colo for 95EUR/month, a reasonable price IMO. You can always rent space at different providers (for fail-over) install the machines just as your like it and rerent your own shared web hosting. Then you can have all the goodies you want and still be in the price range of comparible hosters. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: The ONLY thing that prevents me from using Python
Magnus Lycka wrote: Martin P. Hellwig wrote: Kevin wrote: cut, can't get as many python web hosters as I want Well, for some strange reason I have never found that to be a problem. If you develop software for an external customer, and they have an existing web site run by some ISP that you have no control over, this might well be a problem. Yes indeed there are a *load of companies not interested in technology they just want a fancier web page then their rivals, for them this is definitely a problem well actually it's a problem for the developer. Do you tell the client to do it your way or do you do it their way. It all depends, I work in and for non-profit organization so I mostly I can do what I think is the best solution. I'll explain that and what the advantage or dis-advantage is of all different possibilities. Even if the customer is in control of their web servers, it might be difficult to convince them to install and maintain something like Python on them. I find it a bit surprising that so many people on comp.lang.python don't realize what kind of practical complications most commercial software developers have to struggle with if they don't just follow the mainstream and use PHP or Java for all web apps. Yeah well, I remember that I had a hard time getting java support instead of cgi alone, then somewhat later I've had that with perl and PHP and whatever, it always feels like playing catch up. I really had it with all that begging to get this or that supported. I've been bitten so many times over support issues that it isn't even funny anymore, so in the end I realized that the only way to get it down in a acceptable way is to do it myself or source it to a small company that needs the customer. My ISP (FS Data in Sweden) has Python installed, and always upgraded it when I asked them (but only then, so I suspect I'm the only user-- and this is one of the biggest ISPs in Sweden). As I said above, I found it more likely to get support from smaller companies then the bigger ones. Even if I have access to Python, they don't allow me to have my own long running processes, so I'm stuck with CGI, which wouldn't work very well with a much higher load than my moin has. (Actually, I didn't really need more, so I haven't asked for mod_python support etc.) Colocation is certainly getting much cheaper, my ISP charges much less than 95EUR/month.(295 SEK). Still, it would certainly be great if mod_python, twisted and zope support etc would be as common as mod_perl or PHP support. We can only get that if we actively ask for it, and if we really favour vendors that provide this support when we can. But overall I must say the I agree with you, and that this chicken/egg problem can only be resolved by further popularity of python. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure email
[EMAIL PROTECTED] wrote: I need to write a .cgi that will take the content of an https GET or POST and send it securely as email to an Outlook client. I think that OpenSSL is somewhere in this, but I'm not even sure how to create the right certificate, how to use it to encrypt mail and how to install a certificate in Outlook (= 2000). Code snippets and pointers to tutorials greatly appreciated. I've got a week to deploy this! I think you want this more common approach for mail encryption: server: https CGI form -- mail wrapper -- PGP encryption/signing -- send client: recieve mail -- pgp decryption/verification -- read All parts are trivial except for pgp but you could get more information at http://www.openpgp.org/ -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: pain
Mage wrote: cut Thank you, I will check this out. My company will switch to a jsp site. cut Well I don't know your company and how many developers there are but I know this; a manager telling me what tools to use to do my job is a bad manager by definition because he should realize that the people who best know what tools to use are the peope who use the tools*. If by any chance a manager believes that his employees aren't qualified to make that decision for them self then he hired the wrong people, which makes him bad manager too. But perhaps there are other compelling reasons to switch to a jsp site, but since this is webbased, there are *tons* of ways to mix your favourite language with it, even as abstracted as having a jsp (proxy) page do nothing more then fetch its page from a python powered internal webserver. -- mph * Did you know that most good chef cooks have their own knive set? And what do you think is the reason a restaurant manager don't tell them to use the company in-house Amefa blades instead of his global knives? -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure email
Michael Ströder wrote: Martin P. Hellwig wrote: I think you want this more common approach for mail encryption: server: https CGI form -- mail wrapper -- PGP encryption/signing -- send client: recieve mail -- pgp decryption/verification -- read This would require an additional PGP-plugin for Outlook. Outlook can decrypt S/MIME messages out-of-the-box. Ciao, Michael. Yes indeed, although I personaly find pgp a bit more elegant your solution would be the best for the OP. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Secure email
Michael Ströder wrote: cut This would require an additional PGP-plugin for Outlook. Outlook can decrypt S/MIME messages out-of-the-box. Yes indeed, although I personaly find pgp a bit more elegant your solution would be the best for the OP. cut Whether S/MIME or PGP is used depends very much on the security policy the application has to comply with and the rest of the system environment we both know very little about. Therefore I can't see what's more elegant with PGP in general and how you can tell what the best solution is for the original poster. cut Not general, personal in the sence of my own opinion just like I have it wrote it. Best for the OP because as you pointed out there was a written (although older) howto for s/mime which the OP could follow (as he requested), howto's for PGP icw Python is a bit rare, although I haven't googled for long. -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Friend wants to learn python
EnderLocke wrote: I have a friend who wants to learn python programming. I learned off the internet and have never used a book to learn it. What books do you recommend? Any suggestions would be appreciated. I recommend Learning Python 2nd Edition by Mark Lutz David Ascher (O'Reilly) its reasonable easy to read no heavy language, but clear concept and examples. It does not require any previous programming experience, although being comfortable with computer terms and knowing some basic concepts of programming does make you read faster through the book. My overall conclusion was that the authors know what they are talking about and are honest in what they want to achieve. When done with that the reader has enough experience to at least know where to go further to learn more about python. -- mph -- http://mail.python.org/mailman/listinfo/python-list