小编Den*_*ido的帖子

iOS8上不推荐使用UIActionSheet

我想在iOS8上使用UIActionSheet,但它已被弃用,我不知道如何使用更新的方式来使用它...

看到旧代码:

-(void)acoesDoController:(UIViewController *)controller{
    self.controller = controller;
    UIActionSheet *opcoes = [[UIActionSheet alloc]initWithTitle:self.contato.nome delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:@"other", nil];

    [opcoes showInView:controller.view];
}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

    //switch case of the buttons

}
Run Code Online (Sandbox Code Playgroud)

为了说清楚,在这个例子中,在UITableView索引中长按后激活了操作表.

如何以正确的方式实现上面的代码?

objective-c deprecated uiactionsheet ios ios8

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

使用 .float_val 提取 tensorflow-serving grpc 请求结果的性能非常慢

出于某种原因,使用 .float_val 提取结果所用的时间非常长。

场景示例及其输出:

t2 = time.time()
options = [('grpc.max_receive_message_length', 100 * 4000 * 4000)]
channel = grpc.insecure_channel('{host}:{port}'.format(host='localhost', port=str(self.serving_grpc_port)), options = options)
stub = prediction_service_pb2_grpc.PredictionServiceStub(channel)
request = predict_pb2.PredictRequest()
request.model_spec.name = 'ivi-detector'
request.model_spec.signature_name = 'serving_default'

request.inputs['inputs'].CopyFrom(tf.make_tensor_proto(imgs_array, shape=imgs_array.shape))
res = stub.Predict(request, 100.0)

print("Time to detect:")
t3 = time.time(); print("t3:", t3 - t2)

t11 = time.time()
boxes_float_val = res.outputs['detection_boxes'].float_val
t12 = time.time(); print("t12:", t12 - t11)
classes_float_val = res.outputs['detection_classes'].float_val
t13 = time.time(); print("t13:", t13 - t12)
scores_float_val = res.outputs['detection_scores'].float_val
t14 = time.time(); print("t14:", …
Run Code Online (Sandbox Code Playgroud)

python grpc tensorflow tensorflow-serving

6
推荐指数
0
解决办法
482
查看次数

如何分析 FFT 输出(数组 [512])?

FFT 输出的值是什么意思?

我正在使用 AudioKit 的 FFT 算法(为 Swift 编写的框架),当我对 AudioNode(麦克风声音)进行 fft 时,它给了我一个包含 fft 数据的变量。它是一个有 512 个位置(0 到 511)的变量。

当我这样做时,它给了我非常小的结果,比如 0.00004231 甚至 2.41233e-7,有时是 2.41233e-12。这些值是什么意思?

我的想法:

    index 0: 0 - x Hz
          1: x - 2x Hz
          2: 2x- 3x Hz
          ::
          ::
          and so on...

    Each array has the Amplitude value of that position.
Run Code Online (Sandbox Code Playgroud)

我对吗?如果不是,请解释一下。它会对我有很大帮助。

audio signal-processing fft ios swift

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

与浏览器互动后,如何防止Iframe破坏浏览器的历史记录?

因此,在我的情况下,我使用iframe将Grafana附加到页面上(这为我提供了美观且易于使用的图形)。

可能会注意到,每次对图形进行放大或缩小(使用鼠标单击)的交互之后,Grafana的iframe都会触发我的Angular页面上的某种刷新,从而弄乱了浏览器的历史记录。我看不到Iframe的src发生任何更改以证明刷新此页面是合理的,并且它显然不会触发任何操作(例如,不会触发任何加载)。

这是正常现象吗?我该如何预防?

我正在使用Grafana版本6.2.2和Angular 6.1的脚本仪表板。

html javascript grafana angular

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