Re: Is PyArg_ParseTuple necessary to parse arguments?

2013-01-22 Thread Stefan Behnel
rahulgar...@gmail.com, 22.01.2013 18:20: > Or can I just loop through the argument tuple manually by using something > like PyTuple_GET_ITEM(args,i), then putting manual code to convert the > objects to appropriate C type? > The use case is that I am interfacing Python with another interpreter an

Re: Increase value in hash table

2013-01-22 Thread Chris Rebert
On Jan 22, 2013 11:31 PM, "moonhkt" wrote: > > Hi Al > > I have Data file have below > > Data file > V1 > V2 > V3 > V4 > V4 > V3 > > How to using count number of data ? > > Output > V1 = 1 > V2 = 1 > V3 =2 > V4 = 2 Construct a frequency table using collections.Counter: http://docs.python.org/2.7

Increase value in hash table

2013-01-22 Thread moonhkt
Hi Al I have Data file have below Data file V1 V2 V3 V4 V4 V3 How to using count number of data ? Output V1 = 1 V2 = 1 V3 =2 V4 = 2 # Global Veriable printque = {} in def have below printque[val] = printque[val] + 1 I have below error File "xprintlogchk.py", line 78, in chklog print

Re: Using filepath method to identify an .html page

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 9:16:34 μ.μ. UTC+2, ο χρήστης Peter Otten έγραψε: > Ferrous Cranus wrote: > > > > > Τη Τρίτη, 22 Ιανουαρίου 2013 6:11:20 μ.μ. UTC+2, ο χρήστης Chris Angelico > > > έγραψε: > > > > >> all of it. You are asking something that is fundamentally > > >> impossible[1].

Re: Failed to import a "pyd: File When python intepreter embed in C++ project

2013-01-22 Thread liujz39
On Wednesday, January 23, 2013 12:49:43 PM UTC+8, Chris Angelico wrote: > > > > Thank you! > > > > First thing you should do is to get a minimal example that > > demonstrates the problem, and *copy and paste* it and the exception > > traceback. When your own spelling is as sloppy as this, we

Re: Is PyArg_ParseTuple necessary to parse arguments?

2013-01-22 Thread dieter
rahulgar...@gmail.com writes: > Or can I just loop through the argument tuple manually by using something > like PyTuple_GET_ITEM(args,i), then putting manual code to convert the > objects to appropriate C type? If you like you can do the "parsing" yourself. -- http://mail.python.org/mailman/

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
On 01/22/2013 05:40 PM, MRAB wrote: > "his quote string is Cyrillic"? > > If you're referring to the "Τη Τρίτη, 22 Ιανουαρίου 2013 6:23:16 μ.μ. > UTC+2, ο χρήστης Leonard, Arah έγραψε", that's Greek. Oh, haha! you're so right! -- http://mail.python.org/mailman/listinfo/python-list

Re: Failed to import a "pyd: File When python intepreter embed in C++ project

2013-01-22 Thread Chris Angelico
On Wed, Jan 23, 2013 at 1:43 PM, wrote: > I create a pyd File named "testPyd" with boostPython,and then I import the > testPyd module into "test.py", it works perfect! > But when I embeded the python interpreter into my C++ project and run the > "test.py", it comes out a "ImportErr: no module n

Re: Using filepath method to identify an .html page

2013-01-22 Thread Chris Angelico
On Wed, Jan 23, 2013 at 2:04 PM, rusi wrote: > Considering that you've fried the of all the poor "out- > of-my-control' double-posting GG users, what punishment shall we find > for you? > > Heres an idea: Use GG yourself. > It will help the group/mailing list by reducing 5-fold double-posting > t

Memory error with quadratic interpolation

