在使用Laravel 5.2过滤器时遇到问题,过滤后,我得到了一些意想不到的键,如"0","1","2"......,我该如何删除它?
过滤前:
[
{
"id": 1,
"user_id": 11,
"location": "1",
"content": "1",
"interest_id": 1,
"longitude": 1,
"latitude": 1,
"place_id": "1",
"created_at": "2016-06-09 15:44:18",
"updated_at": "2016-06-02 14:28:42",
"deleted_at": null
},
{
"id": 2,
"user_id": 12,
"location": "Forest Lake QLD, Australia",
"content": "I'm newbie. Hello everybody",
"interest_id": 1,
"longitude": 152.9692508,
"latitude": -27.6236519,
"place_id": "ChIJB_NHl8hOkWsRMIne81qjAgU",
"created_at": "2016-06-09 14:28:42",
"updated_at": "2016-06-09 14:28:42",
"deleted_at": null
},
{
"id": 8,
"user_id": 11,
"location": "Hendra QLD, Australia",
"content": "What time is it?",
"interest_id": 1,
"longitude": 153.0635202, …Run Code Online (Sandbox Code Playgroud) 我想传递一个接口作为参数,如下所示:
class Test {
fun main() {
test({})
// how can I pass here?
}
fun test(handler: Handler) {
// do something
}
interface Handler {
fun onCompleted()
}
}
Run Code Online (Sandbox Code Playgroud)
在Java中,我可以使用匿名函数test(new Handler() { .......... }),但我不能在Kotlin中执行此操作.有人知道怎么做吗?
java.io.IOException: Cannot run program "yarn": error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at com.Main.main(Main.java:32)
Run Code Online (Sandbox Code Playgroud)
你好,我在使用 Java 执行命令时遇到了一个奇怪的问题。我使用以下代码来运行命令,如果我运行mkdir testFolder,则程序运行成功,但如果我更改命令,yarn -v
则会发生错误。
try {
Process process = Runtime.getRuntime().exec("yarn -v");//, null, new File("/Users/macos/Desktop/TestProj/"));
} catch (IOException ex) {
ex.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
P/s: 在调试模式下:IntelliJ 可以运行上面的代码,但 Netbeans 失败。
在生产模式下(jar 文件):IntelliJ 也失败了。
编辑2:
MACs-MacBook-Pro:~ macos$ which pwd
/bin/pwd
MACs-MacBook-Pro:~ macos$ which mkdir
/bin/mkdir
MACs-MacBook-Pro:~ macos$ which java
/usr/bin/java
MACs-MacBook-Pro:~ macos$ which yarn
/usr/local/bin/yarn
Run Code Online (Sandbox Code Playgroud)
/bin我发现如果我运行or中的命令/usr/bin,代码运行正常(pwd,mkdir,java …
将八进制数转换为字符串时遇到问题.
p = 01212
k = str(p)
print k
Run Code Online (Sandbox Code Playgroud)
结果是650但我需要01212.我怎样才能做到这一点?提前致谢.
我使用过Firebase Dynamics链接,它可以打开我的应用,去玩商店或转到网址.但是当我通过链接传递一些参数时,我只能得到第一个参数.这是我的动态链接:
https://xx.app.goo.gl/?link=http://xx.com/?usn=abc&pass=def&apn=com.xx&afl=http://google.com
Run Code Online (Sandbox Code Playgroud)
我使用此代码获取链接:
// Build GoogleApiClient with AppInvite API for receiving deep links
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(AppInvite.API)
.build();
// Check if this app was launched from a deep link. Setting autoLaunchDeepLink to true
// would automatically launch the deep link if one is found.
boolean autoLaunchDeepLink = false;
AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, autoLaunchDeepLink)
.setResultCallback(
result -> {
if (result.getStatus().isSuccess()) {
// Extract deep link from Intent
Intent intent = result.getInvitationIntent();
String deepLink = AppInviteReferral.getDeepLink(intent);
Logger.e(deepLink);
}
}
); …Run Code Online (Sandbox Code Playgroud) 我只是按照本教程通过面容 ID 对用户进行身份验证,但实际上在身份验证失败后,它不适用于“再次尝试面容 ID”按钮,没有调用回调,我不知道为什么。这是代码:
@IBAction func touchIdAction(_ sender: UIButton) {
print("hello there!.. You have clicked the touch ID")
let myContext = LAContext()
let myLocalizedReasonString = "Biometric Authntication testing !! "
var authError: NSError?
if #available(iOS 8.0, macOS 10.12.1, *) {
if myContext.canEvaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, error: &authError) {
myContext.evaluatePolicy(.deviceOwnerAuthenticationWithBiometrics, localizedReason: myLocalizedReasonString) { success, evaluateError in
DispatchQueue.main.async {
if success {
// User authenticated successfully, take appropriate action
self.successLabel.text = "Awesome!!... User authenticated successfully"
} else {
// User did not authenticate successfully, look …Run Code Online (Sandbox Code Playgroud)