Search Results

Search found 1382 results on 56 pages for 'async await'.

Page 24/56 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • Several ifstream vs. ifstream + constant seeking

    - by SpyBot
    I'm writing an external merge sort. It works like that: read k chunks from big file, sort them in memory, perform k-way merge, done. So I need to sequentially read from different portions of the file during the k-way merge phase. What's the best way to do that: several ifstreams or one ifstream and seeking? Also, is there a library for easy async IO?

    Read the article

  • how to code client-side call to webservice that calls automatically every few seconds

    - by Bob Jones
    I have a webservice that I want to call from the browser every few seconds to see if there are any notification messages in the database that should be displayed on the screen. We have the JSON code working to display the messages in a JavaScript function after an Async Postback, but this only executes after a page turn. I want it to execute every 10-15 seconds as well. A code sample would be very helpful.

    Read the article

  • On Click alert if $.get returns a value, if not, submit the form

    - by bradenkeith
    If the submit button is clicked, prevent the default action and see if the field 'account_name' is already in use. If the $.get() returns a result, alert the user of the results. If it doesn't, submit form with id="add_account_form". My problem is that my else{} statement is not submitting the form. I get no response when submit is clicked & there is no value returned. Also I would like to change my code where it goes $("#add_account_form").submit(..) instead of .click() however, would that cause a problem when trying to submit the form later in the script? <script type="text/javascript"> $(document).ready( function () { $("#submit").click( function () { var account_name = $("input[name=account_name]").val(); $.get( "'.url::site("ajax/check_account_name").'", {account_name: account_name}, function(data){ if(data.length > 0){ confirm( "The account name you entered looks like the following:\n" +data+ "Press cancel if this account already exists or ok to create it." ); }else{ $("#add_account_form").submit(); } }); return false; }); }); </script> <p> <input type="submit" id="submit" class="submit small" name="submit" value="Submit" /> </p> </form> Thanks for your help. EDIT So anyone who runs into my problems, it's that $.get() is asynchronous, so it will always return false, or true depending on what submitForm is defined as. $.ajax() however, allows async to be set as false, which allows the function to finish before moving on. See what I mean: $(document).ready( function () { $("#add_account_form").submit( function () { var submitForm = true; var account_name = $("input[name=account_name]").val(); $.ajax({ type: "GET", async: false, url: "'.url::site("ajax/check_account_name").'", data: ({account_name: account_name}), success: function(data){ if(data.length > 0){ if(!confirm( "The account name you entered looks like the following:\n" +data+ "Press cancel if this account already exists or ok to create it." )){ submitForm = false; } } } }); if (submitForm == false ) { return false; } }); }); Thanks for your help @Dan

    Read the article

  • Image upload storage strategies

    - by MatW
    When a user uploads an image to my site, the image goes through this process; user uploads pic store pic metadata in db, giving the image a unique id async image processing (thumbnail creation, cropping, etc) all images are stored in the same uploads folder So far the site is pretty small, and there are only ~200,000 images in the uploads directory. I realise I'm nowhere near the physical limit of files within a directory, but this approach clearly won't scale, so I was wondering if anyone had any advice on upload / storage strategies for handling large volumes of image uploads.

    Read the article

  • Wait during iPhone UI modification

    - by paul simmons
    Hi, I am making modifications to elements on UI. There is no (extra) thread or any async. calls. However I want to give a slow motion effect, so wait specific time at each step in a for loop. How can I achieve this without blocking the UI?

    Read the article

  • Dynamic content doesn't work when loaded with ajax

    - by Wurlitzer
    I'm trying to load some dynamic content after the user has logged in, using $.ajax, like so: $.ajax({ url: "functions.php", type: "GET", data: login_info, datatype: 'html', async: false, success: function (response) { $('#main').html(response); } }); The problem is, that some events don't work, when loaded this way. I fixed the buttons with the .live() method, but a sortable list for example, doesn't work. How can I somehow refresh the DOM, and let jquery know of these new added elements? Thanks!

    Read the article

  • How to write sum calculation based on ria service?

    - by KentZhou
    When using ria service for SL app, I can issue following async call to get a group of entity list. LoadOperation<Person> ch = this.AMSContext.Load(this.AMSContext.GetPersonQuery().Where(a => a.PersonID == this.performer.PersonID)); But I want to get some calculation, for example, sum(Commission), sum(Salary), the result is not entity, just a scalar value. How can I do this?

    Read the article

  • a script translatable to JavaScript with callback-hell automatic avoider :-)

    - by m1uan
    I looking for "translator" for JavaScript like already is CoffeScript, which will be work for example with forEach (inspired by Groovy) myArray.forEach() -> val, idx { // do something with value and idx } translate to JavaScript myArray.forEach(function(val, idx){ // do something with value and idx }); or something more usefull... function event(cb){ foo()-> err, data1; bar(data1)-> err, data2; cb(data2); } the method are encapsulated function event(cb){ foo(function(err,data1){ bar(data1, function(err, data2) { cb(data2); }); }); } I want ask if similar "compiler" to JavaScript like this even better already doesn't exists? What would be super cool... my code in nodejs looks mostly like this :-) function dealer(cb){ async.parallel([ function(pcb){ async.watterfall([function(wcb){ first(function(a){ wcb(a); }); }, function(a, wcb){ thirt(a, function(c){ wcb(c); }); fourth(a, function(d){ // dealing with “a” as well and nobody care my result }); }], function(err, array_with_ac){ pcb(array_with_ac); }); }, function(pcb){ second(function(b){ pcb(b);}); }], function(err, data){ cb(data[0][0]+data[1]+data[0][1]); // dealing with “a” “b” and “c” not with “d” }); } but, look how beautiful and readable the code could be: function dealer(cb){ first() -> a; second() -> b; third(a) -> c; // dealing with “a” fourth(a) -> d; // dealing with “a” as well and nobody care about my result cb(a+b+c); // dealing with “a” “b” and “c” not with “d” } yes this is ideal case when the translator auto-decide, method need to be run as parallel and method need be call after finish another method. I can imagine it's works Please, do you know about something similar? Thank you for any advice;-)

    Read the article

  • MVC + Extjs + IIS6 + Wildcard Mapping = Post Form resulting in 302 object moved

    - by Orkun Balkanci
    Everything seems to work fine until i want to submit the form and update the database. Wildcard mapping works on requests like "/navigation/edit/1", but when i submit the form as: var ajaxPost = function(Url, Params) { Ext.Ajax.request({ url: Url, params: Params, method: 'POST', async: false, scope: this }); }; it says "200 bad response: syntax error" and in firebug there is "Failed to load source for: http://.../Navigation/edit/1". Any help?

    Read the article

  • Block temporarily interaction during wcf call!

    - by Muhammad Jamal Shaikh
    hi , Silverlight version : 4 Silverlight patter :MVVM Visual Studio template :Silverlight navigation application How do I block main navigation on (mainpage.xaml) as in any silverlight navigation application and block page's controls ( i.e whichever page is it in ) during async webservice calls in my viewmodel? Any best practices?

    Read the article

  • IE jQuery ajax results in a stack overflow

    - by dave
    I have the following code that in IE gives me an error in jQuery for "open(G,M.url,M.async" $("#submitButton").click(function(){ $.ajax({ type: "POST", url: "http://url.com/postChat.php", data: "comment="+$("#userInput").val(), success: function(msg){ } }); }); Any ideas as to why this would happen in IE?

    Read the article

  • Real world examples of Rx

    - by theburningmonk
    I've been playing around with the Reactive Extension for a little while now, but mostly limited to handling/composing user driven events within a WPF frontend. It's such a powerful, new way of doing async programming, and I'm curious as to what other people are doing with it, and where do you think it might be able to improve the way we're currently doing things?

    Read the article

  • Update JSON file C# W8 development

    - by AndrewB
    At the moment, I've got a JSON file with content looking like this: { "username": "test", "someNumber":100 } I'm using JSON.Net to fetch the .JSON file from a webserver - C#: var http = new HttpClient(); http.MaxResponseContentBufferSize = Int32.MaxValue; var response = await http.GetStringAsync(URI); var result = JsonConvert.DeserializeObject<DatClass.Result>(response); This works great together with the class getting/setting the properties. However, what I would like to know is whether there's a good way for a user to update the .JSON file through a textbox UI? As in: [textbox - update username] [update button] - username sent to server - .JSON file updated - [textblock - showing updated username in UI]. I'm not looking for exact code solutions, I'm rather looking for good solutions on this, and/or if this is a terrible idea of an easy database(?).

    Read the article

  • JQuery AJAX responseText to JSON

    - by BoredOfBinary
    I have this script that calls a .net WebService msg = $.toJSON( $.ajax({ type: "POST", url: "http://[url]/ETS.UI/WebServices/LocationService.asmx/GetMappingLocationDetails", contentType: "application/json; charset=utf-8", data: $.toJSON({'componentId':994}), dataType: "json", async: false }).responseText ); And I recieve the following value in the msg variable: ""{\"d\":\"{\\"ComponentId\\":994,\\"Latitude\\":32.219627009236405,\\"Longitude\\":-110.96843719482422,\\"LocationName\\":\\"Tucson\\",\\"StreetAddress\\":\\"7201 E 22nd Street \\",\\"City\\":\\"Tucson\\",\\"State\\":\\"AZ\\",\\"PostalCode\\":null}\"}"" I have no idea why this would format this way, seems to only do this in responseText. Does anyone have any ideas?

    Read the article

  • Adding web reference is not generating the expected reference.cs file. Absent functions.

    - by user48408
    I'm working with an old windows app in visual studio 2005. A webserviced referenced in the original app has 2 functions and when i peak inside the auto-generated reference.cs file I notice a couple of other functions to allow async calls have been geenrated i.e. BeginWhateverFunctionNameIsCalled and EndWhateverFunctionNameIsCalled. My problem is that I've created a new windows app and added the same web references but the Begin and End functions are not generated in my reference.cs proxy class. Anyone know whats going on?

    Read the article

  • Asynchronous File I/O in .NET

    - by uno
    I followed the example at this link, Async I/O). The example works on my local machine. However when I deploy to my test machine - Windows Server 2003, It seems to work on 24 files and then the application stops. Procmon shows that its working on 24 files and then there is no data. My local machine is Windows XP. The question is why would this behave this drastically between XP and Windows 2003

    Read the article

  • Task.wait not working as I imagined

    - by user2357446
    I am trying to download a file, wait for the file to finish downloading, and then read the file afterwards. I have the following methods to do this: private async Task startDownload(string link, string savePath) { WebClient client = new WebClient(); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); await client.DownloadFileTaskAsync(new Uri(link), savePath); } private void checkUpdateButton_Click(object sender, EventArgs e) { Task task = Task.Factory.StartNew(() => startDownload(versionLink, versionSaveTo)); task.Wait(); if (task.IsCompleted) { checkVersion(); } } The checkVersion() method reads the file that was downloaded. This is throwing an IOException saying that the file is in use by something else and cannot be read. I thought that having task.Wait would prevent the rest of the method from executing until the task was finished?

    Read the article

  • jquery exit function in ajax call

    - by Raphappa
    I have a javascript function. and in there, I insert a ajax call function using jquery. depends on ajax call result, I want to exit hi function. is there anyway to do this? function hi() { $.ajax({ url: "/shop/haveItem", type: "GET", async:false, success: function(data){ if(data == '1') //exit hi() function } }); //some executable code when data is not '1' ... }

    Read the article

  • How to get the value of the input element of live of Value

    - by Aruna
    HI, i am having a Input hidden element like in my JQuery i am setting the value for the above input type after some ajax call like EDIT::: $.ajax({ type: "POST", url: "http://localhost/FormBuilder/index.php/forms/saveForm/", async: false, data: "formname="+formname+"&status="+status, success: function(msg){$("#FormID").val(msg); }//success });//ajax Now somewhere in the code after this i want to fetch the value of this FIeld.How to get this value on live of value for this input type.. EDIT::: i am retriving like by var FORMID=$("#FormID").val();//but shows null How to get the value of it on live of this Input element

    Read the article

  • Using jQuery to perform a GET request and using the resulting data

    - by Filip Ekberg
    I have a page, let's call it "callme.html" which only has this content: abc Now I want to fire the following: $.get("callme.html", function (data) { alert(data); }, "text"); I am using jQuery 1.4.2 mini and the page is called but the alert is empty. Any ideas why? I'd like the popup to contain abc I've also tried the following $.ajax({ url: "callme.html", async: false, success: function (data) { alert(data); } });

    Read the article

  • Email Sending Task in Windows Phone Universal App

    - by Tanvir Sourov
    I was trying to write an Email sending code for Windows Phone Universal App. This is the Code that I have written in my Event Handler: Windows.ApplicationModel.Email.EmailMessage email = new Windows.ApplicationModel.Email.EmailMessage(); email.Subject = "Good morning"; email.Body = "Hello, how are you?"; var emailRecipient = new Windows.ApplicationModel.Email.EmailRecipient(email.Address); email.To.Add(emailRecipient); await Windows.ApplicationModel.Email.EmailManager.ShowComposeNewEmailAsync(emailMessage); This code works for my Windows Phone 8.1 App. But it's not working in the Universal App. Shall I have to add any reference? Is there any way to make it work in the Universal app? Thanks a lot. :)

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >