Java .class File
package bytecode;

/**
 * Created by IntelliJ IDEA.
 *
 * @author Eric Cui
 * @date 2017/12/7 16:43
 */
public class ClazzTest extends Thread implements Runnable {

    public int instanceField = 1;
    public static int classField = 2;
    public static final int constField = 3;

    {
        System.out.println("static block");
    }

    public static void main(String[] args) {
        ClazzTest clazz = new ClazzTest();
        System.out.println("instantField: " + clazz.instanceField);
        System.out.println("classField  : " + ClazzTest.classField);
        clazz.start();
    }

    @Override
    public void run() {
        System.out.println("Thread start run. " + constField);
    }

}

执行命令 javap -c -verbose ClazzTest

警告: 二进制文件ClazzTest包含bytecode.ClazzTest
Classfile /Users/minee/workspace/IdeaProjects/multi_module_sample/__java-sample/target/classes/bytecode/ClazzTest.class
  Last modified Dec 21, 2017; size 1211 bytes
  MD5 checksum ede05c27167189c157425032ac81b6c2
  Compiled from "ClazzTest.java"
public class bytecode.ClazzTest extends java.lang.Thread implements java.lang.Runnable
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
   #1 = Methodref          #18.#42        // java/lang/Thread."<init>":()V
   #2 = Fieldref           #6.#43         // bytecode/ClazzTest.instanceField:I
   #3 = Fieldref           #44.#45        // java/lang/System.out:Ljava/io/PrintStream;
   #4 = String             #46            // static block
   #5 = Methodref          #47.#48        // java/io/PrintStream.println:(Ljava/lang/String;)V
   #6 = Class              #49            // bytecode/ClazzTest
   #7 = Methodref          #6.#42         // bytecode/ClazzTest."<init>":()V
   #8 = Class              #50            // java/lang/StringBuilder
   #9 = Methodref          #8.#42         // java/lang/StringBuilder."<init>":()V
  #10 = String             #51            // instantField:
  #11 = Methodref          #8.#52         // java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
  #12 = Methodref          #8.#53         // java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
  #13 = Methodref          #8.#54         // java/lang/StringBuilder.toString:()Ljava/lang/String;
  #14 = String             #55            // classField  :
  #15 = Fieldref           #6.#56         // bytecode/ClazzTest.classField:I
  #16 = Methodref          #6.#57         // bytecode/ClazzTest.start:()V
  #17 = String             #58            // Thread start run. 3
  #18 = Class              #59            // java/lang/Thread
  #19 = Class              #60            // java/lang/Runnable
  #20 = Utf8               instanceField
  #21 = Utf8               I
  #22 = Utf8               classField
  #23 = Utf8               constField
  #24 = Utf8               ConstantValue
  #25 = Integer            3
  #26 = Utf8               <init>
  #27 = Utf8               ()V
  #28 = Utf8               Code
  #29 = Utf8               LineNumberTable
  #30 = Utf8               LocalVariableTable
  #31 = Utf8               this
  #32 = Utf8               Lbytecode/ClazzTest;
  #33 = Utf8               main
  #34 = Utf8               ([Ljava/lang/String;)V
  #35 = Utf8               args
  #36 = Utf8               [Ljava/lang/String;
  #37 = Utf8               clazz
  #38 = Utf8               run
  #39 = Utf8               <clinit>
  #40 = Utf8               SourceFile
  #41 = Utf8               ClazzTest.java
  #42 = NameAndType        #26:#27        // "<init>":()V
  #43 = NameAndType        #20:#21        // instanceField:I
  #44 = Class              #61            // java/lang/System
  #45 = NameAndType        #62:#63        // out:Ljava/io/PrintStream;
  #46 = Utf8               static block
  #47 = Class              #64            // java/io/PrintStream
  #48 = NameAndType        #65:#66        // println:(Ljava/lang/String;)V
  #49 = Utf8               bytecode/ClazzTest
  #50 = Utf8               java/lang/StringBuilder
  #51 = Utf8               instantField:
  #52 = NameAndType        #67:#68        // append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
  #53 = NameAndType        #67:#69        // append:(I)Ljava/lang/StringBuilder;
  #54 = NameAndType        #70:#71        // toString:()Ljava/lang/String;
  #55 = Utf8               classField  :
  #56 = NameAndType        #22:#21        // classField:I
  #57 = NameAndType        #72:#27        // start:()V
  #58 = Utf8               Thread start run. 3
  #59 = Utf8               java/lang/Thread
  #60 = Utf8               java/lang/Runnable
  #61 = Utf8               java/lang/System
  #62 = Utf8               out
  #63 = Utf8               Ljava/io/PrintStream;
  #64 = Utf8               java/io/PrintStream
  #65 = Utf8               println
  #66 = Utf8               (Ljava/lang/String;)V
  #67 = Utf8               append
  #68 = Utf8               (Ljava/lang/String;)Ljava/lang/StringBuilder;
  #69 = Utf8               (I)Ljava/lang/StringBuilder;
  #70 = Utf8               toString
  #71 = Utf8               ()Ljava/lang/String;
  #72 = Utf8               start
{
  public int instanceField;
    descriptor: I
    flags: ACC_PUBLIC

  public static int classField;
    descriptor: I
    flags: ACC_PUBLIC, ACC_STATIC

  public static final int constField;
    descriptor: I
    flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL
    ConstantValue: int 3

  public bytecode.ClazzTest();
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: aload_0
         1: invokespecial #1                  // Method java/lang/Thread."<init>":()V
         4: aload_0
         5: iconst_1
         6: putfield      #2                  // Field instanceField:I
         9: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
        12: ldc           #4                  // String static block
        14: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
        17: return
      LineNumberTable:
        line 10: 0
        line 12: 4
        line 17: 9
        line 18: 17
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      18     0  this   Lbytecode/ClazzTest;

  public static void main(java.lang.String[]);
    descriptor: ([Ljava/lang/String;)V
    flags: ACC_PUBLIC, ACC_STATIC
    Code:
      stack=3, locals=2, args_size=1
         0: new           #6                  // class bytecode/ClazzTest
         3: dup
         4: invokespecial #7                  // Method "<init>":()V
         7: astore_1
         8: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
        11: new           #8                  // class java/lang/StringBuilder
        14: dup
        15: invokespecial #9                  // Method java/lang/StringBuilder."<init>":()V
        18: ldc           #10                 // String instantField:
        20: invokevirtual #11                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
        23: aload_1
        24: getfield      #2                  // Field instanceField:I
        27: invokevirtual #12                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
        30: invokevirtual #13                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
        33: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
        36: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
        39: new           #8                  // class java/lang/StringBuilder
        42: dup
        43: invokespecial #9                  // Method java/lang/StringBuilder."<init>":()V
        46: ldc           #14                 // String classField  :
        48: invokevirtual #11                 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder;
        51: getstatic     #15                 // Field classField:I
        54: invokevirtual #12                 // Method java/lang/StringBuilder.append:(I)Ljava/lang/StringBuilder;
        57: invokevirtual #13                 // Method java/lang/StringBuilder.toString:()Ljava/lang/String;
        60: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
        63: aload_1
        64: invokevirtual #16                 // Method start:()V
        67: return
      LineNumberTable:
        line 21: 0
        line 22: 8
        line 23: 36
        line 24: 63
        line 25: 67
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0      68     0  args   [Ljava/lang/String;
            8      60     1 clazz   Lbytecode/ClazzTest;

  public void run();
    descriptor: ()V
    flags: ACC_PUBLIC
    Code:
      stack=2, locals=1, args_size=1
         0: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
         3: ldc           #17                 // String Thread start run. 3
         5: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/String;)V
         8: return
      LineNumberTable:
        line 29: 0
        line 30: 8
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       9     0  this   Lbytecode/ClazzTest;

  static {};
    descriptor: ()V
    flags: ACC_STATIC
    Code:
      stack=1, locals=0, args_size=0
         0: iconst_2
         1: putstatic     #15                 // Field classField:I
         4: return
      LineNumberTable:
        line 13: 0
}
SourceFile: "ClazzTest.java"

class文件16进制查看:

00000000: cafe babe 0000 0034 0049 0a00 1200 2a09 
00000010: 0006 002b 0900 2c00 2d08 002e 0a00 2f00 
00000020: 3007 0031 0a00 0600 2a07 0032 0a00 0800 
00000030: 2a08 0033 0a00 0800 340a 0008 0035 0a00 
00000040: 0800 3608 0037 0900 0600 380a 0006 0039 
00000050: 0800 3a07 003b 0700 3c01 000d 696e 7374 
00000060: 616e 6365 4669 656c 6401 0001 4901 000a 
00000070: 636c 6173 7346 6965 6c64 0100 0a63 6f6e 
00000080: 7374 4669 656c 6401 000d 436f 6e73 7461 
00000090: 6e74 5661 6c75 6503 0000 0003 0100 063c 
000000a0: 696e 6974 3e01 0003 2829 5601 0004 436f 
000000b0: 6465 0100 0f4c 696e 654e 756d 6265 7254 
000000c0: 6162 6c65 0100 124c 6f63 616c 5661 7269 
000000d0: 6162 6c65 5461 626c 6501 0004 7468 6973 
000000e0: 0100 144c 6279 7465 636f 6465 2f43 6c61 
000000f0: 7a7a 5465 7374 3b01 0004 6d61 696e 0100 
00000100: 1628 5b4c 6a61 7661 2f6c 616e 672f 5374 
00000110: 7269 6e67 3b29 5601 0004 6172 6773 0100 
00000120: 135b 4c6a 6176 612f 6c61 6e67 2f53 7472 
00000130: 696e 673b 0100 0563 6c61 7a7a 0100 0372 
00000140: 756e 0100 083c 636c 696e 6974 3e01 000a 
00000150: 536f 7572 6365 4669 6c65 0100 0e43 6c61 
00000160: 7a7a 5465 7374 2e6a 6176 610c 001a 001b 
00000170: 0c00 1400 1507 003d 0c00 3e00 3f01 000c 
00000180: 7374 6174 6963 2062 6c6f 636b 0700 400c 
00000190: 0041 0042 0100 1262 7974 6563 6f64 652f 
000001a0: 436c 617a 7a54 6573 7401 0017 6a61 7661 
000001b0: 2f6c 616e 672f 5374 7269 6e67 4275 696c 
000001c0: 6465 7201 000e 696e 7374 616e 7446 6965 
000001d0: 6c64 3a20 0c00 4300 440c 0043 0045 0c00 
000001e0: 4600 4701 000e 636c 6173 7346 6965 6c64 
000001f0: 2020 3a20 0c00 1600 150c 0048 001b 0100 
00000200: 1354 6872 6561 6420 7374 6172 7420 7275 
00000210: 6e2e 2033 0100 106a 6176 612f 6c61 6e67 
00000220: 2f54 6872 6561 6401 0012 6a61 7661 2f6c 
00000230: 616e 672f 5275 6e6e 6162 6c65 0100 106a 
00000240: 6176 612f 6c61 6e67 2f53 7973 7465 6d01 
00000250: 0003 6f75 7401 0015 4c6a 6176 612f 696f 
00000260: 2f50 7269 6e74 5374 7265 616d 3b01 0013 
00000270: 6a61 7661 2f69 6f2f 5072 696e 7453 7472 
00000280: 6561 6d01 0007 7072 696e 746c 6e01 0015 
00000290: 284c 6a61 7661 2f6c 616e 672f 5374 7269 
000002a0: 6e67 3b29 5601 0006 6170 7065 6e64 0100 
000002b0: 2d28 4c6a 6176 612f 6c61 6e67 2f53 7472 
000002c0: 696e 673b 294c 6a61 7661 2f6c 616e 672f 
000002d0: 5374 7269 6e67 4275 696c 6465 723b 0100 
000002e0: 1c28 4929 4c6a 6176 612f 6c61 6e67 2f53 
000002f0: 7472 696e 6742 7569 6c64 6572 3b01 0008 
00000300: 746f 5374 7269 6e67 0100 1428 294c 6a61 
00000310: 7661 2f6c 616e 672f 5374 7269 6e67 3b01 
00000320: 0005 7374 6172 7400 2100 0600 1200 0100 
00000330: 1300 0300 0100 1400 1500 0000 0900 1600 
00000340: 1500 0000 1900 1700 1500 0100 1800 0000 
00000350: 0200 1900 0400 0100 1a00 1b00 0100 1c00 
00000360: 0000 4800 0200 0100 0000 122a b700 012a 
00000370: 04b5 0002 b200 0312 04b6 0005 b100 0000 
00000380: 0200 1d00 0000 1200 0400 0000 0a00 0400 
00000390: 0c00 0900 1100 1100 1200 1e00 0000 0c00 
000003a0: 0100 0000 1200 1f00 2000 0000 0900 2100 
000003b0: 2200 0100 1c00 0000 8800 0300 0200 0000 
000003c0: 44bb 0006 59b7 0007 4cb2 0003 bb00 0859 
000003d0: b700 0912 0ab6 000b 2bb4 0002 b600 0cb6 
000003e0: 000d b600 05b2 0003 bb00 0859 b700 0912 
000003f0: 0eb6 000b b200 0fb6 000c b600 0db6 0005 
00000400: 2bb6 0010 b100 0000 0200 1d00 0000 1600 
00000410: 0500 0000 1500 0800 1600 2400 1700 3f00 
00000420: 1800 4300 1900 1e00 0000 1600 0200 0000 
00000430: 4400 2300 2400 0000 0800 3c00 2500 2000 
00000440: 0100 0100 2600 1b00 0100 1c00 0000 3700 
00000450: 0200 0100 0000 09b2 0003 1211 b600 05b1 
00000460: 0000 0002 001d 0000 000a 0002 0000 001d 
00000470: 0008 001e 001e 0000 000c 0001 0000 0009 
00000480: 001f 0020 0000 0008 0027 001b 0001 001c 
00000490: 0000 001d 0001 0000 0000 0005 05b3 000f 
000004a0: b100 0000 0100 1d00 0000 0600 0100 0000 
000004b0: 0d00 0100 2800 0000 0200 290a           

A class file consists of a single ClassFile structure:

ClassFile {
    u4             magic;
    u2             minor_version;
    u2             major_version;
    u2             constant_pool_count;
    cp_info        constant_pool[constant_pool_count-1];
    u2             access_flags;
    u2             this_class;
    u2             super_class;
    u2             interfaces_count;
    u2             interfaces[interfaces_count];
    u2             fields_count;
    field_info     fields[fields_count];
    u2             methods_count;
    method_info    methods[methods_count];
    u2             attributes_count;
    attribute_info attributes[attributes_count];
}

Constant pool tags
Hex Value &emsp;&emsp; Constant Type
&emsp;0x07 &emsp;&emsp;&emsp;&emsp;CONSTANT_Class
&emsp;0x09 &emsp;&emsp;&emsp;&emsp;CONSTANT_Fieldref
&emsp;0x0A &emsp;&emsp;&emsp;&emsp;CONSTANT_Methodref
&emsp;0x0B &emsp;&emsp;&emsp;&emsp;CONSTANT_InterfaceMethodref
&emsp;0x08 &emsp;&emsp;&emsp;&emsp;CONSTANT_String
&emsp;0x03 &emsp;&emsp;&emsp;&emsp;CONSTANT_Integer
&emsp;0x04 &emsp;&emsp;&emsp;&emsp;CONSTANT_Float
&emsp;0x05 &emsp;&emsp;&emsp;&emsp;CONSTANT_Long
&emsp;0x06 &emsp;&emsp;&emsp;&emsp;CONSTANT_Double
&emsp;0x0C &emsp;&emsp;&emsp;&emsp;CONSTANT_NameAndType
&emsp;0x01 &emsp;&emsp;&emsp;&emsp;CONSTANT_Utf8
&emsp;0x0F &emsp;&emsp;&emsp;&emsp;CONSTANT_MethodHandle
&emsp;0x10 &emsp;&emsp;&emsp;&emsp;CONSTANT_MethodType
&emsp;0x12 &emsp;&emsp;&emsp;&emsp;CONSTANT_InvokeDynamic

参考:
The Java® Virtual Machine Specification JavaSE 8

Some interesting effects on Google

1、搜索关键词“do a barrel roll”或是”Z or R twice”搜索,Google就会旋转一圈然后还原,很有趣!

2、输入“Askew” 或者 “Tilt”,这两个词都会让页面整个倾斜过来

3、搜索“ GoogleSphere“,然后点击“手气不错”(I’m feeling lucky),看又会出现什么?

4、谷歌不只有谷歌地球,也有谷歌火星!探索火星,请访问:https://www.google.com/mars/

5、打开谷歌地球,然后按“CTRL + Option + A”你就会看到意想不到的事情。

6、搜索“Google Gravity“,然后点击“手气不错”(I’m feeling lucky),看又会出现什么?(网站惊现万有引力现象)

7、Google doodle中经典的吃豆人游戏,现在仍然可以在 https://www.google.com/pacman 页面找到。(都是童年满满的回忆呀)

8、在输入框键入sqrt(cos(x))cos(300x)+sqrt(abs(x))-0.7)(4-x*x)^0.01,sqrt(6-x^2), -sqrt(6-x^2) from -4.5 to 4.5 会出现一个特别有意思的东西。

