Re: Python 2.5 incompatible with Fedora Core 6 - packaging problems again

2007-03-04 Thread Patrick Useldinger
http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/ -- http://mail.python.org/mailman/listinfo/python-list

Re: setuid root

2006-08-24 Thread Patrick Useldinger
Tiago Simões Batista wrote: > The sysadmin already set the setuid bit on the script, but it > still fails when it tries to write to any file that only root has > write access to. use sudo. -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] why cd ripping on Linux is so slow

2006-08-12 Thread Patrick Useldinger
alf wrote: > Hi, > > I try to ip some music CD and later convert it into mp3 for my mp3 > player, but can not get around one problem. ripping from Linux is > extremely slow like 0.5x of CD speed. > > In contrary, on M$ Windows it takes like a few minutes to have CD ripped > and compresses int

filtering DNS proxy

2006-01-14 Thread Patrick Useldinger
Hi all, I am looking to write a filtering DNS proxy which should - receive DNS queries - validate them again an ACL which looks as follows: { 'ip1':['name1','name2',...], 'ip2':['name1','name3'], ... } - if the request is valid (ie. if the sending IP address is allowed to ask for t

Re: Which is easier? Translating from C++ or from Java...

2005-03-29 Thread Patrick Useldinger
cjl wrote: I've found a third open source implementation in pascal (delphi), and was wondering how well that would translate to python? Being old enough to have programmed in UCSD Pascal on an Apple ][ (with a language card, of course), I'd say: go for Pascal! ;-) -- http://mail.python.org/mailma

Re: Which is easier? Translating from C++ or from Java...

2005-03-29 Thread Patrick Useldinger
[EMAIL PROTECTED] wrote: Patrick Useldinger wrote: Depends on what language you know best. But Java is certainly easier to read than C++. There's certainly some irony in those last two sentences. However, I agree with the former. It depends on which you know better, the style of thos

Re: Which is easier? Translating from C++ or from Java...

2005-03-28 Thread Patrick Useldinger
cjl wrote: Implementations of what I'm trying to accomplish are available (open source) in C++ and in Java. Which would be easier for me to use as a reference? I'm not looking for automated tools, just trying to gather opinions on which language is easier to understand / rewrite as python. Depends

Re: numbering variables

