2021年7月30日星期五

gradle lombok local flatDir reference

build.gradle:

apply plugin: 'java'
apply plugin: 'eclipse'
def libs = property("libs").split(",")
println "# libs: ${libs}"
repositories {
  //mavenCentral()
  //will find lombok-1.18.20.jar or lombok.jar under ./maven-repo/
  flatDir dirs: 'maven-repo'
}
tasks.withType(JavaCompile) {
  options.encoding = 'UTF-8'
  options.deprecation = true
  options.compilerArgs.addAll(["-Xmaxerrs", "100000", "-Xmaxwarns", "100000"])
  println "# TASK ${name}"
  println "#   encoding: ${options.encoding}"
  println "#   deprecation: ${options.deprecation}"
  println "#   sourceCompatibility: ${sourceCompatibility}"
  println "#   targetCompatibility: ${targetCompatibility}"
  println "#   compilerArgs: ${options.compilerArgs}"
}
dependencies {
  // lombok
  annotationProcessor 'org.projectlombok:lombok:1.18.20'
  compileOnly 'org.projectlombok:lombok:1.18.20'

  libs.each {
    implementation fileTree(dir: it, include: '**/*.jar')
  }  
}

2021年7月18日星期日

git command: reset, cherry-pick

1. git reset --soft HEAD~n : HEADからn 回履歴の削除
    --soft 改修内容変更なし,  stageのcommit予定内容も変更なし
    --mixed 未指定場合のdefault. 改修内容変更ないが、stageがクリアされる
    --hard改修内容がcommitされた内容に上書きされる

    git reset --soft/hard ORIG_HEAD :RESET間違ったら、RESETを取消すこと。

2. git cherry-pick -f code_index 他branchの特定COMMITを自Branchに運ぶ
    git cherry-pick -n from_index..to_index 一括で複数のCOMMITを取得.
    -n:no auto commit自動COMMITしない、内容改修待ち、

   


 


2021年7月14日星期三

window.showModalDialog for Chrome

 
window.showModalDialog = function (url, arg, feature) {
    var opFeature = feature.split(";");
    var featuresArray = new Array()
    if (document.all) {
       for (var i = 0; i < opFeature.length - 1; i++) {
           var f = opFeature[i].split("=");
           featuresArray[f[0]] = f[1];
       }
    }else {
       for (var i = 0; i < opFeature.length - 1; i++) {
        if(/^[\w\s]+:.*/.test(opFeature[i])){
       var f = opFeature[i].split(":");
               console.log("opFeature:",opFeature);
               featuresArray[f[0].toString().trim().toLowerCase()] = f[1].toString().trim();   
        }
       }
    }
    var h = "200px", w = "400px", l = "100px", t = "100px", r = "yes", c = "yes", s = "no";
    if (featuresArray["dialogheight"]) h = featuresArray["dialogheight"];
    if (featuresArray["dialogwidth"]) w = featuresArray["dialogwidth"];
    if (featuresArray["dialogleft"]) l = featuresArray["dialogleft"];
    if (featuresArray["dialogtop"]) t = featuresArray["dialogtop"];
    if (featuresArray["resizable"]) r = featuresArray["resizable"];
    if (featuresArray["center"]) c = featuresArray["center"];
    if (featuresArray["status"]) s = featuresArray["status"];
    var modelFeature = "height = " + h + ",width = " + w + ",left=" + l + ",top=" + t + ",model=yes,alwaysRaised=yes" + ",resizable= " + r + ",celter=" + c + ",status=" + s;
    var model = window.open(url, "", modelFeature, null);
    model.dialogArguments = arg;
}

2021年7月11日星期日

compile java without ide. build-an-eclipse-java-project-without-eclipse.

Thanks: https://stackoverflow.com/questions/33360980/build-an-eclipse-java-project-without-eclipse

Use the javac compiler from the Java SE development kit to compile Java source files. You can use the existing Java ME Platform SDK project directory structure. Use the -bootclasspath option to tell the compiler to use the MIDP APIs, and use the -d option to tell the compiler where to put the compiled class files.

The following example demonstrates how you might compile a MIDP 2.0 application, taking source files from the src directory and placing the class files in the tmpclasses directory. Newlines have been added for clarity.

javac -target 1.3 -source 1.3 
   -bootclasspath ../../lib/cldc_10.jar;../../lib/midp2.0.jar
   -d tmpclasses
   src/*.java

For the complete guide on how to execute/build code from the command line, consider looking on the official java website: http://docs.oracle.com/javame/dev-tools/jme-sdk-3.0-mac/UserGuide-html/z400007747176.html

Android adb shell command memo

1. adb devices 

2. adb shell pm list packages

3. adb uninstall packagename 

4. adb shell 

  $ pm uninstall packagename

   $ pm uninstall -k  --user 0 packagename (for android 7.0~)


2021年7月9日星期五

rsync folder1 to folder2


rsync -av --no-times --exclude='*.bak' --exclude='*.log' --delete /source/directory/ /destination/directory/

参数解析:

  • -a归档模式,它相当于 -rlptgoD,会递归地同步目录及文件,保持符号链接、权限、用户、组和时间戳等。虽然 -a 默认会同步时间戳,但我们后面会通过 --no-times 参数禁用时间戳同步。
  • -v详细模式,显示传输的文件和操作细节。可以看到哪些文件被同步。
  • --no-times:禁用同步时间戳(-a 包含 -t 会同步时间戳,但 --no-times 覆盖此行为)。
  • --exclude='*.bak':排除 .bak 文件。你可以通过该选项指定不需要同步的文件类型。
  • --exclude='*.log':排除 .log 文件。
  • /source/directory/:源目录路径,尾部有 / 表示同步目录内容,而不是整个目录。
  • /destination/directory/:目标目录路径。
  • --delete:在目标目录中删除源目录不存在的文件。

工作原理:

  • 在同步过程中,rsync 会检查目标目录中的文件,如果它们不在源目录中存在,则会删除这些文件。该功能确保目标目录与源目录保持同步,没有多余的文件。

示例场景:

  • 源目录 /source/directory/ 包含文件 file1.txtfile2.txt
  • 目标目录 /destination/directory/ 包含文件 file1.txtfile2.txt 和一个额外的 file3.txt
  • 执行上述命令后,file3.txt 将从目标目录中删除,因为它不在源目录中。

2021年7月2日星期五