|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Optimized redirection (cgi/perl)
Here's a simple redirection perl script:
Code:
#!/usr/bin/perl -wT print "Location:http://www.nba.com/\n\n "; sleep(15); exit; Is there anyway to cause the redirect to take place immediately, and then perform the calculations afterwards? |
|
|
|
|
|
#2 |
|
♥♥♥ Likes Hugs ♥♥♥
Industry Role:
Join Date: Nov 2001
Location: /home
Posts: 15,841
|
Not efficiently. The only way I can think of to do something like that is to fork() a process off and do the calculations there, but I absolutely would not do that unless it is absolutely necessary. Hopefully though, your code is smooth enough to do the calculations before the user is forwarded. Simple mathematic calculations should be carried out in a fraction of a second. The user shouldn't get impatient and close the browser in that .10 of a second.
|
|
|
|
|
|
#3 |
|
Confirmed User
Industry Role:
Join Date: May 2002
Location: oregon.
Posts: 2,243
|
uh yeah. you should be able to do all the processing before and then fire off the location header..
if you're doing that complicated of processding you may need to move to either real-time analysis (not real-time calculation) or go with a batch approach (i.e. cronjob every x minutes.)
__________________
php/mysql guru. hosting, coding, all that jazz. |
|
|
|
|
|
#4 |
|
Confirmed User
Join Date: Jan 2002
Location: In the walls of your house.
Posts: 3,985
|
Try using the following code...
Code:
#!/usr/bin/perl -wT $| = 1; print "Location:http://www.nba.com/\n\n "; sleep(15); exit; it to 1 tells it not to buffer anything but output immediately. In general its a bad idea not to buffer but this will redirect immediately. |
|
|
|
|
|
#5 |
|
Registered User
Industry Role:
Join Date: May 2001
Location: Са́нкт-Петербу́рг
Posts: 10,945
|
You randomization layers are too low.
Add a couple of glitch targeting mechanisms in order to better bedunktify the layering effect caused by the circumpreferential treatment of African Americans. fo shizzy. |
|
|
|
|
|
#6 |
|
Confirmed User
Join Date: May 2001
Location: ICQ: 25285313
Posts: 993
|
what netrodent said should work well.
-Phil |
|
|
|
|
|
#7 |
|
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Labert, what?
NetRodent, cool i'll try that. When the script in question is only going to output a redirect (one line of text), then 'turning off' the buffer should not be a problem. Damn, I never knew there was a buffer, this is why I was confused by the waiting. mik503, I do batch processing. I'm creating a tracker which logs raw data and it gets processed every update of the site. However, sending hits out and tracking hits in has to be accomplished in real time. The only calculations are updates to these real-time tables that stores url info, hits in, hits out, clicks produced, and where every IP has gone so I don't send it back to the same place twice. The calculations should be quick, but some of these are calculations that can be performed AFTER the destination is known (for permanent links). For blind links, the calcuations have to be performed beforehand. Armed & Hammered, I thought of performing a fork too, but NetRodent's idea is the best solution I think. Thanks all. |
|
|
|
|
|
#8 | |
|
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
Quote:
|
|
|
|
|
|
|
#9 | |
|
Confirmed User
Join Date: Jan 2002
Location: In the walls of your house.
Posts: 3,985
|
Here's what the perl documentation has to say about the $| variable at http://www.perldoc.com/perl5.6/pod/perlvar.html
Quote:
this: Code:
#!/usr/bin/perl -wT $| = 1; # unbuffer this print "Location:http://www.nba.com/\n\n "; $| = 0; # buffer everything else open(LOG, ">>log"); print LOG "blah blah blah\n"; close LOG; exit; |
|
|
|
|
|
|
#10 |
|
Confirmed User
Join Date: Jan 2001
Posts: 3,539
|
$|=1; made the redirection work faster but it was messing up my file writing (I did a $|=0; right after the redirect). Very strange. No scripting errors or anything, just that the file wasn't being written to where it was before.
|
|
|
|