counter

File counter adds 2 instead of 1

I made a simple counter, but it increments by 2 instead of 1. $handle = fopen('progress.txt', 'r'); $pro = fgets($handle); print $pro; // incremented by 2, WTF? fclose($handle); $handle = fopen('progress.txt', 'w'); fwrite($handle, $pro); fclose($handle); Everytime I read the file it has been incremented ...

HIt counter in JSF

I want to add a hit counter to my JSF web app. Like in PHP we can use an external text file to store the count and increment and write it on every request. How to use in JSF? ...

How do you make a count that counts the number of page-views? (PHP)

For each ad on my site, I would like a box that shows the number of views it has (similar to this site). How would I capture the number of page views an ad has? Is there a function that does this in PHP? ...

Daily, Weekly and Monthly Page View Counter

I'm building a website with user generated content. On the home page I want to show a list of all created items, and I want to be able to sort them by a view counter. That's sound easy, but I want multiple counters. I want to know which was the most visited item in the last day, last week or last months or overall. My first Idea was to ...

jQuery: Counter, Tricky problem with effects for brainy people.

Hello there! I made this counter that I think is cool because it only makes visible changes to the numbers being changed between each time it is triggered. This is the code // counter $('a').click(function(){ var u = ''; var newStr = ''; $('.counter').each(function(){ var len = $(this).children('span').length; ...

jQuery - Compatibility Problem with Internet Explorer 7 and Opera

Hello there, I have this counter which counts + 1 every time somebody shares content from the site. When it happens, the social icon that was clicked will bounce. It works in Firefox,Chrome, IE8, and Opera, however the bouncing animation is wrong in opera. $.fn.countExternal = function(animSpeed, num) { // for each counter this.e...

How to access CSS generated content with JavaScript

I generate the numbering of my headers and figures with CSS's counter and content properties: img.figure:after { counter-increment: figure; content: "Fig. " counter(section) "." counter(figure); } This (appropriate browser assumed) gives a nice labelling "Fig. 1.1", "Fig. 1.2" and so on following any image. Question: How can I ac...

How can I access the C# performance counter in the code?

I want to use the performance counter output in my program. How can I access the performance counter in code without using the perfmon.exe. I want to create my own performance counter app. ...

Is there a way to know how many times my jar (in public Maven repository) is downloaded through Maven?

For statistical reasons, we need to know how often our library (jar) is used. When users download the jar from our website, we have a built-in script that counts the downloads. We have recently also included the jar in the Maven public repository. Is there a way to get statistics on how often the jar is actually downloaded through Maven?...

jQuery character counter inside newly created tooltip

I'm having a difficult time figuring this one out. I'm attempting to have a user open a tooltip (using jQuery qTip). What this does is create a "new" tooltip element on the page; it takes it from an existing hidden HTML div on the webpage. Once this new tooltip is created, it has a character counter that is supposed to dynamically up...

High-concurrency counters without sharding

This question concerns two implementations of counters which are intended to scale without sharding (with a tradeoff that they might under-count in some situations): http://appengine-cookbook.appspot.com/recipe/high-concurrency-counters-without-sharding/ (the code in the comments) http://blog.notdot.net/2010/04/High-concurrency-counter...

how to implement a counter in label which decrements every time page is loaded in asp.net(vb)?

how to implement a counter in label which decrements every time page is loaded in asp.net(vb)? It would be better if that counter value is accessed from and updated into database.. I've tried this on buttonclick but the value is reset automatically to intial value everytime as the button is insert and page is reloaded Protected Sub Ins...

ASP.Net Using LINQ SQL as a Counter

Is there a better way to use LINQ to act as a counter each time a button is pressed? Seems like there should be a better way then having a LINQ statement run and get the current value and then an addition statement to insert the old value + 1. ...

Stored Procedure Hit Counter

I have a table with 3 column's in a table on a MS SQL 2008 Database ID ToolID Count Can someone toss me a script that will create a stored procedure that accepts the param ToolID and increases its value by 1? All of my efforts have failed. ...

fread how to Count total from Counter text

hey i have a counter text here and i need to know how to calculate the total this is my information $filename = "data.txt"; $handle = fopen($filename, "r"); $contents = fread($handle, filesize($filename)); $expode = explode("\n",$contents); /** output 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 1024 */ I i need to...

How to use javascript class from within document ready

Hi, I have this countdown script wrapped as an object located in a separate file Then when I want to setup a counter, the timeout function in the countdown class can not find the object again that I have setup within the document ready. I sort of get that everything that is setup in the document ready is convined to that scope, howeve...

Creating Auto Incrementing column in Google Appengine

What is the easiest and most efficient way to create an auto-increment counter for every data row in google appengine? basically I want to give every row a unique row_number so that I can overcome the issue of only being able to get the first 1000 results in a select query. I can thus add a counter lies between condition and mine all th...

Increment global variable on click in flash, actionscript 3

Hi, Making a flash page that can cycle through these three images on mouseclick. For some reason the local changes to count are not reflected on the global one. I tried _global but the syntax was odd and gave me errors. How should I implement this? import flash.events.Event; var images:Array = ["images/image.jpg", "images/image2.jp...

Updating counters through Hibernate

This is an extremely common situation, so I'm expecting a good solution. Basically we need to update counters in our tables. As an example a web page visit: Web_Page -------- Id Url Visit_Count So in hibernate, we might have this code: webPage.setVisitCount(webPage.getVisitCount()+1); The problem there is reads in mysql by defaul...

Update count every second causing massive memory problems

Just on my local machine, trying the run the following script causes my computer to crash... What am I doing wrong? (function($) { var count = '6824756980'; while (count > 0) { setInterval(function() { $('#showcount').html(Math.floor(count-1)); c...