sudo vi /etc/systemd/system/foo.service
#/etc/systemd/system/foo.service
[Unit]
Description=DESCRIPTION
Linux Swap
# 1. generate an empty file
$ dd if=/dev/zero of=/var/swapfile bs=1M count=1024
# 2. format it as swap
$ mkswap /var/swapfile
# 3. turn on it
$ swapon /var/swapfile
# 4. make it works after boot
https://developer.nvidia.com/opencl
py -3 -m pip install pybind11
#!/bash | |
targethost='root@targethost' | |
# eg. 'root@dev.csdra.net' | |
targetpath='/var/www' | |
# eg. '/var/www' | |
targetname=TARGETNAME | |
# eg. 'SomeProject' | |
targetport=TARGETPORT | |
# eg. 8080 |
Callable r = () -> {
try {
log.debug("TryLock");
readLock.tryLock(5, TimeUnit.SECONDS);
Thread.sleep(1000);
log.debug("Read");
readLock.unlock();
} catch (InterruptedException e) {
e.printStackTrace();
# LOGGING | |
logging.file=myapp.log | |
logging.level.root=ERROR | |
logging.level.info.didyapp=INFO | |
# EMBEDDED SERVER CONFIGURATION | |
server.port=8080 | |
# DATASOURCE | |
spring.datasource.url=jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull&useUnicode=yes&characterEncoding=utf8 |
There are two types of exceptions in java language.
A Checked Exception is a part of the method signature, with the method name, arguments and returns. So if a method throws a checked exception, then the caller should have the knowlege about the exception, the deal with it. Thus we say a checked exception is a Exposing of the inner logic of a method.
And anothor way to classify the exceptions:
#Logging Best Practices
Always log, and always log in right place, on right level.
Error Unexcepted exceptions happened, should write down the error message and the call stacks.
log.error(ex.getMessage(),ex);
java -jar xxx.jar --server.port=80 | |
mvn spring-boot:run -Drun.jvmArguments="-Dserver.port=80" |