Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
What i want to do, is to associate a number to an html page's absolute path for to be able to use that number for my database relations instead of the BIG absolute path string.

so to get an integer out of a string i would just have to type:

htmlpage = a string respresenting the absolute path of the requested .html file
# =========================================================== # produce a hash string based on html page's filepath and convert it t +o an integer, that will then be used to identify the page itself # =========================================================== pin = int( htmlpage )
But would that be unique?



Here is some background information:

This counter script 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

In addition to that my counter.py script maintains details in a database table that stores information for each and every webpage requested.

My 'visitors' database has 2 tables:

pin --- page ---- hits (that's to store general information for al +l html pages) <br><br> pin <-refers to-> page <br><br> pin ---- host ---- hits ---- useros ---- browser ---- date (that's t +o store detailed information for all html pages) <br><br> (thousands of records to hold every page's information) <br><br>
'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!!!

So i really - really need to associate a (4-digit integer <=> htmlpage's absolute path)

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.

In reply to Using filepath method to identify an .html page by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-03-28 14:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found