9、在Google搜索栏输入“recursion”。Google会反问你“你是不是要找recursion?”而且这个不会消失,因为它在递归。(无限循环呀)

10、https://www.google.com/logos/2011/lespaul.html 用鼠标或是键盘好好享受这个页面吧

11、输入google pig latin ,点I’m feeling lucky,google会变成latin这种语言

12、输入answer to life, the universe and everything,会出现42,知道为什么吗?(笔者也不知道为什么啊)

13、输入Zerg Rush,认真的看,非常的神奇

14、键入关键字“Epic Google”然后点击手气不错,过一会它会逐渐变大直到占满屏幕;

15、输入输入 Google pink,然后点 I’m feeling lucky,将变粉红色,还可以从点击Red Search,Blue Search,Yellow Search 等;

16、水下搜索,输入url:http://www.google.cn/landing/shuixia/ 在搜索框中输入要搜索的关键词,会有与之相关的图片从天上落入海中,沉入海底,使用鼠标可以让它们漂浮起来,激起海浪。

在Mac上使用Jenkins

安装 Jenkins

自己安装Jenkins时的一些问题记录一下

  1. 官网下载Max OS X版安装包

  2. 点击安装包安装,先按照提示设置密码和安装推荐插件

  3. 第二步完成之,访问 http://localhost:8080 ,登录系统

