zoukankan      html  css  js  c++  java
  • 戴维营收集

    https://github.com/owahab/paperclip-ffmpeg   自动提取视频缩略图,还可以转换视频格式
    https://github.com/thoughtbot/paperclip/  上传文件以及生成缩略图
     
    1633       int QTextEngine::findItem(int strPos) const
    1634 {
    1635     itemize();
    1636     int left = 1;
    1637     int right = layoutData->items.size()-1;
    1638     while(left <= right) {
    1639         int middle = ((right-left)/2)+left;
    1640         if (strPos > layoutData->items[middle].position)
    1641             left = middle+1;
    1642         else if(strPos < layoutData->items[middle].position)
    1643             right = middle-1;
    1644         else {
    1645             return middle;
    1646         }
    1647     }
     
    排云鹤(281559411) 18:46:20
        NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000"];//POST
        NSURLRequest *request = [[AFHTTPClient clientWithBaseURL:url] multipartFormRequestWithMethod:@"POST" path:@"mtvs.json" parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"14", @"mtv[user_id]", @"abcddeexxxxxxxxxxxx", @"mtv[title]", @"adfkajdkfjkasdf", @"mtv[description]", nil] constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
            [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"/Users/cheetah/Downloads/copyright.mp4"] name:@"mtv[video]" error:nil];
        }];
        AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
        [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
            NSString *str = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
            NSLog(@"%@", str);
        } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
            NSLog(@"%@", error);
        }];
        [operation start];
     
       
    //    NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000/login.json"];
    //    NSURL *url = [NSURL URLWithString:@"http://192.168.1.254:5000/signup.json"];
    //    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    //    [request setHTTPMethod:@"POST"];
    //    
    //    NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"wcrane23", @"name", @"asss@a.aaaaaaa", @"email", @"lishan", @"password", nil];
    //    NSData *data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
    //    [request setHTTPBody: data];
    //    [request setValue:[NSString stringWithFormat:@"%d", data.length] forHTTPHeaderField: @"Content-Length"];
    //    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    //    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    //    
    //    NSHTTPURLResponse *response;
    //    NSData *recData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:nil];
    //    NSString *json = [NSJSONSerialization JSONObjectWithData:recData options:NSJSONReadingAllowFragments error:nil];
    //    NSLog(@"%@", json);
     
     
  • 相关阅读:
    python中装饰器的原理
    python中封装、继承、多态
    Linux 中数组的使用
    Linux中环境变量中文件执行顺序
    Linux中FTP的一点理解
    原来... 拷贝构造函数的参数为什么必须使用引用类型
    C++ Programming language读书笔记
    linux 用户态 内核态
    Linux命令学习整理。
    fork &vfork --陈皓
  • 原文地址:https://www.cnblogs.com/alihaiseyao/p/3404768.html
Copyright © 2011-2022 走看看