Posts

php - Limit visitors statistics to 30 days -

i trying edit great visitor statistics script (php/mysql) ghaffar khan (full script @ http://www.codeproject.com/articles/35570/site-statistics-with-php-and-mysql ) having hard time trying limit visitors shown in graph stats past 30 days. there unfortunately no instruction on how , i've been struggling far. here main script: <?php include("configuration.php"); $page = input($_get['page']) or die('error: missing page id'); mysql_select_db($database, $con); // total visits count $query='select count( * ) total '.$tablename.' section=\''.$page.'\''; $result = mysql_query($query); $row = mysql_fetch_array($result, mysql_num); $count = $row[0]; // unique visitors count $query='select count(distinct ip) '.$tablename.' section=\''.$page.'\''; $result = mysql_query($query); $row = mysql_fetch_array($result, mysql_num); $uniaqucount = $row[0]; mysql_close($con); /* graph rendering...

aggregate - Counting in R and preserving the order of occurence -

suppose have generated vector using following statement: x1 <- rep(4:1, sample(1:100,4)) now, when try count number of occurrences using following commands count(x1) x freq 1 1 40 2 2 57 3 3 3 4 4 46 or as.data.frame(table(x1)) x1 freq 1 1 40 2 2 57 3 3 3 4 4 46 in both cases, order of occurrence not preserved. want preserve order of occurrence, i.e. output should this x1 freq 1 4 46 2 3 3 3 2 57 4 1 40 what cleanest way this? also, there way coerce particular order? one way convert variable factor , specify desired order levels argument. ?table : "table uses cross-classifying factors build contingency table of counts @ each combination of factor levels"; "it best supply factors rather rely on coercion.". converting factor yourself, in charge on coercion , order set levels . x1 <- rep(factor(4:1, levels = 4:1), sample(1:100,4)) table(x1) # x1 # 4 3 2 1 # 90 72 11 16

c# - WinForms Designer - Adding control to tabPage -

i have 1 tabcontrol 4 tabpages. added appropriated controls in first 3 tabpages without problems, when try add(drag , drop toolbox) textbox tabpage4(active, highlighted element) goes tabpage1 instead. is strange designer bug or missing option ? that's weird couldn't reproduce same behaviour, visual studio sp1 installed?

java - No response after installing my own eclipse plugin -

recently have developed eclipse plugin, exported plugin method "export" > "deployable plug-ins , fragments" , after got .jar plugin , , put ~/eclipse/plugins , plugin has shown in eclipse. of workmates have no response after put ~/eclipse/plugin , of them can while can't. ones use adt-bundle install plugin have no response. have changed build jar method to: "export" > "jar file" , failed. build jar method wrong or install method jar wrong? first guess colleagues have dependency issues prevents plugin loading. easy check: "help" -> "about" -> "installation details", click on tab "configuration". see list containing entries such as; org.apache.commons.io (2.0.1.v201105210651) "apache commons io" [resolved] org.apache.commons.lang (2.6.0.v201205030909) "apache commons lang" [resolved] org.apache.commons.logging (1.1.1.v201101211721) "apache commons lo...

javascript - Error: Syntax error, unrecognized expression: a[rel= {myString} ] -

i working on small application , got stuccked on small error. firebug: error: syntax error, unrecognized expression: a[rel=!a1=0,1000,0,0,0,1,0,0.4] jquery.1.11.js (line 1471) throw new error( "syntax error, unrecognized expression: " + msg ); what app does: [not important] sends form data php processinf , retrieves , display received data. after data displayed adds link variables store data [ in case user needs send page queries other user] at page load process repeated [script sends data; php process data; send etc]. problem error in firebug. idea? this of code: after form submit , data received: function addtolink(){ /* set vars manually not important */ var tip = 0; var suma = 1000; var pai = 0; var cdm = 0; var bdm = 0; var fdb = 1; var sni = 0; var mbp = 0; var qlink = tip+','+suma+','+pai+','+cdm+','+bdm+','+fdb+','+sni+','+mbp ; window.loc...

javascript - Backbone, keep a models data even after the page was refreshed -

i building rest api. client side, use backbone. upon authentication, api sends token via ajax on backbone's session model. i place token using jquery's ajaxprefilter method, send token towards api on every request. everything works perfect, until users refreshes page. if page refreshed, token lost, model re-initializes , user has authenticate again. how can bypass this? 1. store token inside cookie (very unsafe, bad idea) - defeats rest purpose. 2. store token inside localstorage - equally bad, believe. is there else can done? thank you! you can store token both ways. if you're using ssl, token available client (and nsa, maybe) brings no problem. i rather store token using localstorage unless client doesn't supports it. you can check answer keep session across page reload in backbone js

gcc - Static local C variables are followed by a number in assembler code. Is that number random? -

i wonder if number follows local static variable name in assembler random or if there meaning. compiled sample c source gcc v. 4.7.2 in debian wheezy; assembler listing shows row containing: .comm i.1705,4,4 where 1705 come from? thank in advance. here source: int main() { static int i=0; return i; } it counter of identifiers encountered during compilation. if put declaration behind, gives me next number. if put another, non-static, object in between difference 2.