synchronous

Synchronous request with ajax in a loop

旧城冷巷雨未停 提交于 2019-12-13 04:31:50
问题 I have a for loop which contains ajax request. The request is working aynchronously. So i can't reach the result of request in time. How can i solve this problem without using any library? Thanks. var availables = document.getElementsByClassName("available"); for(var i=0;i<availables.length;i++){ var element = availables[i]; var xmlhttp; if(window.XMLHttpRequest) xmlhttp = new XMLHttpRequest; else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("GET", "control.php?user=" +

simulating a synchronous XmlHttpRequest

限于喜欢 提交于 2019-12-13 02:08:35
问题 I've read some of the other related questions (Pattern for wrapping an Asynchronous JavaScript function to make it synchronous & Make async event synchronous in JavaScript & there may be more), but I just want to be sure to exhaust all possibilities. Might it be possible to "convert" an asynchronous XmlHttpRequest into a quasi-synchronous one using either setInterval or setTimeout? The idea being that upon success of the Ajax request a variable will be set, which will be the signal for a

Oracle dbms_job.submit: Mixing Synchronous and Asynchronous

对着背影说爱祢 提交于 2019-12-13 01:06:48
问题 I have 7 Materialized Views that need to be refreshed on a schedule. Five of them are data source independent and could be rebuilt asynchronously. I'd like do use something like Tom described here PROCEDURE refresh_Independent_MViews AS l_job BINARY_INTEGER; BEGIN dbms_job.submit (l_job, 'DBMS_MVIEW.REFRESH(list => ''IndependentMView1'', method => ''C'') ;') ; dbms_job.submit (l_job, 'DBMS_MVIEW.REFRESH(list => ''IndependentMView2'', method => ''C'') ;') ; dbms_job.submit (l_job, 'DBMS_MVIEW

iOS7 SpriteKit how to wait for an animation to complete before resuming method execution?

混江龙づ霸主 提交于 2019-12-12 18:17:57
问题 Is there a way to make a method wait for a SpriteKit action initiated within the method to complete before continuing code execution? Here's what I have so far, but it just hangs at the wait loop. __block BOOL wait = YES; SKAction* move = [SKAction moveTo:destination duration:realMoveDuration]; SKAction* sequence = [SKAction sequence:@[[SKAction waitForDuration:0.07],move,[SKAction waitForDuration:0.07] ]]; [spellEffect runAction:sequence completion:^{ [spellEffect removeFromParent]; wait =

Asynchronous function in a while-loop

强颜欢笑 提交于 2019-12-12 11:53:00
问题 I have a question about how to perform an asynchronous task in a while-loop until some condition is met. This is more of a theoretical question but I can see how this could be an issue in some scenarios. I'll try demonstrate the problem at an example (I'm using JavaScript here, but you can use any language): I could have a device and I want to hold my application until that device has reached a specific state. If the method with which I can getrieve with state of the device is synchronouse,

How to display 'Loading' when making a 'synchronous' AJAX call in pure JavaScript?

十年热恋 提交于 2019-12-12 11:26:40
问题 I want to make sure the result is shown to user, so I make synchronous AJAX call. It's quite simple to display a 'Loading' indicator with asynchronous AJAX (the examples are everywhere), but when I use synchronous AJAX call with XMLHttpRequest, the loading indicator GIF image doesn't show up at all. Some said that it's impossible to show indicator when doing a synchronous call (block until having response from server). But I just want to ask to see whether there's a way to do it. 回答1: It's

Are LINK elements loaded synchronously?

本秂侑毒 提交于 2019-12-12 11:23:12
问题 If I have the following HTML5 document: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>FOOBAR</title> </head> <body> <link rel="stylesheet" href="/largefonts.css"> <script src="onload.js"></script> </body> </html> Will the <link> tag load synchronously, so that when the onload.js script is executed, the fonts should be loaded in the browser? Note that I’m not asking if the fonts have been applied to any DOM nodes, I just want to know if they are loaded into memory. 回答1: The

Add additional parameters to callback function

余生颓废 提交于 2019-12-12 10:54:18
问题 I'm building a system in Node.js that is supposed to find all files in an array of folders, stat them, and then do some additional work using that information. I'm using fs.readdir() to get all the files synchronously from each of the folders. My code looks like this: for(i=0,max=paths.length; i<max; i++) { var path = paths.pop(); console.log("READING PATH: " + path); fs.readdir(path, function(err, files) { handleDir(err, files, path); }); } The problem is that, depending on how fast the

node.js — execute command synchronously and get result

江枫思渺然 提交于 2019-12-12 07:58:15
问题 I'm trying to execute a child_process synchronously in node.js (Yes, I know this is bad, I have a good reason) and retrieve any output on stdout, but I can't quite figure out how... I found this SO post: node.js execute system command synchronously that describes how to use a library (node-ffi) to execute the command, and this works great, but the only thing I'm able to get is the process exit code. Any data the command executes is sent directly to stdout -- how do I capture this? > run(

OpenSplice DDS: Publish, until some timeout

半世苍凉 提交于 2019-12-12 04:23:39
问题 I'm learning every day more about dds, so my question my sound weird. I hope it makes sense. One of the requirements of some dds wrapper I'm writing, is that it times out after some timeout period if it fails to write. My question: How can I do that? On Prism Tech's website's tutorial, there's explanation on how to use a WaitSet to block a read operation, but what about write? Here's some code including the question: dds::domain::DomainParticipant dp(0); dds::topic::Topic<MyType> topic(dp,