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


Groups > comp.lang.python > #37278

Re: Using filepath method to identify an .html page

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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; 'string.': 0.04; 'binary': 0.05; 'paths': 0.05; 'column': 0.07; 'python': 0.09; 'args,': 0.09; 'filename.': 0.09; 'indexes': 0.09; 'path)': 0.09; 'string)': 0.09; 'subject:method': 0.09; 'index': 0.13; '"unique"': 0.16; '12:57': 0.16; '794': 0.16; 'coding?': 0.16; 'costing': 0.16; 'easier.': 0.16; 'entries.': 0.16; 'happily': 0.16; 'ids.': 0.16; 'really?': 0.16; 'uniqueness': 0.16; 'written.': 0.16; 'wed,': 0.16; 'string': 0.17; 'wrote:': 0.17; 'instance,': 0.17; 'integer': 0.17; 'skip': 0.17; 'subject:page': 0.17; 'test.': 0.17; 'jan': 0.18; '>>>': 0.18; 'sort': 0.21; 'supposed': 0.21; 'keys': 0.22; 'please?': 0.22; 'help.': 0.22; 'absolute': 0.23; 'this:': 0.23; "i've": 0.23; 'long,': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'creating': 0.26; 'common': 0.26; 'am,': 0.27; 'there.': 0.28; 'chris': 0.28; 'fine': 0.28; 'run': 0.28; 'hosting': 0.28; '>>>>': 0.29; "d'aprano": 0.29; 'mode.': 0.29; 'piece': 0.29; 'steven': 0.29; 'maybe': 0.29; 'that.': 0.30; 'expect': 0.31; 'code': 0.31; 'could': 0.32; 'idle': 0.33; 'instead,': 0.33; 'subject: .': 0.33; 'to:addr:python-list': 0.33; 'likely': 0.33; 'produced': 0.33; 'done': 0.34; 'returning': 0.35; 'skip:f 40': 0.35; 'so,': 0.35; 'expected': 0.35; 'table': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; 'should': 0.36; 'bad': 0.37; 'does': 0.37; 'two': 0.37; 'being': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'things': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'easily': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'end': 0.40; 'most': 0.61; 'chance': 0.61; "you'll": 0.62; 'between': 0.63; 'information': 0.63; 'more': 0.63; 'dont': 0.64; 'gave': 0.65; 'six': 0.65; '10,000': 0.65; 'response.': 0.67; '8bit%:100': 0.70; '8bit%:92': 0.70; 'received:74.208': 0.71; 'foreign': 0.72; '2013': 0.84; 'compose': 0.84; 'relation.': 0.84; 'subject:Using': 0.84; 'tree,': 0.84; '1,000,000': 0.91; 'birthday': 0.91; 'imagine': 0.96
Date Tue, 22 Jan 2013 10:05:49 -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: Using filepath method to identify an .html page
References <adcfb222-a038-4700-8959-38e452c04b85@googlegroups.com> <50fe787e$0$30003$c3e8da3$5496439d@news.astraweb.com> <f4298c6f-81a2-45c7-903b-015e9f17d5a7@googlegroups.com> <mailman.784.1358857784.2939.python-list@python.org> <mailman.785.1358858844.2939.python-list@python.org> <50fe8e69$0$30003$c3e8da3$5496439d@news.astraweb.com> <0459659d-4ec2-4c7d-bee3-b4e363c916dd@googlegroups.com> <mailman.790.1358865192.2939.python-list@python.org> <ec8f1a56-d0f7-46a6-a8a3-9425d3aabf8e@googlegroups.com>
In-Reply-To <ec8f1a56-d0f7-46a6-a8a3-9425d3aabf8e@googlegroups.com>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Provags-ID V02:K0:rTF3XOq1EKBTz3XPTmt/te2WlIJM6+099vrQsKUVo/f +V8D/a1yGnQOaxIJyBHJn4trRq1CgWQW96Q1bKKlsIP3tr4V5X /CSXBH8CzhFKtOO6ExhwdamTYpDn68L/uYmpxI4L4HMK6bDrMv ExzqVYgGZZc8Zl8r2wuToftp/i6kWrO7q4dCyukTsBLj6QcEC3 pyMJMxMQ86Z3pSedBiOcm/H1J6WyTc9ioKsZ5e2Fidk4V5HYI7 E1IVkI5KL9FAv1JfPeCNkI1D8CyRoAmmRqjjQLA1OmDKDk/bJ3 a5yqLny+pTkY2LEoXDYQavxOVoEF7FxPQzUAFYEXOiwlRSNEw= =
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.792.1358867171.2939.python-list@python.org> (permalink)
Lines 108
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358867171 news.xs4all.nl 6908 [2001:888:2000:d::a6]:60498
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37278

