Hi all,

We have been running on CF since 1998 and quite happy with the performance
(with caching on!!). For example, yesterday we had 1.3 million hits and
200,000 page views with average download time of 3.4 seconds. (More than 60%
of the pages served were dynamic)

Regards
Govind Bhat
Technology Manager
www.50plus.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:CF-Talk-list@;houseoffusion.com]
Sent: October 30, 2002 6:08 AM
To: [EMAIL PROTECTED]
Subject: CF-Talk-list V1 #57


CF-Talk-list                   Wed, 30 Oct 2002           Volume 1 : Number
57

In this issue:

        Re: Shorter urls?
        RE: Shorter urls?
        RE: Yahoo moving to PHP
        RE: OT:Yahoo moving to PHP
        Re: Yahoo moving to PHP
        cfc question
        RE: cfc question
        RE: cfc question
        Re: Shorter urls?
        cfc error help
        cfc question
        RE: cfc question
        Re: columns of user-editable text: Link to Excel sheet?
        RE: MX Installation: Client Variables Not Changing (Part 2!)
        OT:Looking for a good SQL mailing list
        RE: Looking for a good SQL mailing list
        Re: OT:Looking for a good SQL mailing list
        RE: OT:Yahoo moving to PHP
        Re: Yahoo moving to PHP
        RE: cfc error help
        Converting HTML to images (JPG/GIF)


----------------------------------------------------------------------

Date: Tue, 29 Oct 2002 22:08:26 -0500
From: Christian Cantrell <[EMAIL PROTECTED]>
Subject: Re: Shorter urls?
Message-ID: <[EMAIL PROTECTED]>

Here's an interesting solution.  It's not perfect (just threw the code 
together), but it works.  It has the additional benefit of adding a 
level of security to your application because it hashes your query 
string in a way that cannot be reversed (essentially obfuscates it in a 
non-reversible manner).  It also assumes that once you have created a 
shorter query string, you will eventually want to recover the original 
query string, probably in the page processing the request that contains 
the query string.

Start by including these two functions:

<cfscript>
     function getShortString(str) {
         var key = "";
         if (false is isDefined("application._strMap")) {
             application._strMap = structNew();
         }
         key = hash(str);
         application._strMap[key] = str;
         return key;
     }

     function getLongString(key) {
         if (false is isDefined("application._strMap")) {
             return "";
         }

         if (false is structKeyExists(application._strMap, key)) {
             return "";
         }
         return application._strMap[key];
     }
</cfscript>

Then create your querystrings like this:

<cfset qs = "a=b&b=c&c=a" />
<a 
href="someProcessingPage.cfm?q=<cfoutput>#getShortString(qs)#</cfoutput>">cl
ick 
here</a>

In the processing page, retrieve the original querystring like this:

<cfset qs = "#getLongString(url.q)#" />
The full querystring is <cfoutput>#qs#</cfoutput>.

Of course, you could do something a little more clever like creating a 
function that returns a struct or parses the querystring and puts the 
values in the URL scope so that you could retrieve them just as though 
they were literally passed in the URL as opposed to actually getting 
back a query string, but you get the idea.

Your query string has to be over 32 characters before this technique 
starts to pay for itself in terms of length since the hash() function 
returns a 32 byte string.  As I mentioned earlier, it has the added 
benefit of completely obscruing the data you pass in your query string, 
too, since the MD5 hash is not reversable.

If you decide to implement something like this, consider variable locking.

Hope this helps.

Cantrell

Ian Lurie wrote:
> Hi all,
> 
> I've searched the devcenter, google, etc. but can't seem to find any
> discussion of how to generate shorter URL strings. I want to take:
> 
> http://www.site.com?action=blah&brand=1&name=blahblah&;....
> 
> And convert it to 
> 
> http://www.site.com/asdfwer234123
> 
> I've seen it done but just can't remember where. Can someone send me a
url?
> 
> Thanks in advance,
> 
> Ian


-- 
Christian Cantrell
[EMAIL PROTECTED]
(571) 220-8659 (mobile)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm

------------------------------

