task

calling gradle “build” task in another project

匆匆过客 提交于 2019-12-08 23:42:17
问题 I am only a couple of days into using gradle In my current build.gradle script I have a task which I would like to call the build task in another project (ie. defined in a different build.gradle somewhere else) after each time it is executed My question is how do I call a task from another project? I guess I want to do something like tasks.build.execute() but it doesn't seem to work. I tried this: commandLine "${rootDir}\\gradle", 'build', 'eclipse' it at least executed the build and eclipse

Automatically run Git hook when creating a Git tag

左心房为你撑大大i 提交于 2019-12-08 17:26:38
问题 Is there a Git hook which can be executed when a new Git tag is added? Because I want to automatically write new Git tag names into a textfile. Do you have a clue on how to do this? 回答1: While it's not currently possible using hooks, you can always create a simple script. mytag.sh : #!/bin/sh [ -z "$1" ] || ( git tag $1 && git tag > /path/to/your-tags-file ) then : chmod +x mytag.sh git config alias.mytag !/path/to/mytag.sh 来源: https://stackoverflow.com/questions/4309759/automatically-run-git

Why is this code running synchronously?

試著忘記壹切 提交于 2019-12-08 17:15:38
问题 I am trying to understand concurrency by doing it in code. I have a code snippet which I thought was running asynchronously. But when I put the debug writeline statements in, I found that it is running synchronously. Can someone explain what I need to do differently to push ComputeBB() onto another thread using Task.Something? Clarification I want this code to run ComputeBB in some other thread so that the main thread will keep on running without blocking. Here is the code: { // part of the

Only run task if another isn't UP-TO-DATE in gradle

怎甘沉沦 提交于 2019-12-08 16:53:59
问题 I want to automatically add a serverRun task when doing functional tests in Gradle, so I add a dependency : funcTestTask.dependsOn(serverRun) Which results in the task running whether or not the funcTestTask even runs :compile :serverRun :funcTestTask (and associate compile tasks... etc) :serverStop OR :compile UP-TO-DATE :serverRun <-- unnecessary :funcTestTask UP-TO-DATE :serverStop The cost of starting the server is pretty high and I only want it to start if the functionalTest isn't UP-TO

Task.Factory.StartNew() vs. TaskEx.Run()

偶尔善良 提交于 2019-12-08 16:02:51
问题 Task.Factory.StartNew() basically receives an Action and returns a Task. In The Async CTP we have TaskEx.Run() which also receives an Action and returns a Task. They seem to do that same thing. Why TaskEx.Run() was introduced ? 回答1: Anders Hejlsberg talked about that briefly in an interview on Channel9. Apparently, Task.Run is just a shorthand for Task.Factory.StartNew . Its still early CTP days so we're unsure that Task.Run will make it int. I personally hope it won't because it's kind of

async vs non-async methods in a new library [closed]

喜你入骨 提交于 2019-12-08 15:59:07
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 years ago . In .NET 4.5, there are many methods that now come in async and non-async pairs, such as Flush() and FlushAsync() . Ideally I/O interactions would always be asynchronous where possible (you can always block with .Wait() if you really want to), but the non-async (blocking)

Task.Delay vs DispatcherTimer?

倾然丶 夕夏残阳落幕 提交于 2019-12-08 15:33:14
问题 I'm considering use Task.Delay() for a non-stop timer, because it's more simple and readable. As I'm new to .NET, I see no significant difference between the two codes. Can you show me the difference (if there is any) between them? // Create variable at some place DispatcherTimer timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(5); timer.Tick += timer_Elapsed; timer.Start(); // Function other place void timer_Elapsed(object sender, EventArgs e) { //Do stuff } vs // Every

iOS - calling Webservice and parsing JSON in Swift

我的梦境 提交于 2019-12-08 14:50:50
问题 I am using NSURLSession to call my own Webservice which returns JSON, works fine with this code: func getJSONFromDatabase(){ let url = NSURL(string: "http://www.myurl/mysqlapi.php") let task = NSURLSession.sharedSession().dataTaskWithURL(url!) {(data, response, error) in self.json = NSString(data: data!, encoding: NSUTF8StringEncoding) print(self.json) } task.resume() } However, it seems that this Task is not executed in the right order, because when i run the following function after the

await Task.CompletedTask for what?

此生再无相见时 提交于 2019-12-08 14:46:48
问题 I created UWP app with Windows Template Studio that introduced at Build2017. Below class is a part of generated code from it. public class SampleModelService { public async Task<IEnumerable<SampleModel>> GetDataAsync() { await Task.CompletedTask; // <-- what is this for? var data = new List<SampleModel>(); data.Add(new SampleModel { Title = "Lorem ipsum dolor sit 1", Description = "Lorem ipsum dolor sit amet", Symbol = Symbol.Globe }); data.Add(new SampleModel { Title = "Lorem ipsum dolor sit

webClient.DownloadStringTaskAsync().Wait() freezes the UI

人盡茶涼 提交于 2019-12-08 13:03:54
问题 I am using silverlight 4, and the new async CTP. private void button1_Click(object sender, RoutedEventArgs e) { WebClient wb = new WebClient(); var t = wb.DownloadStringTaskAsync("http://www.google.com"); t.Wait(); } This code causes the UI to freeze. On the other hand, this code works fine : private void button1_Click(object sender, RoutedEventArgs e) { WebClient wb = new WebClient(); var t = Task.Factory.StartNew(() => Debug.WriteLine("Doing something")); t.Wait(); } Whats the difference