Show key headers only | View raw


On 01/22/2013 09:55 AM, Ferrous Cranus wrote:
> Τη Τρίτη, 22 Ιανουαρίου 2013 4:33:03 μ.μ. UTC+2, ο χρήστης Chris Angelico έγραψε:
>> On Wed, Jan 23, 2013 at 12:57 AM, Ferrous Cranus <nikos.gr33k@gmail.com> wrote:
>>
>>> Τη Τρίτη, 22 Ιανουαρίου 2013 3:04:41 μ.μ. UTC+2, ο χρήστης Steven D'Aprano έγραψε:
>>
>>>
>>
>>>> What do you expect int("my-web-page.html") to return? Should it return 23
>>
>>>> or 794 or 109432985462940911485 or 42?
>>
>>>
>>
>>> I expected a unique number from the given string to be produced so i could have a (number <=> string) relation. What does int( somestring ) is returning really? i don;t have IDLE to test.
>>
>>
>>
>> Just run python without any args, and you'll get interactive mode. You
>>
>> can try things out there.
>>
>>
>>
>>> This counter.py will work on a shared hosting enviroment, so absolutes paths are BIG and expected like this:
>>
>>>
>>
>>> /home/nikos/public_html/varsa.gr/articles/html/files/index.html
>>
>>
>>
>> That's not big. Trust me, modern databases work just fine with unique
>>
>> indexes like that. The most common way to organize the index is with a
>>
>> binary tree, so the database has to look through log(N) entries.
>>
>> That's like figuring out if the two numbers 142857 and 857142 are the
>>
>> same; you don't need to look through 1,000,000 possibilities, you just
>>
>> need to look through the six digits each number has.
>>
>>
>>
>>> 'pin' has to be a number because if i used the column 'page' instead, just imagine the database's capacity withholding detailed information for each and every .html requested by visitors!!!
>>
>>
>>
>> Not that bad actually. I've happily used keys easily that long, and
>>
>> expected the database to ensure uniqueness without costing
>>
>> performance.
>>
>>
>>
>>> So i really - really need to associate a (4-digit integer <=> htmlpage's absolute path)
>>
>>
>>
>> Is there any chance that you'll have more than 10,000 pages? If so, a
>>
>> four-digit number is *guaranteed* to have duplicates. And if you
>>
>> research the Birthday Paradox, you'll find that any sort of hashing
>>
>> algorithm is likely to produce collisions a lot sooner than that.
>>
>>
>>
>>> Maybe it can be done by creating a MySQL association between the two columns, but i dont know how such a thing can be done(if it can).
>>
>>>
>>
>>> So, that why i need to get a "unique" number out of a string. please help.
>>
>>
>>
>> Ultimately, that unique number would end up being a foreign key into a
>>
>> table of URLs and IDs. So just skip that table and use the URLs
>>
>> directly - much easier. In this instance, there's no value in
>>
>> normalizing.
>>
>>
>>
>> ChrisA
>
> I insist, perhaps compeleld, to use a key to associate a number to a filename.
> Would you help please?
>
> I dont know this is supposed to be written. i just know i need this:
>
> number = function_that_returns_a_number_out_of_a_string( absolute_path_of_a_html_file)
>
> Would someone help me write that in python coding? We are talkign 1 line of code here....
>

I gave you every piece of that code in my last response.  So you're not 
willing to compose the line from the clues?


-- 
DaveA

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


Thread

Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 02:07 -0800
  Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 11:31 +0000
    Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 03:53 -0800
      Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-22 23:26 +1100
    Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 04:02 -0800
      Re: Using filepath method to identify an .html page Lele Gaifax <lele@metapensiero.it> - 2013-01-22 13:22 +0100
      Re: Using filepath method to identify an .html page Dave Angel <d@davea.name> - 2013-01-22 07:29 -0500
        Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 04:47 -0800
          Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 04:50 -0800
          Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-22 23:59 +1100
          Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 04:50 -0800
        Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 04:47 -0800
          Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 13:04 +0000
            Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 05:57 -0800
              Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-23 01:33 +1100
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 06:55 -0800
                Re: Using filepath method to identify an .html page Dave Angel <d@davea.name> - 2013-01-22 10:05 -0500
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:21 -0800
                Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-23 02:27 +1100
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 11:36 -0700
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:40 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:40 +0000
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 17:07 -0700
                Re: Using filepath method to identify an .html page MRAB <python@mrabarnett.plus.com> - 2013-01-23 00:40 +0000
                Re: Using filepath method to identify an .html page rusi <rustompmody@gmail.com> - 2013-01-22 18:55 -0800
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 02:50 +0000
                Re: Using filepath method to identify an .html page rusi <rustompmody@gmail.com> - 2013-01-22 19:04 -0800
                Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-23 15:44 +1100
                Re: Using filepath method to identify an .html page Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 22:15 -0500
                Re: Using filepath method to identify an .html page MRAB <python@mrabarnett.plus.com> - 2013-01-23 03:35 +0000
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 22:10 -0700
                Re: Using filepath method to identify an .html page Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-23 01:13 -0500
                RE: Using filepath method to identify an .html page "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-23 16:33 +0000
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 08:51 -0800
                RE: Using filepath method to identify an .html page "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-23 18:19 +0000
                Re: Using filepath method to identify an .html page Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-01-23 18:36 +0000
                Re: Using filepath method to identify an .html page Dave Angel <d@davea.name> - 2013-01-23 17:46 -0500
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 08:51 -0800
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:34 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:35 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:34 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:36 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:36 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:37 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:39 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:38 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:39 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:37 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:38 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:39 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:36 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:35 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:37 +0000
                Re: Using filepath method to identify an .html page Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 16:44 -0500
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:21 -0800
                Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-23 02:07 +1100
                Re: Using filepath method to identify an .html page Peter Otten <__peter__@web.de> - 2013-01-22 16:25 +0100
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:46 -0800
                Re: Using filepath method to identify an .html page Dave Angel <d@davea.name> - 2013-01-22 11:11 -0500
                RE: Using filepath method to identify an .html page "Leonard, Arah" <Arah.Leonard@bruker-axs.com> - 2013-01-22 16:23 +0000
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:13 -0800
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 11:43 -0700
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:13 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:46 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:59 -0800
                Re: Using filepath method to identify an .html page Chris Angelico <rosuav@gmail.com> - 2013-01-23 03:11 +1100
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:26 -0800
                Re: Using filepath method to identify an .html page MRAB <python@mrabarnett.plus.com> - 2013-01-22 18:49 +0000
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 11:49 -0700
                Re: Using filepath method to identify an .html page Dave Angel <d@davea.name> - 2013-01-22 14:00 -0500
                Re: Using filepath method to identify an .html page Peter Otten <__peter__@web.de> - 2013-01-22 20:16 +0100
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 23:25 -0800
                Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-23 08:25 -0700
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 07:56 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-23 07:56 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 23:25 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:26 -0800
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 07:59 -0800
                Re: Using filepath method to identify an .html page John Gordon <gordon@panix.com> - 2013-01-22 16:55 +0000
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:07 -0800
                Re: Using filepath method to identify an .html page John Gordon <gordon@panix.com> - 2013-01-22 18:37 +0000
                Re: Using filepath method to identify an .html page Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-01-22 17:01 -0500
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 23:23 +0000
                Re: Using filepath method to identify an .html page rusi <rustompmody@gmail.com> - 2013-01-22 09:33 -0800
                Re: Using filepath method to identify an .html page Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-01-22 17:54 +0000
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 10:23 -0800
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 22:45 +0000
                Re: Using filepath method to identify an .html page Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-22 22:44 +0000
                Re: Using filepath method to identify an .html page Mitya Sirenef <msirenef@lightbird.net> - 2013-01-22 19:23 -0500
                Re: Using filepath method to identify an .html page Ferrous Cranus <nikos.gr33k@gmail.com> - 2013-01-22 06:55 -0800
  Re: Using filepath method to identify an .html page Michael Torrie <torriem@gmail.com> - 2013-01-22 11:21 -0700
  Re: Using filepath method to identify an .html page alex23 <wuwei23@gmail.com> - 2013-01-22 17:27 -0800

csiph-web