[thelist] Internet Sharing

Joshua OIson joshua at alphashop.net
Mon Jun 25 10:46:45 CDT 2001


I have a client using Win2k Server with internet sharing enabled to let NT
boxes share a single internet connection.  Odd thing is, for a few minutes
after a client-side ipconfig /release, ipconfig /renew it works great.
Then, it just stops working!  They can ping the server from the clients, but
they cannot ping past the server, even to the outside NIC of the server.
DNS lookups fail, etc.  Any ideas?

If this is off-topic:

<tip type="ColdFusion">
Are you needing to select 1 of n advertisers for display on a web page where
each advertiser has a "random-weight".  IOW, an advertiser with a weight of
2 will appear twice as often as an advertiser with 1, or an advertiser of 3
will appear three times as often as an advertiser with 1 and 1.5 times as
often as an advertiser of 2?

This technique may help.

Use

<cfquery name="get_ads">
SELECT id, weight FROM advertisers WHERE #conditional#
</cfquery>

to get the total sum of the weights within the set of advertisers.

<cfset ids = ValueList(get_ads.id)>
<cfset weights = ValueList(get_ads.weight)>

<cfset total_weight = "0">
<cfloop index="i" list="#weights#">
  <cfset total_weight = total_weight + i>
</cfloop>

<cfset r = RandRange(1, total_weight)>

<cfset i = "1">
<cfloop index="w" list="#weights#">
  <cfset r = r - w>
  <cfif r LTE "0">
    <cfset ad_id = ListGetAt(ids, i)>
    <cfbreak>
  </cfif>
  <cfset i = i + "1">
</cfloop>

ad_id will then display the id of the advertiser to requery and display.
</tip>

TIA,
-joshua





More information about the thelist mailing list