2005-03-28 Thread Patrick Useldinger
remi wrote: Hello, I have got a list like : mylist = ['item 1', 'item 2','item n'] and I would like to store the string 'item1' in a variable called s_1, 'item2' in s_2,...,'item i' in 's_i',... The lenght of mylist is finite ;-) Any ideas ? Thanks a lot. Rémi. Use a dictionary: variable['s_1

Re: how to add a string to the beginning of a large binary file?

2005-03-27 Thread Patrick Useldinger
could ildg wrote: I want to add a string such as "I love you" to the beginning of a binary file, How to? and how to delete the string if I want to get the original file? You shouldn't use Python to write a virus :-) -pu -- http://mail.python.org/mailman/listinfo/python-list

[ann] fdups 0.15

2005-03-20 Thread Patrick Useldinger
I am happy to announce version 0.15 of fdups. Changes in this version: - ability to limit the number of file handles used Download = To download, go to: http://www.homepages.lu/pu/fdups.html What is fdups? == fdups is a Python program to detect duplicate

Re: How to create an object instance from a string??

2005-03-19 Thread Patrick Useldinger
Tian wrote: I have a string: classname = "Dog" It's easier without strings: >>> classname = Dog >>> classname().bark() Arf!!! >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: a program to delete duplicate files

2005-03-14 Thread Patrick Useldinger
David Eppstein wrote: The hard part is verifying that the files that look like duplicates really are duplicates. To do so, for a group of m files that appear to be the same, requires 2(m-1) reads through the whole files if you use a comparison based method, or m reads if you use a strong hashin

Re: a program to delete duplicate files

2005-03-14 Thread Patrick Useldinger
David Eppstein wrote: When I've been talking about hashes, I've been assuming very strong cryptographic hashes, good enough that you can trust equal results to really be equal without having to verify by a comparison. I am not an expert in this field. All I know is that MD5 and SHA1 can create c

Re: a program to delete duplicate files

2005-03-13 Thread Patrick Useldinger
John Machin wrote: Test: !for k in range(1000): !open('foo' + str(k), 'w') I ran that and watched it open 2 million files and going strong ... until I figured that files are closed by Python immediately because there's no reference to them ;-) Here's my code: #!/usr/bin/env python import os

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote: Oh yeah, "the computer said so, it must be correct". Even with your algorithm, I would be investigating cases where files were duplicates but there was nothing in the names or paths that suggested how that might have come about. Of course, but it's good to know that the computer

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote: Maybe I was wrong: lawyers are noted for irritating precision. You meant to say in your own defence: "If there are *any* number (n >= 2) of identical hashes, you'd still need to *RE*-read and *compare* ...". Right, that is what I meant. 2. As others have explained, with a decent

Re: Can't seem to insert rows into a MySQL table

2005-03-12 Thread Patrick Useldinger
grumfish wrote: connection = MySQLdb.connect(host="localhost", user="root", passwd="pw", db="japanese") cursor = connection.cursor() cursor.execute("INSERT INTO edict (kanji, kana, meaning) VALUES (%s, %s, %s)", ("a", "b", "c") ) connection.close() Just a guess "in the dark" (I don't use MySQL):

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
François Pinard wrote: Identical hashes for different files? The probability of this happening should be extremely small, or else, your hash function is not a good one. We're talking about md5, sha1 or similar. They are all known not to be 100% perfect. I agree it's a rare case, but still, why se

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
Scott David Daniels wrote: comparisons. Using hashes, three file reads and three comparisons of hash values. Without hashes, six file reads; you must read both files to do a file comparison, so three comparisons is six files. That's provided you compare always 2 files at a time. I compar

Re: Adapting code to multiple platforms

2005-03-12 Thread Patrick Useldinger
Jeffrey Barish wrote: I have a small program that I would like to run on multiple platforms (at least linux and windows). My program calls helper programs that are different depending on the platform. I think I figured out a way to structure my program, but I'm wondering whether my solution is go

Re: a program to delete duplicate files

2005-03-12 Thread Patrick Useldinger
John Machin wrote: Just look at the efficiency of processing N files of the same size S, where they differ after d bytes: [If they don't differ, d = S] PU: O(Nd) reading time, O(Nd) data comparison time [Actually (N-1)d which is important for small N and large d]. Hashing method: O(NS) reading time

Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
David Eppstein wrote: Well, but the spec didn't say efficiency was the primary criterion, it said minimizing the number of comparisons was. That's exactly what my program does. More seriously, the best I can think of that doesn't use a strong slow hash would be to group files by (file size, cheap

Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux). Changed. -- http://mail.python.org/mailman/listinfo/python-list

Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
David Eppstein wrote: You need do no comparisons between files. Just use a sufficiently strong hash algorithm (SHA-256 maybe?) and compare the hashes. That's not very efficient. IMO, it only makes sense in network-based operations such as rsync. -pu -- http://mail.python.org/mailman/listinfo/py

Re: [perl-python] a program to delete duplicate files

2005-03-11 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: The relevant parts from this last page: st_dev <-> dwVolumeSerialNumber st_ino <-> (nFileIndexHigh, nFileIndexLow) I see. But if I am not mistaken, that would mean that I (1) had to detect NTFS volumes (2) use non-standard libraries to find these information (like

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: That's fast and good. Nice to hear. A minor nit-pick: `fdups.py -r .` does nothing (at least on Linux). I'll look into that. Have you found any way to test if two files on NTFS are hard linked without opening them first to get a file handle? No. And even then, I wo

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
Christos TZOTZIOY Georgiou wrote: On POSIX filesystems, one has also to avoid comparing files having same (st_dev, st_inum), because you know that they are the same file. I then have a bug here - I consider all files with the same inode equal, but according to what you say I need to consider the

Re: [perl-python] a program to delete duplicate files

2005-03-10 Thread Patrick Useldinger
I wrote something similar, have a look at http://www.homepages.lu/pu/fdups.html. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python docs [was: function with a state]

2005-03-10 Thread Patrick Useldinger
You don't understand the "global" statement in Python, but you do understand Software industry in general? Smart... -- http://mail.python.org/mailman/listinfo/python-list

Re: function with a state

2005-03-06 Thread Patrick Useldinger
Kent Johnson wrote: globe=0 globe=myfun(globe) def myFun(var): return var+1 This mystifies me. What is myfun()? What is var intended to be? myfun is an error ;-) should be myFun, of course. var is parameter of function myFun. If you call myFun with variable globe, all references to var will be

Re: function with a state

2005-03-06 Thread Patrick Useldinger
Xah Lee wrote: globe=0; def myFun(): globe=globe+1 return globe The short answer is to use the global statement: globe=0 def myFun(): global globe globe=globe+1 return globe more elegant is: globe=0 globe=myfun(globe) def myFun(var): return var+1 and still more elegant is using classes

Re: enum question

2005-03-05 Thread Patrick Useldinger
M.N.A.Smadi wrote: does python support a C-like enum statement where one can define a variable with prespesified range of values? thanks m.smadi >>> BLUE, RED, GREEN = 1,5,8 >>> BLUE 1 >>> RED 5 >>> GREEN 8 -- http://mail.python.org/mailman/listinfo/python-list

Re: Indexing strings

2005-03-05 Thread Patrick Useldinger
Fred wrote: That was exactely what I was searching for. I needed a program, that chopped up a string into its words and then saves them into a list. I think I got this done... There's a function for that: text.split(). You should really have a look at the Python docs. Also, http://diveintopython.o

Re: Indexing strings

2005-03-04 Thread Patrick Useldinger
Fred wrote: I am searching for a possibility, to find out, what the index for a certain lettyer in a string is. My example: for x in text: if x == ' ': list = text[: # There I need the index of the space the program found during the loop... Is there and possibility to find the index o

Re: Wishful thinking : unix to windows script?

2005-03-04 Thread Patrick Useldinger
Grant Edwards wrote: If you install cygwin there almost always is. If you install cygwin there's no need for what the OP describes. -pu -- http://mail.python.org/mailman/listinfo/python-list

Re: Wishful thinking : unix to windows script?

2005-03-04 Thread Patrick Useldinger
John Leslie wrote: Or does anyone have a python script which takes a standard unix command as an argument and runs the pyton/windows equivalent on windows? There's not always an equivalent command. -pu -- http://mail.python.org/mailman/listinfo/python-list

os.stat('')[stat.ST_INO] on Windows

2005-02-27 Thread Patrick Useldinger
What does the above yield on Windows? Are inodes supported on Windows NTFS, FAT, FAT32? -- http://mail.python.org/mailman/listinfo/python-list

Re: fdups: calling for beta testers

2005-02-27 Thread Patrick Useldinger
John Machin wrote: I've tested it intensively "Famous Last Words" :-) ;-) (1) Manic s/w producing lots of files all the same size: the Borland C[++] compiler produces a debug symbol file (.tds) that's always 384KB; I have 144 of these on my HD, rarely more than 1 in the same directory. Not sure wha

Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
Serge Orlov wrote: Or use exemaker, which IMHO is the best way to handle this problem. Looks good, but I do not use Windows. -pu -- http://mail.python.org/mailman/listinfo/python-list

Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
John Machin wrote: Yes. Moreover, "WinZip", the most popular archive-handler, doesn't grok bzip2. I've added a zip file. It was made in Linux with the zip command-line tool, the man pages say it's compatible with the Windows zip tools. I have also added .py extentions to the 2 programs. I did how

Re: fdups: calling for beta testers

2005-02-26 Thread Patrick Useldinger
John Machin wrote: (1) It's actually .bz2, not .bz (2) Why annoy people with the not-widely-known bzip2 format just to save a few % of a 12KB file?? (3) Typing that on Windows command line doesn't produce a useful result (4) Haven't you heard of distutils? (1) Typo, thanks for pointing it out (2)(3

fdups: calling for beta testers

2005-02-25 Thread Patrick Useldinger
Hi all, I am looking for beta-testers for fdups. fdups is a program to detect duplicate files on locally mounted filesystems. Files are considered equal if their content is identical, regardless of their filename. Also, fdups ignores symbolic links and is able to detect and ignore hardlinks, whe