Gradle task replace string in .java file

May be you should try something like ant’s replaceregexp: task myCopy << { ant.replaceregexp(match:’aaa’, replace:’bbb’, flags:’g’, byline:true) { fileset(dir: ‘src/main/java/android/app/cfg’, includes: ‘TestingConfigCopy.java’) } } This task will replace all occurances of aaa with bbb. Anyway, it’s just an example, you can modify it under your purposes or try some similar solution with ant.

C# async within an action

The problem is in this line: return new Action(async () => … You start an async operation with the async lambda, but don’t return a task to await on. I.e. it runs on worker threads, but you’ll never find out when it’s done. And your program terminates before the async operation is complete -that’s why … Read more

Should we use ConfigureAwait(false) in libraries that call async callbacks?

When you say await task.ConfigureAwait(false) you transition to the thread-pool causing mapping to run under a null context as opposed to running under the previous context. That can cause different behavior. So if the caller wrote: await Map(0, i => { myTextBox.Text = i.ToString(); return 0; }); //contrived… Then this would crash under the following … Read more

AfterPublish target not working

Note: The following applies to VS2010 and publishing web-application projects with the “Web Deploy” publish method selected in the ‘Build/Publish {projectname}’ dialog. Julien Hoarau’s correct in that “Publish” is NOT the name of the msbuild target invoked in the above case; the actual target name is “MSDeployPublish”. Therefore, you have to define a “Target” element … Read more

NSubstitute – mock throwing an exception in method returning Task

Actually, the accepted answer mocks a synchronous exception being thrown, that is not the real async behavior. The correct way to mock is: var myService = Substitute.For<IMyService>(); myService.GetAllAsync() .Returns(Task.FromException<List<object>>(new Exception(“some error”))); Let’s say you had this code and GetAllAsync() try { var result = myService.GetAllAsync().Result; return result; } catch (AggregateException ex) { // whatever, do … Read more

Does Task.Wait(int) stop the task if the timeout elapses without the task finishing?

Task.Wait() waits up to specified period for task completion and returns whether the task completed in the specified amount of time (or earlier) or not. The task itself is not modified and does not rely on waiting. Read nice series: Parallelism in .NET, Parallelism in .NET – Part 10, Cancellation in PLINQ and the Parallel … Read more

How do task killers work?

In a nutshell, Automatic Task Killers work by polling the OS for a list of currently running processes and the memory they are consuming. Then either with an intelligent algorithm or with user input the Task Killers issue a call to the system telling the system to kill the process. There are two apis you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)