Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37299 > unrolled thread

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

Started byFerrous Cranus <nikos.gr33k@gmail.com>
First post2013-01-22 08:15 -0800
Last post2013-01-22 12:04 -0500
Articles 6 on this page of 26 — 11 participants

Back to article view | Back to comp.lang.python


Contents

  Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 08:15 -0800
    RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 16:27 +0000
      Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
        RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 17:24 +0000
          Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
            Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 18:36 +0000
            Re: Converting a string to a number by using INT  (no hash method) Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 17:22 -0500
          Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:39 -0800
          Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
            Re: Converting a string to a number by using INT  (no hash method) Michael Torrie <torriem@gmail.com> - 2013-01-22 12:02 -0700
              Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
                Re: Converting a string to a number by using INT  (no hash method) Alan Spence <alan.spence@ntlworld.com> - 2013-01-22 20:00 +0000
              Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 11:28 -0800
                Re: Converting a string to a number by using INT (no hash method) John Gordon <gordon@panix.com> - 2013-01-22 20:40 +0000
                  Re: Converting a string to a number by using INT (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 00:44 -0800
            Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 14:08 -0500
            RE: Converting a string to a number by using INT  (no hash method) "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 20:30 +0000
            Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 15:43 -0500
          Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:37 -0800
      Re: Converting a string to a number by using INT  (no hash method) Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 09:02 -0800
    Re: Converting a string to a number by using INT  (no hash method) Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-01-22 16:27 +0000
    Re: Converting a string to a number by using INT  (no hash method) Dave Angel <d@davea.name> - 2013-01-22 11:40 -0500
      Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 17:32 -0800
        Re: Converting a string to a number by using INT (no hash method) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 03:02 +0000
          Re: Converting a string to a number by using INT (no hash method) alex23 <wuwei23@gmail.com> - 2013-01-22 19:59 -0800
    Re: Converting a string to a number by using INT  (no hash method) "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-01-22 12:04 -0500

Page 2 of 2 — ← Prev page 1 [2]


#37302

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2013-01-22 16:27 +0000
Message-ID<mailman.807.1358872081.2939.python-list@python.org>
In reply to#37299
On 22/01/2013 16:15, 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 TO STORE THE ACTUAL HTML PAGE'S ABSOLUTE PATH!!!!
>
> 1. User requests a specific html page( .htaccess gives my script the absolute path for that .html page)
> 2. I turn the path into a 4-digitnumber
> 3. i store that number to the database. I DONT EVEN HAVE TO STORE THE PATH TO THE DATABASE ANYMORE!!! this is just great!
>

Hi Iron Skull,

I hereby nominate you for Troll of the Millenium.

-- 
Cheers.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#37304

FromDave Angel <d@davea.name>
Date2013-01-22 11:40 -0500
Message-ID<mailman.808.1358872879.2939.python-list@python.org>
In reply to#37299
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 TO STORE THE ACTUAL HTML PAGE'S ABSOLUTE PATH!!!!
>
> 1. User requests a specific html page( .htaccess gives my script the absolute path for that .html page)
> 2. I turn the path into a 4-digitnumber
> 3. i store that number to the database. I DONT EVEN HAVE TO STORE THE PATH TO THE DATABASE ANYMORE!!! this is just great!
>

I had prepared a detailed response, showing what your choices are with 
this new constraint.  But I can see from this post here that there's no 
point, so I've thrown it out.

Either you're trolling, or you have a very limited knowledge of 
mathematics.   This isn't a programming problem, it's a simple problem 
of information theory.

Unless you constrain your users to very restrictive filenames, what you 
ask here simply cannot be done.

Perpetual motion machine, anyone?  Or a compression algorithm which can 
be applied repeatedly to a chunk of data until it shrinks down to one 
byte?  No way to do it without cheating, and the literature is full of 
examples of people cheating.


-- 
DaveA

[toc] | [prev] | [next] | [standalone]


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

Fromalex23 <wuwei23@gmail.com>
Date2013-01-22 17:32 -0800
SubjectRe: Converting a string to a number by using INT (no hash method)
Message-ID<c94adf68-74a3-4bb6-9758-fd28aa0577e0@vb8g2000pbb.googlegroups.com>
In reply to#37304
On Jan 23, 2:40 am, Dave Angel <d...@davea.name> 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: troll or willful ignorance seems to be what we're seeing
here.

[toc] | [prev] | [next] | [standalone]


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

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-01-23 03:02 +0000
SubjectRe: Converting a string to a number by using INT (no hash method)
Message-ID<50ff52af$0$29877$c3e8da3$5496439d@news.astraweb.com>
In reply to#37394
On Tue, 22 Jan 2013 17:32:58 -0800, alex23 wrote:

> On Jan 23, 2:40 am, Dave Angel <d...@davea.name> 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: troll or willful ignorance seems to be what we're seeing here.

Definitely troll, and we got well and truly had.

Shame on us -- he practically *screamed* "I am a troll" in his user-name. 
"Ferrous Cranus" ("Iron Skull") is the name of a particular subspecies of 
troll in Mike Reed's well known compendium:

http://redwing.hutman.net/~mreed/warriorshtm/ferouscranus.htm


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?

I wouldn't even trust that he is Greek. Quite likely he uses a non-
English attribution line to hint that English is not his first language, 
so his victims will think that there is a language barrier. "Maybe he 
doesn't understand me. If I answer again, in a slightly different way, 
perhaps it will be more clear."



-- 
Steven

[toc] | [prev] | [next] | [standalone]


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

Fromalex23 <wuwei23@gmail.com>
Date2013-01-22 19:59 -0800
SubjectRe: Converting a string to a number by using INT (no hash method)
Message-ID<b16a26fb-01bb-4d19-84cc-4da9bb5dc805@pd8g2000pbc.googlegroups.com>
In reply to#37399
On Jan 23, 1:02 pm, Steven D'Aprano <steve
+comp.lang.pyt...@pearwood.info> 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 stretched themselves to try and find solutions or better ways
of communicating. The troll just learned how to be a better troll.

We still win.

[toc] | [prev] | [next] | [standalone]


#37309

From"D'Arcy J.M. Cain" <darcy@druid.net>
Date2013-01-22 12:04 -0500
Message-ID<mailman.811.1358874305.2939.python-list@python.org>
In reply to#37299
On Tue, 22 Jan 2013 16:27:32 +0000
"Leonard, Arah" <Arah.Leonard@bruker-axs.com> 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.  At least that would be theoretically possible.

> *might* be able to convert a string that long into some kind of
> 4-digit integer checksum, but you would *never* be able to convert
> that back into a file path.  Nor would it be guaranteed to be unique.

In fact, if you have 10,001 files it is absolutely guaranteed to have at
least one duplicate entry.

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy@Vex.Net

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.python


csiph-web