2013-01-22 Thread Isaac Won
Hi all, I have tried to use different interpolation methods with Scipy. My code seems just fine with linear interpolation, but shows memory error with quadratic. I am a novice for python. I will appreciate any help. #code f = open(filin, "r") for columns in ( raw.strip().split() for raw in f ):

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread alex23
On Jan 23, 1:02 pm, Steven D'Aprano wrote: > How many days was he posting here, pretending to be dumber than a box of > hammers? How many hours have we collectively wasted, reading and replying > to his posts? Trying to find some positive in this: the people sincerely responding at least stretche

Re: Retrieving the full command line

2013-01-22 Thread Steven D'Aprano
On Wed, 23 Jan 2013 00:53:21 +, Oscar Benjamin wrote: > On 22 January 2013 23:46, Steven D'Aprano > wrote: [SNIP] >> >> I am a bit disturbed that you cannot distinguish between: >> >> python C:\something\on\pythonpath\app\__main__.py >> >> python -m app >> >> >> by inspecting the command line

Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
On Tue, Jan 22, 2013 at 10:29 PM, Dave Angel wrote: > On 01/22/2013 10:15 PM, Kevin Holleran wrote: > >> Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2. I >> tried to get it from Macports and download/install it myself. Both seem >> to >> get me to here: >> >> ImportErro

Re: Using filepath method to identify an .html page

2013-01-22 Thread MRAB
On 2013-01-23 03:15, Dennis Lee Bieber wrote: On 22 Jan 2013 23:40:24 GMT, Steven D'Aprano declaimed the following in gmane.comp.python.general: On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here,

Re: Parse a Wireshark pcap file

2013-01-22 Thread Dave Angel
On 01/22/2013 10:15 PM, Kevin Holleran wrote: Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2. I tried to get it from Macports and download/install it myself. Both seem to get me to here: ImportError: No module named dnet I tried to download libdnet but no matter what I

Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
I also found this: http://code.google.com/p/py-greppcap/ Which I can leverage to do what I want but I also get that dnet error! -- Kevin Holleran Master of Science, Computer Information Systems Grand Valley State University Master of Business Administration Western Michigan University SANS GCFA

Re: Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
Thanks, I have been trying to get it to work but I am on Mac OS 10.8.2. I tried to get it from Macports and download/install it myself. Both seem to get me to here: ImportError: No module named dnet I tried to download libdnet but no matter what I do this is what I get. Granted I am doing; fr

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 17:32:58 -0800, alex23 wrote: > On Jan 23, 2:40 am, Dave Angel wrote: >> Unless you constrain your users to very restrictive filenames, what you >> ask here simply cannot be done. > > He's also INSISTED in other threads that these files should be moveable > at will by other u

Re: Using filepath method to identify an .html page

2013-01-22 Thread rusi
On Jan 23, 7:50 am, Steven D'Aprano wrote: > On Tue, 22 Jan 2013 23:40:24 +, Steven D'Aprano wrote: > > [snip content] > > Holy crap! Sorry for the flood of duplicated posts. That was out of my > control, honest. > > -- > Steven Now Now! Considering that you've fried the of all the poor "ou

Re: Parse a Wireshark pcap file

2013-01-22 Thread Dave Angel
On 01/22/2013 08:32 PM, Kevin Holleran wrote: Is there a way to parse out a wireshark pcap file and extract key value pairs from the data? I am illustrated a sniff of some traffic and why it needs utilize HTTPS instead of HTTP but I was hoping to run the pcap through a python script and just out

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 23:40:24 +, Steven D'Aprano wrote: [snip content] Holy crap! Sorry for the flood of duplicated posts. That was out of my control, honest. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Failed to import a "pyd: File When python intepreter embed in C++ project

2013-01-22 Thread liujz39
I create a pyd File named "testPyd" with boostPython,and then I import the testPyd module into "test.py", it works perfect! But when I embeded the python interpreter into my C++ project and run the "test.py", it comes out a "ImportErr: no module named testPyd". It has confused me for two days and

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread alex23
On Jan 23, 2:40 am, Dave Angel wrote: > Unless you constrain your users to very restrictive filenames, what you > ask here simply cannot be done. He's also INSISTED in other threads that these files should be moveable at will by other users and still be recognisable as the same file. So yes: trol

