runtime

Java trycatch使用重试Retryer

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 02:50:27
重试的工具类 Guava-retrying 依赖 <!-- https://mvnrepository.com/artifact/com.github.rholder/guava-retrying --> <dependency> <groupId>com.github.rholder</groupId> <artifactId>guava-retrying</artifactId> <version>2.0.0</version> </dependency>    Retryer<Boolean> retryer = RetryerBuilder.<Boolean>newBuilder() //抛出runtime异常、checked异常时都会重试,但是抛出error不会重试。 .retryIfException() //返回false也需要重试(可以根据返回值确定需不需要重试) .retryIfResult(Predicates.equalTo(false)) //重调策略 .withWaitStrategy(WaitStrategies.fixedWait(10, TimeUnit.SECONDS)) //尝试次数 .withStopStrategy(StopStrategies.stopAfterAttempt(3)) .build(); try { retryer.call

How to open word document with /m “Macro argument” from java/or command-line without to specifi winword.exe path

人盡茶涼 提交于 2019-12-06 02:21:10
I want to do the next thing: String[] cmd = {"cmd","/c","c:\\Program Files (x86)\\Microsoft Office\\Office12\\WINWORD.exe","/mOpenPage","c:\\Navodilo.doc"}; Process proc = Runtime.getRuntime().exec(cmd); But, without to specify the winword.exe path but open the document with the macro... I read that there exist Auto Open macro, is it possible to specify input arguments for Auto Open macro? SOLVED: String[] cmd = {"cmd","/c","start","WINWORD.exe","/mOpenPage","c:\\Navodilo_za_uporabo_spletnega_servisa_wsEdp.doc"}; Process proc = Runtime.getRuntime().exec(cmd); It runs default winword.exe and

Adding Trusted Location to Access Run Time

廉价感情. 提交于 2019-12-06 02:17:00
问题 I have created a runtime access file, how do I add this file to Trusted Location on my clients PC, where there is No Access Installed. 回答1: Access 2007: [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations] [HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Access\Security\Trusted Locations\Location(n)] Access 2010: [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access\Security\Trusted Locations] [HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Access

how does the undecided generic type represents in ghci's runtime

大城市里の小女人 提交于 2019-12-06 01:59:16
I'm clear about the generic functions and generic data-types. In the generic type: data SB = forall x. (show x) => SB x instance Show SB where show (SB x) = show x so for any given type x , if it has a signature of Show , and there sure be a show function corresponds to it. but when typing in ghci, e.g. :t 1 outputs 1 :: Num a => a if binds 1 to a name: let a=1 :t a now a has a true type. The question is: What is 1 's form in the run-time system (before it has a type, it has only Num ) , since it can only hold some info of what it can be transformed to. Are there some internal functions for

get the annotation information at runtime

有些话、适合烂在心里 提交于 2019-12-06 01:55:43
问题 I wonder if there is any way I can get the annotation information of a class at runtime? Since I want to get the properties that sepcifily annotated. Example: class TestMain { @Field( store = Store.NO) private String name; private String password; @Field( store = Store.YES) private int age; //..........getter and setter } The annotations come from the hibernate-search,and now what I want is get which property of the "TestMain" is annotated as a 'field'(in the example,they are [name,age] ),and

Failure delivering result ResultInfo{who_null,request=1,result=-1, data =Intent{( has extras )}} to activity;NullPointerException

二次信任 提交于 2019-12-06 01:48:42
问题 I have two classes these names are Courses and MainActivity .MainActivity has LAUNCHER activity and it has Gridlayout. Courses has DEFAULT activity.When GridLayout clicked Courses Interface is openning and user is filling the views according to his or her course program so Courses object is created.I would like to send this object to MainActivity class.When I sending this object I'm getting NullPointerException.I tried to solve this problem but I can not.I need a proffesional help. here is

Template instantiation and function selection at runtime

*爱你&永不变心* 提交于 2019-12-06 01:34:54
I'm quite new to c++ and I'm trying to achieve something a bit tricky, for which I can't seem to find a satisfiable solution. Let's say I have these two functions: template <class T1, class T2> void foo(T1 param1, T2 param2){...}; template <class T1, class T2> void bar(T1 param1, T2 param2){...}; And at runtime, I want to select on of these two functions, and instantiate it with some template types obtained from a user input, say a char c . So I could do something like: double d; float f; switch(c) { case 'a': foo(d, f); break; case 'b': foo(f, d); break; case 'c': bar(d, f); break; case 'd':

Java入门——在Linux环境下安装JDK并配置环境变量

为君一笑 提交于 2019-12-06 01:08:50
Java入门——在Linux环境下安装JDK并配置环境变量 摘要:本文主要说明在Linux环境下JDK的安装,以及安装完成之后环境变量的配置。 安装 使用已下载的压缩包进行安装 在Java的官网上下载需要的版本: https://www.oracle.com/technetwork/java/javase/downloads/index.html 因为是在Linux环境上安装,所以要下载 .tar.gz 后缀的文件,才能在Linux系统里进行解压缩。 注意下载的压缩包要和Linux系统的位数相匹配,可以通过 cat /proc/version 命令查看系统的版本。 使用工具将下载好的文件上传到装有Linux系统的电脑上。 将压缩包的内容解压缩到 /opt 目录: 1 [root@localhost opt]# tar -zxvf jdk-8u91-linux-x64.tar.gz 等待解压缩完成,至此,Java在Linux上就安装完成了。 使用yum命令进行安装 使用 yum search jdk 命令查看可用安装包: 1 [root@localhost opt]# yum search jdk 2 已加载插件:fastestmirror 3 Loading mirror speeds from cached hostfile 4 * base: mirrors.tuna

Segfault on C++ Plugin Library with Duplicate Symbols

折月煮酒 提交于 2019-12-06 00:40:38
问题 I have a cross platform C++ application that is broken into several shared libraries and loads additional functionality from plugin shared libraries. The plugin libraries are supposed to be self contained and function by themselves, without knowledge of or dependency on the calling application. One of the plugins contains copied code from the main application, so contains symbol names that are duplicate to those in the engine. (Yes I know that's generally a no-no, but at the time the plugin

Method Swizzling利用OC动态性解决问题

ε祈祈猫儿з 提交于 2019-12-06 00:33:09
Method Swizzling 原理 在Objective-C中调用一个方法,其实是向一个对象发送消息,查找消息的唯一依据是selector的名字。利用Objective-C的动态特性,可以实现在运行时偷换selector对应的方法实现,达到给方法挂钩的目的。 每个类都有一个方法列表,存放着selector的名字和方法实现的映射关系。IMP有点类似函数指针,指向具体的Method实现。 我们可以利用 method_exchangeImplementations 来交换2个方法中的IMP, 我们可以利用 class_replaceMethod 来修改类, 我们可以利用 method_setImplementation 来直接设置某个方法的IMP, …… 归根结底,都是偷换了selector的IMP. // // MRProgressOverlayView+runtime.m // Identify // // Created by wupeng on 15/12/3. // Copyright © 2015年 StarShine. All rights reserved. // #import "MRProgressOverlayView+runtime.h" #import <objc/runtime.h> #import "StringUtils.h" #import