小编Car*_*tin的帖子

对于R数据帧中的每一行

我有一个数据帧,对于该数据帧中的每一行,我必须进行一些复杂的查找并将一些数据附加到文件中.

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方式"是什么?

r rows dataframe

165
推荐指数
7
解决办法
30万
查看次数

如何在NSOperation中执行异步NSURLConnection?

我想在后台线程的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)

iphone nsoperation

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

iphone文件系统的块大小是多少?

将1000字节文件压缩为300字节文件对我来说是否值得?或者文件系统空间消耗是否相同?

我正在寻找在我的iphone上存储少于4k文件的10k,我很好奇我是否会通过压缩来节省空间.

谢谢,

卡尔

iphone

10
推荐指数
1
解决办法
3069
查看次数

SKPayementQueue:恢复事务完成而不在调试配置中调用'updatedTransactions'而不调用调试配置

我正在调试恢复事务,在我的调试配置中一切正常:

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的调用,因此我从未真正恢复购买.

可能相关,在我尝试恢复后,它不起作用.我重新启动应用程序,当我向商店询问产品列表时,我发现我没有收到回复.

iphone storekit in-app-purchase iphone-sdk-3.0

10
推荐指数
1
解决办法
3295
查看次数

将UIViewController推送到导航堆栈时,如何显示标签栏

因此,当您将视图控制器推入导航控制器堆栈时,很容易隐藏标签栏:

uiViewController.hidesBottomBarWhenPushed = YES;
Run Code Online (Sandbox Code Playgroud)

只是很好的工作.

让我们说我想深入到堆栈并再次显示它?

设置

 laterUIViewController.hidesBottomBarWhenPushed = NO; 
Run Code Online (Sandbox Code Playgroud)

在一些后来的视图控制器不会使它重新出现.它仍然隐藏着.

iphone iphone-sdk-3.0

8
推荐指数
1
解决办法
4832
查看次数

如何突出显示UITableViewCell

我非常想暂时突出显示一个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)

iphone

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