Re: Uniquely identifying each & every html template

2013-01-22 Thread alex23
On Jan 22, 10:04 am, Chris Angelico wrote: > My family in fact has a literal "grandfather's axe" (except that I > don't think either of my grandfathers actually owned it, but it's my > Dad's old axe) that has had many new handles and a couple of new > heads. Ah, that's brilliant, I hadn't heard t

Parse a Wireshark pcap file

2013-01-22 Thread Kevin Holleran
Is there a way to parse out a wireshark pcap file and extract key value pairs from the data? I am illustrated a sniff of some traffic and why it needs utilize HTTPS instead of HTTP but I was hoping to run the pcap through a python script and just output some interesting key value pairs Thanks

Re: Else statement executing when it shouldnt

2013-01-22 Thread alex23
On Jan 23, 1:48 am, Thomas Boell wrote: > I must say, that's bound to be confusing for anyone who knows any > language other than Python (or none, even).  Syntax like that is "an > accident waiting to happen"... No, ignorantly expecting every language to conform to every other is the pending acci

Re: Using filepath method to identify an .html page

2013-01-22 Thread alex23
On Jan 22, 8:07 pm, Ferrous Cranus wrote: > Hello, i decided to switch from embedding string into .html to actually grab > the filepath in order to identify it So all that crap you wrote in past threads about absolutely essentially needing to identify a html page _no matter where it was stored o

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread peter
Yes, raw sockets need admin privileges, I knew that. The app I'm writing runs as root so that's not a problem. It runs during the %pre script stage of a kickstart controlled install. On Tuesday, January 22, 2013 1:58:07 PM UTC-8, Rob Williscroft wrote: > Try > > s = socket.socket( socket

Re: Retrieving the full command line

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 09:24, Tim Golden wrote: > [Python 2.7/3.3 (and hg tip) running on Windows. Not Windows-specific, > though]. > > I use the python -mpackage incantation to run a package which has a > __main__.py module and which uses relative imports internally. > > I'm developing under cherrypy

Re: Retrieving the full command line

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 23:46, Steven D'Aprano wrote: [SNIP] > > I am a bit disturbed that you cannot distinguish between: > > python C:\something\on\pythonpath\app\__main__.py > > python -m app > > > by inspecting the command line. I consider it a bug, or at least a > misfeature, if Python transforms

Re: Using filepath method to identify an .html page

2013-01-22 Thread MRAB
On 2013-01-23 00:07, Michael Torrie wrote: On 01/22/2013 04:40 PM, Steven D'Aprano wrote: On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: I'm sorry you are getting so frustrated. There's obviously a language barrier here, I don't think there is. The OP's posts have been written in

Re: Understanding while...else...

2013-01-22 Thread Oscar Benjamin
On 22 January 2013 23:41, Terry Reedy wrote: > On 1/22/2013 3:09 PM, Ethan Furman wrote: >> >> On 01/22/2013 09:44 AM, Terry Reedy wrote: >>> [SNIP] >>> The else clause is executed if and when the condition is false. >>> Now use a real Python while statement to do the *same >>> thing*. >>> >>> whi

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Else statement executing when it shouldnt

2013-01-22 Thread René Klačan
it seems that lot of you are forgeting about this case: for i in [1,2,3,4,5]: print i else: print('this will be printed also because cycle wasnt broke') so the one case when else branch is executed is when condition is not satisfied and the other case is when there is no break executed du

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Mitya Sirenef
On 01/22/2013 12:33 PM, rusi wrote: On Jan 22, 8:59 pm, Ferrous Cranus wrote: >> I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! >> That's all i want!! But i cannot make it work :( > > I just need a way to eat my soup with a screwdriver. > No I WONT

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 10:07:21 -0800, Ferrous Cranus wrote: > No, because i DO NOT WANT to store LOTS OF BIGS absolute paths in the > database. They are not big. They are tiny. Please stop being too arrogant to listen to advice from people who have been programming for years or decades. -- St

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 09:33:00 -0800, rusi wrote: > On Jan 22, 8:59 pm, Ferrous Cranus wrote: >> I just need a way to CONVERT a string(absolute path) to a 4-digit >> unique number with INT!!! That's all i want!! But i cannot make it work >> :( > > I just need a way to eat my soup with a screwdrive

Re: Else statement executing when it shouldnt

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 16:48:35 +0100, Thomas Boell wrote: > On Wed, 23 Jan 2013 02:42:27 +1100 > Chris Angelico wrote: > >> On Wed, Jan 23, 2013 at 2:39 AM, Thomas Boell >> wrote: >> > Huh?! I would have expected all your examples to raise a SyntaxError >> > or IndentationError. Why don't they? I

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
On 01/22/2013 04:40 PM, Steven D'Aprano wrote: > On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > >> I'm sorry you are getting so frustrated. There's obviously a language >> barrier here, > > I don't think there is. The OP's posts have been written in excellent > English. Well, his

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 09:33:00 -0800, rusi wrote: > On Jan 22, 8:59 pm, Ferrous Cranus wrote: >> I just need a way to CONVERT a string(absolute path) to a 4-digit >> unique number with INT!!! That's all i want!! But i cannot make it work >> :( > > I just need a way to eat my soup with a screwdrive

Re: Uniquely identifying each & every html template

2013-01-22 Thread Michael Torrie
On 01/21/2013 08:00 AM, Ferrous Cranus wrote: > Τη Δευτέρα, 21 Ιανουαρίου 2013 2:47:54 μ.μ. UTC+2, ο χρήστης Joel > Goldstick έγραψε: >> This is trolling Ferrous. you are a troll. Go away > > Just because you cannot answer my question that doesn't make me a > troll you know. It becomes trolling

Re: Retrieving the full command line

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 15:07:18 +, Tim Golden wrote: > On 22/01/2013 14:53, Terry Reedy wrote: >> On 1/22/2013 4:24 AM, Tim Golden wrote: >>> [Python 2.7/3.3 (and hg tip) running on Windows. Not Windows-specific, >>> though]. >>> >>> I use the python -mpackage incantation to run a package which h

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: pycache directories

2013-01-22 Thread monosij . forums
On Tuesday, January 22, 2013 1:01:44 AM UTC-5, Terry Reedy wrote: > > > I am doing some OO python3 where I am using multiple dirs/sub-dirs. > > > > > > So everything works fine, however when I run code __pycache__ > > > directories are being created in every directory touched by the > > > exec

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Using filepath method to identify an .html page

2013-01-22 Thread Steven D'Aprano
On Tue, 22 Jan 2013 11:36:31 -0700, Michael Torrie wrote: > I'm sorry you are getting so frustrated. There's obviously a language > barrier here, I don't think there is. The OP's posts have been written in excellent English. I think we've been well and truly trolled, by somebody who even uses

Re: Understanding while...else...

2013-01-22 Thread Terry Reedy
On 1/22/2013 3:09 PM, Ethan Furman wrote: On 01/22/2013 09:44 AM, Terry Reedy wrote: Several people have trouble understanding Python's while-else and for-else constructs. It is actually quite simple if one starts with if-else, which few have any trouble with. Start with, for example if n > 0:

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Rob Williscroft
Peter Steele wrote in news:96947c45-f16b-4e97-b055-edc1241ee...@googlegroups.com in comp.lang.python: > I just tried running you code, and the "sendto" call fails with > "Network is unreachable". That's what I expected, based on other tests > I've done. That's why I was asking about how to do raw

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Peter Steele
Actually, I used to teach C, so yeah, I know it pretty well. :-) Scapy is a possibility, I just need to add it to my environment (which doesn't have a C compiler). I can jury rig something though. On Tuesday, January 22, 2013 1:19:14 PM UTC-8, Chris Angelico wrote: > On Wed, Jan 23, 2013 at 4:57

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Chris Angelico
On Wed, Jan 23, 2013 at 4:57 AM, Peter Steele wrote: > In fact, I have used scapy in the past, but I am working in a restricted > environment and don't have this package available. It provides tones more > than I really need anyway, and I figured a simple raw socket send/receive > can't be *tha

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
In Ferrous Cranus writes: > May i sent you my code by mail so for you see whats wrong and > http://superhost.gr produces error? I tried going to that address and got some error output. I noticed this in the error dump: 186 if cursor.rowcount == 0: 187 cursor

Re: Importing class from another file

2013-01-22 Thread Kevin Holleran
Thanks, you got me straightened out. -- Kevin Holleran Master of Science, Computer Information Systems Grand Valley State University Master of Business Administration Western Michigan University SANS GCFA, SANS GCFE, CCNA, ISA, MCSA, MCDST, MCP "Do today what others won't, do tomorrow what other

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
On 01/22/2013 03:30 PM, Leonard, Arah wrote: The perl code will produce the same hash for "abc.html" as for "bca.html" That's probably one reason Leonard didn't try to transliterate the buggy code. Actually, to give credit where it's due, it wasn't me. I just modified someone else's inter

RE: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Leonard, Arah
> The perl code will produce the same hash for "abc.html" as for "bca.html" > That's probably one reason Leonard didn't try to transliterate the buggy code. > Actually, to give credit where it's due, it wasn't me. I just modified someone else's interesting solution in this thread and added t

Re: Understanding while...else...

2013-01-22 Thread Ethan Furman
On 01/22/2013 09:44 AM, Terry Reedy wrote: Several people have trouble understanding Python's while-else and for-else constructs. It is actually quite simple if one starts with if-else, which few have any trouble with. Start with, for example if n > 0: n -= 1 else: n = None The else clau

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Alan Spence
On 22 Jan 2013, at 19:28, Ferrous Cranus wrote: > Τη Τρίτη, 22 Ιανουαρίου 2013 9:02:48 μ.μ. UTC+2, ο χρήστης Michael Torrie > έγραψε: >> On 01/22/2013 11:37 AM, Ferrous Cranus wrote: >> >>> == pin = int( >> >>> htmlpage.encode("hex"), 16 ) % 1 >

Re: Importing class from another file

2013-01-22 Thread John Gordon
In Kevin Holleran writes: > I have a class called My_Class in a subdir called Sub_Dir. > in My_Class.py is the following > class My_Class_Connector: > def __init__(self,un,pw,qs_srv="domain.com"): > self.username = un > self.password = pw > Then I am trying to call from a

Oportunidade: Desenvolvedor Python/Django Sênior - RJ

2013-01-22 Thread zughumancapital
Arpex Capital Seleciona: Desenvolvedor Python/Django Sênior Estamos em busca daqueles(as) que: acham que meritocracia é indispensável, programam desde a infância, possuem sede por aprender e programar e querem trabalhar muito para fazer algo especial! O desenvolvedor estará envolvido em um pr

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 9:02:48 μ.μ. UTC+2, ο χρήστης Michael Torrie έγραψε: > On 01/22/2013 11:37 AM, Ferrous Cranus wrote: > > > == pin = int( > > > htmlpage.encode("hex"), 16 ) % 1 > > > == > >

Re: Using filepath method to identify an .html page

2013-01-22 Thread Peter Otten
Ferrous Cranus wrote: > Τη Τρίτη, 22 Ιανουαρίου 2013 6:11:20 μ.μ. UTC+2, ο χρήστης Chris Angelico > έγραψε: >> all of it. You are asking something that is fundamentally >> impossible[1]. There simply are not enough numbers to go around. > Fundamentally impossible? > > Well > > OK: How abou

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
On 01/22/2013 01:37 PM, Ferrous Cranus wrote: == pin = int( htmlpage.encode("hex"), 16 ) % 1 == Can you please explain the differences to what you have posted opposed to this perl coding? ===

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Michael Torrie
On 01/22/2013 11:37 AM, Ferrous Cranus wrote: > == pin = int( > htmlpage.encode("hex"), 16 ) % 1 > == > > Can you please explain the differences to what you have posted > opposed to this perl coding? > >

Re: Using filepath method to identify an .html page

2013-01-22 Thread Dave Angel
On 01/22/2013 01:26 PM, Ferrous Cranus wrote: sub hashit { my $url=shift; my @ltrs=split(//,$url); my $hash = 0; foreach my $ltr(@ltrs){ $hash = ( $hash + ord($ltr)) %1; } printf "%s: %0.4d\n",$url,$hash } which yields: $ perl testMD5.pl /index.html:

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
On 01/22/2013 11:26 AM, Ferrous Cranus wrote: > which yields: > $ perl testMD5.pl > /index.html: 1066 > /about/time.html: 1547 Well do it the same with in python then. Just read the docs on the hashlib so you know what kind of object it returns and how to call methods on that object to return a

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
On 01/22/2013 11:13 AM, Ferrous Cranus wrote: > a) I'am a reseller, i have unlimited ftp quota, hence database space Space doesn't even come into the equation. There's virtually no difference between a 4-digit number and a 100-character string. Yes there is an absolute difference in storage spac

Re: Using filepath method to identify an .html page

2013-01-22 Thread MRAB
On 2013-01-22 18:26, Ferrous Cranus wrote: Τη Τρίτη, 22 Ιανουαρίου 2013 6:11:20 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: On Wed, Jan 23, 2013 at 2:59 AM, Ferrous Cranus wrote: > I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!

Re: Using filepath method to identify an .html page

2013-01-22 Thread John Gordon
In <4847a0e3-aefa-4330-9252-db08f2e99...@googlegroups.com> Ferrous Cranus writes: > And the .html files are not even close 10.000 You said you wanted a 4-digit number. There are 10,000 different 4-digit numbers. 0001 0002 ... -- John Gordon A is for Amy, who fell

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread John Gordon
In <592233bd-3fc1-4e13-97f8-e11f89fbb...@googlegroups.com> Ferrous Cranus writes: > > pin int( htmlpage.encode("hex"), 16 ) % 1 > > > > It'll give you your number, but there are no guarantees of uniqueness. > You're looking at more blind random luck using that. > Finally!! THANK YOU VER

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
I'm sorry you are getting so frustrated. There's obviously a language barrier here, but also your frustration is preventing you from thinking clearly. You need to take a step back, breath, and re-read everything that's been written to you on this thread. All your questions that can be answered h

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 7:24:26 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > No need, to turn the number back to a path anymore, just the path to a > > number, to identify the specific .html page > > > > > > Can this be done? > > > > Guaranteed to be unique? Not even remotely possib

Re: Using filepath method to identify an .html page

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:11:20 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε: > On Wed, Jan 23, 2013 at 2:59 AM, Ferrous Cranus wrote: > > > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > > number with INT!!! That's all i want!! But i cannot make it work :( > >

Re: Using filepath method to identify an .html page

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 7:33:00 μ.μ. UTC+2, ο χρήστης rusi έγραψε: > On Jan 22, 8:59 pm, Ferrous Cranus wrote: > > > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > > number with INT!!! > > > That's all i want!! But i cannot make it work :( > > > > I just need

Re: Using filepath method to identify an .html page

2013-01-22 Thread Michael Torrie
On 01/22/2013 03:07 AM, Ferrous Cranus wrote: > Now, can you pleas help me write the switch to filepath identifier? > I'am having trouble writing it. Unfortunately this isn't the way to go either. Apache uses its own config and rules to map a url to a "filepath." There's no way for Python to do

Re: Using filepath method to identify an .html page

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:23:16 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > Thank you but the number needs to be a 4-digit integer only, if its to be > > stored in the database table correctly. > > > > Okay, I think we need to throw the flag on the field at this point. What > you're

Re: Using filepath method to identify an .html page

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:55:02 μ.μ. UTC+2, ο χρήστης John Gordon έγραψε: > In Ferrous Cranus > writes: > > > > > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > > > number with INT!!! That's all i want!! But i cannot make it work :( > > > > Given your requ

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Peter Steele
In fact, I have used scapy in the past, but I am working in a restricted environment and don't have this package available. It provides tones more than I really need anyway, and I figured a simple raw socket send/receive can't be *that* hard. I may have to reverse engineer some C code, such as d

Re: Using filepath method to identify an .html page

2013-01-22 Thread Mark Lawrence
On 22/01/2013 17:33, rusi wrote: On Jan 22, 8:59 pm, Ferrous Cranus wrote: I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( I just need a way to eat my soup with a screwdriver. No I WONT use a spoon.

Understanding while...else...

2013-01-22 Thread Terry Reedy
Several people have trouble understanding Python's while-else and for-else constructs. It is actually quite simple if one starts with if-else, which few have any trouble with. Start with, for example if n > 0: n -= 1 else: n = None The else clause is executed if and when the condition is

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 7:24:26 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > No need, to turn the number back to a path anymore, just the path to a > > number, to identify the specific .html page > > > > > > Can this be done? > > > > Guaranteed to be unique? Not even remotely possib

Re: Using filepath method to identify an .html page

2013-01-22 Thread rusi
On Jan 22, 8:59 pm, Ferrous Cranus wrote: > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > number with INT!!! > That's all i want!! But i cannot make it work :( I just need a way to eat my soup with a screwdriver. No I WONT use a spoon. Im starving HELP -- http://ma

RE: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Leonard, Arah
> No need, to turn the number back to a path anymore, just the path to a > number, to identify the specific .html page > > Can this be done? Guaranteed to be unique? Not even remotely possible. Even with a lookup table approach (which defeats your purpose of not storing the path) with 4 digit

Is PyArg_ParseTuple necessary to parse arguments?

2013-01-22 Thread rahulgarg44
Or can I just loop through the argument tuple manually by using something like PyTuple_GET_ITEM(args,i), then putting manual code to convert the objects to appropriate C type? The use case is that I am interfacing Python with another interpreter and do not know the type and number of arguments

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread D'Arcy J.M. Cain
On Tue, 22 Jan 2013 16:27:32 + "Leonard, Arah" wrote: > > I just need a way to CONVERT a string(absolute path) to a 4-digit > > unique number with INT!!! That's all i want!! But i cannot make it > > work :( Why bother? Just wish for a zillion dollars and then you never have to program again.

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Ferrous Cranus
Τη Τρίτη, 22 Ιανουαρίου 2013 6:27:32 μ.μ. UTC+2, ο χρήστης Leonard, Arah έγραψε: > > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > > number with INT!!! That's all i want!! But i cannot make it work :( > > > > > > And the best part is that "that" number must be able

Re: Sending a broadcast message using raw sockets

2013-01-22 Thread Corey LeBleu
If you don't *have* to use the actual socket library, you might want to have a look at scapy. It's a packet manipulation program/library. It might make things a little easier. http://www.secdev.org/projects/scapy/ On Jan 22, 2013 9:17 AM, "Peter Steele" wrote: > I just tried running you code,

Re: Using filepath method to identify an .html page

2013-01-22 Thread John Gordon
In Ferrous Cranus writes: > I just need a way to CONVERT a string(absolute path) to a 4-digit unique > number with INT!!! That's all i want!! But i cannot make it work :( Given your requirements, I don't think it *can* work. There's just no way to do it. How can the computer guarantee that b

Re: Converting a string to a number by using INT (no hash method)

2013-01-22 Thread Dave Angel
On 01/22/2013 11:15 AM, Ferrous Cranus wrote: I just need a way to CONVERT a string(absolute path) to a 4-digit unique number with INT!!! That's all i want!! But i cannot make it work :( And the best part is that "that" number must be able to turn back into a path. This way i DON'T EVEN HAVE T

  1   2   >