Send commands to a specific device with ADB
adb devices
adb -s serial_number command
References
https://developer.android.com/studio/command-line/adb.html
adb devices
adb -s serial_number command
References
https://developer.android.com/studio/command-line/adb.html
pacman -S base-devel mingw-w64-x86_64-toolchain mingw-w64-i686-cmake mingw-w64-i686-extra-cmake-modules cmake libcurl-devel
pacman -S base-devel git mingw-w64-i686-toolchain
References
https://wiki.qt.io/MSYS2
Enum Example
public enum Level { HIGH, MEDIUM, LOW }
Enums in if Statements
Level level = ... //assign some Level constant to it if( level == Level.HIGH) { } else if( level == Level.MEDIUM) { } else if( level == Level.LOW) { }
Enum Iteration
for (Level level : Level.values()) { System.out.println(level); }
Enum Fields
public enum Level { HIGH (3), //calls constructor with value 3 MEDIUM(2), //calls constructor with value 2 LOW (1) //calls constructor with value 1 ; // semicolon needed when fields / methods follow private final int levelCode; private Level(int levelCode) { this.levelCode = levelCode; } }
Enum Methods
public enum Level { HIGH (3), //calls constructor with value 3 MEDIUM(2), //calls constructor with value 2 LOW (1) //calls constructor with value 1 ; // semicolon needed when fields / methods follow private final int levelCode; Level(int levelCode) { this.levelCode = levelCode; } public int getLevelCode() { return this.levelCode; } }
References
http://tutorials.jenkov.com/java/enums.html
https://www.mkyong.com/java/java-enum-example/
Indexed
This annotation marks the field as indexed in MongoDB
@QueryEntity @Document public class User { @Indexed private String name; ... }
Compound Indexes
MongoDB supports compound indexes, where a single index structure holds references to multiple fields.
@QueryEntity @Document @CompoundIndexes({ @CompoundIndex(name = "email_age", def = "{'email.id' : 1, 'age': 1}") }) public class User { // }
Transient
As you would expect, this simple annotation excludes the field from being persisted in the database.
public class User { @Transient private Integer yearOfBirth; // standard getter and setter }
Field
@Field indicates the key to be used for the field in the JSON document
@Field("email") private EmailAddress emailAddress;
References
http://www.baeldung.com/spring-data-mongodb-index-annotations-converter
myCommand & echo $!
$$ is the current script’s pid
$! is the pid of the last background process
References
http://stackoverflow.com/questions/1908610/how-to-get-pid-of-background-process
http://serverfault.com/questions/205498/how-to-get-pid-of-just-started-process
task cleanAll { group = 'minify' doFirst { tasks.cleanCSS.execute() tasks.cleanJS.execute() } }
task cleanCSS { group = 'minify' doLast { String basePath = 'src/main/resources/static/stylesheets/site'; FileTree tree = project.fileTree(dir: basePath); tree.include "**/*.css" tree.exclude "**/*.scss" tree.exclude "**/*.css.map" tree.visit { FileVisitDetails element -> if (!element.isDirectory()) { element.file.delete() } } } }
task cleanJS { group = 'minify' doLast { String basePath = 'src/main/resources/static/javascripts/site'; FileTree tree = project.fileTree(dir: basePath); tree.include "**/*.min.js" tree.exclude "**/*.js.map" tree.exclude "**/*.ts" tree.exclude "**/*.d.ts" tree.visit { FileVisitDetails element -> if (!element.isDirectory()) { element.file.delete() } } } }
task sass { group = 'minify' doLast { String basePath = 'src/main/resources/static/stylesheets/site'; FileTree tree = project.fileTree(dir: basePath); tree.include "**/*.scss" tree.exclude "**/*.css" tree.exclude "**/*.css.map" tree.visit { FileVisitDetails element -> if (!element.isDirectory()) { String filePath = basePath + "/" + element.getPath(); int pos = filePath.lastIndexOf("."); String newFilePath = ""; if (pos > 0) { newFilePath = filePath.substring(0, pos) + ".css"; } if (project.file(newFilePath).exists()) { project.file(newFilePath).delete(); } String cmd = String.format("node-sass $filePath $newFilePath"); java.lang.Runtime.getRuntime().exec(cmd); } } } }
task csso { group = 'minify' doLast { String basePath = 'src/main/resources/static/stylesheets/site'; FileTree tree = project.fileTree(dir: basePath); tree.include "**/*.css" tree.exclude "**/*.min.css" tree.exclude "**/*.css.map" tree.exclude "**/*.scss" tree.visit { FileVisitDetails element -> if (!element.isDirectory()) { String filePath = basePath + "/" + element.getPath(); int pos = filePath.lastIndexOf("."); String newFilePath = ""; if (pos > 0) { newFilePath = filePath.substring(0, pos) + ".min.css"; } String cmd = String.format("csso -i $filePath -o $newFilePath"); java.lang.Runtime.getRuntime().exec(cmd); } } } }
task uglify { group = 'minify' doLast { String basePath = 'src/main/resources/static/javascripts/site'; FileTree tree = project.fileTree(dir: basePath); tree.include "**/*.js" tree.exclude "**/*.min.js" tree.exclude "**/*.js.map" tree.exclude "**/*.ts" tree.exclude "**/*.d.ts" tree.visit { FileVisitDetails element -> if (!element.isDirectory()) { String filePath = basePath + "/" + element.getPath(); int pos = filePath.lastIndexOf("."); String newFilePath = ""; if (pos > 0) { newFilePath = filePath.substring(0, pos) + ".min.js"; } String cmd = String.format("uglifyjs $filePath -o $newFilePath"); java.lang.Runtime.getRuntime().exec(cmd); } } } }
sass.mustRunAfter cleanCSS csso.mustRunAfter sass uglify.mustRunAfter cleanJS
task minify{ group = 'minify' doFirst{ tasks.cleanCSS.execute() tasks.cleanJS.execute() } doLast{ tasks.sass.execute() tasks.csso.execute() tasks.uglify.execute() } }
References
https://docs.gradle.org/current/userguide/working_with_files.html
https://docs.gradle.org/current/userguide/tutorial_using_tasks.html
https://docs.gradle.org/current/userguide/custom_tasks.html
https://docs.gradle.org/current/userguide/more_about_tasks.html
task wrapper(type: Wrapper) { gradleVersion = '2.10' //we want gradle 2.10 to run this project }
gradle wrapper
References
https://www.mkyong.com/gradle/how-to-use-gradle-wrapper/
https://docs.gradle.org/current/userguide/gradle_wrapper.html
https://docs.gradle.org/current/dsl/org.gradle.api.tasks.wrapper.Wrapper.html
<script type="text/javascript" src="myfile.js?1500"></script>
References
http://stackoverflow.com/questions/32414/how-can-i-force-clients-to-refresh-javascript-files
http://www.thymeleaf.org/doc/articles/springmvcaccessdata.html
@RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {ErpServerApplication.class})
gradle bootRun
You might also want to use this useful operating system environment variable:
export JAVA_OPTS=-Xmx1024m -XX:MaxPermSize=128M