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


Groups > comp.lang.python > #37304

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

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'algorithm': 0.03; 'chunk': 0.07; 'compression': 0.09; 'filenames,': 0.09; 'page)': 0.09; 'path)': 0.09; 'path.': 0.09; 'subject:method': 0.09; 'subject:number': 0.09; 'subject:string': 0.09; 'subject:using': 0.09; 'thrown': 0.09; '4-digit': 0.16; 'anyone?': 0.16; 'great!': 0.16; 'mathematics.': 0.16; 'subject:Converting': 0.16; 'wrote:': 0.17; 'examples': 0.18; 'requests': 0.18; 'programming': 0.23; 'absolute': 0.23; "i've": 0.23; 'script': 0.24; 'header:In-Reply- To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'done.': 0.27; 'actual': 0.28; 'post': 0.28; 'convert': 0.29; 'choices': 0.33; 'point,': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'knowledge': 0.33; 'path': 0.35; 'problem,': 0.35; 'but': 0.36; 'turn': 0.36; 'skip:4 10': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'gives': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'back': 0.62; 'information': 0.63; 'dont': 0.64; 'here': 0.65; 'received:74.208': 0.71; 'literature': 0.84; 'response,': 0.93
Date Tue, 22 Jan 2013 11:40:57 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: Converting a string to a number by using INT (no hash method)
References <e74ae1aa-f760-4123-8770-3b8a4f9a2f91@googlegroups.com>
In-Reply-To <e74ae1aa-f760-4123-8770-3b8a4f9a2f91@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:Hz+3YJoW8JsVFOZyXQvuwVg8ZTmWOa5xPOeXsnqJkN2 qaCX8LzjbxWnMrzCnrnrHJY89LLK0NdVYzmSncv9kfkUnf0QyD 6DPq0ttXR4e6mw5pou7UB5W3onKPIdC7+9Qi6zcJUaqgmIAqOK ilQ15WSlASIb7CN1FImXmtBobxiUBc3cXyX+KD+cSGeyJoCz4o p3W8CI52EpsUt+3h0QUfoEeCTNee1FwzArOw6EAZbYEbTe4ScT AdmO4iQ8FJZElWno+KH+j6Bg9Ai4kc62MJQurngYgfoZ7GAkaH DK65JiA/TAxwxNe0LK7DrgdZT2aRH4qWzmu3UlW6XxUYvSxyw= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.808.1358872879.2939.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358872879 news.xs4all.nl 6876 [2001:888:2000:d::a6]:56423
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37304

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web