Home | Games | Awards | About | Blog | Media | Contact | Other
Xona.com Hit Counter Stopped at 7,000,000 Page Views
Tuesday, December 21, 2010
By: Matthew Doucette
(printer friendly version)

We stopped our xona.com hit counter a few days ago. It was over 7,000,000 page views, started on July 27th, 2004. This makes for over 3,000 page views everyday on average, since day one, not including all our domain hack views.

If you scroll to the bottom of our articles, you will see that xona.com use to be a non-profite technology article website, as well as offering Windows freeware and web utilities, all free. Now, of course, we are all about games, and have quite a story in gaming behind us building up.

The reason we stopped our counter was because, due to increased traffic, it continually would lose it's data, despite us locking the counter file. You can look at our code and let us know if you see what we coded wrong:

newcount.cgi:

#!/usr/bin/perl
print "Content-type:text/html\n\n";
open FH, "<newcount.dat";
flock FH, 2;
seek FH, 0, 0;
$count = <FH>;
$count = $count + 1;
close FH;

if ($count <= 2)
{
 # count did NOT work

 open FH2, ">>newcounterror.txt";
 flock FH2, 2;
 seek FH2, 0, 2;
 print FH2 "$count\n";
 close FH2;
 print "Indeterminable\n";
}
else
{
 # count worked

 open FH, ">newcount.dat";
 flock FH, 2;
 seek FH, 0, 0;
 print FH "$count\n";
 close FH;
 $ones = $count % 1000;
 $count = ($count - $ones) / 1000;
 $thousands = $count % 1000;
 $count = ($count - $thousands) / 1000;
 $millions = $count % 1000;
 $count = ($count - $millions) / 1000;
 $billions = $count % 1000;
 if ($billions > 0) { printf("%d,%03d,%03d,%03d",$billions,$millions,$thousands,$ones); }
 elsif ($millions > 0) { printf("%d,%03d,%03d",$millions,$thousands,$ones); }
 elsif ($thousands > 0) { printf("%d,%03d",$thousands,$ones); }
 elsif ($ones > 0) { printf("%d",$ones); }
}

exit;

The newcount.dat file would continually lose its data, the script would print out "Indeterminable" (see the code above), and newcounterror.txt would fill with "1"s (the value of the counter) each on their own line, when our traffic would go up.

For now, we have too much on our plate to worry about hit counters messing up, so we decided to pull it!

Feel free to contact us if you see the problem in our code above.

 

More Tech Articles:

2010/Dec/21 Xona.com Hit Counter Stopped at 7,000,000 Page Views
2009/Sep/01 Was Gmail Down For Everyone?
2009/Apr/05 Xona.com's Top 10 Articles of 2008
2007/Feb/11 Editing Google Toolbar Dictionary
2007/Feb/05 Ramblings in Realtime
2007/Feb/05 Ramblings in Realtime: Chapter 1: Inside Quake - Visible Surface Determination
2007/Feb/05 Ramblings in Realtime: Chapter 2: Consider the Alternatives - Quake's Hidden Surface Removal
2007/Feb/05 Ramblings in Realtime: Chapter 3: Sorted Spans in Action
2007/Feb/05 Ramblings in Realtime: Chapter 4: Quake's Lighting Model - Surface Caching
2007/Feb/05 Ramblings in Realtime: Chapter 5: Surface Caching Revisited - Quake's Triangle Models and More

External Links:

 

About the Author: I am Matthew Doucette of Xona Games, an award-winning, indie game studio I run with my twin brother. We make intense retro games. Our company, our games, and our engine technology have all won prestigious awards and received worldwide press. Our games have ranked from #1 in Canada to #1 in Japan, as well as become #1 best sellers in multiple countries. Read about our story and our blog.


Email:
Xona Games, Xona.com, Xonatech, Saw Tooth Distortion, Duality ZF, Decimation X, Decimation X2, Decimation X3, and Score Rush
trademarked and copyrighted by Xona Games, Inc., Jason Doucette, and Matthew Doucette.
© Xona Games, Inc.