我想选择p
.section容器中的所有元素,但只是在包含已单击的a.open链接的元素中
$('.section').delegate('a.open', "click", function(){
$(this).parent().filter('p').show(); //I want to select all `p` elements in .section container, but just in th one that containts the a.open link that has been clicked
})
Run Code Online (Sandbox Code Playgroud)
谢谢
我想做这样的事情:
$string = "Lorem ipsum DOLOR Sit amet";
...some magic here... -> $finalString
$finalString = "Lorem ipsum dolor Sit amet"
Run Code Online (Sandbox Code Playgroud)
基本上我不想将所有完全大写的单词转换为完整的小写单词.
我在https://github.com/KnpLabs/DoctrineBehaviors/#softDeletable的实体中使用 SoftDeletable 特征它工作正常,但有时我想强制删除实体。我怎样才能做到这一点?
当我使用时$em->remove($entity)
,它会被软删除,但我需要将其从数据库中完全删除。
我WHERE
在 postgres 数据库中使用具有以下条件的查询:
WHERE extract(EPOCH FROM created_at) BETWEEN 1511132400 AND 1511737199
如何添加索引以便具有此条件的查询使用它?创建索引created_at
没有帮助,并且不使用索引。
目前,EXPLAIN
这样的查询给出:
Filter: (date_part('epoch'::text, created_at) >= '1511132400'::double precision) AND (date_part('epoch'::text, created_at) <= '1511737199'::double precision)
(该extract()
语句由 Grafana 生成,因此这就是我(或 Grafana 正在)使用它的原因
我无法理解kafka流中的groupBy / groupById和窗口化的概念。我的目标是汇总一段时间(例如5秒)内的流数据。我的流数据看起来像:
{"value":0,"time":1533875665509}
{"value":10,"time":1533875667511}
{"value":8,"time":1533875669512}
Run Code Online (Sandbox Code Playgroud)
时间以毫秒(纪元)为单位。我的时间戳记在我的消息中,而不在密钥中。我想平均5秒窗口的值。
这是我正在尝试的代码,但似乎无法使它正常工作
builder.<String, String>stream("my_topic")
.map((key, val) -> { TimeVal tv = TimeVal.fromJson(val); return new KeyValue<Long, Double>(tv.time, tv.value);})
.groupByKey(Serialized.with(Serdes.Long(), Serdes.Double()))
.windowedBy(TimeWindows.of(5000))
.count()
.toStream()
.foreach((key, val) -> System.out.println(key + " " + val));
Run Code Online (Sandbox Code Playgroud)
即使主题每两秒钟生成一次消息,此代码也不会打印任何内容。当我按Ctrl + C时,它会打印出类似
[1533877059029@1533877055000/1533877060000] 1
[1533877061031@1533877060000/1533877065000] 1
[1533877063034@1533877060000/1533877065000] 1
[1533877065035@1533877065000/1533877070000] 1
[1533877067039@1533877065000/1533877070000] 1
Run Code Online (Sandbox Code Playgroud)
此输出对我来说没有意义。
相关代码:
public class MessageTimeExtractor implements TimestampExtractor {
@Override
public long extract(ConsumerRecord<Object, Object> record, long previousTimestamp) {
String str = (String)record.value();
TimeVal tv = TimeVal.fromJson(str);
return tv.time;
}
}
public …
Run Code Online (Sandbox Code Playgroud) 我需要使用Java中的替换功能:
string.replace(myString,"");
myString的值,例如javascript:r(0)
,javascript:r(23)
,javascript:l(5)
等只是数始终是不同的,有r
或l
字母.匹配它的正则表达式是什么?谢谢
我有这个带有HTML的字符串: <span title="whatever">something I want to preserve</span>...
我正在使用正则表达式替换<span title="whatever">
,(
然后使用以下</span>
替换)
Pattern regex = Pattern.compile("<span\\s+[^>]*title=(['\"])(.*?)\\1[^>]*>");
Matcher matcher = regex.matcher(strLine);
if (matcher.find()) {
strLine = matcher.replaceAll("(");
strLine = strLine.replace("</span>", ")");
}
Run Code Online (Sandbox Code Playgroud)
我工作,但它取代了所有</span>
标签; 我只想替换匹配我刚刚匹配的开始标记的那个.
我尝试这样做,echo date("Y", strtotime("1999-00-00"));
而不是1999
返回1998
.有办法怎么处理这个?我更喜欢"干净的方式",不喜欢$finalYear = (float)$year+1
等等.日期格式必须是YYYY-00-00
(带零)
我正在努力做到这一点
@import "compass/css3";
.example {
@include display-box;
}
Run Code Online (Sandbox Code Playgroud)
Basicaly只是使用来自compass/css3
这里描述的mixin http://compass-style.org/reference/compass/css3/box/
但它给了我这个错误 Syntax error: Undefined mixin 'display-box'
我的指南针版本是 Compass 1.0.0.rc.1 (Polaris)
我究竟做错了什么?谢谢
使用jquery,如何在值数组中选择没有属性值的所有元素?
假设我有数组['a', 'b']
和输入
<input value="a">
<input value="b">
<input value="c">
<input value="d">
Run Code Online (Sandbox Code Playgroud)
我怎么可以只选择那些具有价值c
和d
?有没有办法没有each()
使用某种选择器,所以我可以使用它作为find(selector)
功能的例子?
java ×3
jquery ×2
php ×2
apache-kafka ×1
arrays ×1
compass-sass ×1
css ×1
css3 ×1
date ×1
doctrine-orm ×1
javascript ×1
postgresql ×1
regex ×1
replace ×1
sass ×1
string ×1
symfony ×1