点击Credentials菜单出现异常

java.lang.AssertionError: InstanceIdentity is missing its singleton:

解决方法:

1.在终端中用su登录,点这里查看如何开启

2.停止Jenkins: launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

3.编辑/Library/Application Support/Jenkins/jenkins-runner.sh文件:

a.在文件顶部增加一行

export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home"

> > b.修改最后两行为:
> >
> > ```bash
echo "/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java" $javaArgs -jar "$war" $args
exec "/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/bin/java" $javaArgs -jar "$war" $args

4.启动Jenkins:launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist

5.访问 http://localhost:8080 ,重新登录系统

Using the CLI client

  1. 访问http://localhost:8080/me/configure 查看当前用户的API Token
  2. 访问http://localhost:8080/cli/ 查看相关命令
  3. 点击页面jenkins-cli.jar链接下载jar文件到指定目录,也可以直接在Jenkins目录中找:/Users/Shared/Jenkins/Home/war/WEB-INF
  4. 执行命令:java -jar jenkins-cli.jar -s http://localhost:8080/ -auth [User ID]:[API Token] list-jobs

    [User ID]:[API Token] 即上面第一步所看到的

    ```bash
    $ java -jar jenkins-cli.jar -s http://localhost:8080/ -auth admin:Your Token list-jobs
    jk_1st_job

