问题列表 - 第29325页

为什么我不能在Bash For-loop中使用Unix Nohup?

例如,此行失败:

$ nohup for i in mydir/*.fasta; do ./myscript.sh "$i"; done > output.txt&
-bash: syntax error near unexpected token `do
Run Code Online (Sandbox Code Playgroud)

什么是正确的方法呢?

unix linux bash nohup

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

终止现有的 tcp 连接

有没有办法终止现有的连接?

例如,192.168.1.120 通过端口 8080 连接。

我想知道如何终止该连接?

非常感谢!

c++

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

加入集合以获取客户名称(对于管理网格)

我有一个自定义模块的表,其中包含以下列:

---------------
| custom_table|
---------------
| id
| seller_id
| buyer_id
| ...
---------------

seller_id -> customer_enity [entity_id]
buyer_id -> customer_entity [entity_id]
Run Code Online (Sandbox Code Playgroud)

现在我想在管理网格布局中显示卖家名称和买家名称.我无法弄清楚如何从客户实体中检索卖家名称和买家名称.但我知道如何检索他们的电子邮件:

protected function _prepareCollection()
{
  $collection = Mage::getModel('custommodule/custommodule')->getCollection();  
  $collection->getSelect()
        ->join( array('ce1' => 'customer_entity'), 'ce1.entity_id=main_table.seller_id', array('seller_email' => 'email'))
        ->join( array('ce2' => 'customer_entity'), 'ce2.entity_id=main_table.buyer_id', array('buyer_email' => 'email'));
  #echo $collection->getSelect()->__toString();
  $this->setCollection($collection);
  return parent::_prepareCollection();
}
Run Code Online (Sandbox Code Playgroud)

以上代码工作正常.但我想显示他们的名字而不是电子邮件.任何人都可以帮我修改这个系列吗?

很感谢任何形式的帮助.谢谢

magento

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

在C#中使用右对齐组合框

默认情况下,C#Combobox中的项目保持对齐.除了重写DrawItem方法和设置组合框绘制模式 - > DrawMode.OwnerDrawFixed之外,还有其他选项可用于更改此理由吗?

干杯

.net c# combobox text-alignment winforms

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

iPhone 4:何时保存数据?

我有一个应用程序(游戏),可以保存数据:游戏状态,高分,成就等.目前,应用程序代表执行此操作applicationWillTerminate:.在使用iPhone 4之后,似乎应用程序几乎永远不会终止:它们只是永远在后台运行,除非用户竭尽全力退出它们,或重新启动手机.

所以我的问题是,我应该找到另一个地方来保存我的数据,如果是,那么什么时候?

iphone iphone-4

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

使用C语言传递结构成员时的printf行为

我正在尝试一个程序来理解结构变量的行为,

示例代码:

struct temp
{
   int a;
   int b;
}obj;

int main()
{
   obj.a = 10;
   obj.b = 7;
   /* to see whether obj and &obj both are same 
    * I was verifying whether structure variables behave as arrays
    */
   printf("%d -- %p",obj,&obj); 
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

我期待输出为10和obj的地址但令我惊讶的是,实际输出为10和00000007

这对我来说很烦人!!!

谁能帮助我理解为什么printf正在接受第二个成员并打印它的价值.

c

2
推荐指数
3
解决办法
4207
查看次数

替换链接位置(href ='...')

我想替换页面的链接位置(锚标记),如下所示.

样本输入:

text text text <a href='http://test1.com/'> click </a> text text
other text <a class='links' href="gallery.html" title='Look at the gallery'> Gallery</a>
more text
Run Code Online (Sandbox Code Playgroud)

样本输出

text text text <a href='http://example.com/p.php?q=http://test1.com/'> click </a> text text
other text <a class='links' href="http://example.com/p.php?q=gallery.html" title='Look at the gallery'> Gallery</a>
more text
Run Code Online (Sandbox Code Playgroud)

我希望我已经说清楚了.无论如何,我正在尝试使用PHP和reg-ex.请你点赞我吧.

谢谢萨迪

php regex string preg-replace html-parsing

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

为什么Guava中的Iterables.find()抛出NoSuchElementException,而不是返回null?

我喜欢谷歌番石榴并且使用它很多,但有一种方法我总能找到我写的..

 public static <T> T tryFind(Iterable<T> iterable, Predicate<T> predicate){
     for(T t : iterable){
         if(predicate.apply(t)){
              return t;
         }
     }
     return null;
  }
Run Code Online (Sandbox Code Playgroud)

对我来说,这似乎是一个非常有用的补充Iterables(也是Iterators为了那个问题),所以我想知道它为什么缺失.此外,虽然我可以看到有一个方法抛出的点NoSuchElementException,也许是为了区分找到一个null而没有找到该元素,但只有当你使用的谓词是

public boolean apply(T t){
     return t==null;
}
Run Code Online (Sandbox Code Playgroud)

这似乎不是一个常见的情况.

那么为什么番石榴设计师选择了这种行为,而不是只是在找不到它时才返回null?

这是[Iterables.find()] [1]的javadoc

[1]:http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Iterables.html#find (java.lang.Iterable,com.google.common.base.谓语)

api-design guava

17
推荐指数
3
解决办法
7982
查看次数

如何在AddEvent侦听器中内联定义ActionScript事件处理函数

我有一个动作监听器:

myText.addEventListener(TextEvent.LINK,linkClickHandler);
Run Code Online (Sandbox Code Playgroud)

根据这个,我需要编写一个事件处理函数seperate来处理文本链接事件.

现在我的要求是我需要在相同的行中编写该函数,而不是给它的名字.比如

mytext.addEventListenet(TextEvent.LINK, 
                 function(event:TextEvent) {....code comes here....});
Run Code Online (Sandbox Code Playgroud)

我可以在AS3中这样做.如果可能的话,这将是什么语法.

另外我想知道,除了作为默认参数的事件之外,我还可以向事件处理程序传递一个额外的参数.

flash actionscript

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

使取消按钮下键盘

我有一个UISearchBar.我启用了"取消"按钮,因此它在搜索框旁边显示取消如何设置该按钮,以便在用户按下时简单地降低键盘?

iphone sdk uisearchbar

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