我正在尝试使用这个工具.(Perl版本)但是,当我尝试使用推荐的命令运行它时perl bin/SWOG.pl --input=examples/simple.swog --toPng=simple,它会显示以下警告(添加了use diagnostics希望它可以解释如何修复它)
Variable "$np" will not stay shared at (re_eval 8) line 2 (#1)(W闭包)内部(嵌套)命名子例程引用外部命名子例程中定义的词法变量.
当调用内部子程序时,它将看到外部子程序变量的值,就像它在第一次 调用外部子程序之前和期间一样; 在这种情况下,在第一次调用外部子程序完成后,内部子程序和外部子程序将不再共享该变量的公共值.换句话说,该变量将不再共享.
通常可以通过使用sub {}语法使内部子例程匿名来解决此问题.当创建引用外部子例程中的变量的内部匿名子时,它们会自动回弹到这些变量的当前值.
我已经对Google做了尽职调查:链接,但仍然不明白如何在我的情况下应用这个.
我还回到了导致此问题的代码段的源代码.该片段再次在下方生成,以便于参考:
# parentheses balance pattern
# @ http://www.unix.org.ua/orelly/perl/prog3/ch05_10.htm
$np= qr{
\(
(
(?:
(?> [^()]+ ) # Non-parens without backtracking
|
(??{ $np }) # Group with matching parens
)*
)
\)
}x;
Run Code Online (Sandbox Code Playgroud)
我认为嵌套$np在同一个变量的定义中$np会导致此警告.
请帮忙.谢谢!
我想将RTSP流转储到文件中。
ffmpeg -y-i rtsp://172.19.12.37/live.sdp -acodec copy -vcodec copy tmp.mp4
但是我有错误
[mp4 @ 0x7fe98400dc00] track 1: could not find tag, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
但是,我可以通过任何媒体播放器播放RTSP流,我的ffmpeg命令出了什么问题?
是否有任何选项可以转储任何流并将其转储为相同的视频格式。
ffplay日志
$ ffplay rtsp://172.19.12.37/live.sdp
ffplay version 2.1.4 Copyright (c) 2003-2014 the FFmpeg developers
built on Mar 12 2014 14:37:48 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample …Run Code Online (Sandbox Code Playgroud) 是否可以设置一个 -halt 条件(或多个 -halt 条件?),以便无论退出代码如何,如果其中任何一个作业失败,所有作业都将停止?
我想监视一个事件(我刚刚在负载平衡服务上单独触发)。我可以通过查看日志来确定事件是通过还是失败,但我必须同时查看多个服务器上的日志。完美的!平行吧!不过,我有一个额外的要求:我想根据日志结果返回成功或失败。
因此,如果并行作业中的任何一个检测到事件(即"-halt now"),我想停止并行作业,但我不知道检测是否会返回零或非零(这就是重点:我正在尝试找出该信息),所以两者"--halt now,success=1"都不"--halt now,fail=1"正确,我需要找出一种方法来做类似的事情"--halt now,any=1")
我查看了源代码,嗯,我的 perl 功夫不足以解决这个问题(看起来 exitstatus 在源代码的许多不同地方使用,所以我很难弄清楚这是否可行或不。)
请注意,,success=1两者,fail=1都工作得很好(给定相应的退出状态),但我不知道在并行运行之前它会成功还是失败。
从提供的输入字符串:
{"200,400,7,1","100,0,1,1","200,200,3,1","0,400,11,1","407,308,5,1","100,600,9,1" },
我在TreeSet中添加相同的内容并希望它按第3个元素顺序排序,因此预期的输出将是:
(100,0,1,1)(200,200,3,1)(407,308,5,1)(200,400,7,1)(100,600,9,1)(0,400,11,1)
但我的实际输出是:
(100,0,1,1)(0,400,11,1)(200,200,3,1)(407,308,5,1)(200,400,7,1)(100,600,9,1)
但由于11的字符串比较小于9,但就整数而言,11> 9.我的预期产量变得不同了.建议我解决同样的问题.
import java.util.Comparator;
import java.util.TreeSet;
public class TreeSetComparator {
public static void main(String[] args) {
Comparator<String> comparator = new Comparator<String>() {
@Override
public int compare(String a, String b) {
String aStr = a;
String bStr = b;
String[] splitA = aStr.split(",");
String[] splitB = bStr.split(",");
return splitA[2].compareTo(splitB[2]);
}
};
String[] arr = { "200,400,7,1", "100,0,1,1", "200,200,3,1",
"0,400,11,1", "407,308,5,1", "100,600,9,1" };
TreeSet<String> ts = new TreeSet<String>(comparator);
for (String str : arr) {
ts.add(str); …Run Code Online (Sandbox Code Playgroud) 我正在制作一个基于react-redux的文件管理器应用程序,我遇到了问题input.
例如,我的代码:
PathForm.js:
export default class PathForm extends Component {
render() {
const { currentPath, handleSubmit } = this.props;
console.log('PathFormPathFormPathForm', this.props)
return (
<div className="path-box">
<form onSubmit={handleSubmit}>
<div>
<input type="text" className="current-path-input" placeholder="input path" value={currentPath} />
</div>
<button className="go-btn" type="submit">Go</button>
</form>
</div>
);
}
}
Run Code Online (Sandbox Code Playgroud)
Explorer.js:
class Explorer extends Component {
goPath(e) {
e.preventDefault()
// fake function here, because I have to solve the input problem first
console.log('PathForm goPath:',this.props)
let {targetPath , actions} = this.props
swal(targetPath)
}
render() { …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,当使用文件时,报告说它在 Mach-O 中有 2 个架构
iPad:~/map/MyApp.app root# file MyApp
MyApp: Mach-O fat file with 2 architectures
Run Code Online (Sandbox Code Playgroud)
编辑 - 我也用 Xcode 的工具检查过这个
xcrun -sdk iphoneos lipo -info MyApp
Architectures in the fat file: MyApp are: armv7 arm64
Run Code Online (Sandbox Code Playgroud)
当我使用 otool 来定位架构时,我可以看到我有 2 个,一个 ARMv7(cpusubtype 9) 和一个 ARM64 (cpysubtype 0)
iPad:~/map/MyApp.app root# otool -arch all -Vh MyApp
MyApp (architecture cputype (12) cpusubtype (9)):
Mach header
magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
MH_MAGIC ARM 9 0x00 EXECUTE 41 4760 NOUNDEFS DYLDLINK TWOLEVEL …Run Code Online (Sandbox Code Playgroud) 我正在尝试收听从特定发件人发送的包含特定关键字的非常具体的短信。为此,我创建了一个android.provider.Telephony.SMS_RECEIVED通过清单绑定的 BroadcastReceiver。
如果我发现特定发件人发送包含该关键字的短信,我需要从我的应用程序发送短信。我已经在我的应用程序中通过onReceive()函数做到了这一点。
问题是我想监听 SMS_SENT 和 SMS_DELIVERED 事件以了解短信是否已成功发送/传递。为此,我通过注册这些接收器
context.registerReceiver(smsSentReceiver, new IntentFilter(Consts.SENT));
context.registerReceiver(smsDeliveredReceiver, new IntentFilter(Consts.DELIVERED));
Run Code Online (Sandbox Code Playgroud)
虽然,我已经实例化了一个单独的AsyncTask方法onReceive来完成这项工作,但我仍然收到以下错误
BroadcastReceiver components are not allowed to register to receive intents
我应该使用IntentService而不是AsyncTaskfrom 吗onReceive?或者我应该实例化一个IntentServicefromAsyncTask执行的吗onReceive?
android ×1
comparator ×1
ecmascript-6 ×1
ffmpeg ×1
forms ×1
gnu-parallel ×1
input ×1
ios ×1
java ×1
lipo ×1
perl ×1
reactjs ×1
redux ×1
treeset ×1
video ×1