我使用虚拟Box和Genymotion插件(Android Studio)安装了Genymotion,创建了一个新设备并且即使从Android Studio也能正常运行.
但是,当我点击"运行"按钮时,Genymotion设备没有出现在设备选择器上,它在"选择正在运行的设备"单选按钮下显示 " 无显示 ".如何让Genymotion设备出现在设备选择器上并运行我的应用程序?这是我在SDK管理器中遗漏的东西吗?
我经常要排序卡片.这些是"收集器"卡,编号从1到216,有双打和缺少数字.
我正在寻找适用于物理卡的排序算法.插入排序似乎很好,因为插入卡不需要像计算机内存中那样移动后续卡.但是,通过大型平台进行扫描非常耗时.有了一个大甲板,甚至有可能你可以放下甲板,不得不重新开始排序.
我可以将卡片放在一张大桌子上并直接将每张卡片放在正确的位置,但这需要相当大的空间并且不太方便.
我通常的方法是在甲板上进行第一次扫描并将它们放入1-49,50-99,100-149,150-199,200 +的堆叠中.然后我扫描每个牌组并将它们放入堆栈0,1,2,3,4中.最后,我对每个10个包应用插入排序.尽管如此,这仍然是一个乏味的过程.
另一个想法是采取50个堆栈并粗略地对它们进行排序.25将围绕中间,40靠近堆栈的末端,依此类推.这很快就会带来一个粗略排序的50层甲板,我可以轻松地扫描它并修复排序.
我想知道更复杂的算法是否可以方便地应用于物理卡组.我没有看到我们如何应用快速排序和像堆排序这样的东西需要知道卡片内的卡片索引.
我必须使用无效的SSL证书调用托管在Web服务器上的HTTP服务.在开发中,我使用keytool导入证书,但每个客户端安装的证书都不同,所以我不能捆绑它.
前言:我不要知道跳过SSL验证实在是太丑了.在这种特定情况下,我甚至不需要SSL,系统中的所有其他通信都是简单的HTTP.所以我真的不关心MITM攻击等.攻击者无需破解SSL,因为数据没有SSL.这是对我无法控制的遗留系统的支持.
我正在使用HttpURLConnection带有SSLSocketFactorya NaiveTrustManager和a的NaiveHostnameVerifier.这适用于我尝试过的一些自签名服务器,但不适用于客户的网站.我得到的错误是:
javax.net.ssl.SSLKeyException: [Security:090477]Certificate chain received from xxxxxxxxxx was not trusted causing SSL handshake failure.
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireException(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.fireAlertSent(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.fireAlert(Unknown Source)
at com.certicom.tls.record.handshake.ClientStateReceivedServerHello.handle(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessage(Unknown Source)
at com.certicom.tls.record.handshake.HandshakeHandler.handleHandshakeMessages(Unknown Source)
at com.certicom.tls.record.MessageInterpreter.interpretContent(Unknown Source)
at com.certicom.tls.record.MessageInterpreter.decryptMessage(Unknown Source)
at com.certicom.tls.record.ReadHandler.processRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readRecord(Unknown Source)
at com.certicom.tls.record.ReadHandler.readUntilHandshakeComplete(Unknown Source)
at com.certicom.tls.interfaceimpl.TLSConnectionImpl.completeHandshake(Unknown Source)
at com.certicom.tls.record.WriteHandler.write(Unknown Source)
at com.certicom.io.OutputSSLIOStreamWrapper.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.flush(FilterOutputStream.java:123)
at …Run Code Online (Sandbox Code Playgroud) 在我的Angular 2应用程序中,我从原始css切换到less,以便我可以写:
.main-button {
.btn;
.btn-primary;
padding: 1em;
}
Run Code Online (Sandbox Code Playgroud)
而不是在我的HTML中到处堆叠类名.为了实现这一点,我需要:
在angular-cli.json,改变:
"defaults": {
"styleExt": "css",
"prefixInterfaces": false
}
至 "styleExt": "less",
重命名我foo.component.css要foo.component.less和更新foo.component.ts相应.
在组件中,为了能够引用引导类,我不得不: @import "~bootstrap/less/bootstrap";
这工作正常,但我现在在浏览器控制台中收到404错误:
jquery-1.12.3.min.js:2 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.woff2 (anonymous function) @ jquery-1.12.3.min.js:2i @ jquery-1.12.3.min.js:2fireWith @ jquery-1.12.3.min.js:2ready @ jquery-1.12.3.min.js:2K @ jquery-1.12.3.min.js:2
foobar:1 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.woff
foobar:1 GET http://localhost:4200/node_modules/bootstrap/fonts/bootstrap/glyphicons-halflings-regular.ttf
Run Code Online (Sandbox Code Playgroud)
我在@ icon-font-path上尝试了一些变种而没有成功.我检查了网络选项卡中的字体请求并查看http://localhost:4200/448c34a56d699c29117adc64c43affeb.woff2.
我也尝试过使用sass/scss.这需要附加模块bootstrap-sass和类似的include指令,但结果完全相同.
没有404错误的正确方法是什么?
这是服务ng serve,它是默认的.
我有一个logback.groovy,它使用一些自定义字段将数据发送到网络上的logstash:
appender("LOGSTASH", LogstashTcpSocketAppender) {
encoder(LogstashEncoder) {
customFields = """{ "token": "xxxxx", "environment":"dev", "some_property":"foobar" }"""
}
remoteHost = "logstashlistener.host.name"
port = 5000
}
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.但是,我需要清理一些对弹性搜索下游无效的字段名称.基于LogstashEncoder文档,这可以像这样实现:
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<fieldNames>
<timestamp>time</timestamp>
<message>msg</message>
...
</fieldNames>
</encoder>
Run Code Online (Sandbox Code Playgroud)
这看起来很棒,但我必须将其纳入logback.groovy表示法.我尝试了一个hashmap,字符串和更多,但总是最终Cannot cast object 'xxxx' with class 'xxxx' to class 'net.logstash.logback.fieldnames.LogstashFieldNames'
当我在index.html页面中添加我的代码时,我正试图在我的项目angular2中使用wysiwyg(在根页面上,它可以工作)
但是当我尝试在子视图html中使用它时,它没有得到css或(和)javascript代码来正确获取我的所见即所得
<!doctype>
<html>
<head>
<base href="/">
<title>Arkloud Adservio</title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0"/>
<!-- Load libraries -->
<!-- IE required polyfills, in this exact order -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/es6/dev/src/testing/shims_for_IE.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.js"></script>
<script src="node_modules/angular2/bundles/router.dev.js"></script>
<script src="node_modules/angular2/bundles/http.js"></script>
<script src="node_modules/angular2/bundles/http.dev.js"></script>
<!--bootsrat https-->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"
integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript --> …Run Code Online (Sandbox Code Playgroud) 我有一个带有代表上次活动的 Date 对象的实体。我想查询平均空闲时间。所以在 SQL 中类似:
SELECT AVG(NOW() - idle_date) FROM mytable WHERE ....
Run Code Online (Sandbox Code Playgroud)
我尝试这样计算差异:
query.singleResult(
Expressions.dateOperation(
Long.class,
Ops.DateTimeOps.DIFF_SECONDS,
DateExpression.currentDate(),
myTable.idleDate
)
);
Run Code Online (Sandbox Code Playgroud)
但这不允许我对结果求平均值,只能对最小值和最大值求平均值。
如何用日期/时间差(以秒为单位)表达该平均值?
我正在使用XMLSlurper(groovy 1.7.4)解析一些XML,我需要删除一个标签(不要让它为空!).这是一个代码示例说明它:
import groovy.xml.StreamingMarkupBuilder
def CAR_RECORDS = '''
<records>
<car name='HSV Maloo' make='Holden' year='2006'>
<country>Australia</country>
<record type='speed'>Production Pickup Truck with speed of 271kph</record>
</car>
<car name='P50' make='Peel' year='1962'>
<country>Isle of Man</country>
<record type='size'>Smallest Street-Legal Car at 99cm wide and 59 kg in weight</record>
</car>
<car name='Royale' make='Bugatti' year='1931'>
<country>France</country>
<record type='price'>Most Valuable Car at $15 million</record>
</car>
</records>
'''
def records = new XmlSlurper().parseText(CAR_RECORDS)
def allRecords = records.car
assert 3 == allRecords.size()
def firstRecord = records.car[0]
assert 'car' == firstRecord.name() …Run Code Online (Sandbox Code Playgroud) 我有一个带有继电器和过滤器的石墨烯接口。它工作得很好,但我想添加 order_by 选项。我的对象看起来像:
class FooGQLType(DjangoObjectType):
class Meta:
model = Foo
exclude_fields = ('internal_id',)
interfaces = (graphene.relay.Node,)
filter_fields = {
"id": ["exact"],
"code": ["exact", "icontains"],
}
connection_class = ExtendedConnection
class Query(graphene.ObjectType):
foo = DjangoFilterConnectionField(FooGQLType)
Run Code Online (Sandbox Code Playgroud)
ExtendedConnection 不应该相关,但是:
class ExtendedConnection(graphene.Connection):
class Meta:
abstract = True
total_count = graphene.Int()
def resolve_total_count(root, info, **kwargs):
return root.length
Run Code Online (Sandbox Code Playgroud)
这使我可以像foo(code_Icontains:"bar"). 根据石墨烯文档,我应该为此在 FilterSet 中使用 OrderingFilter 。我觉得有点烦人,因为过滤器应该是自动的,但如果我这样做:
class FooGQLFilter(FilterSet):
class Meta:
model = Foo
order_by = OrderingFilter(
fields=(
('code', 'code'),
('lastName', 'last_name'),
('otherNames', 'other_names'),
)
) …Run Code Online (Sandbox Code Playgroud)