task

Handling file access locks while file is being built

喜你入骨 提交于 2019-12-12 01:58:25
问题 I have a [SQL 2008] SSIS package that takes a CSV text file and moves it to a separate folder. Once it is in this folder, I import the data to SQL. The text file is being automatically generated by an outside program on a periodic schedule. The file is also pretty large, so it takes a while (~10 minutes) for it to be generated. If I attempt to move this file (using a File System Task) WHILE the file is still being built, I get this error message: "The process cannot access the file because it

Android: Switch back to Chrome from app

和自甴很熟 提交于 2019-12-12 01:57:04
问题 I have a weblink on the android tablet that when clicked, runs Chrome full screen. In that website, I can click a link and open my application (developed in Android Studio). But once that app is opened, I want it to immediately send focus back to Chrome. I've seen people say on this forum there is a way to switch tasks, but they didn't provide code or links on how to do it. Or disabling my app from the task manager (but still have it run) would be good too I maybe? What I am trying to do is

Windows process can't close my application

我们两清 提交于 2019-12-12 01:26:30
问题 I have a windows form application which is writing bunch of stuff in the database. Now some time ago I was asking for the solution of how to be sure that all requests (writing to the database) has been done before windows form is closed. The reason why am I doing this is because it will be a self standing application which has an automatic shut down and therefore I need to be able to finish all my writing and reading from the database and be sure when I am closing form that all the job is

How is Task.Run limited by CPU cores?

[亡魂溺海] 提交于 2019-12-12 01:21:43
问题 Why is it that the following program will only run a limited number of blocked tasks. The limiting number seems to be the number of cores on the machine. Initially when I wrote this I expected to see the following: Job complete output of Jobs 1 - 24 A 2 second gap Output of Jobs 25 - 48 However the output was: Job complete output of Jobs 1 - 4 Then randomly completing jobs every couple of 100ms. When running on server with 32 cores, the program did run as I had expected. class Program {

Control Not yielding after Task.Result in a non Async Block [duplicate]

元气小坏坏 提交于 2019-12-12 00:43:56
问题 This question already has answers here : await works but calling task.Result hangs/deadlocks (5 answers) Closed 4 years ago . I was experimenting with an MSDN sample. I came across the following issue. When running an async block of code from a button click event handler, with async pattern, it works fine ( button1_Click ). But for button2_Click , the control is not going beyond TaskObj.Result . What might be the reason for the same? private async void button1_Click(object sender, EventArgs e

Turn this code into a Task to run Asynchronously on another thread

人盡茶涼 提交于 2019-12-11 23:43:44
问题 I am starting to toy with Tasks and async await. So that I get a better handle on how to convert my existing code, I thought I would try to try changing a current method which is run synchronously: private bool PutFile(FileStream source, string destRemoteFilename, bool overwrite) { if (string.IsNullOrEmpty(destRemoteFilename)) return false; string path = Path.GetDirectoryName(destRemoteFilename); if (path == null) return false; if (!Directory.Exists(path)) Directory.CreateDirectory(path); if

Long script in admin, task in Symfony?

醉酒当歌 提交于 2019-12-11 23:30:06
问题 In the admin panel, when the admin selects an action it will load data from an API and save it to the DB. It could take from 2 seconds to 3 minutes, depending on what he is importing. How can I do in Symfony to create like a thread, so the admin is not waiting to finish. And when it's finished tell him to check the result? Are the tasks the answer for this problem? thanks! 回答1: Not symfony-specific, but you'll want to kick off some background process. I'm not familiar with symfony's tooling

PictureBox animation freezing while Task running

帅比萌擦擦* 提交于 2019-12-11 23:21:31
问题 My Winforms application shows an animated gif inside a picturebox while long running operations run. However, it freezes while waiting for the completion of the task: Public Class MyUserControl Sub Initialize() Dim folderscantask = Task.Factory.StartNew( Function() EwsManagedApiScanFolderHierarchy(), TaskCreationOptions.LongRunning ) folderdictask.Wait() Dim folderscanresult = folderscantask.Result End Sub Function EwsManagedApiScanFolderHierarchy() As Dictionary(Of String, String) 'Performs

How to make some Tasks change my WPF controls

你。 提交于 2019-12-11 20:37:36
问题 I want to create a WPF application that does this: The application will have 8 Tasks running together. Each task will be able to ad some strings to a text box shown in the main window. how do I get the tasks all running at the same time, and running on the main UI Thread? (30/04/13:) please see the next code: private void RunTasks(int ThreadsNumber) { int Ratio = NumbersToCheck / ThreadsNumber; for (int i = 0; i < ThreadsNumber; i++) { Task.Run(() => { int counter = 0; int low = Ratio * i;

FX Task, returning a value always returns null

二次信任 提交于 2019-12-11 20:27:43
问题 I am trying to return a String from a FX Task. Expected output: true,testABC. Real output: true,null. The call to the task: public static void main(String[] args) { ExecutorService pool = Executors.newCachedThreadPool(); Future<String> my_String = (Future<String>) pool.submit(new my_task()); try { Thread.sleep(500); System.out.println(my_String.isDone()); System.out.println(my_String.get());//gettings the String from the future } catch (InterruptedException | ExecutionException ex) { Logger