Xona.com Hit Counter Stopped at 7,000,000 Page Views
Tuesday, December 21, 2010
By: Matthew Doucette

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:

2017/Apr/10 Exploring Non-Euclidean Geometry
2017/Feb/04 Another Way to Create a GitHub Repository
2016/Jul/05 XNA 5.0 Officially Declined by Microsoft
2016/Jun/06 Unity Game Development Tutorial
2016/May/01 Xonafish (Chess Engine)
2016/Mar/25 2D Game Development Tutorial - Part 1 - Installing the Software
2016/Mar/17 Introducing Xona Learn
2016/Mar/17 2D Game Development Tutorial - C#/XNA (PC/X360/PS4/XB1)
2015/Nov/30 Tandy 1000 SX
2014/Oct/10 Speed Up DOSBox

External Links:

 

About the Author: I am Matthew Doucette of Xona Games, an award-winning indie game studio that I founded with my twin brother. We make intensified arcade-style retro games. Our business, our games, our technology, and we as competitive gamers have won prestigious awards and received worldwide press. Our business has won $180,000 in contests. Our games have ranked from #1 in Canada to #1 in Japan, have become #1 best sellers in multiple countries, have won game contests, and have held 3 of the top 5 rated spots in Japan of all Xbox LIVE indie games. Our game engines have been awarded for technical excellence. And we, the developers, have placed #1 in competitive gaming competitions -- relating to the games we make. Read about our story, our awards, our games, and view our blog.



Home | Games | Awards | About | Learn | Blog | Press Kit | Contact
Email:

Xona Games, Xona.com, Xonatech, Saw Tooth Distortion, Evolutionary Prototype (EP), Duality ZF, Decimation X, Decimation X2,
Decimation X3, Decimation X3.5, Decimation X4, Score Rush, Score Rush 2, Score Rush (HTML5), Score Rush MP, and Score Rush Extended (Score Rush EX)
trademarked and copyrighted by Xona Games Inc., Matthew Doucette, and/or Jason Doucette.
© 2000..2005 Saw Tooth Distortion. © Xona.com. © 2008..2010 Xona Games (under Xona.com).
© Xona Games Inc.

We make Intense Retro video games.