突突唧之家

我的疑问 & 我的解决方案

When using images for API 27 or later, the emulator can render the Android UI with Skia, which can render more smoothly and efficiently.

To enable Skia rendering, use the following commands in adb shell:

su
setprop debug.hwui.renderer skiagl
stop
start

问题描述

通过远程桌面访问 Windows 上安装好的 MATLAB 的时候,出现了 License Manager Error -103 的错误。

解决办法

这是由于 MATLAB 使用了 FLEXlm 进行 license 管理,而 FLEXlm 不支持从远程桌面访问。不过,对 license 文件稍加修改,就能够使用了。

修改 安装目录/licenses 目录下的许可证文件,用任何编辑工具打开 .lic 文件,然后在每一行的 SIGN=xxxxxxxxxx 前面,加入 TS_OK 这个参数(注意 OK 后面有一个空格)。

修改之后即可使用。

Concatenation of Files with Same Codecs

There are two methods within FFmpeg that can be used to concatenate files of the same type: the concat demuxer & the concat protocol

The demuxer is more flexible – it requires the same codecs, but different container formats can be used; and it can be used with any container formats, while the concat protocol only works with a select few containers.

The Concat Demuxer

create a text file named vidlist.txt in the following format:

file '/path/to/clip1'
file '/path/to/clip2'
file '/path/to/clip3'

Note that these can be either relative or absolute paths.

Then issue the command:

ffmpeg -f concat -safe 0 -i vidlist.txt -c copy output

The files will be stream copied in the order they appear in the vidlist.txt into the output container. the "copy codec" is blazing fast.

Edit: Note that although the docs say you don't need -safe 0 if the paths are relative, my testing indicates it's a requirement. It's possible that this may vary with your version of FFmpeg.

There are tips for auto generating the file available in the docs.

Note: All the clips must already exist or the command will fail because decoding won't start until the whole list is read.

The Concat Protocol

ffmpeg -i "concat:video1.ts|video2.ts|video3.ts" -c copy output.ts

Note: as mentioned above the concat protocol is severely limited in what streams and containers it supports so I never use it. The above is only included in an attempt to create a thorough answer. The concat demuxer is a far better choice for most projects.

An alternative suggestion: Personally I prefer using the Matroska container due to it's flexibility and low overhead and join videos with the same encoding using

mkvmerge -o output.mkv input1.mkv + input2.mkv

Concatenation of Files with Different Codecs

If your clips don't use the same codecs for audio and video and/or have different rates, your stuck re-encoding to intermediate files prior to joining which as we all know is both time and resource consuming.

Note that special characters can break things so if you have these in your filenames you'll need to deal with them.

There are two types of variables in batch files. One is for parameters which can be passed when the batch file is called and the other is done via the set command.

Command Line Arguments

Batch scripts support the concept of command line arguments wherein arguments can be passed to the batch file when invoked. The arguments can be called from the batch files through the variables %1, %2, %3, and so on.

The following example shows a batch file which accepts 3 command line arguments and echos them to the command line screen.

@echo off
echo %1
echo %2
echo %3
阅读全文 »

for /l is your friend:

for /l %x in (1, 1, 100) do echo %x

Starts at 1, steps by one, and finishes at 100.

Use two %s if it's in a batch file:

for /l %%x in (1, 1, 100) do echo %%x

If you have multiple commands for each iteration of the loop, do this:

for /l %x in (1, 1, 100) do (
echo %x
copy %x.txt z:\whatever\etc
)

or in a batch file:

for /l %%x in (1, 1, 100) do (
echo %%x
copy %%x.txt z:\whatever\etc
)

Key:

  • /l denotes that the for command will operate in a numerical fashion, rather than operating on a set of files.
  • %x is the loops variable.
  • (starting value, increment of value, end condition[inclusive])

引用文件

首先需要引用 JUnit 库文件。

依次操作 File -> Project Structure… -> Libraies -> 加号 -> Java -> 选择 IDEA 安装路径 lib 文件夹中的 junit-4.12.jarhamcrest-core-1.3.jar

编写测试代码

TestJUnit.java

1
2
3
4
5
6
7
8
9
10
import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class TestJUnit {
@Test
public void testAdd() {
String str = "Junit is working fine.";
assertEquals("Junit is working fine.", str);
}
}

TestRunner.java

1
2
3
4
5
6
7
8
9
10
11
12
13
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;

public class TestRunner {
public static void main(String[] args) {
Result result = JUnitCore.runClasses(TestJUnit.class);
for (Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
}

期望输出

true

要修改默认的启动内核,可以执行以下操作。

打开文件 /etc/default/grub ,将 GRUB_DEFAULT 的值更改为您希望选择的菜单选项的索引值。

例如,在启动过程中的 GRUB 菜单中有

Ubuntu
Advanced options for Ubuntu
Windows 10 (loader) (on /dev/sda1)
system setup

其中 Advananced options for Ubuntu 子菜单如下所示

1
2
3
4
5
6
Ubuntu, with Linux 4.13.0-26-generic
Ubuntu, with Linux 4.13.0-26-generic (upstart)
Ubuntu, with Linux 4.13.0-26-generic (recovery mode)
Ubuntu, with Linux 4.10.0-42-generic
Ubuntu, with Linux 4.10.0-42-generic (upstart)
Ubuntu, with Linux 4.10.0-42-generic (recovery mode)

现在,第一个选项是索引 0 ,第二个是 1 ,第三个是 2 ,依此类推。

例如现在想选择 Advanced options for Ubuntu 子菜单中的 Ubuntu, with Linux 4.10.0-42-generic ,则将 GRUB_DEFAULT 设为:

GRUB_DEFAULT = "1> 3"

使用 > 符号来指定子菜单(注意符号 > 和数字 3 之间有空格,所以需要双引号)。在这种情况下,主菜单中选择第二个选项(索引 1 ),在子菜单中选择第四个选项(索引 3 )。

菜单选项来自文件 /boot/grub/grub.cfg (不要编辑这个文件)。

一旦对 /etc/default/grub 进行了更改,请保存并运行

update-grub

来更新 GRUB 配置文件(必须,否则不生效)。重新启动,现在应该默认启动旧的内核版本。

首先安装并配置好 adb 工具,并选择以下命令中的一条执行。

PACKAGE 替换为应用包名。

adb shell pm block PACKAGE # Kitkat 可用
adb shell pm hide PACKAGE # Lollipop 可用
adb shell pm uninstall --user 0 PACKAGE # Marshmallow 和 Nougat 可用

注意第三种命令可能会失效,而且在重新安装或恢复出厂设置之前无法找回被删除的软件。

在引导时按住 Shift 键即可进入高级选项菜单。如果想要每次都显示的话可以进行如下修改。

打开 /etc/default/grub ,将 GRUB_TIMEOUT 设置为 -1

运行命令

update-grub

完成修改。