Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-14 Thread Mahdi Farhat
 


i want faster request .. 300-400 ms is too high ..sometime they go down to 
150  , ifyou can check bidzeed.co M the request is 90ms 
what do you think shall i do 

On Sunday, June 12, 2016 at 4:18:35 PM UTC+3, Walter Lee Davis wrote:
>
> It's not clear what your goal is. Do you want to reduce the number of 
> requests from the page to your server, as I suggested, or do you want each 
> request to be faster? In you message, you mentioned that I was seeing the 
> faster return because "the cache was on". I can't think of a reason why you 
> would ever want that cache to be off, or what you would gain by having it 
> off. It's hard to see what your problem is, other than the overall design 
> of how the page works (making 1 request per second for as long as the page 
> is loaded). 
>
> Walter 
>
> > On Jun 11, 2016, at 7:47 PM, Mahdi Farhat  > wrote: 
> > 
> > i have sent you an email on 
> > 
> > wal**@wdstudio.com 
> >  please reply 
> > 
> > 
> > On Saturday, June 11, 2016 at 9:28:59 PM UTC+3, Walter Lee Davis wrote: 
> > I'm watching it in the Network pane of Safari Web Inspector. It's 
> running at a total duration of 1.464 ms, but a latency of 159.4 ms. So your 
> server is replying nearly instantly when it gets the request, but there's a 
> lag while the message travels to and fro. Overall, this is astoundingly 
> fast. 
> > 
> > What I have seen pages like this do, however, is only update to the 
> server every few minutes or more, and have the browser's JavaScript update 
> the tick tock countdown timer independently. Let the local time drift out 
> of synch with the server, then catch up each time the "heartbeat" connects 
> back to the server. I can't imagine that this will be as fast when there 
> are hundreds of visitors connecting at once, constantly pinging every 
> second. 
> > 
> > Walter 
> > 
> > > On Jun 11, 2016, at 1:07 PM, Mahdi Farhat  wrote: 
> > > 
> > > please check li1510-169.members.linode.com 
> > > 
> > > On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis 
> wrote: 
> > > 
> > > > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  
> wrote: 
> > > > 
> > > > i asked a developer to develop me a a penny auction script but the 
> request are slow , 300 ms on local machine and 600ms on server 
> > > > can i know why?  can you help me? is the code not optimized? 
> > > 
> > > Where are you measuring these times? Is this how long the JavaScript 
> takes to execute, or how long the total 
> (request/response/calculating/updating page) cycle takes per request? There 
> are a lot of factors that can cause Ajax to take time, not many of them 
> come down to the programming within the page. 
> > > 
> > > Another question, how many requests are sent by the page? I have only 
> glanced over the code, but it may be sending a separate request per item on 
> the page, which could get very "chatty" and cause the server to bog down in 
> replying to the requests. Have you watched the page in the Developer Tools 
> part of your browser? Can you post a link to a sample page showing the 
> script in action? 
> > > 
> > > Walter 
> > > 
> > > > 
> > > > 
> > > >   
> > > > function auctionTimer(dt,no,id) 
> > > > { 
> > > > //alert(no); 
> > > >  var end = new Date(dt); 
> > > >  var now_date= new Date(no); 
> > > >  // alert(now_date); 
> > > >  // alert(end); 
> > > > var _second = 1000; 
> > > > var _minute = _second * 60; 
> > > > var _hour = _minute * 60; 
> > > > var _day = _hour * 24; 
> > > >   flag_time = true; 
> > > > timer = ''; 
> > > > setInterval(function(){showRemaining();},1000); 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > function showRemaining() 
> > > > { 
> > > > var date = no; 
> > > > var now = new Date(date); 
> > > > var de= now.getTime(); 
> > > > 
> > > > if ( flag_time ) { 
> > > > timer = de; 
> > > > } 
> > > > var d = new Date(timer); 
> > > > currentYear = d.getFullYear(); 
> > > > month = d.getMonth()+1; 
> > > > 
> > > > var currentDate = d.getDate(); 
> > > > currentDate = currentDate < 10 ? '0'+currentDate : 
> currentDate; 
> > > > 
> > > > var hours = d.getHours(); 
> > > > var minutes = d.getMinutes(); 
> > > > var seconds = d.getSeconds(); 
> > > > 
> > > > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > > > // hours = hours % 12; 
> > > > // hours = hours ? hours : 12; // the hour ’0′ 
> should be ’12′ 
> > > > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > > > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > > > var strTime = hours + ':' + minutes+ ':' + seconds; 
> // + ' ' + ampm; 
> > > > 

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-12 Thread Mahdi Farhat
i want faster request .. 300-400 ms is too high ..sometime they go down to 
150  , ifyou can check bidzeed.co M the request is 90ms 
what do you think shall i do 


On Sunday, June 12, 2016 at 4:18:35 PM UTC+3, Walter Lee Davis wrote:
>
> It's not clear what your goal is. Do you want to reduce the number of 
> requests from the page to your server, as I suggested, or do you want each 
> request to be faster? In you message, you mentioned that I was seeing the 
> faster return because "the cache was on". I can't think of a reason why you 
> would ever want that cache to be off, or what you would gain by having it 
> off. It's hard to see what your problem is, other than the overall design 
> of how the page works (making 1 request per second for as long as the page 
> is loaded). 
>
> Walter 
>
> > On Jun 11, 2016, at 7:47 PM, Mahdi Farhat  > wrote: 
> > 
> > i have sent you an email on 
> > 
> > wal**@wdstudio.com 
> >  please reply 
> > 
> > 
> > On Saturday, June 11, 2016 at 9:28:59 PM UTC+3, Walter Lee Davis wrote: 
> > I'm watching it in the Network pane of Safari Web Inspector. It's 
> running at a total duration of 1.464 ms, but a latency of 159.4 ms. So your 
> server is replying nearly instantly when it gets the request, but there's a 
> lag while the message travels to and fro. Overall, this is astoundingly 
> fast. 
> > 
> > What I have seen pages like this do, however, is only update to the 
> server every few minutes or more, and have the browser's JavaScript update 
> the tick tock countdown timer independently. Let the local time drift out 
> of synch with the server, then catch up each time the "heartbeat" connects 
> back to the server. I can't imagine that this will be as fast when there 
> are hundreds of visitors connecting at once, constantly pinging every 
> second. 
> > 
> > Walter 
> > 
> > > On Jun 11, 2016, at 1:07 PM, Mahdi Farhat  wrote: 
> > > 
> > > please check li1510-169.members.linode.com 
> > > 
> > > On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis 
> wrote: 
> > > 
> > > > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  
> wrote: 
> > > > 
> > > > i asked a developer to develop me a a penny auction script but the 
> request are slow , 300 ms on local machine and 600ms on server 
> > > > can i know why?  can you help me? is the code not optimized? 
> > > 
> > > Where are you measuring these times? Is this how long the JavaScript 
> takes to execute, or how long the total 
> (request/response/calculating/updating page) cycle takes per request? There 
> are a lot of factors that can cause Ajax to take time, not many of them 
> come down to the programming within the page. 
> > > 
> > > Another question, how many requests are sent by the page? I have only 
> glanced over the code, but it may be sending a separate request per item on 
> the page, which could get very "chatty" and cause the server to bog down in 
> replying to the requests. Have you watched the page in the Developer Tools 
> part of your browser? Can you post a link to a sample page showing the 
> script in action? 
> > > 
> > > Walter 
> > > 
> > > > 
> > > > 
> > > >   
> > > > function auctionTimer(dt,no,id) 
> > > > { 
> > > > //alert(no); 
> > > >  var end = new Date(dt); 
> > > >  var now_date= new Date(no); 
> > > >  // alert(now_date); 
> > > >  // alert(end); 
> > > > var _second = 1000; 
> > > > var _minute = _second * 60; 
> > > > var _hour = _minute * 60; 
> > > > var _day = _hour * 24; 
> > > >   flag_time = true; 
> > > > timer = ''; 
> > > > setInterval(function(){showRemaining();},1000); 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > function showRemaining() 
> > > > { 
> > > > var date = no; 
> > > > var now = new Date(date); 
> > > > var de= now.getTime(); 
> > > > 
> > > > if ( flag_time ) { 
> > > > timer = de; 
> > > > } 
> > > > var d = new Date(timer); 
> > > > currentYear = d.getFullYear(); 
> > > > month = d.getMonth()+1; 
> > > > 
> > > > var currentDate = d.getDate(); 
> > > > currentDate = currentDate < 10 ? '0'+currentDate : 
> currentDate; 
> > > > 
> > > > var hours = d.getHours(); 
> > > > var minutes = d.getMinutes(); 
> > > > var seconds = d.getSeconds(); 
> > > > 
> > > > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > > > // hours = hours % 12; 
> > > > // hours = hours ? hours : 12; // the hour ’0′ 
> should be ’12′ 
> > > > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > > > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > > > var strTime = hours + ':' + minutes+ ':' + seconds; 
> // + ' ' + ampm; 
> > > >

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-12 Thread Walter Lee Davis
It's not clear what your goal is. Do you want to reduce the number of requests 
from the page to your server, as I suggested, or do you want each request to be 
faster? In you message, you mentioned that I was seeing the faster return 
because "the cache was on". I can't think of a reason why you would ever want 
that cache to be off, or what you would gain by having it off. It's hard to see 
what your problem is, other than the overall design of how the page works 
(making 1 request per second for as long as the page is loaded).

Walter

> On Jun 11, 2016, at 7:47 PM, Mahdi Farhat  wrote:
> 
> i have sent you an email on 
> 
> wal**@wdstudio.com
>  please reply
> 
> 
> On Saturday, June 11, 2016 at 9:28:59 PM UTC+3, Walter Lee Davis wrote:
> I'm watching it in the Network pane of Safari Web Inspector. It's running at 
> a total duration of 1.464 ms, but a latency of 159.4 ms. So your server is 
> replying nearly instantly when it gets the request, but there's a lag while 
> the message travels to and fro. Overall, this is astoundingly fast. 
> 
> What I have seen pages like this do, however, is only update to the server 
> every few minutes or more, and have the browser's JavaScript update the tick 
> tock countdown timer independently. Let the local time drift out of synch 
> with the server, then catch up each time the "heartbeat" connects back to the 
> server. I can't imagine that this will be as fast when there are hundreds of 
> visitors connecting at once, constantly pinging every second. 
> 
> Walter 
> 
> > On Jun 11, 2016, at 1:07 PM, Mahdi Farhat  wrote: 
> > 
> > please check li1510-169.members.linode.com 
> > 
> > On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis wrote: 
> > 
> > > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  wrote: 
> > > 
> > > i asked a developer to develop me a a penny auction script but the 
> > > request are slow , 300 ms on local machine and 600ms on server 
> > > can i know why?  can you help me? is the code not optimized? 
> > 
> > Where are you measuring these times? Is this how long the JavaScript takes 
> > to execute, or how long the total (request/response/calculating/updating 
> > page) cycle takes per request? There are a lot of factors that can cause 
> > Ajax to take time, not many of them come down to the programming within the 
> > page. 
> > 
> > Another question, how many requests are sent by the page? I have only 
> > glanced over the code, but it may be sending a separate request per item on 
> > the page, which could get very "chatty" and cause the server to bog down in 
> > replying to the requests. Have you watched the page in the Developer Tools 
> > part of your browser? Can you post a link to a sample page showing the 
> > script in action? 
> > 
> > Walter 
> > 
> > > 
> > > 
> > >   
> > > function auctionTimer(dt,no,id) 
> > > { 
> > > //alert(no); 
> > >  var end = new Date(dt); 
> > >  var now_date= new Date(no); 
> > >  // alert(now_date); 
> > >  // alert(end); 
> > > var _second = 1000; 
> > > var _minute = _second * 60; 
> > > var _hour = _minute * 60; 
> > > var _day = _hour * 24; 
> > >   flag_time = true; 
> > > timer = ''; 
> > > setInterval(function(){showRemaining();},1000); 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > function showRemaining() 
> > > { 
> > > var date = no; 
> > > var now = new Date(date); 
> > > var de= now.getTime(); 
> > > 
> > > if ( flag_time ) { 
> > > timer = de; 
> > > } 
> > > var d = new Date(timer); 
> > > currentYear = d.getFullYear(); 
> > > month = d.getMonth()+1; 
> > > 
> > > var currentDate = d.getDate(); 
> > > currentDate = currentDate < 10 ? '0'+currentDate : 
> > > currentDate; 
> > > 
> > > var hours = d.getHours(); 
> > > var minutes = d.getMinutes(); 
> > > var seconds = d.getSeconds(); 
> > > 
> > > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > > // hours = hours % 12; 
> > > // hours = hours ? hours : 12; // the hour ’0′ should be 
> > > ’12′ 
> > > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > > var strTime = hours + ':' + minutes+ ':' + seconds; // + 
> > > ' ' + ampm; 
> > > timer = timer + 1000; 
> > >var now_time = currentYear+'/' + month+'/' + currentDate + 
> > > ' ' + strTime ; 
> > > 
> > > // document.getElementById("demo1").innerHTML= 
> > > currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ; 
> > > 
> > > // document.getElementById("demo2").innerHTML= 
> > > current

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-11 Thread Mahdi Farhat
i have sent you an email on 

wal**@wdstudio.com please reply


On Saturday, June 11, 2016 at 9:28:59 PM UTC+3, Walter Lee Davis wrote:
>
> I'm watching it in the Network pane of Safari Web Inspector. It's running 
> at a total duration of 1.464 ms, but a latency of 159.4 ms. So your server 
> is replying nearly instantly when it gets the request, but there's a lag 
> while the message travels to and fro. Overall, this is astoundingly fast. 
>
> What I have seen pages like this do, however, is only update to the server 
> every few minutes or more, and have the browser's JavaScript update the 
> tick tock countdown timer independently. Let the local time drift out of 
> synch with the server, then catch up each time the "heartbeat" connects 
> back to the server. I can't imagine that this will be as fast when there 
> are hundreds of visitors connecting at once, constantly pinging every 
> second. 
>
> Walter 
>
> > On Jun 11, 2016, at 1:07 PM, Mahdi Farhat  > wrote: 
> > 
> > please check li1510-169.members.linode.com 
> > 
> > On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis wrote: 
> > 
> > > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  
> wrote: 
> > > 
> > > i asked a developer to develop me a a penny auction script but the 
> request are slow , 300 ms on local machine and 600ms on server 
> > > can i know why?  can you help me? is the code not optimized? 
> > 
> > Where are you measuring these times? Is this how long the JavaScript 
> takes to execute, or how long the total 
> (request/response/calculating/updating page) cycle takes per request? There 
> are a lot of factors that can cause Ajax to take time, not many of them 
> come down to the programming within the page. 
> > 
> > Another question, how many requests are sent by the page? I have only 
> glanced over the code, but it may be sending a separate request per item on 
> the page, which could get very "chatty" and cause the server to bog down in 
> replying to the requests. Have you watched the page in the Developer Tools 
> part of your browser? Can you post a link to a sample page showing the 
> script in action? 
> > 
> > Walter 
> > 
> > > 
> > > 
> > >   
> > > function auctionTimer(dt,no,id) 
> > > { 
> > > //alert(no); 
> > >  var end = new Date(dt); 
> > >  var now_date= new Date(no); 
> > >  // alert(now_date); 
> > >  // alert(end); 
> > > var _second = 1000; 
> > > var _minute = _second * 60; 
> > > var _hour = _minute * 60; 
> > > var _day = _hour * 24; 
> > >   flag_time = true; 
> > > timer = ''; 
> > > setInterval(function(){showRemaining();},1000); 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > function showRemaining() 
> > > { 
> > > var date = no; 
> > > var now = new Date(date); 
> > > var de= now.getTime(); 
> > > 
> > > if ( flag_time ) { 
> > > timer = de; 
> > > } 
> > > var d = new Date(timer); 
> > > currentYear = d.getFullYear(); 
> > > month = d.getMonth()+1; 
> > > 
> > > var currentDate = d.getDate(); 
> > > currentDate = currentDate < 10 ? '0'+currentDate : 
> currentDate; 
> > > 
> > > var hours = d.getHours(); 
> > > var minutes = d.getMinutes(); 
> > > var seconds = d.getSeconds(); 
> > > 
> > > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > > // hours = hours % 12; 
> > > // hours = hours ? hours : 12; // the hour ’0′ should 
> be ’12′ 
> > > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > > var strTime = hours + ':' + minutes+ ':' + seconds; // 
> + ' ' + ampm; 
> > > timer = timer + 1000; 
> > >var now_time = currentYear+'/' + month+'/' + 
> currentDate + ' ' + strTime ; 
> > > 
> > > // document.getElementById("demo1").innerHTML= 
> currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ; 
> > > 
> > > // document.getElementById("demo2").innerHTML= 
> currentDate+':' +(month+1)+':' +currentYear + ' ' + strTime ; 
> > > 
> > > // document.getElementById("demo3").innerHTML= strTime 
> ; 
> > > 
> > > // document.getElementById("demo4").innerHTML= 
> current_day + ' , ' +currentMonth1+' ' + currentDate+' , ' + currentYear + 
> ' ' + strTime ; 
> > > 
> > > 
> > >   
> > > // alert(now_time); 
> > > 
> > > var now = new Date(now_time); 
> > >   
> > > // alert(now); 
> > > var distance = end - now; 
> > > 
> > > if (distance < 0) { 
> 

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-11 Thread Walter Lee Davis
I'm watching it in the Network pane of Safari Web Inspector. It's running at a 
total duration of 1.464 ms, but a latency of 159.4 ms. So your server is 
replying nearly instantly when it gets the request, but there's a lag while the 
message travels to and fro. Overall, this is astoundingly fast.

What I have seen pages like this do, however, is only update to the server 
every few minutes or more, and have the browser's JavaScript update the tick 
tock countdown timer independently. Let the local time drift out of synch with 
the server, then catch up each time the "heartbeat" connects back to the 
server. I can't imagine that this will be as fast when there are hundreds of 
visitors connecting at once, constantly pinging every second.

Walter

> On Jun 11, 2016, at 1:07 PM, Mahdi Farhat  wrote:
> 
> please check li1510-169.members.linode.com
> 
> On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis wrote:
> 
> > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  wrote: 
> > 
> > i asked a developer to develop me a a penny auction script but the request 
> > are slow , 300 ms on local machine and 600ms on server 
> > can i know why?  can you help me? is the code not optimized? 
> 
> Where are you measuring these times? Is this how long the JavaScript takes to 
> execute, or how long the total (request/response/calculating/updating page) 
> cycle takes per request? There are a lot of factors that can cause Ajax to 
> take time, not many of them come down to the programming within the page. 
> 
> Another question, how many requests are sent by the page? I have only glanced 
> over the code, but it may be sending a separate request per item on the page, 
> which could get very "chatty" and cause the server to bog down in replying to 
> the requests. Have you watched the page in the Developer Tools part of your 
> browser? Can you post a link to a sample page showing the script in action? 
> 
> Walter 
> 
> > 
> > 
> >   
> > function auctionTimer(dt,no,id) 
> > { 
> > //alert(no); 
> >  var end = new Date(dt); 
> >  var now_date= new Date(no); 
> >  // alert(now_date); 
> >  // alert(end); 
> > var _second = 1000; 
> > var _minute = _second * 60; 
> > var _hour = _minute * 60; 
> > var _day = _hour * 24; 
> >   flag_time = true; 
> > timer = ''; 
> > setInterval(function(){showRemaining();},1000); 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > function showRemaining() 
> > { 
> > var date = no; 
> > var now = new Date(date); 
> > var de= now.getTime(); 
> > 
> > if ( flag_time ) { 
> > timer = de; 
> > } 
> > var d = new Date(timer); 
> > currentYear = d.getFullYear(); 
> > month = d.getMonth()+1; 
> > 
> > var currentDate = d.getDate(); 
> > currentDate = currentDate < 10 ? '0'+currentDate : 
> > currentDate; 
> > 
> > var hours = d.getHours(); 
> > var minutes = d.getMinutes(); 
> > var seconds = d.getSeconds(); 
> > 
> > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > // hours = hours % 12; 
> > // hours = hours ? hours : 12; // the hour ’0′ should be 
> > ’12′ 
> > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > var strTime = hours + ':' + minutes+ ':' + seconds; // + ' 
> > ' + ampm; 
> > timer = timer + 1000; 
> >var now_time = currentYear+'/' + month+'/' + currentDate + ' 
> > ' + strTime ; 
> > 
> > // document.getElementById("demo1").innerHTML= 
> > currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ; 
> > 
> > // document.getElementById("demo2").innerHTML= 
> > currentDate+':' +(month+1)+':' +currentYear + ' ' + strTime ; 
> > 
> > // document.getElementById("demo3").innerHTML= strTime ; 
> > 
> > // document.getElementById("demo4").innerHTML= current_day 
> > + ' , ' +currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + 
> > strTime ; 
> > 
> > 
> >   
> > // alert(now_time); 
> > 
> > var now = new Date(now_time); 
> >   
> > // alert(now); 
> > var distance = end - now; 
> > 
> > if (distance < 0) { 
> >  if (distance>-3) 
> > { 
> > location.reload(true); 
> > return; 
> > }; 
> > 
> > clearInterval(timer); 
> > document.getElementById('countdown_'+id).innerHTML = 'Sold'; 
> > document.getElementById('bid-box').hide(); 
> >

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-11 Thread Mahdi Farhat
please check li1510-169.members.linode.com

On Saturday, June 11, 2016 at 5:52:02 PM UTC+3, Walter Lee Davis wrote:
>
>
> > On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  > wrote: 
> > 
> > i asked a developer to develop me a a penny auction script but the 
> request are slow , 300 ms on local machine and 600ms on server 
> > can i know why?  can you help me? is the code not optimized? 
>
> Where are you measuring these times? Is this how long the JavaScript takes 
> to execute, or how long the total (request/response/calculating/updating 
> page) cycle takes per request? There are a lot of factors that can cause 
> Ajax to take time, not many of them come down to the programming within the 
> page. 
>
> Another question, how many requests are sent by the page? I have only 
> glanced over the code, but it may be sending a separate request per item on 
> the page, which could get very "chatty" and cause the server to bog down in 
> replying to the requests. Have you watched the page in the Developer Tools 
> part of your browser? Can you post a link to a sample page showing the 
> script in action? 
>
> Walter 
>
> > 
> > 
> >   
> > function auctionTimer(dt,no,id) 
> > { 
> > //alert(no); 
> >  var end = new Date(dt); 
> >  var now_date= new Date(no); 
> >  // alert(now_date); 
> >  // alert(end); 
> > var _second = 1000; 
> > var _minute = _second * 60; 
> > var _hour = _minute * 60; 
> > var _day = _hour * 24; 
> >   flag_time = true; 
> > timer = ''; 
> > setInterval(function(){showRemaining();},1000); 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > function showRemaining() 
> > { 
> > var date = no; 
> > var now = new Date(date); 
> > var de= now.getTime(); 
> > 
> > if ( flag_time ) { 
> > timer = de; 
> > } 
> > var d = new Date(timer); 
> > currentYear = d.getFullYear(); 
> > month = d.getMonth()+1; 
> > 
> > var currentDate = d.getDate(); 
> > currentDate = currentDate < 10 ? '0'+currentDate : 
> currentDate; 
> > 
> > var hours = d.getHours(); 
> > var minutes = d.getMinutes(); 
> > var seconds = d.getSeconds(); 
> > 
> > // var ampm = hours >= 12 ? 'PM' : 'AM'; 
> > // hours = hours % 12; 
> > // hours = hours ? hours : 12; // the hour ’0′ should be 
> ’12′ 
> > minutes = minutes < 10 ? '0'+minutes : minutes; 
> > seconds = seconds < 10 ? '0'+seconds : seconds; 
> > var strTime = hours + ':' + minutes+ ':' + seconds; // + 
> ' ' + ampm; 
> > timer = timer + 1000; 
> >var now_time = currentYear+'/' + month+'/' + currentDate 
> + ' ' + strTime ; 
> > 
> > // document.getElementById("demo1").innerHTML= 
> currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ; 
> > 
> > // document.getElementById("demo2").innerHTML= 
> currentDate+':' +(month+1)+':' +currentYear + ' ' + strTime ; 
> > 
> > // document.getElementById("demo3").innerHTML= strTime ; 
> > 
> > // document.getElementById("demo4").innerHTML= 
> current_day + ' , ' +currentMonth1+' ' + currentDate+' , ' + currentYear + 
> ' ' + strTime ; 
> > 
> > 
> >   
> > // alert(now_time); 
> > 
> > var now = new Date(now_time); 
> >   
> > // alert(now); 
> > var distance = end - now; 
> > 
> > if (distance < 0) { 
> >  if (distance>-3) 
> > { 
> > location.reload(true); 
> > return; 
> > }; 
> > 
> > clearInterval(timer); 
> > document.getElementById('countdown_'+id).innerHTML = 'Sold'; 
> > document.getElementById('bid-box').hide(); 
> > document.getElementById('auction_watcher').hide(); 
> > toggleDisabled(document.getElementById('bid-box')); 
> > toggleDisabled(document.getElementById('auction_watcher')); 
> > 
> document.getElementById('watcher_url').removeAttribute('href'); 
> > return; 
> > } 
> > var days = Math.floor(distance / _day); 
> > var hours = Math.floor((distance % _day) / _hour); 
> > var minutes = Math.floor((distance % _hour) / _minute); 
> > var seconds = Math.floor((distance % _minute) / _second); 
> > if (days <10) 
> > {days = '0' + days;} 
> > if (hours <10) 
> > {hours = '0' + hours;} 
> > if (minutes < 10) 
> >{ minutes = '0' + minutes;} 
> > if (seconds < 10) 

Re: [Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-11 Thread Walter Lee Davis

> On Jun 10, 2016, at 10:40 AM, Mahdi Farhat  wrote:
> 
> i asked a developer to develop me a a penny auction script but the request 
> are slow , 300 ms on local machine and 600ms on server
> can i know why?  can you help me? is the code not optimized? 

Where are you measuring these times? Is this how long the JavaScript takes to 
execute, or how long the total (request/response/calculating/updating page) 
cycle takes per request? There are a lot of factors that can cause Ajax to take 
time, not many of them come down to the programming within the page.

Another question, how many requests are sent by the page? I have only glanced 
over the code, but it may be sending a separate request per item on the page, 
which could get very "chatty" and cause the server to bog down in replying to 
the requests. Have you watched the page in the Developer Tools part of your 
browser? Can you post a link to a sample page showing the script in action?

Walter

> 
> 
>   
> function auctionTimer(dt,no,id)
> {
> //alert(no);
>  var end = new Date(dt);
>  var now_date= new Date(no);
>  // alert(now_date);
>  // alert(end);
> var _second = 1000;
> var _minute = _second * 60;
> var _hour = _minute * 60;
> var _day = _hour * 24;
>   flag_time = true;
> timer = '';
> setInterval(function(){showRemaining();},1000);
> 
> 
> 
> 
> 
> 
> 
> 
> function showRemaining() 
> {
> var date = no;
> var now = new Date(date);
> var de= now.getTime();
> 
> if ( flag_time ) {
> timer = de;
> }
> var d = new Date(timer);
> currentYear = d.getFullYear();
> month = d.getMonth()+1;
>
> var currentDate = d.getDate();
> currentDate = currentDate < 10 ? '0'+currentDate : 
> currentDate;
> 
> var hours = d.getHours();
> var minutes = d.getMinutes();
> var seconds = d.getSeconds();
> 
> // var ampm = hours >= 12 ? 'PM' : 'AM';
> // hours = hours % 12;
> // hours = hours ? hours : 12; // the hour ’0′ should be ’12′
> minutes = minutes < 10 ? '0'+minutes : minutes;
> seconds = seconds < 10 ? '0'+seconds : seconds;
> var strTime = hours + ':' + minutes+ ':' + seconds; // + ' ' 
> + ampm;
> timer = timer + 1000;
>var now_time = currentYear+'/' + month+'/' + currentDate + ' ' 
> + strTime ;
> 
> // document.getElementById("demo1").innerHTML= 
> currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ;
> 
> // document.getElementById("demo2").innerHTML= 
> currentDate+':' +(month+1)+':' +currentYear + ' ' + strTime ;
> 
> // document.getElementById("demo3").innerHTML= strTime ;
> 
> // document.getElementById("demo4").innerHTML= current_day + 
> ' , ' +currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ;
> 
> 
>  
> // alert(now_time);
> 
> var now = new Date(now_time);
>  
> // alert(now);
> var distance = end - now;
>
> if (distance < 0) {
>  if (distance>-3) 
> {
> location.reload(true); 
> return;
> };
> 
> clearInterval(timer);
> document.getElementById('countdown_'+id).innerHTML = 'Sold';
> document.getElementById('bid-box').hide();
> document.getElementById('auction_watcher').hide();
> toggleDisabled(document.getElementById('bid-box'));
> toggleDisabled(document.getElementById('auction_watcher'));
> document.getElementById('watcher_url').removeAttribute('href');
> return;
> }
> var days = Math.floor(distance / _day);
> var hours = Math.floor((distance % _day) / _hour);
> var minutes = Math.floor((distance % _hour) / _minute);
> var seconds = Math.floor((distance % _minute) / _second);
> if (days <10)
> {days = '0' + days;}
> if (hours <10)
> {hours = '0' + hours;}
> if (minutes < 10)
>{ minutes = '0' + minutes;}
> if (seconds < 10)
> {seconds = '0' + seconds; }
> if(days==00)
> {
> dytext = '';   
> 
> }
> else if(days==1)
> {
> dytext = ''+ days +' Day  ';  
>  
> }
> else
> {
>  dytext = ''+ days +' Days  
> ';
> }
> if(hours==00) {
> hrtext='';
> }
> else {
> hrtext = ''+ hours + ''

[Proto-Scripty] help me with prototype ajax .. request are slow

2016-06-10 Thread Mahdi Farhat
i asked a developer to develop me a a penny auction script but the request 
are slow , 300 ms on local machine and 600ms on server
can i know why?  can you help me? is the code not optimized? 


  
function auctionTimer(dt,no,id)
{
//alert(no);
 var end = new Date(dt);
 var now_date= new Date(no);
 // alert(now_date);
 // alert(end);
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
  flag_time = true;
timer = '';
setInterval(function(){showRemaining();},1000);








function showRemaining() 
{
var date = no;
var now = new Date(date);
var de= now.getTime();

if ( flag_time ) {
timer = de;
}
var d = new Date(timer);
currentYear = d.getFullYear();
month = d.getMonth()+1;
   
var currentDate = d.getDate();
currentDate = currentDate < 10 ? '0'+currentDate : 
currentDate;

var hours = d.getHours();
var minutes = d.getMinutes();
var seconds = d.getSeconds();

// var ampm = hours >= 12 ? 'PM' : 'AM';
// hours = hours % 12;
// hours = hours ? hours : 12; // the hour ’0′ should be 
’12′
minutes = minutes < 10 ? '0'+minutes : minutes;
seconds = seconds < 10 ? '0'+seconds : seconds;
var strTime = hours + ':' + minutes+ ':' + seconds; // + ' 
' + ampm;
timer = timer + 1000;
   var now_time = currentYear+'/' + month+'/' + currentDate + ' 
' + strTime ;

// document.getElementById("demo1").innerHTML= 
currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + strTime ;

// document.getElementById("demo2").innerHTML= 
currentDate+':' +(month+1)+':' +currentYear + ' ' + strTime ;

// document.getElementById("demo3").innerHTML= strTime ;

// document.getElementById("demo4").innerHTML= current_day 
+ ' , ' +currentMonth1+' ' + currentDate+' , ' + currentYear + ' ' + 
strTime ;


 
// alert(now_time);

var now = new Date(now_time);
 
// alert(now);
var distance = end - now;
   
if (distance < 0) {
 if (distance>-3) 
{
location.reload(true); 
return;
};

clearInterval(timer);
document.getElementById('countdown_'+id).innerHTML = 'Sold';
document.getElementById('bid-box').hide();
document.getElementById('auction_watcher').hide();
toggleDisabled(document.getElementById('bid-box'));
toggleDisabled(document.getElementById('auction_watcher'));
document.getElementById('watcher_url').removeAttribute('href');
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
if (days <10)
{days = '0' + days;}
if (hours <10)
{hours = '0' + hours;}
if (minutes < 10)
   { minutes = '0' + minutes;}
if (seconds < 10)
{seconds = '0' + seconds; }
if(days==00)
{
dytext = '';   

}
else if(days==1)
{
dytext = ''+ days +' Day 
 ';   
}
else
{
 dytext = ''+ days +' Days 
 ';
}
if(hours==00) {
hrtext='';
}
else {
hrtext = ''+ hours + ''+ 
":";
}
if(minutes==00)
{
mintext='';
}else {
  mintext = ''+ minutes 
+''+ ":";
  
}
sectext = ''+ seconds +'';
document.getElementById('countdown_'+id).innerHTML = dytext + 
hrtext +  mintext + sectext;
   flag_time = false;
}

//timer = setInterval(showRemaining, 1000);
}
function callme()
{
document.getElementById('countdown').innerHTML = "Time";
}


function price_condtion(min_price,max_price,id)
{ return;

min_price ="(Between" + ''+ "$" +min_price + 
'' +" and ";
max_price = ''+ "$"+max_price + '' + ")";
document.getElementById('price_condition_'+id).innerHTML = min_price + 
max_price;
}
function PlacepennyBid(url,id){
//var bid_type = 
$$('input:checked[type="radio"][name="bid_type"]').pluck('value');
//var is_valid_bidprice = checkBidPrice();
// if(is_valid_bidprice == false)
// return;
//var bid_price = $('bid_price').value;
   
var product_id = id;