class HasId<I> {}
class HasStringId extends HasId<String> {}
class Alert<T extends /*Some*/Object> extends HasStringId {}
class BaseController<M extends HasId<String>> {
// abstract Class<M> getModelClass();
}
class AlertController extends BaseController<Alert> { // error here
// @Override Class<Alert> getModelClass() {
// return Alert.class;
// }
}
Run Code Online (Sandbox Code Playgroud)
在OpenJDK6上编译很好,但在OpenJDK7中给出:
AlertController.java:50: error: type argument Alert is not within bounds of
type-variable T
class AlertController extends BaseController<Alert> {
^
where T is a type-variable:
T extends HasId<String> declared in class BaseController
Run Code Online (Sandbox Code Playgroud)
请注意,第50行有rawtype警告,因为必须参数化Alert.如果我这样做,例如extends BaseController<Alert<Object>>代码编译.但我不能这样做,因为我需要实现getModelClass().
更新:这是Java …
如何生成“较低”和“较高”预测,而不仅仅是“yhat”?
import statsmodels
from statsmodels.tsa.arima.model import ARIMA
assert statsmodels.__version__ == '0.12.0'
arima = ARIMA(df['value'], order=order)
model = arima.fit()
Run Code Online (Sandbox Code Playgroud)
现在我可以生成“yhat”预测
yhat = model.forecast(123)
Run Code Online (Sandbox Code Playgroud)
并获取模型参数的置信区间(但不适用于预测):
model.conf_int()
Run Code Online (Sandbox Code Playgroud)
但如何生成yhat_lower和yhat_upper预测呢?
如何对一个Observable进行分组,并从每个GroupedObservable中仅保留内存中最后一个发出的项目?这样每个组的行为就像BehaviorSubject一样.
像这样的东西:
{user: 1, msg: "Anyone here?"}
{user: 2, msg: "Hi"}
{user: 2, msg: "How are you?"}
{user: 1, msg: "Hello"}
{user: 1, msg: "Good"}
Run Code Online (Sandbox Code Playgroud)
所以在内存中我们只有最后一项user:
{user: 2, msg: "How are you?"}
{user: 1, msg: "Good"}
Run Code Online (Sandbox Code Playgroud)
当订户订阅时,这两个项目立即发布(每个项目都在其自己的排放中).就像我们每个都有BehaviorSubject一样user.
因为人们可能会永远聊天,所以onCompleted()永远不会被激发.
我事先并不知道user可以有什么价值.
根据文件:
不要在客户端代码中的任何位置包含API密钥.
在我们当前的Android应用程序中就是这种情况 - API Key无法包含在代码中.但是,对于新版本的3.0.0 com.google.gms:google-services库,它在Missing api_key/current_key没有它的情况下开始抛出错误,如下所述:缺少使用Google Services 3.0.0的api_key /当前密钥.
此外,Google的配置生成器https://developers.google.com/mobile/add?platform=android&cntapi=gcm在google-services.json文件中包含API密钥.
它应该被保密吗?或者将它包含在客户端应用程序中是否安全?
就我可以阅读文档而言,两个设置都做同样的事情:当请求在待处理队列中花费的时间超过该设置时,启动一个新实例.
<max-pending-latency>在启动新实例以处理请求之前,App Engine应允许请求在挂起队列中等待的最长时间.默认值:"30ms".
- 较低的最大值意味着App Engine将更快地为待处理的请求启动新实例,从而提高性能但提高运行成本.
- 高最大值意味着用户可能需要等待更长时间才能提供服务请求,如果有待处理的请求且没有空闲实例来提供服务,但您的应用程序运行成本会更低.
<min-pending-latency>在启动新实例处理请求之前,App Engine应允许请求在挂起队列中等待的最短时间.
- 最小值意味着当所有现有实例都处于活动状态时,请求必须在待处理队列中花费更少时间.这样可以提高性能,但会增加运行应用程序的成本.
- 最小值意味着如果所有现有实例都处于活动状 这降低了运行成本,但增加了用户必须等待其请求的服务时间.
资料来源:https://cloud.google.com/appengine/docs/java/config/appref
那么min和max之间的区别是什么?
春天 3.2。当我这样做时一切正常:
@Controller
public class MyController {
@Inject
Provider<MyBean> provider;
@RequestMapping("/chart")
public void getChart(HttpServletResponse resp) {
provider.get();
}
}
Run Code Online (Sandbox Code Playgroud)
但当我将 MyBean 设置为 getChart 的参数时,它不起作用:
@Controller
public class MyController {
@RequestMapping("/chart")
public void getChart(HttpServletResponse resp, MyBean myBean) {
// No such method MyBean.<init>()
}
}
Run Code Online (Sandbox Code Playgroud)
因此 Spring 尝试创建 myBean 的一个新实例,而不是使用已经绑定的实例。
配置:
@Configuration
public class Config {
@Inject
@Bean @Scope("request")
public MyBean provideMyBean(MyOtherBean myOtherBean) {
return myOtherBean.getMyBean();
}
}
Run Code Online (Sandbox Code Playgroud)
如果我将控制器请求限定范围,并将 @Inject/@Autowired 添加到getChart(). 然后它无法找到 HttpServletResponse 实例 (NoSuchBeanDefinitionException),尽管请求范围内肯定存在一个实例。
也许它只是没有在 Spring 中实现?
当我使用 *DataflowPipelineRunner 从 Dataflow 文档中运行示例 WordCount 作业时,它会启动工作程序,然后只是挂起状态为 Running。
最后两条状态消息:
Jan 29, 2016, 22:05:50
S02: (b959a12901787f4d): Executing operation ReadLines+WordCount.CountWords/ParDo(ExtractWords)+WordCount.CountWords/Count.PerElement/Init+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey+WordCount.CountWords/Count.PerElement/Count.PerKey/Combine.GroupedValues/Partial+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey/Reify+WordCount.CountWords/Count.PerElement/Count.PerKey/GroupByKey/Write
Jan 29, 2016, 22:06:42
(c3fc1276c0229a41): Workers have started successfully.
Run Code Online (Sandbox Code Playgroud)
就是这样。当我单击“工作日志”时,它完全是空的。保持这种状态至少 20 分钟。
它适用于 DirectPipelineRunner(在几秒钟内完成并在我的 gs://... 上创建输出文件)。
我应该看什么?
命令行参数:
--project=my-project
--stagingLocation=gs://my-project/dataflow/staging
Run Code Online (Sandbox Code Playgroud) Google Managed Prometheus 表示每百万个样本的成本为 0.2 美元。然而,在定价示例中他们说:
场景 1:您有 100 个容器,每个容器写入 1,000 个标量时间序列。
变体 A:如果每个时间序列每 15 秒写入一次(1 个样本/15 秒),则每月写入的样本数量为 17,420,000,000 个(175,200 个样本/月 * 1,000 个时间序列 * 100 个容器),即 1742 万个。
而174.2亿就是174.2亿。所以在这个例子中,价格应该是 3600 美元,而不是 3.60 美元,这对于口袋来说是一个相当大的差异。
我有一个Google接受的有效OAuth2令牌,但GoogleIdTokenVerifier甚至无法解析它.
令牌是ya29.1.AADtN_XcjzHgauKetBvrbgHImGFg1pjiHRQAKHyTglBDjEZsTPUMQJ5p-xAKtk955_4r6MdnTe3HZ08(不用担心,它已经过期).
它是在Android上使用获得的
accountManager.blockingGetAuthToken(account, "oauth2:https://www.googleapis.com/auth/userinfo.email", true);
Run Code Online (Sandbox Code Playgroud)
当我打电话给https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=...
我时,我得到了理智的结果
{
"issued_to": "34951113407.apps.googleusercontent.com",
"audience": "34951113407.apps.googleusercontent.com",
"scope": "https://www.googleapis.com/auth/userinfo.email",
"expires_in": 3175,
"email": "me@gmail.com",
"verified_email": true,
"access_type": "offline"
}
Run Code Online (Sandbox Code Playgroud)
所以它必须是有效的令牌.但是当我打电话时
new GoogleIdTokenVerifier(new UrlFetchTransport(), JacksonFactory.getDefaultInstance())
.verify(authToken)
Run Code Online (Sandbox Code Playgroud)
它给了我
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('É' (code 201)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.ByteArrayInputStream@69886979; line: 1, column: 2]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1378)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:599)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:520)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2275)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:788)
at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:674)
at com.google.api.client.json.jackson2.JacksonParser.nextToken(JacksonParser.java:55)
at com.google.api.client.json.JsonParser.startParsing(JsonParser.java:213)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:372)
at com.google.api.client.json.JsonParser.parse(JsonParser.java:328)
at …Run Code Online (Sandbox Code Playgroud) google-api oauth-2.0 google-api-java-client android-authenticator
Spark具有SQL函数percentile_approx(),与Scala对应的是SQL df.stat.approxQuantile()。
但是,Scala副本不能用于分组数据集,例如df.groupby("foo").stat.approxQuantile(),在此处回答:https : //stackoverflow.com/a/51933027。
但是可以在SQL语法中进行分组和百分位。所以我想知道,是否可以从SQL percentile_approx函数定义UDF 并将其用于分组数据集?
我想用“dev”配置文件构建我的 rust 应用程序,但是一些依赖关系用“release”配置文件(因为否则它们真的很慢)。如何有选择地为我的 crate 依赖项指定配置文件?
java ×2
android ×1
apache-spark ×1
arima ×1
autowired ×1
generics ×1
google-api ×1
javascript ×1
oauth-2.0 ×1
openjdk ×1
python ×1
reactivex ×1
rust ×1
rust-cargo ×1
rxjs ×1
spring ×1
spring-3 ×1
spring-mvc ×1
statsmodels ×1