counter

how can I make visitor counter in php? [closed]

喜欢而已 提交于 2019-12-01 11:41:22
How I can count visitors ?? I want to insert when open the page and when close or leave the page but not onunload And I don't want to insert when refresh the page the below code help me to insert when open the page , but not help when close session_start(); if (!isset($_SESSION["visits"])) $_SESSION["visits"] = 0; if ($_SESSION["visits"] > 1){ echo 'visit='.$_SESSION["visits"]; echo "You hit the refresh button!";} else{ mysql_query( "INSERT INTO najd_visit( visit_userId, visit_staticId, visit_page, visit_enterTime)VALUES ('$userId', '$Sid', '$title', '$date') "); $_SESSION["visits"] = $

Can you make Counter not write-out “Counter”?

南笙酒味 提交于 2019-12-01 10:32:19
So when I print the Counter ( from collections import Counter ) to a file I always get this the literal Counter ({'Foo': 12}) Is there anyway to make the counter not write out so literally? So it would instead write {'Foo' : 12} instead of Counter({'Foo' : 12}) . Yeah it's picky, but I am sick of grep'n the thing out of my files afterward. You could just pass the Counter to dict : counter = collections.Counter(...) counter = dict(counter) In [56]: import collections In [57]: counter = collections.Counter(['Foo']*12) In [58]: counter Out[58]: Counter({'Foo': 12}) In [59]: counter = dict(counter

Can you make Counter not write-out “Counter”?

青春壹個敷衍的年華 提交于 2019-12-01 08:40:53
问题 So when I print the Counter ( from collections import Counter ) to a file I always get this the literal Counter ({'Foo': 12}) Is there anyway to make the counter not write out so literally? So it would instead write {'Foo' : 12} instead of Counter({'Foo' : 12}) . Yeah it's picky, but I am sick of grep'n the thing out of my files afterward. 回答1: You could just pass the Counter to dict : counter = collections.Counter(...) counter = dict(counter) In [56]: import collections In [57]: counter =

Using a counter inside an apply structured loop in R

邮差的信 提交于 2019-12-01 07:54:15
I'm trying to plot from a rather complex array in R. I want to produce an image with 3 by 3 graphs, each with red and blue points on it. I've got a structure of apply loops which works, but I'd like to change the y maximum value by each row. I would normally do this using a counter, like i, in other languages. But the apply thing in R is completely baffling me! par(mfrow=c(3,3),pty="s") # a 3 by 3 graphic set.seed(1001) x <- 1:54 # with 1 to 54 along the x axis y <- array(rexp(20), dim=c(54,6,3,2)) # and the y axis coming # from an array with dimensions as shown. ymax <- c(1,0.1,0.3) # three

counting element occurrences in nested lists

自作多情 提交于 2019-12-01 06:43:05
This is probably quite a straightforward question, but I can't find an answer elsewhere so I'll ask. What is the best way to find the number of times an element appears in a nested list? For example: my_list=[[a,b,c,d],[a,b,z,d],[a,c,f,e],[d,w,f,a]] How would I find how many times 'a' is the first element of the list? Or more generally, how many times 'a' appears in my_list at all? I imagine there's a way to do this with collections.Counter, but I haven't been able to figure it out. EDIT For my_list, I would like an output of a:3 when counting if it's the first element of the list. If the

Javascript, increment a counter on button click

女生的网名这么多〃 提交于 2019-12-01 06:25:09
问题 In javascript, I want to make a counter that increases the value when you click a button. When I click the add button the first time, the number doesn't increase. But when I print the value to the console, the result increases. The fiddle: http://jsfiddle.net/techydude/H63As/ $(function() { var //valueCount = $("counter").value(), counter = $("#counter"), addBtn = $("#add"), value = $("#counter").html(); addBtn.on("click", function() { counter.html(value ++); //this value is not incremented.

Step counter doesn't reset the step count

爷,独闯天下 提交于 2019-12-01 05:45:34
I am able to start and stop recording steps with the Sensor.TYPE_STEP_COUNTER by registering and unregistering the listener. However, the actual value that is passed to my app via the SensorEvent object does not reset to zero when the application is destroyed. If I close the app and restart it, or even if I recompile my app with updates, the counter picks up where it left off. If I run other apps that use the step counter sensor, they independently count their steps and reset their counter. Does the sensor have a cache that is app specific? What is the correct way to reset the sensor to zero

counting element occurrences in nested lists

心已入冬 提交于 2019-12-01 04:55:41
问题 This is probably quite a straightforward question, but I can't find an answer elsewhere so I'll ask. What is the best way to find the number of times an element appears in a nested list? For example: my_list=[[a,b,c,d],[a,b,z,d],[a,c,f,e],[d,w,f,a]] How would I find how many times 'a' is the first element of the list? Or more generally, how many times 'a' appears in my_list at all? I imagine there's a way to do this with collections.Counter, but I haven't been able to figure it out. EDIT For

Using a counter inside an apply structured loop in R

让人想犯罪 __ 提交于 2019-12-01 04:31:56
问题 I'm trying to plot from a rather complex array in R. I want to produce an image with 3 by 3 graphs, each with red and blue points on it. I've got a structure of apply loops which works, but I'd like to change the y maximum value by each row. I would normally do this using a counter, like i, in other languages. But the apply thing in R is completely baffling me! par(mfrow=c(3,3),pty="s") # a 3 by 3 graphic set.seed(1001) x <- 1:54 # with 1 to 54 along the x axis y <- array(rexp(20), dim=c(54,6

More than 120 counters in hadoop

戏子无情 提交于 2019-12-01 04:01:08
There's a limit for Hadoop counter size. It's 120 by default. I try to use the configuration "mapreduce.job.counters.limit" to change that, but it doesn't work. I've seen the source code. It's like the instance of JobConf in class "org.apache.hadoop.mapred.Counters" is private. Have anybody seen that before? What's your solution? THX :) You can override that property in mapred-site.xml on your JT, TT, client nodes but make sure that this will be a system-wide modification: <configuration> ... <property> <name>mapreduce.job.counters.limit</name> <value>500</value> </property> ... <