f*******o 发帖数: 88 | 1 也许对很多大牛来说是一个比较老的问题,不过对我来说是一个新问题。
起因是想从一个video文件在任意时间点读取图像出来。 最开始是用opencv实现的,在
一些文件上测试也没有问题。后来换了一批h264格式的video文件就有问题了,很多文
件读取不出来。 在网上查了一下后,换成用moviepy来读取。 但是现在有新的问题是
就是moviepy在读取有些video文件在初始化阶段就死锁了。 跟踪进去,发现问题主要
出现在:
s = self.proc.stdout.read(nbytes) 语句时。
这个之前还有一堆初始化的代码, 主要是调用ffmpeg来执行并声称一个pipe.
def initialize(self, starttime=0):
"""Opens the file, creates the pipe. """
self.close() # if any
if starttime != 0 :
offset = min(1, starttime)
i_arg = ['... 阅读全帖 |
|
|
c*m 发帖数: 9 | 3
key is used for that u can get unique mem(semphora, msg queue,....) ID for the
system. In general, you can input an integer from the stdin. Before using the
share mem, make sure u called shmget(...), get the ID. |
|
s*****g 发帖数: 219 | 4 你应该看看CGI的书。
一句两句说不清楚,简单介绍如下。Web Server调
CGI程序 (比如说Perl吧,其实用C写也行)。
然后CGI程序从stdin或者query_string环境变量
读取输入,向stdout输出结果。(就是print啦。) |
|
y***y 发帖数: 56 | 5 正解:
#!/usr/local/perl
$x=;
if($x>=0){
print int($x+0.5);
}
else{
print int($x-0.5);}
win!! hohohoho~ |
|
q**c 发帖数: 3 | 6 a program about pipe, suppose a command:
ls -l | more
then use fork to create process for more, dup pipe[0] as
stdin, execv more
then use fork to create process for ls -l, dup pipe[1] as
stdout execv ls -l
wait at parent process
but even the process ls stopped, the process more is
still running, so when I type new command, it don't echo at
screen. Please help me to kill process more
thanks a lot!!! |
|
u*c 发帖数: 3 | 7 请教高人,在用at的时候如果用stdin做input而不是用文件input,
该怎么做?比如,假设我想在明天执行一个叫做command的可执行文
件:
% at tommrrow
at> csh
at> command
at>
然后怎么办?怎么退出编辑状态?
谢谢! |
|
w*****n 发帖数: 94 | 8 the ftp program always tries to get username and password from tty,
instead of stdin which can be redirected. the solutions are:
1) put username and password in $HOME/.netrc file, or
2) use expect |
|
p******f 发帖数: 162 | 9
- tells paste to read data from stdin, that is the output of ls. |
|
f*****r 发帖数: 229 | 10 First, in you script, you write: awk 'BEGIB ... ', it's not right. You need to give a
file or stdin as argument, for example: echo $i| awk 'BEGIN ...'
If you want to use float calculation, you can use bc or awk.
Say, you want to calculate: 12./3.4,
then: echo "scale=3; 12./3.4" |bc
or use awk: echo aa | awk 'END {print 12./3.4}' (echo aa is no any meaning, just
give an argument to awk. |
|
p******f 发帖数: 162 | 11 I am after some command line tools for send or receive data through
TCP socket. e.g.
send ... # send files or STDIN to a host:port
receive # read data from host:port and print to STDOUT
This should be very useful and easy to implement. Instead of reinvent
the wheels i would like to know whether somebody has done that before. |
|
c****j 发帖数: 258 | 12 redirect stderr(2) to stdout(1), then you can use more to see the output.
exec_file 2>&1 | more
pipe(|) just redirect stdout to stdin(0), not stderr
you can also put it into a file
exec_file 2>&1>logfile
我用f90编译一个model,但是错误太多,都看不到前面的。怎么办?
redirection > 不行!
| more 也不行!
谢谢各位!!! |
|
P**l 发帖数: 3722 | 13 你搜一下bash redirect stdin应该能搜到 |
|
|
|
b*******e 发帖数: 288 | 16 有的呀
不过用的时候小心,这个是把所有line全部读出,太大的文件内存就满了,readline()
是一次读一行 |
|
n******7 发帖数: 12463 | 17 run jar文件是比较啰嗦
这种大工具集为了风格统一,也会造成一些啰嗦的用法
其实java的文化就是啰嗦但不复杂
因为缺省一些东西意味着你大脑要记住一些默认规则
这就为出问题创造了机会,滥用这点也会增加复杂度
比如就这个samtools,我记得好像就是这个sort命令,在某个版本之前和之后是不一样的
一个版本默认到stdout,需要用-O指定输出文件前缀;一个是直接跟输出文件前缀,
-o是到stdout
具体可能有出入,但是这种问题挺烦人,各个工具也不一样,不如统一规范省心
另一个问题就是pipe的时候,各个工具接收stdin的方式会有不同,有时也是挺烦的
java的控制pipe library我没用过,应该不是问题
-
i |
|
l******l 发帖数: 233 | 18 【 以下文字转载自 Linux 讨论区 】
发信人: lsloneil (Eric), 信区: Linux
标 题: 请问mpirun怎么放在后台运行?
发信站: BBS 未名空间站 (Mon Dec 7 11:39:45 2009, 美东)
是在bash shell上运行。
参照网上的一些说法在mpirun前加了nohup,但当我关掉窗口的时候程序还是会断掉并
在nohup.out文件里输出以下信息
mpiexec_*.umd.edu: mpd_uncaught_except_tb handling:
exceptions.IOError: [Errno 9] Bad file descriptor
/usr/local/bin/mpirun 1065 handle_stdin_input
sys.stdin.flush() # probably does nothing
/usr/local/bin/mpdlib.py 762 handle_active_streams
handler(stream,*args)
|
|
s*****u 发帖数: 164 | 19 Oh no! Disaster has struck some of ACME's redundant data centers. The
administrators have managed to restore backups, but some data sets are
still missing from some data centers. Fortunately, every data set can be
found at least once in one or more of the data centers. However, before
ACME can resume normal operations, it needs to ensure that each data
center has a copy of every data set.
Your goal is to help ACME resume normal operations by writing a program
to synchronize data sets between dat... 阅读全帖 |
|
D******n 发帖数: 2836 | 20 这种data还好,其实是用错了工具,data cleaning从来就不是SAS该做的东西。用perl
或者其他编程语言都比较好搞。SAS不是不行,而是思维不能很直接。linux 下面可以这
样搞。
sed -e 's/\///g' yourdata.dat | perl -e 'while() {@a=split(" ",$_);$i
d=shift @a;for (@a) {print "$id $_\n"}}' |
|
d******c 发帖数: 2407 | 21 发现现在有很多网站,从各个角度入手在找工作的市场中赚钱,就以data science和
programming方面为例,列举几个看到的网站和现象。自己只是初学者,观察的不准确
的地方或者说错的地方欢迎指正
kaggle算是做的比较有影响的,通过competition拿奖金或者公司招人,似乎之前还有
几个公司的compeition,现在比较少了,要么是学术性的会议competition放到kaggle
平台,要么是某些教育性的练习,还有的是某些公司自己遇到的问题,可是感觉提供的
数据信息太少,它可能是怕泄露机密,但就给一堆没名字的feature然后去预测click
through真的可以?如果比较简单能做出来,也不用贴出来悬赏了吧?
有些competition的leader成绩很好,进去一看是deep learning的phd们,感觉是专业
队员到业余俱乐部炫耀一下顺便做个广告的。还有不少参加者就是machine learning的
phd在读学生。
有一类网站是作为contractor中介,注册你的专业特长和hourly rate,公司悬赏项目
,大家竞标,网站抽成。进去一看,几个什么... 阅读全帖 |
|
发帖数: 1 | 22 亲测有效,牛,膝盖奉上
我来补充一下,mac下直接能用
但是因为mac 的openssl 没有zlib所以要用python
dd if=fp.data bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(
zlib.decompress(sys.stdin.read()))" | tar -xvf - |
|
发帖数: 1 | 23 亲测有效,牛,膝盖奉上
我来补充一下,mac下直接能用
但是因为mac 的openssl 没有zlib所以要用python
dd if=fp.data bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(
zlib.decompress(sys.stdin.read()))" | tar -xvf - |
|
i*****f 发帖数: 578 | 24 【 以下文字转载自 Programming 讨论区 】
发信人: icewolf (好好活), 信区: Programming
标 题: Re: python .pyw问题请教
发信站: BBS 未名空间站 (Mon Feb 1 23:00:57 2010, 美东)
Hi, there are two ways of solving the problem. you can either comment out
the print statement in the loop, or redirect stdout stdin, stderr to null.
there's a known problem with pythonw.exe and the std* stream
BTW, welcome to join my Python club (technology) and discuss issues about
python :)
PS, your code works great:) |
|
i*****f 发帖数: 578 | 25 Users of curly bracket programming languages, such as C or Java, sometimes
expect or wish Python to follow a block-delimiter convention. Brace-
delimited block syntax has been repeatedly requested, and consistently
rejected by core developers. The Python interpreter contains an easter egg
that summarizes its developers' feelings on this issue. The code from __
future__ import braces raises the exception SyntaxError: not a chance.
>>> from __future__ import braces
File "", line 1
SyntaxE |
|
p**z 发帖数: 65 | 26 用 logic array 来 index 另一个 array:这两个 array 都必须是 numpy array。如
果用了 list,就会出错。例子:
>>> a = [1,2,3,4,5]
>>> b = [True, True, False, False, False]
>>> a[b]
Traceback (most recent call last):
File "", line 1, in
TypeError: list indices must be integers, not list
>>> a = np.array(a)
>>> a[b]
array([2, 2, 1, 1, 1])
>>> b = array(b)
>>> a[b]
array([1, 2]) |
|
r****t 发帖数: 10904 | 27 在 /usr/bin/ 下面就有,贴在这儿,似乎 arcNumber 不对?Dockstar arcNumber应该
是多少?另,这个 hostname 名字叫 alarm 是正常的么?
$ fw_printenv
]# fw_printenv
ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_installed=0
rescue_set_bootargs=setenv bootargs console=$console u... 阅读全帖 |
|