Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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

by Anonymous Monk
on Jan 22, 2013 at 16:31 UTC ( #1014719=note: print w/replies, xml ) Need Help??

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

So, what you want is a function foo() and its inverse foo'() that does this:

foo( "some long string" )  -->  1234
foo'( 1234 ) --> "some long string"


In other words, you want to keep the entire information content of the original string.

There are only two ways to do this:

  1. keep the original string, i.e. store it in a database of some sort, or
  2. lossless compression of the original string into a short number. While theoretically possible, the compression ratio you're asking for isn't going to be possible.

Which leaves the first option, as plenty of people here have described.

So: You've said you already have a database with a column that stores a 4-digit number. If that database table doesn't already have a column that stores the HTML page's absolute path, then add one. You'll also want a UNIQUE constraint on the column with the number (and/or the other column, depending on your database design). The rest is "just" SQL...

  • Comment on Re^7: Using filepath method to identify an .html page

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1014719]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2023-06-07 09:08 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (29 votes). Check out past polls.