由于Meteor 0.6.0+直接支持npm包,陨石仍然具有相关性,使用它会有任何优势/劣势吗?
我正在构建一个iOS应用程序(我的第一个),它可以动态处理视频静止帧.为了深入研究,我从Apple 的AV*文档中提供了一个示例.
该过程涉及设置输入(摄像机)和输出.输出使用委托,在这种情况下是控制器本身(它符合并实现所需的方法).
我遇到的问题是委托方法永远不会被调用.下面的代码是控制器的实现,它有几个NSLog.我可以看到"已启动"消息,但"被调用的委托方法"从未显示过.
此代码都在实现"AVCaptureVideoDataOutputSampleBufferDelegate"协议的控制器中.
- (void)viewDidLoad {
[super viewDidLoad];
// Initialize AV session
AVCaptureSession *session = [AVCaptureSession new];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
[session setSessionPreset:AVCaptureSessionPreset640x480];
else
[session setSessionPreset:AVCaptureSessionPresetPhoto];
// Initialize back camera input
AVCaptureDevice *camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
NSError *error = nil;
AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:camera error:&error];
if( [session canAddInput:input] ){
[session addInput:input];
}
// Initialize image output
AVCaptureVideoDataOutput *output = [AVCaptureVideoDataOutput new];
NSDictionary *rgbOutputSettings = [NSDictionary dictionaryWithObject:
[NSNumber numberWithInt:kCMPixelFormat_32BGRA] forKey:(id)kCVPixelBufferPixelFormatTypeKey];
[output setVideoSettings:rgbOutputSettings];
[output …Run Code Online (Sandbox Code Playgroud) 无论如何我在这里找不到答案,也没有看到重复的问题.
我的代码很简单.给定3 UIView,parent,from和to,从parent中删除并添加子视图.+添加动画,但这只是doodads.
现在,问题是当我这样做时,然后得到抵消.好像它被推倒了.
我甚至添加了To.frame = ParentView.frame; 确保它有效.它没有.
我该怎么办?
+ (void) AnimateSwitchingWithParent: (UIView *) ParentView From: (UIView *) From To: (UIView* ) To
{
/*[UIView beginAnimations:@"View Flip" context:nil];
[UIView setAnimationDuration:1.25];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView:ParentView cache:YES];*/
[From removeFromSuperview];
[ParentView addSubview:To];
To.frame=ParentView.frame; //If I don't do this, the subview is still off by around 20 points
NSLog(@"To.bounds: %@", NSStringFromCGRect(To.bounds));
NSLog(@"From.bounds.: %@", NSStringFromCGRect(From.bounds));
NSLog(@"ParentView.bounds: %@", NSStringFromCGRect(ParentView.bounds));
//JA_DUMP (To.bounds);
//JA_DUMP (To.bounds);
/*[UIView commitAnimations];*/
}
Run Code Online (Sandbox Code Playgroud)
我已经找到了解决方案.结果是To的框架
To.frames:{{0,0},{320,372}}
但是,如果我删除To.frame = ParentView.frame,那么框架也是如此
{{0,20},{320,460}}
我想知道为什么?20点似乎是状态栏的距离.我们在哪里可以在InterfaceBuilder中设置该框架?
我在SimulatedMetric部分中将statusbar设置为none.
在我深入研究我的问题之前,我想指出我正在做这个部分以熟悉node和mongo.我意识到可能有更好的方法来实现我的最终目标,但我想要摆脱的是一种可能适用于其他情况的一般方法.
目标:
我有一个包含600多万个地理IP记录的csv文件.每条记录总共包含4个字段,文件大约为180mb.
我想处理这个文件并将每条记录插入名为"Blocks"的MongoDB集合中.每个"块"将包含csv文件中的4个字段.
我目前的做法
我正在使用mongoose创建一个"Block"模型和一个ReadStream来逐行处理文件.我用来处理文件和提取记录的代码工作,如果我愿意,我可以让它将每条记录打印到控制台.
对于文件中的每个记录,它调用一个函数来创建一个新的Blocks对象(使用mongoose),填充字段并保存它.
这是每次读取和解析行时调用的函数内部的代码."rec"变量包含一个表示文件中单个记录的对象.
block = new Block();
block.ipFrom = rec.startipnum;
block.ipTo = rec.endipnum;
block.location = rec.locid;
connections++;
block.save(function(err){
if(err) throw err;
//console.log('.');
records_inserted++;
if( --connections == 0 ){
mongoose.disconnect();
console.log( records_inserted + ' records inserted' );
}
});
Run Code Online (Sandbox Code Playgroud)
问题
由于文件是异步读取的,因此同时处理多行,并且读取文件比MongoDB可以写入的速度快得多,因此整个过程停留在大约282000条记录,并且高达5k +并发Mongo连接.它不会崩溃..它只是坐在那里什么都不做,似乎没有恢复,mongo集合中的项目计数也没有进一步.
我在这里所说的是解决这个问题的一般方法.我如何限制并发Mongo连接的数量?我想利用能够同时插入多个记录,但我错过了一种规范流量的方法.
先感谢您.
我从服务器端方法抛出一个Meteor.Error异常.
throw new Meteor.Error( 500, 'There was an error processing your request' );
Run Code Online (Sandbox Code Playgroud)
我的目标是让客户端Meteor.call接收到这个错误,但它也会导致节点进程退出.
错误:永远检测到的脚本退出代码:8
在不杀死脚本的情况下,从Meteor.methods()向Meteor.call发出错误信号的正确方法是什么?
是否有已知和成熟的解析器生成器,它们都支持php和javascript?
目的是在php和javascript中生成单个语法定义和解析器.
有吗?
我想在我正在编写的Swift框架中使用XCGLogger.包含此框架的应用程序可能也可能不使用XCGLogger.
处理这种情况的最佳方法是什么?我会使用依赖注入之类的东西让应用程序将XCGLogger实例发送到框架吗?在框架中我将调用XCGLogger的设置方法?
如果我有这样的模板
<template name="my_form">
<form name="my_form">
<input name=" ....
</form>
</template>
Run Code Online (Sandbox Code Playgroud)
我想听听"my_form"的提交事件.
我试过这个:
Template.my_form.events({
'submit form': function( event ){ // also tried just 'submit'
console.log( 'Submitting form!' );
event.preventDefault();
event.stopPropagation();
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
但没有运气.事件处理程序似乎没有注册.有什么我想念的吗?
ps我知道我可以通过听取提交按钮单击事件来处理表单"提交",但我需要在此特定方案中使用表单提交事件.
我正在开发一个涉及使用AVPlayer在界面后台制作视频的应用程序.
我们发现在播放视频时,应用程序永远不会进入睡眠状态.有没有办法让AVPlayer允许应用程序进入睡眠状态?
我如何使用Ext.tree.ViewDDPlugin的事件?
我有一个使用DDPplugin的TreePanel,但我想知道如何监听drop事件.
这就是我的代码:
var monPretree = Ext.create('Ext.tree.Panel',{
id : 'treepanel',
title : 'TITRE',
//width : 800,
//height : 600,
width : 500,
enableDD: true,
useArrows : true,
viewConfig : {
plugins : {
ptype: 'treeviewdragdrop',
appendOnly: true,
listeners: {
drop: function (node, data, overModel, dropPosition) {
alert('CHANGE');
},
notifyDrop: function (dragSource, event, data) {
var nodeId = data.node.id;
alert(nodeId);
},
notifyOver: function (dragSource, event, data) {
alert('over');
}
}
}
},
singleExpand : false,
store : monPrestore,
rootVisible : false, …Run Code Online (Sandbox Code Playgroud) 使用TideSDK窗口时,您可以控制它们在屏幕中的位置.但是,我找不到任何方法来检索屏幕的大小,也无法找到窗口居中的方法.
有没有办法实现这一目标?
我正在 RN 中构建这个应用程序,升级到 0.49 后,它仅在“发布”模式下开始崩溃。启动后就崩溃了。我花了一段时间才找到崩溃点,因为我的崩溃报告器(bugsnag)甚至没有触发。
我将 xcode 中的方案设置为“发布”,我终于能够使用系留设备重现崩溃。
输出是:
43 JavaScriptCore 0x00000001880011ac _ZN3JSC8evaluateEPNS_9ExecStateERKNS_10SourceCodeENS_7JSValueERN3WTF8NakedPtrINS_9ExceptionEEE + 316
44 JavaScriptCore 0x000000018836a558 JSEvaluateScript +2017-10-15 02:54:24.331 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 's.View.propTypes.style')
B56
INFO : BSG_KSCrashReport.c (2157): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /var/mobile/Containers/Data/Application/00FD4F8E-DFF5-4166-982B-0D4AB56048DE/Library/Caches/KSCrashReports/GP/GP-CrashReport-0659B2B2-1DB4-48B9-BDDB-5EC72DE8B201.json
2017-10-15 02:54:24.354 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 's.View.propTypes.style')
2017-10-15 02:54:24.357 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
INFO : BSG_KSCrashReport.c (2157): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char …Run Code Online (Sandbox Code Playgroud) meteor ×3
objective-c ×2
addsubview ×1
avfoundation ×1
avplayer ×1
extjs ×1
ios ×1
ios5 ×1
iphone ×1
javascript ×1
meteorite ×1
mongodb ×1
mongoose ×1
node.js ×1
npm ×1
panel ×1
parsing ×1
php ×1
react-native ×1
subview ×1
superview ×1
swift ×1
tidesdk ×1
xcglogger ×1
xcode ×1