我有一个数据帧,对于该数据帧中的每一行,我必须进行一些复杂的查找并将一些数据附加到文件中.
dataFrame包含用于生物研究的96孔板中选定孔的科学结果,因此我想做类似的事情:
for (well in dataFrame) {
wellName <- well$name # string like "H1"
plateName <- well$plate # string like "plate67"
wellID <- getWellID(wellName, plateName)
cat(paste(wellID, well$value1, well$value2, sep=","), file=outputFile)
}
Run Code Online (Sandbox Code Playgroud)
在我的程序世界中,我会做类似的事情:
for (row in dataFrame) {
#look up stuff using data from the row
#write stuff to the file
}
Run Code Online (Sandbox Code Playgroud)
这样做的"R方式"是什么?
我想在后台线程的NSOperation中进行异步NSURLConnection.
(这是因为我在数据上做了一些非常昂贵的操作,因为他们回来了,希望在数据进入和后台时完成)
这是我的第一次尝试:
在我的AppDelegate中:
// create the opperation and add it to the queue:
self.sharedOperationQueue = [[[NSOperationQueue alloc] init] autorelease];
LibXMLOperation *op = [[[LibXMLOperation alloc] init] autorelease];
[self.sharedOperationQueue addOperation:op];
Run Code Online (Sandbox Code Playgroud)
这是我的操作:
@interface EbirdLibXMLOperation : NSOperation {
@private
NSURLConnection *urlConnection;
// Overall state of the parser, used to exit the run loop.
BOOL done;
// properties to maintain the NSOperation
BOOL finished;
BOOL executing;
}
- (void)downloadAndParse:(NSURL *)url;
- (void)start;
- (BOOL)isConcurrent;
- (BOOL)isFinished;
- (BOOL)isExecuting;
@property BOOL done;
@property (nonatomic, retain) …
Run Code Online (Sandbox Code Playgroud) 将1000字节文件压缩为300字节文件对我来说是否值得?或者文件系统空间消耗是否相同?
我正在寻找在我的iphone上存储少于4k文件的10k,我很好奇我是否会通过压缩来节省空间.
谢谢,
卡尔
我正在调试恢复事务,在我的调试配置中一切正常:
IE我打电话:
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
Run Code Online (Sandbox Code Playgroud)
以后的queueCalls:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
Run Code Online (Sandbox Code Playgroud)
它之后的某个时候它会调用:
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
Run Code Online (Sandbox Code Playgroud)
每个人都很开心
但在我的发布配置中,我从未看到对updatedTransactions的调用,因此我从未真正恢复购买.
可能相关,在我尝试恢复后,它不起作用.我重新启动应用程序,当我向商店询问产品列表时,我发现我没有收到回复.
因此,当您将视图控制器推入导航控制器堆栈时,很容易隐藏标签栏:
uiViewController.hidesBottomBarWhenPushed = YES;
Run Code Online (Sandbox Code Playgroud)
只是很好的工作.
让我们说我想深入到堆栈并再次显示它?
设置
laterUIViewController.hidesBottomBarWhenPushed = NO;
Run Code Online (Sandbox Code Playgroud)
在一些后来的视图控制器不会使它重新出现.它仍然隐藏着.
我非常想暂时突出显示一个UITableViewCell来引起注意包含数据已经改变的事实.
有一个UITableViewCell方法:-setHighlighted:(BOOL)动画:( BOOL)但我不能让它做任何事情?
这是视图控制器的相关部分:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
switch (indexPath.section) {
case 0: {
if (indexPath.row == 0) {
cell = [[UITableViewCell alloc ] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"currentLoc"];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.text = @"This is the special cell";
}
[cell setHighlighted:YES animated:YES];
[cell setHighlighted:NO animated:YES];
//[cell setNeedsDisplay];
} else {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"setLocAutomatically"];
cell.accessoryType = UITableViewCellAccessoryNone;
cell.textLabel.text = @"Foo";
}
} break;
case 1: {
cell = [[UITableViewCell alloc ] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"selectCity"];
cell.accessoryType = …
Run Code Online (Sandbox Code Playgroud)