小编Jab*_*Jab的帖子

错误域= NSURLErrorDomain代码= -1017"操作不能

我刚刚开始ios开发,我正在尝试与我的api交换数据.当我正在进行POST请求时一切正常,但是当我尝试执行GET请求时,我收到以下错误:

错误域= NSURLErrorDomain代码= -1017"操作无法完成.(NSURLErrorDomain错误-1017.)"UserInfo = 0x145a2c00 {NSErrorFailingURLStringKey = http://myAPI.com/,_kCFStreamErrorCodeKey = -1,NSErrorFailingURLKey = http:/ /myAPI.com,_kCFStreamErrorDomainKey = 4,NSUnderlyingError = 0x145b21d0"操作无法完成.(kCFErrorDomainCFNetwork error -1017.)"}

有人可以解释出了什么问题以及如何解决它?

我的请求:

-(void)hitApiWithURL:(NSString*)url HTTPMethod:(NSString*)HTTPMethod params:(NSDictionary*)params successBlock:(successTypeBlock)success  failureBlock:(errorTypeBlock)failure{


    NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration];
    NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil];


    [sessionConfig setHTTPAdditionalHeaders:@{@"Content-type": @"application/json"}];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:url]];
    [request setHTTPMethod:HTTPMethod];

    // The body
    NSError *error = nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:params options:0 error:&error];
    [request setHTTPBody:jsonData];


    NSURLSessionDataTask *dataTaks = [session dataTaskWithRequest:request];
    [dataTaks resume];

    NSLog(@"dataTask started");

}


- (void)URLSession:(NSURLSession *)session …
Run Code Online (Sandbox Code Playgroud)

objective-c ios

5
推荐指数
2
解决办法
9389
查看次数

Bokeh:AttributeError:'DataFrame'对象没有属性'tolist'

我是熊猫和散景的新手,我正在尝试从熊猫数据框创建一个散点图.但是,我不断收到以下错误:

new_data[colname] = df[colname].tolist()
AttributeError: 'DataFrame' object has no attribute 'tolist' 
Run Code Online (Sandbox Code Playgroud)

使用散景中的虚拟数据(来自bokeh.sampledata.iris导入花作为数据),散射效果很好.

   type   tsneX      tsneY      +50.000 columns
0  A      53.828863  20.740931  
1  B      57.816909  18.478468  
2  A      55.913429  22.948167  
3  C      56.603005  15.738954 


scatter = Scatter(df, x='tsneX', y='tsneY',
                  color='type', marker='type',
                  title='t-sne',
                  legend=True)
Run Code Online (Sandbox Code Playgroud)

编辑:我没有使用tolist(),但是散景的Scatter()会产生并产生下面的错误.

python pandas bokeh

5
推荐指数
2
解决办法
3万
查看次数

React Native摇动手势不起作用

将此pod添加到我的react-native项目(RN 0.42)后,摇动手势在iOS上不再起作用.除了在xcode中构建它之外,我无法调试我的代码,这非常烦人.它确实减慢了开发速度,所以如果有人有解决方案,我们将不胜感激.

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
use_frameworks!

def available_pods
    project ‘rrnf’, 'Debug' => :debug

    react_path = '../node_modules/react-native'
    yoga_path = File.join(react_path, 'ReactCommon/yoga')


    pod 'React', path: react_path, :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    ]
    pod 'Yoga', :path => yoga_path

    [
    'Firebase',
    'Firebase/Core',
    'Firebase/Auth',
    'Firebase/Storage',
    'Firebase/Database',
    'Firebase/RemoteConfig',
    'Firebase/Messaging'
    ].each do |lib|
        pod lib
    end

    pod 'react-native-camera', path: '../node_modules/react-native-camera'

end

target 'rrnf' do
    available_pods
end

target 'rrnfTests' do
    available_pods
end
Run Code Online (Sandbox Code Playgroud)

react-native

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

logits 和标签必须是可广播的:logits_size=[32,1] labels_size=[16,1]

我正在尝试学习 tensorflow,但出现以下错误:logits 和标签必须是可广播的:logits_size=[32,1] labels_size=[16,1]

