Posts

javascript - Change Graph in the div using Drop Down List. -

here html code generate drop-down list - <form method="post" action="abc.php"> <select name="daterange" id="myselect" size="1" onchange="window.location=this.options[this.selectedindex].value"> <option value > select duration </option> <option value="/abc.php/?daterange=1d">last 24 hours</option> <option value="/abc.php/?daterange=2d">last 2 days</option> <option value="/abc.php/?daterange=1w">last week</option> <option value="/abc.php/?daterange=2w">last 2 weeks</option> <option value="/abc.php/?daterange=1m">last month</option> <option value="/abc.php/?daterange=3m">last 3 months</option> <option value="/abc.php/?daterange=6m">last 6 months</option> <option value="/abc.php...

javascript - How to know how much time a user has our webpage open -

i'm trying guess how time user expend on website in php. that, thinking every new action on web, difference between $_server['request_time'] , current. planning stats of current hosting don't know if can these values via php request. point of view using first , second method, in advice should i'm not happy first option, cause server collapsed if amount of petitions high..., otherwise don't know other way if me, wonderful. on website i'm using html5, css3, php, javascript, jquery, ajax , mysql database. supposed i'd store , count time users stay logged in webpage. in advice. there few ways of doing this, 1 way accurate readings. php time difference this method talking checking time difference. mark time user visited page. when visitor navigates page, subtract 2 times , have duration user looking @ previous page. to make myself little more clear, below basic layout of actions need perform make php time difference method work. log cur...

math - strange behavior when calculating numbers in PHP -

when run following php script calculating discount of 30% 11.5. i'll strange result. expect condition false when testing calculated result. instead true. whats wrong php in case? <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo $_result !== 8.05; // returns 1 instead of 0 ?> try use this : <?php $_discount = 30; $_price = 11.5; $_qty = 1; echo $_result = ((1-$_discount / 100) * $_price); // result 8.05 echo $_result; // prints 8.05; echo gettype($_result); // prints double echo (double)$_result !== 8.05; ?>

How to handle duplicate tags when creating tag in Asana API -

i using ruby wrapper "asana" create integration asana api. 1 problem when test tag creation through curl seems asana doesn't take care of duplicating tags. i.e. when following command twice. generate 2 tags different tag id. can asana detect duplicate tags , merge tasks together? curl -u <my_api_key>: https://app.asana.com/api/1.0/tags \ -d "name=test tag" \ -d "workspace=123123123" 1st response: {"data":{"id":11800363445095,"created_at":"2014-04-22t10:03:19.888z","name":"test tag","notes":"","....:[]}}% 2nd response: {"data":{"id":11800365867646,"created_at":"2014-04-22t10:03:27.501z","name":"test tag","notes":"","....:[]}}% note although tags have same name, have different ids. want if task created same tag name, fall on previous tag id. tags, p...

html - How to use JQuery to auto reload div content every X seconds? -

i have been doing web page, , encountered problem on reloading div content. i have done research, , of examples found on has "script.php" on .load(), not need... ( example ) is there way use .load() load specific div content again? (btw, sry bad english etc... , hope explanation makes sense) code: <head> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> function update(){ $('#div1').load("index.html #div1"); } setinterval( 'update()', 1000 ); </script> </head> <body> <div id="div1"> <script language="javascript"> <!-- date=date() document.write(date) //--> </script> ...

jquery - jqXHR Status Code Mismatch -

Image
i seeing status code of 302 on network tab of chrome dev tools getting 200 within error callback of ajax request. how possible 200 success inside error ? someone clear air please.

mysql - Previous/next button in PHP -

i´m pretty entirely new php, please bear me. i´m trying build website running on cms called core. i'm trying make previous/next buttons cycle through tags rather entries. tags stored in database core_tags. each tag has own tag_id, number. i've tried changing excisting code thep previous/next buttons, keeps giving me 'warning: mysql_fetch_array() expects parameter 1 resource, null given in /home/core/functions/get_entry.php on line 50'.' any appreciated. get_entry.php: <?php $b = $_server['request_uri']; if($entry) { $b = substr($b,0,strrpos($b,"/")) . "/core/"; $id = $entry; $isperma = true; } else { $b = substr($b,0,mb_strrpos($b,"/core/")+6); $id = $_request["id"]; } $root = $_server['document_root'] . $b; $http = "http://" . $_server['http_host'] . substr($b,0,strlen($b)-5); require_once($root . "user/configuration.php"); require_once($root ...