当我的iPhone 7还是iOS 12时一切都很好。升级到iOS13 public beta7后,我发现我的iPhone无法使用Charles 3.x版本进行SSL代理。
查尔斯 说:
SSLHandshake:握手期间远程主机关闭连接
您可能需要将浏览器或应用程序配置为信任 Charles 根证书。请参阅帮助菜单中的 SSL 代理。
在我的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不验证值,我是否以错误的方式更新枚举?
我的代码:
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)
该状态枚举应该只有三个值:["创造","运","证实"]
但我能做到:
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) 这是代码不起作用:
- (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) 我有一个查询来查找一个帐户并填充该帐户的子文档。
当我使用 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) ios ×3
mongoose ×3
mongodb ×2
apple-vision ×1
coreml ×1
https ×1
ios13 ×1
iphone ×1
node.js ×1
objective-c ×1
uitableview ×1
xcode ×1