Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Using filepath method to identify an .html page

by Nik
on Jan 22, 2013 at 15:27 UTC ( #1014695=note: print w/replies, xml ) Need Help??


in reply to Re: Using filepath method to identify an .html page
in thread Using filepath method to identify an .html page

The only thing i know is that:

a) i only need to get a number out of string(being an absolute path)
b) That number needs to be unique, because "that" number is an indicator to the actual html file.

Will int function get the job done or a hashing method needs to get involved?

I dont know HOW 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)

pin = int ( '/home/nikos/public_html/index.html' )
This fails for me. Is it because it has slashes in it?

Replies are listed 'Best First'.
Re^3: Using filepath method to identify an .html page
by Corion (Pope) on Jan 22, 2013 at 15:28 UTC

    Why don't you create a database table with two columns. One column is "the string", and the other column is a unique integer. Most databases have an almost inexhaustible supply of unique integers for such columns.

      Integers need to be created on the fly when an html file is being requested.
      I just tried:
      pin = int( htmlpage.encode("hex"), 16 )
      but that also fails.

      The number needs to be a 4-digit integer only, if its to be stored in the database table correctly. So hex encoding is not usefull here.

        I did not mention a "hex encoding" anywhere in my reply. I suggest you actually read my reply, and use a database, or a "key value store", and build a map of words to numbers.

Re^3: Using filepath method to identify an .html page
by Anonymous Monk on Jan 22, 2013 at 15:30 UTC

    Will int function get the job done or a hashing method needs to get involved?

    Read int and then you will know, then write your own function

    I dont know HOW this is supposed to be written.

    Keep a database of numbers ( AnyDBM_File ), assign one to each path, and then you're done

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014695]
help
Chatterbox?
[Discipulus]: choroba if let your company to hire Tanktalus and marioroy ... what a big fishing!
[Discipulus]: i choice prague!!
[choroba]: 1200 years is enough :-)
[marioroy]: Lady_Aleena my $ans = qx! find . -name "*.pl" -exec ls -l {} \\; !;
[Tanktalus]: My basic problem right now is that if I were willing to move, I could be back in Toronto with a pay raise. We have a number of reasons for not wanting to do that.
[marioroy]: I had to backslash the backslash inside qx.
[Tanktalus]: marioroy++ # nice catch
[Lady_Aleena]: marioroy, that makes kinda makes sense.
[Discipulus]: yes i can survive also in younger town.. but when i passed i saw many strange letters..
[Lady_Aleena]: marioroy, sorry, I am not making sense right now.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2017-04-23 20:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.