当我将其作为输入时,代码运行良好:

self.input = np.ones((500, 784))
self.y = np.ones((500, 1))
Run Code Online (Sandbox Code Playgroud)

但是,当我添加额外的维度时,会抛出错误:

self.input = np.ones((500, 2, 784))
    self.y = np.ones((500, 1))
Run Code Online (Sandbox Code Playgroud)

构建图的代码

    self.x = tf.placeholder(tf.float32, shape=[None] + self.config.state_size)
    self.y = tf.placeholder(tf.float32, shape=[None, 1])

    # network architecture
    d1 = tf.layers.dense(self.x, 512, activation=tf.nn.relu, name="dense1")
    d2 = tf.layers.dense(d1, 1, name="dense2")


    with tf.name_scope("loss"):
        self.cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits(labels=self.y, logits=d2))
        self.train_step = tf.train.AdamOptimizer(self.config.learning_rate).minimize(self.cross_entropy,
                                                                                     global_step=self.global_step_tensor)
        correct_prediction = tf.equal(tf.argmax(d2, 1), tf.argmax(self.y, 1))
        self.accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
Run Code Online (Sandbox Code Playgroud)

有人可以向我解释为什么会发生这种情况以及如何解决这个问题吗?

python tensorflow

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

使用CCHmac()生成HMAC swift sdk8.3

在SDK8.3之前我用这种方式生成了我的hmac.现在我在CCHmac()函数上出错了.由于我是初学者,我无法弄清楚如何解决它.在此先感谢您的帮助!

xcode警告:不能用类型的参数列表(UInt32,[CChar] ?, UInt,[CChar] ?, UInt,inout [(CUnsignedChar)]来'CCHmac'

func generateHMAC(key: String, data: String) -> String {

    let cKey = key.cStringUsingEncoding(NSUTF8StringEncoding)
    let cData = data.cStringUsingEncoding(NSUTF8StringEncoding)

    var result = [CUnsignedChar](count: Int(CC_SHA512_DIGEST_LENGTH), repeatedValue: 0)
    CCHmac(CCHmacAlgorithm(kCCHmacAlgSHA512), cKey, strlen(cKey!), cData, strlen(cData!), &result)


    let hash = NSMutableString()
    for var i = 0; i < result.count; i++ {
        hash.appendFormat("%02hhx", result[i])
    }

    return hash as String
}
Run Code Online (Sandbox Code Playgroud)

ios swift

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

2维字符串数组声明,线程"main"中的异常java.lang.NullPointerException java

我是java编程的新手,我无法找到解决问题的方法.我认为这是一个非常容易的问题,但我无法弄清楚我做错了什么,所以我希望你们中的一个可以帮助我.问题是当我尝试在数组中存储一些数据时,它返回以下错误:

Exception in thread "main" java.lang.NullPointerException
Run Code Online (Sandbox Code Playgroud)

public class FetchData{
    private String rows[][];
    private int rowCount;

    public FetchData(){
        rowCount = 0;
    }

    public boolean ConnectAndFetch(String start, String end){

        //not relevant to the problem
        for(...){
            List<WebElementdivList = driver.findElements(By.tagName("div"));

            int divCount = 0;
            int colCount = 0;
            for (WebElement elem : divList) {
                if(divCount 24){ 
                    if(colCount < 17){
                        System.out.println(elem.getText());
                        //System.out.println(colCount);
                        //System.out.println(rowCount);
                        rows[rowCount][colCount] = elem.getText();
                        colCount++;
                    } else { 
                        rowCount += 1;
                        colCount = 0;
                    }
                }
                divCount++;
            }
        }
        return true;
    } …
Run Code Online (Sandbox Code Playgroud)

java arrays string declaration nullpointerexception

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

内存耗尽php,这是因为1个文件发生还是可能发生因为我同时运行多个文件?

我已经制作了一个CSV解析器,但有时会返回内存耗尽错误.CSVparser包含一个jquery循环,它使用ajax启动多个php文件来解析文件.一些文件返回错误,我想知道这是否与同时运行的文件有关.所以我的问题是,我可以通过排队解析来防止疲惫的错误吗?

php cron parsing

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