Most voted "task" questions
None
Learn more…52 questions
Sort by count of
-
31
votes1
answer5828
viewsDifference between Task and Thread
I need to create an executable c# and the question was: Do with thread or do with task? In practice there is some difference between using Task and the "traditional" multi-thread?? It is true that a…
-
15
votes3
answers2510
viewsWhen not to return Task in async methods?
Normally, in some time-consuming tasks, I use asynchronous methods: public async Task myLongRunningOperation(int i) { ... } However, in what situations I don’t necessarily need to return a Task?…
-
9
votes1
answer515
viewsWhat are the pros and cons of the Task<List<Object>> implementation on List<Object>
What are the advantages between the two implementations below. Both return a list with multiple products (more than 1k): public Task<List<Product>> GetAllProductsAsync() { var query =…
-
9
votes7
answers65838
viewsHow to run a C program in Visual Studio Code
I’m trying to run a code (program) in C in Visual Studio Code, but I can’t find the necessary settings. I installed the C/C++ extension (Microsoft) Project structure: .vscode - c_cpp_properties.json…
-
8
votes1
answer3990
viewsDifference between Thread.Sleep and Task.Delay
I am developing a client/server communication, and using Task for asynchronous communication. Previously, I had already made another communication where I used Thread, works smoothly and consumes…
-
6
votes2
answers283
viewsModifying a list item shared by multiple threads
I have the following pseudo-code: public void Associar(List<Data> dados) { List<Task> tasks = new List<Task>(); foreach(dado in dados) { tasks.Add(AdicionarAsync(dado)); }…
-
5
votes1
answer349
viewsDoes Task.Run always start a new Thread?
When executing a list of tasks initiated through Task.Run, it is ensured that each one is executed in a different Thread? When reading the documentation, it seems to me that this is the default…
-
4
votes1
answer533
viewsWhat is the difference between Task and async Task?
In the code below I wrote two methods, one with the return Task and another async Task. What happens differently in the execution of these methods since for one added in the construction the…
-
3
votes1
answer631
viewsHow to cast between base and derivative classes?
I have an exercise that says I have to create a foundation. This base has two derivatives. I have to cast the derived class(1) for the derived class(2) and the derived class(2) for the base class.…
-
3
votes1
answer474
viewsSending birthday emails based on Mysql query
I have to create a function (task) on the server of my site that sends a birthday email, containing an HTML code, to birthday emails. Detail: these birthdays are registered in a Mysql table that…
-
3
votes1
answer1242
viewsDownload async with Webclient.Downloadfileasync
Today I have a class that downloads photos, but as there are many photos always above 5mil think I could take advantage with async method. Process multiple task at the same time. But I think I’m…
-
3
votes1
answer228
viewsGulp task using (usemin)
I recently started using Gulp in an existing project. I created the following gulpfile.js: var gulp = require('gulp'), imagemin = require('gulp-imagemin'), clean = require('gulp-clean'), concat =…
-
3
votes2
answers291
viewsPerform another action during a await Task.Delay
I’m making an application where comes a certain part of the code I need to put a: await Task.Delay(tempo); But at the same time I have to wait around this time I need execute an action every 10…
-
3
votes1
answer710
viewsTransforming synchronous into asynchronous method
I have the following method: public string MyMethod1(string myParam1) { // Implementação return myReturnValue; } I needed to create an asynchronous method that did the same thing, to process several…
-
3
votes1
answer150
viewsTask is not called
Guys I have an api where your processing takes around 6 hours of execution, so I added a Task.Factory.Startnew with the main processing. So when someone calls, she responds to Statuscode 200 and…
-
2
votes1
answer1967
views -
2
votes1
answer585
viewsDoubt when using Timertask
follows my example of class use TimerTask and my problem is this: I want to make sure that every day the 12 hours is done this routine automatically. Currently nothing is happening, is this missing…
-
2
votes2
answers162
viewsonTaskRemoved() method giving error
I have an Activity that extends Appcompatactivity and in it I have the following method: @Override public void onTaskRemoved(Intent rootIntent) { NotificationManager mNotificationManager =…
-
2
votes1
answer839
viewsASP.Net and C# - automatic e-mail sending
On the site I took over from a client, developed in ASP.Net with C#, there are registered employees with a defined admission date. The registration of these employees is in an SQL Server 2008…
-
2
votes2
answers59
viewsTaskcompletionsource<Tresult> without a type parameter
The class TaskCompletionSource<TResult> needs a type TResult. That way, when I need to use this class without having a return type (void), I have to do something like: var tcs = new…
-
2
votes1
answer157
viewsWhy is it not possible to capture exceptions triggered by async void?
Why it is not possible to capture exceptions triggered by non-recurring asynchronous methods Task? public async void calcularPrecos() { var tabelaPreco = await getTabelaPreco(); /* Blá, blá, blá...…
-
2
votes1
answer97
viewsTask List<T> showing Xamarin error
I am creating a Task List<> but the same shows error in 'Tmodel' Error shown: "Tmodel" type or namespace name cannot be found (using a directive or Assembly reference?) public async…
-
2
votes0
answers22
viewsJava with Javafx
People I’m trying to make a thread call when opening the customer registration screen, but my screen is not opening, someone can help?? @FXML void OpenCliente(ActionEvent event) { try { //CREATING A…
-
2
votes1
answer44
viewsIs there a difference between Task.Fromresult and Task.Factory.Startnew?
Given a method in precise return a Task<T>. Example: public Task<MyResult> Handle(); I can make the following implementations: Thus: public Task<MyResult> Handle() { for (int i =…
-
1
votes1
answer246
viewsCopy the font folder using Gulp?
How to create a task to copy the bootstrap font folder to the build folder? I created the following task but it’s not working. var config = { assets_path: './resources/assets', build_path:…
-
1
votes1
answer290
viewsProcess manipulation with Javascript
I’d like to know how I give kill in a process running with javascript. To do this with the cmd you must first list capture the PID and execute the command taskKill with the PID as follows: netstat…
-
1
votes0
answers44
viewsInvokemainthread Xamarin
I’m having a problem invoking a Uithread on PCL. I made a method like this: private void PopularConteudo() { Task<List<Departamento>> taskDep = new…
-
1
votes1
answer113
viewsUse synchronous or asynchronous tasks to collect print counters
I am trying to develop a process that performs the collection of some printers counters via SNMP protocol, I thought to use Threads to perform this process, refatorei to use tasks, but I do not know…
-
1
votes0
answers39
viewsQuartz Spring Test Junit
How to recur a Job that is operating in Cluster in Spring? Spring 4.3 Quartz 2.2.3 Example of Job’s declaration @PersistJobDataAfterExecution @DisallowConcurrentExecution public class…
-
1
votes0
answers21
viewsProgressiring is not shown
I need to show the progressringduring the execution of a task, but it does not appear and the screen is frozen until the execution of the task. private async void btn_Criar_Click(object sender,…
-
1
votes1
answer133
views -
0
votes1
answer399
viewsPerform a task on a specific date and time
I’m trying to develop a small system that sends a e-mail every Tuesday at 08:00 in the morning. But I’m a little confused, I can already send the email and check if it’s Tuesday, but I don’t know if…
-
0
votes1
answer69
viewsHow to take values from a JSON and pass as SASS variables with Grunt
I need to compile templates using Grunt and I want to put the color settings inside a JSON file that will be inside each layout folder, that is, I need to use Grunt to read JSON and pass the values…
-
0
votes1
answer77
viewsInterpret if link is running from browser or cronjob
I have a working cronjob but practically the link(PHP code) this public because for cronjob to work the authentication check system is disabled. So I’d like to know some way that this link do not…
-
0
votes1
answer77
viewsInterpret if link is running from browser or cronjob
I have a working cronjob but practically the link(PHP code) this public because for cronjob to work the authentication check system is disabled. So I’d like to know some way that this link do not…
-
0
votes1
answer301
viewsGulp task - Error
I’ve been using Gulp for some time, to minify css files for Less, but now I wanted to use Gulp tb for js files and I’m not getting it, giving the following error. NOTE: Use of Windows module.js:472…
-
0
votes1
answer183
viewsHow can I for timers who were initiated by a task c#
Hello, I’m trying to understand a situation but so far I haven’t been able to solve it. Imagine that we have an X class that has a timer that is started by the constructor. Now imagine that this…
-
0
votes1
answer196
viewsProblem with Celery and Django/Python
I am trying to implement a tasks system with Celery in Django, but it is giving error and I do not know how to solve... Error that appears on console: tasks py. from __future__ import…
-
0
votes1
answer51
viewsContinuing task execution even after exception
The method RelatoriosEstaticos.AbrirDataAtual which is within the Task below is returning an exception already dealt with in the method itself, the problem is that the Task continues the execution…
-
0
votes1
answer95
viewsProblem when cancelling a process
I asked a question earlier to cancel the process of compressing files. I have 2 problems with this code, the program has the function of compressing files in pairs separately getting 2 files in each…
-
0
votes0
answers54
viewsParallel Task How to improve the performance of this function
I would like a suggestion to improve the performance of these methods. They have taken too long to complete. Please if the question is not very clear just say that I try to improve I will provide…
-
0
votes0
answers56
viewsHow to call methods so that they have a delay?
I have a class: public class Robo { public async Task Ligar() { /* * Algo que pode demorar ou nao depende do status do robo * */ } } public class TesteRobo { public void Main() { List < Robo >…
-
0
votes1
answer53
viewsHow to wait for multiple tasks to finish to run the next line?
I have a button normal that performs three tasks, I want that when the tasks are running stay on the same line until the work is finished, without locking the program. I know there is a method of…
-
0
votes2
answers259
viewsC# - Can you run a task and return to the main thread later?
in the case the whole program is written without task and only one excerpt is with task, I wanted after that piece it returned to the "main thread". The code below is inside a for, and serves to…
-
0
votes0
answers86
viewsHow to get back Task<int> of a function (Mediatr) - Asp.net Core MVC
How do I get the entire value returned through a Task? I have tried several ways, as I have seen in forums on the net, but I could not. I tried to use var customerId =…
-
0
votes1
answer31
viewsException coming from a LIB and closing the system c#
I made a lib to manage the part of a system of mine, until then everything is ok, the problem occurs when this lib launches an Exception: public async void Update(ObjetoPostalModel objeto) { await…
-
0
votes0
answers45
viewsScrip | Task Scheduler (Never Finish)
Hello I created the . BAT that deletes files from the previous day and then opens Winscp and runs a Script @echo off C: cd C:\Unigrupo\ forfiles -p "C:\Unigrupo\ARQUIVOS_GERADOS" -d -1 -m *.csv -c…
-
0
votes1
answer92
viewsWhat is the difference between passing nil in Synchronize/What is the difference between a Task/Thread?
In most examples I found the structure of a basic Task is: procedure var FTask : ITask; begin FTask := TTask.Run( procedure begin //código a ser executado dentro da Task;…
-
0
votes1
answer60
viewsProblem when trying to solve a challenge
Good night, you guys... I need your help to write a small code that is able to receive a number as well as its index and return the next element of the sequence... The problem is that I still can’t…
-
-1
votes1
answer30
viewsAndroid task flow app?
You can create an application that does a "path" for the user? For example, when running the application it calls an Intent pro user set the time and the application "waits" the user events to go to…