我使用枚举来制作一些常量:
enum ids {OPEN, CLOSE};
Run Code Online (Sandbox Code Playgroud)
OPEN值为零,但我希望它为100.是否可能?
我在shell脚本中使用了'更改目录'(bash)
#!/bin/bash
alias mycd='cd some_place'
mycd
pwd
Run Code Online (Sandbox Code Playgroud)
pwd
打印some_place
正确,但脚本完成后,我当前的工作目录不会更改.
是否可以通过脚本更改我的路径?
我尝试通过git push命令删除bitbucket上的git远程分支:
qty:workspace qrtt1$ git push origin :my_branch
remote: fatal: bad object 0000000000000000000000000000000000000000
remote: bb/acl: qrtt1 is allowed. accepted payload.
remote: fatal: bad object 0000000000000000000000000000000000000000
To git@bitbucket.org:qrtt1/workspace.git
- [deleted] my_branch
Run Code Online (Sandbox Code Playgroud)
但是,只删除了我本地条目中的分支.我该如何删除它?
PS.我可以从github以相同的方式删除远程分支.
我正在尝试将结构库安装到旧机器上./ usr/lib中有一些遗留库,例如libgmp.
(py27)[qrtt1@hcservice app]$ ls /usr/lib|grep gmp
libgmp.a
libgmp.so
libgmp.so.3
libgmp.so.3.3.3
libgmpxx.a
libgmpxx.so
libgmpxx.so.3
libgmpxx.so.3.0.5
Run Code Online (Sandbox Code Playgroud)
我已经在我的$ HOME/app中编译了libgmp 5.x,然后我尝试安装pycrypto(它是fab的依赖):
CFLGAS=-I/home/qrtt1/app/include LDFLGAS=-L/home/qrtt1/app/lib pip install pycrypto
Run Code Online (Sandbox Code Playgroud)
我发现编译/链接选项中没有我的include或lib目录:
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/home/qrtt1/app/include/python2.7 -c src/_fastmath.c -o build/temp.linux-i686-2.7/src/_fastmath.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/_fastmath.o -lgmp -o build/lib.linux-i686-2.7/Crypto/PublicKey/_fastmath.so
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/qrtt1/app/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/MD2.o -o build/lib.linux-i686-2.7/Crypto/Hash/_MD2.so
building 'Crypto.Hash._MD4' extension
gcc -pthread -fno-strict-aliasing -fwrapv …
Run Code Online (Sandbox Code Playgroud) 我使用gradle应用程序插件生成应用程序文件夹.该installApp
任务为我提供了一个启动脚本,但我不知道如何设置jvm args build.gradle
.
我需要一些jvm args,比如file.encoding
.我只是修改启动脚本来设置DEFAULT_JVM_OPTS
变量
#!/usr/bin/env bash
##############################################################################
##
## MuzeeS3Deployer start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and MUZEE_S_DEPLOYER_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=" -Dfile.encoding=utf-8 "
Run Code Online (Sandbox Code Playgroud)
如果未设置args,我的控制台无法正常显示消息:
qty:MuzeeS3Deployer qrtt1$ ./build/install/MuzeeS3Deployer/bin/MuzeeS3Deployer d
2012/10/14 #U###12:02:03 SyncCommand main
?#i: no aws credentials found at /Users/qrtt1/AwsCredentials.properties
Run Code Online (Sandbox Code Playgroud)
当我设置编码时:
qty:MuzeeS3Deployer qrtt1$ ./build/install/MuzeeS3Deployer/bin/MuzeeS3Deployer d
2012/10/14 ?? 12:04:19 SyncCommand main
??: no aws credentials found at …
Run Code Online (Sandbox Code Playgroud) 我用librtmp构建了ffmpeg.我的librtmp位于/ opt/librtmp/lib.当我执行ffmpeg时,它说:
./ffmpeg: error while loading shared libraries: librtmp.so.0: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我使用ldd命令显示未找到:
[qty@testing bin]# ldd ffmpeg
linux-vdso.so.1 => (0x00007fff15576000)
librtmp.so.0 => not found
libz.so.1 => /lib64/libz.so.1 (0x00002b9a71e10000)
libm.so.6 => /lib64/libm.so.6 (0x00002b9a72025000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b9a722a8000)
libc.so.6 => /lib64/libc.so.6 (0x00002b9a724c3000)
/lib64/ld-linux-x86-64.so.2 (0x00002b9a71bf2000)
Run Code Online (Sandbox Code Playgroud)
我知道我的意思是:
[qty@testing bin]# ls -alh /opt/librtmp/lib/
total 300K
drwxr-xr-x 3 root root 4.0K Sep 25 17:10 .
drwxr-xr-x 7 root root 4.0K Sep 25 17:10 ..
-rw-r--r-- 1 root …
Run Code Online (Sandbox Code Playgroud) 在linux中,我使用lsof来检查文件是由哪个进程打开的.我有一个Android设备,但没有lsof命令.是否有可能找到打开特定文件的进程?
我将使用它来验证MediaPlayer是否持有fd,但应该关闭它.
我安装了 Eclipse Neon,但对它的代码建议感觉很糟糕。
以代码模板为例,通常我输入main并按 <ALT> + / 来显示建议。在旧版本中,主要方法模板显示在第一个。但是,top N 被很多 Main* 类 main 占用,对我来说没有意义。
有什么办法可以改变它吗?
我已经使用库(libavformat和libavcodec)来解码一些MMS流媒体网址.但其中一些受DRM保护.当我尝试解码它们时,库会警告它
在libavformat/asfdec.c中:
if (!s->keylen) {
if (!guidcmp(&g, &ff_asf_content_encryption)) {
av_log(s, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\n");
} else if (!guidcmp(&g, &ff_asf_ext_content_encryption)) {
av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\n");
} else if (!guidcmp(&g, &ff_asf_digital_signature)) {
av_log(s, AV_LOG_WARNING, "Digital signature detected, decoding will likely fail!\n");
}
}
Run Code Online (Sandbox Code Playgroud)
变量s是struct AVFormatContext.我的问题是从哪里拿到钥匙?它似乎用DRM密钥解码它.
我查看ASF规范,并尝试修补asfdec.c.现在,我有获取许可证URL和密钥ID.问题可以改写为"是否有适用于Linux的MS-DRM客户端库?" (旧:如何通过ffmpeg解码带有DRM的MMS流媒体网址?)
是否可以使用许可证URL和密钥ID来获取内容密钥?
我使用ExecutorService在不同的线程中运行许多任务.有时,在线程池中等待的Runnable实例太多可能会导致Out of Memory问题.
我尝试编写一个阻塞作业执行器来解决它.这有什么官方解决方案吗?
例如:
BlockingJobExecutor executor = new BlockingJobExecutor(3);
for (int i = 0; i < 1000; i++) {
executor.addJob(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
LogFactory.getLog(BTest.class).info("test " + System.currentTimeMillis());
}
});
}
executor.shutdown();
Run Code Online (Sandbox Code Playgroud)
这是BlockingJobExecutor类:
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
public class BlockingJobExecutor {
AtomicInteger counter = new AtomicInteger();
ExecutorService service;
int threads;
public BlockingJobExecutor(int threads) {
if (threads < 1) {
throw new IllegalArgumentException("threads …
Run Code Online (Sandbox Code Playgroud)