Date: Tue, 29 Oct 2002 22:16:26 -0500
From: "Matt Liotta" <[EMAIL PROTECTED]>
Subject: RE: Shorter urls?
Message-ID: <000101c27fc2$bb740100$c801a8c0@FREEWILL>

This technique seems like a waste of processing time when the underlying
Java object already provides the same thing. From the documentation...

hashCode
public int hashCode()

Returns the hash code value for this map. The hash code of a map is
defined to be the sum of the hash codes of each entry in the map's
entrySet() view. This ensures that t1.equals(t2) implies that
t1.hashCode()==t2.hashCode() for any two maps t1 and t2, as required by
the general contract of Object.hashCode.

This implementation iterates over entrySet(), calling hashCode on each
element (entry) in the Collection, and adding up the results.

See my earlier response to the question for an example of using the
hashCode method with a Map.

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Christian Cantrell [mailto:qantrell@;yahoo.com]
> Sent: Tuesday, October 29, 2002 10:08 PM
> To: CF-Talk
> Subject: Re: Shorter urls?
> 
> Here's an interesting solution.  It's not perfect (just threw the code
> together), but it works.  It has the additional benefit of adding a
> level of security to your application because it hashes your query
> string in a way that cannot be reversed (essentially obfuscates it in
a
> non-reversible manner).  It also assumes that once you have created a
> shorter query string, you will eventually want to recover the original
> query string, probably in the page processing the request that
contains
> the query string.
> 
> Start by including these two functions:
> 
> <cfscript>
>      function getShortString(str) {
>          var key = "";
>          if (false is isDefined("application._strMap")) {
>              application._strMap = structNew();
>          }
>          key = hash(str);
>          application._strMap[key] = str;
>          return key;
>      }
> 
>      function getLongString(key) {
>          if (false is isDefined("application._strMap")) {
>              return "";
>          }
> 
>          if (false is structKeyExists(application._strMap, key)) {
>              return "";
>          }
>          return application._strMap[key];
>      }
> </cfscript>
> 
> Then create your querystrings like this:
> 
> <cfset qs = "a=b&b=c&c=a" />
> <a
>
href="someProcessingPage.cfm?q=<cfoutput>#getShortString(qs)#</cfoutput>
">
> click
> here</a>
> 
> In the processing page, retrieve the original querystring like this:
> 
> <cfset qs = "#getLongString(url.q)#" />
> The full querystring is <cfoutput>#qs#</cfoutput>.
> 
> Of course, you could do something a little more clever like creating a
> function that returns a struct or parses the querystring and puts the
> values in the URL scope so that you could retrieve them just as though
> they were literally passed in the URL as opposed to actually getting
> back a query string, but you get the idea.
> 
> Your query string has to be over 32 characters before this technique
> starts to pay for itself in terms of length since the hash() function
> returns a 32 byte string.  As I mentioned earlier, it has the added
> benefit of completely obscruing the data you pass in your query
string,
> too, since the MD5 hash is not reversable.
> 
> If you decide to implement something like this, consider variable
locking.
> 
> Hope this helps.
> 
> Cantrell
> 
> Ian Lurie wrote:
> > Hi all,
> >
> > I've searched the devcenter, google, etc. but can't seem to find any
> > discussion of how to generate shorter URL strings. I want to take:
> >
> > http://www.site.com?action=blah&brand=1&name=blahblah&;....
> >
> > And convert it to
> >
> > http://www.site.com/asdfwer234123
> >
> > I've seen it done but just can't remember where. Can someone send me
a
> url?
> >
> > Thanks in advance,
> >
> > Ian
> 
> 
> --
> Christian Cantrell
> [EMAIL PROTECTED]
> (571) 220-8659 (mobile)
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The
place for dependable ColdFusion Hosting.

------------------------------

Date: Tue, 29 Oct 2002 23:04:45 -0500
From: Nick McClure <[EMAIL PROTECTED]>
Subject: RE: Yahoo moving to PHP
Message-ID: <[EMAIL PROTECTED]>

I work on that gets nearly 1million hits a day during the course of the
event.

http://www.rk3de.org

All CF, has been for 5 years.

>What is the most high trafficked website/application made with
>ColdFusion you guys know?


Reply via email to