```

参考:

[HOW TO: Start, Stop, Restart or Reload Jenkins – Mac OSx](HOW TO: Start, Stop, Restart or Reload Jenkins – Mac OSx)

Java and OS X 10.9 Mavericks or 10.10 Yosemite

Using the CLI client

Jenkins+CLI

Using vim on MaxOS

使用vim作为16进制查看器

# 进入16进制模式
:!xxd
# 退出16进制模式
:!xxd -r

Mac Vim:

brew install vim --with-python3 --with-lua

报错:xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools ), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解决:

执行命令:

xcode-select --install
Build BLOG with Hexo

Install Hexo

SEE Hexo: https://hexo.io/zh-cn/index.html
tips: npm install -g npm Error: https://github.com/npm/npm/issues/10010

NexT theme & config

SEE NexT: http://theme-next.iissnan.com/getting-started.html

1.visit algolia: https://www.algolia.com
2.regist && visit dashboard
3.indices -> create new index
4.API Keys -> ALL API KEYS -> Edit
upload successful
upload successful
5.update _config.yml add

algolia:
  applicationID: 'applicationID'
  apiKey: 'apiKey'
  indexName: 'indexName'
  chunkSize: 5000

6.A separate API Key must be provided as an environment variable named HEXO_ALGOLIA_INDEXING_KEY

$ export HEXO_ALGOLIA_INDEXING_KEY=Your Api Key
$ ./node_modules/.bin/hexo algolia 

7.SEE: https://www.npmjs.com/package/hexo-algolia

Comment

SEE Hypercomments: https://www.hypercomments.com/

Deploy to github.io

1.update _config.yml

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repository: https://github.com/YourName/YourName.github.io.git
  branch: master

2.if you use hexo-admin,you can add a deploy script hexo-deploy.sh

#!/usr/bin/env sh
hexo g
hexo deploy

3.update _config.yml

# hexo-admin authentification
admin:
  username: YourName
  password_hash: YourPwd
  secret: YourSecret
  deployCommand: './hexo-deploy.sh'

Reference

https://github.com/jaredly/hexo-admin/issues/70
https://reuixiy.github.io/technology/computer/computer-aided-art/2017/06/09/hexo-next-optimization.html
https://github.com/npm/npm/issues/10010
https://ask.helplib.com/linux/post_60421

Hello World

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

$ hexo new "My New Post"

More info: Writing

Run server

$ hexo server

More info: Server

Generate static files

$ hexo generate

More info: Generating

Deploy to remote sites

$ hexo deploy

More info: Deployment