App可以到https://play.google.com/store/apps/details?id=com.dayun.driverecorder&hl=zh_TW 下載
截圖如下:
車用手機架則可以上PCHome買
https://24h.pchome.com.tw/store/DEADCG
$ git clone https://github.com/tzutalin/labelImg.git
$ docker pull tzutalin/py2qt4Step3: Get started with the application and container
docker run -it \ --user $(id -u) \ -e DISPLAY=unix$DISPLAY \ --workdir=$(pwd) \ --volume="/home/$USER:/home/$USER" \ --volume="/etc/group:/etc/group:ro" \ --volume="/etc/passwd:/etc/passwd:ro" \ --volume="/etc/shadow:/etc/shadow:ro" \ --volume="/etc/sudoers.d:/etc/sudoers.d:ro" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ tzutalin/py2qt4Then, you will see that we can run GUI inside the container.
$ mkdir docker-registry;cd $_;mkdir dataCreate a docker-compose.yml for docker-compose.
Get any image from the hub and tag it to point to your registry:registry:restart: alwaysimage: registry:2ports:- 5000:5000environment:REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /datavolumes:- ./data:/data
$ docker pull ubuntu && docker tag ubuntu localhost:5000/ubuntu
$ docker push localhost:5000/ubuntu
DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=HOST:5000"
$ docker pull HOST:5000/ubuntu
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
sudo apt-get update sudo apt-get install jenkins
sudo usermod -a -G YOUR_USERNAME jenkins
HTTP_PORT=8080
HTTP_PORT=8880
sudo service jenkins restart
ANDROID_NDK_HOMEJAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-amd64
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <sys/file.h> #include <iostream> void lockUnLock() { int fd, i; char path[] = "test.txt"; fd = open(path, O_WRONLY | O_CREAT); if (fd != -1) { std::cout << "open file " << path << std::endl; std::cout << "Please input a number to lock the file" << path << std::endl; scanf("%d", &i); if (flock(fd, 2) == 0) { std::cout << "The file was locked " << std::endl; } else { std::cout << "The file was not locked " << std::endl; } std::cout << "please input a number to unlock the file " << std::endl; scanf("%d", &i); if (flock(fd, 8) == 0) { std::cout << "The file was unlocked. " << std::endl; } else { std::cout << "The file was no unlocked. " << std::endl; } close(fd); } else { std::cout << "Cannot open file " << path << std::endl; } } int main() { lockUnLock(); return 0; }
jclass arrayListClass = env->FindClass("java/util/ArrayList");
....
env->DeleteLocalRef(arrayListClass);
Is it necessary to call DeleteLocalRef ? In fact, it is unnecessary to call DeleteLocalRef in most of the cases. However, JNI has a limited (but configurable) number of local references available. So, the best practice is to delete if the reference is created in a loop#pragma once
// A *string*, LIB_VERSION, in the form "x.y.[z]"
// where x is the major version number,
// y is the minor version number,
// and z is the patch level
#define LIB_VERSION_MAJOR 0
#define LIB_VERSION_MINOR 4
#define LIB_VERSION_PATCH 12
#define AUX_STR_EXP(__A) #__A
#define AUX_STR(__A) AUX_STR_EXP(__A)
#define LIB_VERSION AUX_STR(LIB_VERSION_MAJOR) "."
\ AUX_STR(LIB_VERSION_MINOR) "."
\ AUX_STR(LIB_VERSION_PATCH)
REG_VERSION_LINE = r"ASUS_VISION_LIB_VERSION_PATCH. +([0-9:]+)"
def changeSoVersion(versionFile):
# Read in the file
filedata = None
with open(versionFile, 'r') as file:
filedata = file.read()
matches = re.finditer(REG_VERSION_LINE, filedata)
for matchNum, match in enumerate(matches):
oldVersion = match.group(1)
newVersion = str(int(match.group(1)) + 1)
print oldVersion
print newVersion
if len(oldVersion) > 0 and len(newVersion) > 0:
filedata = filedata.replace(oldVersion, newVersion)
# Write the file out again
with open(versionFile, 'w') as file:
file.write(filedata)
public static void main(String[] args) {
char[] task = findBestTaskArrangement(String.valueOf("AAABBB").toCharArray(), 2);
System.out.println(task);
System.out.println("Total time: " + computeTatalTaskTime(task, 2));
// ABABAB
// Total time:8
}
public static char[] findBestTaskArrangement(char[] tasks, int k) {
int n = tasks.length;
Map<Character, Integer> map = new HashMap<>();
for (char task : tasks) {
map.put(task, map.getOrDefault(task, 0) + 1);
}
PriorityQueue<Task> queue = new PriorityQueue<>(new Comparator<Task>() {
@Override
public int compare(Task a, Task b) {
return b.frequency - a.frequency;
}
});
for (Map.Entry<Character, Integer> entry : map.entrySet()) {
queue.offer(new Task(entry.getKey(), entry.getValue()));
}
tasks = new char[n];
int i = 0;
while (!queue.isEmpty()) {
int c = 0;
List<Task> nextRoundTask = new ArrayList<>();
while(c++ < k && !queue.isEmpty()) {
Task task = queue.poll();
task.frequency--;
// Locate the next empty slot
tasks[i++] = task.id;
if (task.frequency > 0)
nextRoundTask.add(task);
}
for (Task task : nextRoundTask) {
queue.offer(task);
}
}
return tasks;
}
// helper class
public static class Task {
char id;
int frequency;
Task(char i, int f) {
id = i;
frequency = f;
}
}
public static int computeTatalTaskTime(char[] tasks, int k) {
HashMap<Character, Integer> taskLastTimeMap = new HashMap<>();
int currTime = 0;
for (char task : tasks) {
if (taskLastTimeMap.containsKey(task)) {
int exceptedTime = taskLastTimeMap.get(task) + k + 1;
if (exceptedTime > currTime) {
currTime = exceptedTime;
} else
currTime++;
} else {
currTime++;
}
taskLastTimeMap.put(task, currTime);
}
return currTime;
}
public static void main(String[] args) {
MinQueue queue = new MinQueue();
// Input 3 -> 1 -> 4 -> 2
queue.offer(3).offer(1).offer(4).offer(2);
// 0 0 0 1 1 1
while(queue.isEmpty() == false) {
System.out.println(queue.getMin());
queue.poll();
}
// Output should be 1 -> 1 -> 2 -> 2
}
static class MinQueue {
private Queue<Integer> mQueue = new LinkedList<>();
private Deque<Integer> mMinDeque = new ArrayDeque<>();
MinQueue offer(int val) {
int min = val;
while(!mMinDeque.isEmpty() && mMinDeque.getLast() > val) {
mMinDeque.pollLast();
min = val;
}
int size = mQueue.size() - mMinDeque.size();
for (int i = 0; i <= size; i++) {
mMinDeque.addLast(min);
}
mQueue.offer(val);
return this;
}
int poll() {
mMinDeque.poll();
return mQueue.poll();
}
boolean isEmpty() {
return mQueue.isEmpty();
}
int getMin() {
return mMinDeque.peek();
}
}