我如何"问"应该由其路径提供的演员?
ask(context.actorSelection("../foo"), GetInfoMessage)
Run Code Online (Sandbox Code Playgroud)
...结果ActorSelection只有ActorRefs可以"问".或者,context.actorFor返回an ActorRef,但根据文档不推荐使用此函数.
如何编写JavaScript RegEx,以便它匹配例如单词cube,但只有在该单词small之前的20个字符范围内不存在该单词时.
RegEx应匹配:
cubered cubewooden cubesmall................cubeRegEx不匹配:
small cubesmall red cubesmall wooden cube..........small......cubeany sphere目前我的正则表达式看起来像这样:
> var regex = /(?:(?!small).){20}cube/im;
undefined
> regex.test("small................cube") // as expected
true
> regex.test("..........small......cube") // as expected
false
> regex.test("01234567890123456789cube") // as expected
true
> regex.test("0123456789012345678cube") // should be `true`
false
> regex.test("cube") // should be `true`
false
Run Code Online (Sandbox Code Playgroud)
前面必须有20个字符cube,每个字符不是第一个字符small.但问题是:如果cube出现在字符串的前20个字符内,则RegEx当然不匹配,因为前面没有足够的字符cube.
如何修复RegEx,以防止这些误报?
我想显示一个消息框,它在main.qml中实现(作为所有其他组件之上的层).该函数showMessage()使QML消息框可见并设置文本.因此,main.qml中的代码可以显示消息框,但其他组件(不在main.qml中)也应该能够显示消息框.
到目前为止,我的想法是创建一个C++ QML组件,它具有一个displayMessage()调用showMessage()根上下文功能的函数(→ main.qml).
mail.qml(根组件)
import QtQuick 1.0
// [...]
Rectangle {
id: main
function showMessage(text) {
// make a message area visible and set text
}
// [...]
// message box implementation
}
Run Code Online (Sandbox Code Playgroud)
App.qml
import QtQuick 1.0
import MessageForwarder 1.0 // implemented in C++
// [...]
Rectangle {
id: anApp
MessageForwarder { id: mf } // ? Possible without this?
Component.onCompleted: mf.displayMessage("A message."); // show …Run Code Online (Sandbox Code Playgroud) 其加密方法允许解密用数据Ñ出的中号键?
示例:共有5个人,每个人都获得一个单独的密钥.他们应该能够解密加密数据,但至少需要其中3个(任意组合)才能对其进行解密.