task

How to load a cron expression from db and reschedule it with Spring?

有些话、适合烂在心里 提交于 2019-12-05 01:41:40
I'm using Spring scheduling to have batches in my application. @Scheduled(cron = "${batch.name|0 0 21 * * ?}") public void restart() { } Values are load from a properties file and default value from the @Scheduled annotation parameter. Now, I would like to be able to load a cron value from database (so from an object) without using Quartz library, only with the default Spring scheduler. Does someone know if and how it is possible? Thank you in advance. Alexis B. I found a solution by following this : Spring @Scheduled annotation and this : http://tutorials.jenkov.com/java-util-concurrent

Continue Task after all tasks finish

我只是一个虾纸丫 提交于 2019-12-05 01:22:18
问题 In some class I want to load 2 collection asynchronously with Task and stop busyindicator I try Something like this var uiScheduler = TaskScheduler.FromCurrentSynchronizationContext(); WaitingIndicatorViewModel.IsBusy = true; var loadData1 = new Task<ObservableCollection<Data1>>(GetData1FromService).ContinueWith(t => Data1Collection = t.Result, uiScheduler); var loadData2 = new Task<ObservableCollection<Data2>>(GetData2FromService).ContinueWith(t => Data2Collection = t.Result, uiScheduler);

The taskdef ant task cannot be found

不羁岁月 提交于 2019-12-05 01:21:59
All - I'm following the most simplest instructions on this page: http://ant.apache.org/manual/develop.html However, when I try to execute the target "main" I get this error in netbeans: taskdef class dec102012.MyAntTask cannot be found using the classloader AntClassLoader[] But this error does not make sense because my new Java class that extends "Task" looks like this: package dec102012; import org.apache.tools.ant.BuildException; public class MyAntTask extends org.apache.tools.ant.Task{ private String msg; // The method executing the task public void execute() throws BuildException { System

How to check if an activity is locked (app pinning) in android Lollipop

让人想犯罪 __ 提交于 2019-12-05 01:02:48
I would like to know whether an activity is locked under app pinning in android 5.0 and above programatically. Please help me in this! Thanks! Sarangan Method to get if the activity in lock task mode. activityManager.isInLockTaskMode() API is deprecated in API level 23. Use the method activityManager.getLockTaskModeState() http://developer.android.com/reference/android/app/ActivityManager.html#getLockTaskModeState() public boolean isAppInLockTaskMode() { ActivityManager activityManager; activityManager = (ActivityManager) this.getSystemService(Context.ACTIVITY_SERVICE); if (Build.VERSION.SDK

How do I kill a task / coroutine in Julia?

只谈情不闲聊 提交于 2019-12-04 23:20:12
using HttpServer http = HttpHandler() do request::Request, response::Response show(request) Response("Hello there") end http.events["error"] = (client, error) -> println(error) http.events["listen"] = (port) -> println("Listening on $port") server = Server(http) t = @async run(server, 3000) This starts a simple little web server asynchronously. The problem is I have no idea how to stop it. I've been going through the Julia documentation and trying to find some function that will remove this task from the queue ( kill , interrupt , etc.) but nothing seems to work. How can I kill this task? I

Multiple Tasks JavaFX

那年仲夏 提交于 2019-12-04 21:52:23
I've been searching for some time now on how to create multiple tasks and have them run one after the other. Here is the java code: public class Main extends Application { DropShadow shadow = new DropShadow(); Button button = new Button("Start"); Task<Integer> task; Task<Integer> task2; Label label1 = new Label("Status: NOT STARTED"); ProgressBar bar = new ProgressBar(0); ProgressIndicator pi = new ProgressIndicator(0); Thread th = new Thread(); public void start(Stage stage) { task = new Task<Integer>() { protected Integer call() throws Exception { int iterations; for (iterations = 0;

How to correctly cancel a printing task running on a background STA thread?

孤街浪徒 提交于 2019-12-04 21:22:39
[Please note: This question was effectively solved in my other question: How to use a cancellationtokensource to cancel background printing ] I have been using the following method (from SO) to run my printers and print previews on a background thread: public static Task StartSTATask(Action func) { var tcs = new TaskCompletionSource<object>(); var thread = new Thread(() => { try { func(); tcs.SetResult(null); } catch (Exception e) { tcs.SetException(e); } }); thread.SetApartmentState(ApartmentState.STA); thread.Priority = ThreadPriority.AboveNormal; thread.Start(); return tcs.Task; } It works

Task not serializable while using custom dataframe class in Spark Scala

微笑、不失礼 提交于 2019-12-04 21:06:29
I am facing a strange issue with Scala/Spark (1.5) and Zeppelin: If I run the following Scala/Spark code, it will run properly: // TEST NO PROBLEM SERIALIZATION val rdd = sc.parallelize(Seq(1, 2, 3)) val testList = List[String]("a", "b") rdd.map{a => val aa = testList(0) None} However after declaring a custom dataframe type as proposed here //DATAFRAME EXTENSION import org.apache.spark.sql.DataFrame object ExtraDataFrameOperations { implicit class DFWithExtraOperations(df : DataFrame) { //drop several columns def drop(colToDrop:Seq[String]):DataFrame = { var df_temp = df colToDrop.foreach{

Bring task to front on widget click

狂风中的少年 提交于 2019-12-04 20:59:53
I sent a task (activity) to back with: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); moveTaskToBack(true); } but I need bring it to front by setOnClickPendingIntent in widget. Just start the main (root) activity of your application like this: Intent intent = new Intent(context, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); If the activity is already running in a task, this will just bring that task to the foreground (without creating any new

Save content of Email body in outlook to a file

三世轮回 提交于 2019-12-04 20:49:45
i want to save the contents of the Email Body in outlook to a file. I am able to save the entire message .msg but i want to save only the html content of the body. for example: In the outlook email body i have a table i want to save that table to a file. the script which i am working on: public void GetAttachments() { Microsoft.Office.Interop.Outlook.Application myolApp = default(Microsoft.Office.Interop.Outlook.Application); Microsoft.Office.Interop.Outlook.NameSpace ns = default(NameSpace); MAPIFolder Inbox = default(MAPIFolder); object Item = null; Attachment Atmt = default(Attachment);