小编Yan*_* Li的帖子

node.js https示例,错误,与localhost连接的未知SSL协议错误

我使用这些链接中的简单示例:

链接 [如何在Node.js中创建HTTPS服务器?]

一个链接 [如何创建一个https服务器?docs.nodejitsu.com]

但我得到的错误就像

curl:(35)与localhost连接时出现未知的SSL协议错误:-9838

为什么?

https node.js

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

iOS13 public beta7 Charles 证书有问题,无法进行 SSL 代理

当我的iPhone 7还是iOS 12时一切都很好。升级到iOS13 public beta7后,我发现我的iPhone无法使用Charles 3.x版本进行SSL代理。

查尔斯 说:

SSLHandshake:握手期间远程主机关闭连接

您可能需要将浏览器或应用程序配置为信任 Charles 根证书。请参阅帮助菜单中的 SSL 代理。

在此处输入图片说明

charles-proxy ios13

9
推荐指数
2
解决办法
3552
查看次数

Mongoose Schema,如何在一个模式中嵌套对象?

在我的mongoose模式中,我定义了一些数据类型和两个对象数组.第一个对象菜应该没问题.

但是在第二个嵌套对象顺序中,我想要包含第一个对象菜,我不知道如何正确地执行此操作.

module.exports = function( mongoose) {
      var ShopSchema = new mongoose.Schema({
        shopName:     { type: String, unique: true },
        address:     { type: String},
        location:{type:[Number],index: '2d'},
        shopPicUrl:      {type: String},
        shopPicTrueUrl:{type: String},
        mark:  { type: String},
        open:{type:Boolean},
        shopType:{type:String},

        dish:   {type: [{
          dishName: { type: String},
          tags: { type: Array},
          price: { type: Number},
          intro: { type: String},
          dishPic:{ type: String},
          index:{type:Number},
          comment:{type:[{
            date:{type: Date,default: Date.now},
            userId:{type: String},
            content:{type: String}
          }]}
        }]},

        order:{type:[{
          orderId:{type: String},
          date:{type: Date,default: Date.now},
          dish:{type: [dish]},//!!!!!!!!! could I do …
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb

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

Mongoose .update()不会触发验证检查

我可以设置超出枚举数组的值,我不知道为什么mongoose不验证值,我是否以错误的方式更新枚举?

我的代码:

var OrderSchema = new mongoose.Schema({
status:{type:String,enum:['created','shipped','confirmed']},
)};

var changeOrderStatus = function(shopId,orderId,status,callback){

    Order.update({_id:orderId,shop:shopId},{$set:{status:status}},{upsert:false},
        function(err){

            console.log(err);
            callback(err);

    })
}
Run Code Online (Sandbox Code Playgroud)

状态枚举应该只有三个值:["创造","运","证实"]

但我能做到:

在此输入图像描述

mongoose

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

iOS 11 使用视觉框架 VNDetectRectanglesRequest 不精确地进行对象检测?

Apple 在 iOS 11 中有新功能,允许您使用视觉框架在没有模型的情况下进行对象检测。我尝试了这些新的 API,但发现VNDetectRectanglesRequest 的结果并不好。我是否正确使用了 API?

这是一些很好的案例:

在此处输入图片说明

在此处输入图片说明

还有一些不好的情况:

在此处输入图片说明

这是我的代码:

 func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
    guard let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)

        // create the request

        let request2 = VNDetectRectanglesRequest { (request, error) in
            self.VNDetectRectanglesRequestCompletionBlock(request: request, error: error)
        }

        do {
            request2.minimumConfidence = 0.7
            try self.visionSequenceHandler.perform([request2], on: pixelBuffer)
        } catch {
            print("Throws: \(error)")
        }
    }


func VNDetectRectanglesRequestCompletionBlock(request: VNRequest, error: Error?) {
        if let array = request.results {
            if array.count > 0 {
                let …
Run Code Online (Sandbox Code Playgroud)

ios apple-vision coreml

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

UITableView 部分标题与自定义 headerView 重叠?

我试图调整视图大小或添加约束但不起作用。 在此处输入图片说明

在此处输入图片说明

这是代码不起作用:

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 100;
    }
    return 0;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    //self.mainViewTableView.tableHeaderView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0.1)];
    if (section == 0) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 50, tableView.frame.size.width, 100)];
        //[view setBackgroundColor:[UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1]];
        [view setBackgroundColor:[UIColor redColor]];
        [self.mainViewTableView setTableHeaderView:view];
        return view;
    }
    else{
        return nil;
    }

}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试这个时,它可以找到。(这不是我想要的,我想在故事板中添加标题视图但不以编程方式添加它。)

UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width, 300)];
//[view setBackgroundColor:[UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1]];
[view …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

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

猫鼬填充选项限制,如何限制子文档的数量?

我有一个查询来查找一个帐户并填充该帐户的子文档。

当我使用 populate path:"orders" 时,限制选项将起作用。但是,如果我使用填充路径“orders.order”,则选项限制将不起作用。

我该怎么办?

我的架构是这样的:

  var AccountSchema = new mongoose.Schema({

    _id:id,
    orders:{type:[{
      order:{type: mongoose.Schema.Types.ObjectId, ref:'Order'}
    }]}
  });


var findOrderByUserId = function(accountId,index,count,callback){
  var limit = index*count;
  console.log(limit);
  Account.findOne({_id:accountId}).populate({
    path:'orders.order',//If path is orders, then limit will work

    options:{
      limit:limit
    }
  }).exec(function (err, doc) {
              if (err) {
                console.log(err);
                callback(err);
              }
              console.log(doc);
                var array = [];
                for(var i=limit - count;i<doc.orders.length;i++){
                    if(doc.orders[i]!=null){
                        array.push(doc.orders[i]);            
                    }
                    else{
                      break;
                    }
                }
              callback(doc);
          })
}
Run Code Online (Sandbox Code Playgroud)

mongoose mongodb

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

xcode,如何使用情节提要参考连接内部视图控制器?

在屏幕截图中,我有一个与情节提要参考连接的视图控制器。

在作为参考情节提要的屏幕截图二中,具有初始视图控制器一个和一个内部视图控制器两个

如何将内部VC连接2参照? 在此处输入图片说明

在此处输入图片说明

iphone xcode ios

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