I have a doubt in context switching.
In multi threading, when the context switching occurs, what will be the time between two context switches? Is it fixed time interval?
I use the following code to log a map, it is fast when it only contains zeroes, but as soon as there is actual data in the map it becomes unbearably slow... Is there any way to do this faster?
log_file = open('testfile', 'w')
for i, x in ((i, start + i * interval) for i in range(length)):
log_file.write('%-5d %8.3f %13g %13g %13g %13g %13g %13g\n' % (i, x,
map[0][i], map[1][i], map[2][i], map[3][i], map[4][i], map[5][i]))
It seems that Cron doesn't support a seconds interval. What is the easiest way to run a cli script (php) every 15 seconds? Is there a cron tool that works specifically with seconds (then I could use Cron to call it every minute)?
I'm using Flash Builder 4.6. As a simple example, say I have the following application:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:sdk="services.sdk.*">
<fx:Script>
<![CDATA[
private function btnGetValue_clickHandler():void
{
getValueResult.token = sdk.getValue();
}
private function getValueResultHandler():void
{
// ...
}
]]>
</fx:Script>
<fx:Declarations>
<sdk:SDK id="sdk" fault="{Alert.show(event.fault.faultString +'\n\n'+ event.fault.faultDetail, 'SDK ERROR');}" showBusyCursor="false"/>
<s:CallResponder id="getValueResult" result="getValueResultHandler()"/>
</fx:Declarations>
<s:Button id="btnGetValue" click="btnGetValue_clickHandler()" label="Get Value" />
</s:Application>
So when you click on the button, it calls a PHP file and when it gets a result, it calls getValueResultHandler(). Easy enough.
But what if the response from the PHP file takes a second or two and the user clicks the button rapidly? Then the result handler function may not get called every time, since the call responder gets a new token before it received the last response.
Is there a standard way of resolving this issue? I came up with the following workaround, and it works fine, but it seems like this issue would be common enough to have a more built-in solution.
My workaround is:
var getValueResultProcessing:Boolean = false;
private function btnGetValue_clickHandler():void
{
var interval:uint = setInterval(function():void
{
if (!getValueResultProcessing)
{
getValueResultProcessing = true;
getValueResult.token = sdk.getValue();
clearInterval(interval);
}
}, 100);
getValueResult.token = sdk.getValue();
}
private function getValueResultHandler():void
{
getValueResultProcessing = false;
// ...
}
Any better way of resolving this issue?
The docs for flash.utils.setTimeout() state:
Instead of using this method, consider
creating a Timer object, with the
specified interval, using 1 as the
repeatCount parameter (which sets the
timer to run only once).
Does anyone know if there is a (significant) advantage in doing so? Using setTimeout is a lot easier when you only need to delay 1 call.
I am converting some old C# code, and it has a CountDownLatch using a package called Spring.Threading.Helpers. The odd thing is that I can't find this package on Google - so a) is it still supported? And, if so, where is it documented? b) What I really want to do is wait for a count to get to zero, but interrupt every so many msecs. Would it just be simpler to set up another thread, and do WaitOnes on an Event specifying an interval? TIA
Given any number of the random real numbers from the interval [0,1] is there exist any method to construct a floating point number with zero decimal part?
Your algorithm can use only random() function calls and no variables or constants. No constants and variables are allowed, no type casting is allowed. You can use for/while, if/else or any other programming language operands.
Hi all,
I just would like to clarify:
When a timer's autostart is set to true, does it execute the elapsed event automatically, or just wait for the elapsed interval then executes the event?
Thank you!
I need to modify a GLib's time-out interval while it is in execution. Is that possible? I took a look to the source code and it seems possible to me, but is required use some non-public functions from GLib internals. Should I reimplement GTimeoutSource or there are a way to do it?
i want to take data from bluetooth into matlab after every 10 to 15 seconds.. have figured out a way to transfer data to matlab via bluetooth. the problem i am facing is that i want matlab to execute a set of commands after a time interval to take input from bluetooth. if u cld plz help in this matter??
Thinks at a backgammon online multiplayer game with over 100, or even 1000 online users. The game communication is done using Ajax + 3 seconds Comet connection interval + ASP.NET technology. Is this a real scenario ?
Didn't so many Comet open connections block the server resulting in big latency ?
Hi everyone,
I have two python cgi pages (index, display), what i need to do is calculate time frame between the execution.
Work flow:
Index.py (submit)
After submit it redirect to display.py page
display.py page has got class with execute(),display() &init_main() functions
In init_main() i have created class object which access to above functions
I need to calculate time interval between the submit (index.py) to execute() end, so i can show user how much time does different weighted file takes on real time.
Hoping to see your suggestions
Thanks
I have a few questions about CoreLocation and GPS.
First, what method in core location is used to continually get the users current coordinates? And at what interval should these be retrieved?
Second, should these coordinates be pushed into a NSMutableArray each time they are received, so that the array of coordinates will represent the users path?
Thanks, just wanting to get started getting me mind around this.
I don't know how to explain this correctly but just some sample for you guys so that you can really get what Im trying to say.
Today is April 09, 2010
7 days from now is April 16,2010
Im looking for a php code, which can give me the exact date giving the number of days interval prior to the current date.
I've been looking for a thread which can solve or even give a hint on how to solve this one but I found none.
I need to access this from my setInterval handler
prefs: null,
startup : function()
{
// init prefs
...
this.retrieve_rate();
this.intervalID = setInterval(this.retrieve_rate, this.INTERVAL);
},
retrieve_rate : function()
{
var ajax = null;
ajax = new XMLHttpRequest();
ajax.open('GET', 'http://xyz.com', true);
ajax.onload = function()
{
// access prefs here
}
}
How can I access this.prefs in ajax.onload ?
I have a database table that stores user comments:
comments(id, user_id, created_at)
I want to get from it the number of users that have commented for the first time in the past week.
Here's what I have so far:
SELECT COUNT(DISTINCT `user_id`)
FROM `comments`
WHERE `created_at` BETWEEN DATE_SUB(NOW(), INTERVAL 7 DAY) AND NOW()
This would give the number of users that have commented, but it would not take into consideration whether these comments are first for these users.
Is there a way in SQL Server to parition over a date range?
I'm looking for something along these lines:
SELECT ROW_NUMBER() OVER (PARTITION BY RANGE(DateTimeField) INTERVAL(1))
I want to group rows that are within one day of each other.
Hi,
I need to refresh an iframe with asynchronous time intervals.
The asynchronous time interval is calculated in the server side. Also, the user shouldn't able to feel the refresh in the whole page. It is ok if he finds that the iframe is refreshing in certain intervals.
I have an interval let's say (0..3) where next element is +1 unless the last. Then the next is 0. I solved it by the code below. Just wondering if there is anything else outhere :-)
def next(max,current)
if current+1 == max
return 0
else
return current+1
end
end
i have a data set called SIZEDIST$AVG.µm., and i have fitted this data with a weibull curve.
now i have generated the quantiles by using the quantile function and now i want to access the output of this function generated at the interval of p=0.01.
fwbl<-fitdist(SIZEDIST$AVG.µm., "weibull",start=list(shape=0.8,scale=1))
fwbl
quantwbl<-quantile(fwbl,probs=seq(.1,.99,.01))
quantwbl
str(quantwbl)
using str(quantwbl) i can visualize the output but i cant convert them into data.frame
I have an orientation expressed with a quaternion and an angular velocity expressed as either a quaternion or a number (radians per second around the original orientation). I understand how to do this using conversion to axis-angle but that method is rather computationally expensive and is not a realistic option. How would I go about modifying the orientation quaternion given a time interval (in seconds)? I need a solution for both cases (the quaternion and the number).
Hi, I am working on a project to capture images via webcam in a predefined time interval, and continuously compare the images to a template (good image) and give an error if the difference is tolerance set.
I working out using OpenCV. Would like to have advice how should I do it, e.g. best method, etc.
Appreciate if any one can help me on this. Thanks.
I need to know how to add 2 hours to the below 'Completed' timestamp.
Here is the Select statement
Select Tsk.task_id,Tsk.org_id,Tsk.completed,Tsk.assgn_acct_id,name
FROM tdstelecom.tasks As Tsk
WHERE Tsk.task_id = '11094836'
AND DATE(Tsk.completed) < CURDATE() AND DATE(Tsk.completed) >= DATE_SUB(CURDATE
(),INTERVAL 180 DAY)
Here are the results: 2012-08-22 14:18:14
Desired results: 2012-08-22 16:18:14
Haven't seen this before so hopefully someone has a easy solve, I have a 3 feature panel divs side by side, what I want happen is the 1st panel has a "hover" class added so I can change the background etc and then on a timed interval the hover class jumps to the next panel then the next panel then back to the start on a loop.
Also on a side note can you keep the code in mind to be able to add more then 3 feature divs so you could have for example 6 or more or less etc.
I have many div in my aspx page. how to update the content of a particular div?
It should update every one minute time interval..
with out reloading entire page..