小编mve*_*lli的帖子

如何设置ABPeoplePickerNavigationController的提示?

这是我用来调用人员选择器的代码,但提示标签文本不会改变:

ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
picker.peoplePickerDelegate = self;
picker.displayedProperties = [NSArray arrayWithObjects: [NSNumber numberWithInt:kABPersonEmailProperty], nil];  

picker.navigationItem.prompt = @"Choose a contact to...";

[self presentModalViewController:picker animated:YES];
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c addressbook

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

如何使用HTTP :: Server同时流式传输多个文件?

我正在开发一个提供大文件的HTTP服务.我注意到并行下载是不可能的.该过程一次只提供一个文件,所有其他下载都在等待上一次下载完成.如何同时流式传输多个文件?

    require "http/server"

    server = HTTP::Server.new(3000) do |context|
      context.response.content_type = "application/data"
      f = File.open "bigfile.bin", "r"
      IO.copy f, context.response.output
    end

    puts "Listening on http://127.0.0.1:3000"
    server.listen
Run Code Online (Sandbox Code Playgroud)

一次请求一个文件:

    $ ab -n 10 -c 1 127.0.0.1:3000/

    [...]
    Percentage of the requests served within a certain time (ms)
     50%      9
     66%      9
     75%      9
     80%      9
     90%      9
     95%      9
     98%      9
     99%      9
    100%      9 (longest request)
Run Code Online (Sandbox Code Playgroud)

一次请求10个文件:

    $ ab -n 10 -c 10 127.0.0.1:3000/

    [...]
    Percentage of the requests served within a …
Run Code Online (Sandbox Code Playgroud)

crystal-lang

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