小编cak*_*s88的帖子

在自制安装脚本中绕过提示(按回车)

安装自制软件的非常简单的脚本:

  #!/bin/bash

  ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Run Code Online (Sandbox Code Playgroud)

输出给出:

==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press RETURN to continue or any other key to abort
Run Code Online (Sandbox Code Playgroud)

如何在这样的脚本中按Enter键?期望是最好的路线?

bash homebrew

22
推荐指数
3
解决办法
1万
查看次数

使用decimal将Java转换为BigDecimal - Java

我很难搞清楚如何转换它.这就是我想要的:

int i = 5900;

BigDecimal bD = new BigDecimal(i);
Run Code Online (Sandbox Code Playgroud)

我需要bD为59.00,但我无法弄清楚如何得到这个结果.所有我能得到的是5900作为BigDecimal类型.任何建议都会有所帮助,谢谢.

java type-conversion bigdecimal

17
推荐指数
1
解决办法
6万
查看次数

pm2 start app.js在15次重启后退出

npm start会启动我的应用程序就好了但是当我这样做时:

pm2 start app.js
Run Code Online (Sandbox Code Playgroud)

我明白了:

[PM2] Spawning PM2 daemon
[PM2] PM2 Successfully daemonized
[PM2] Process app.js launched
????????????????????????????????????????????????????????????????????????????????????
? App name ? id ? mode ? pid  ? status ? restart ? uptime ? memory      ? watching ?
????????????????????????????????????????????????????????????????????????????????????
? app      ? 0  ? fork ? 4681 ? online ? 0       ? 0s     ? 11.508 MB   ? disabled ?
????????????????????????????????????????????????????????????????????????????????????
 Use `pm2 show <id|name>` to get more details about an app
Run Code Online (Sandbox Code Playgroud)

在我得到的日志中:

[PM2] Starting streaming logs for [all] process …
Run Code Online (Sandbox Code Playgroud)

node.js express pm2

8
推荐指数
1
解决办法
5528
查看次数

模拟在xCode 7 UI Automation中按Home键

我已经把它归结为:

XCUIDevice.pressButton(noideawhatgoeshere)
Run Code Online (Sandbox Code Playgroud)

我试过XCUIDeviceButtonHome,home,Home,1

不知道如何模拟按下主页按钮,有没有人有任何指针?我是xCode/swift的新手

ui-automation ios-ui-automation swift ios9 xcode7

6
推荐指数
2
解决办法
4718
查看次数

检测tearDown() 函数中的测试是否失败 - Xcode UIAutomation、XCTest、Swift

如果测试通过,我需要更新一些日志,如果测试通过,我需要更新一些不同的日志。如何确定tearDown() 方法中的测试是通过还是失败?

override func tearDown() {
    super.tearDown()
    // Would like an if statement here to update my logs but not sure how to detect the state
    if fail {
        log.update("failed")
    } else if !fail {
        log.update("success")
    }

}
Run Code Online (Sandbox Code Playgroud)

xcode xctest swift xcode-ui-testing

5
推荐指数
1
解决办法
2044
查看次数

使用NSURLSession连接到具有无效证书的服务器(swift2,xcode7,ios9)

我正在使用Xcode 7,Swift 2和iOS9.我想使用NSURLSession连接到Web服务,但是当我尝试连接时出现以下错误:

2015-10-13 16:07:33.595 XCTRunner[89220:4520715] NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9813)
2015-10-13 16:07:33.604 XCTRunner[89220:4520571] Error with connection, details: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “domainapi.com” which could put your confidential information at risk." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x7fac7b6facc0>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

func request( dataPost : String, successHandler: (response: String) -> Void)-> String {
        let destination:String =  "https://domainapi.com:8743/WebService/sendData"
        let request …
Run Code Online (Sandbox Code Playgroud)

xcode swift ios9 xcode7 swift2

4
推荐指数
3
解决办法
1万
查看次数

使用sed抓取一个字符串

我正在使用curl从网站获取html然后我只需要一个介于'standards.xml?revision ='和'&'之间的特定字符串.我正在使用sed这样做,但我似乎无法正确使用正则表达式并需要一些帮助.

curl website.com | sed -r 's|.*standards\.xml\?revision=([0-9]+).*|\1|'
Run Code Online (Sandbox Code Playgroud)

我得到的输出是完整的HTML - 任何帮助将不胜感激.

regex sed

2
推荐指数
1
解决办法
96
查看次数

Swift 2中的HTTPS Post - 使用NSURLSession/NSMutableURLRequest

使用swift 2,新的语言.我的目标是向API发送一个简单的post请求,然后解析响应.我没有找到一个明确的方法来做到这一点,我所做的任何尝试都失败了.这是我有的:

func restURL() {
        let xmlStr: String? = "<webservices><WebService type='test'><WSName>test</WSName><select>select * from receipts where id = '1234'</select></WebService></webservices>"
        let session = NSURLSession.sharedSession()
        let url = NSURL(string: "https://apiwebaddress.com/post" as String)!
        let request = NSMutableURLRequest(URL: url)
        let post:NSString = xmlStr!
        let postData:NSData = post.dataUsingEncoding(NSUTF8StringEncoding)!
        request.HTTPMethod = "POST"
        request.HTTPBody = postData
        request.setValue("0", forHTTPHeaderField: "Content-Length")
        request.setValue("application/xml", forHTTPHeaderField: "Content-Type")
        request.setValue("gzip,deflate", forHTTPHeaderField: "Accept-Encoding")
        request.setValue("Keep-Alive", forHTTPHeaderField: "Connection")
Run Code Online (Sandbox Code Playgroud)

我相信我把它设置正确,我想发送它然后在响应的主体中获取xml,但我不知道从这里去哪里.我读过的所有内容都被弃用或混淆.有人可以用简单的术语解释如何实现我的目标吗?提前致谢

xml rest post xcode7 swift2

1
推荐指数
1
解决办法
1750
查看次数