• 戴维营收集


    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);
     
     
  • 相关阅读:
    json2.js和wcf传递Date对象问题
    使用WebClient发送POST请求
    我也质疑下petshop
    sql server 2005 游标使用小例
    关于SCOPE_IDENTITY、IDENT_CURRENT 和 @@IDENTITY
    小错误大麻烦
    SQL Server启动出现“指定的服务未安装”的解决方法
    非常不错的一个网站
    objectdatasource 未能找到带参数的非泛型方法
    SQLServer日志文件收缩
  • 原文地址:https://www.cnblogs.com/alihaiseyao/p/3404768.html
Copyright © 2020-2023  润新知