uname and file

uname -arv

List the basic system information, OS release, and OS version as shown below.

SunOS hope 5.7 Generic_106541-08 sun4m sparc SUNW,SPARCstation-10

file

Advertisements

annotation

@Override – Checks that the method is an override. Causes a compile error if the method is not found in one of the parent classes or implemented interfaces.

The first main distinction between kinds of annotation is whether they’re used at compile time and then discarded
 (like @Override) or placed in the compiled class file and available at runtime (like Spring’s @Component).
This is determined by the @Retention policy of the annotation. If you’re writing your own annotation,
you’d need to decide whether the annotation is helpful at runtime (for autoconfiguration, perhaps) or
only at compile time (for checking or code generation).When compiling code with annotations, the compiler sees the annotation just like it sees other modifiers on source
elements, like access modifiers (public/private) or final. When it encounters an annotation, it runs an annotation
processor, which is like a plug-in class that says it’s interested a specific annotation. The annotation processor
 generally uses the Reflection API to inspect the elements being compiled and may simply run checks on them,
 modify them, or generate new code to be compiled. @Override is an example of the first; it uses the Reflection API
to make sure it can find a match for the method signature in one of the superclasses and uses the Messager to
cause a compile error if it can’t.
  • Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate.
  • Suppose that a software group traditionally starts the body of every class with comments providing important information:
    public class Generation3List extends Generation2List {
    
       // Author: John Doe
       // Date: 3/17/2002
       // Current revision: 6
       // Last modified: 4/12/2004
       // By: Jane Doe
       // Reviewers: Alice, Bill, Cindy
    
       // class code goes here
    
    }

    To add this same metadata with an annotation, you must first define the annotation type. The syntax for doing this is:

    @interface ClassPreamble {
       String author();
       String date();
       int currentRevision() default 1;
       String lastModified() default "N/A";
       String lastModifiedBy() default "N/A";
       // Note use of array
       String[] reviewers();
    }

    The annotation type definition looks similar to an interface definition where the keyword interface is preceded by the at sign (@) (@ = AT, as in annotation type). Annotation types are a form of interface, which will be covered in a later lesson. For the moment, you do not need to understand interfaces.

    The body of the previous annotation definition contains annotation type element declarations, which look a lot like methods. Note that they can define optional default values.

    After the annotation type is defined, you can use annotations of that type, with the values filled in, like this:

    @ClassPreamble (
       author = "John Doe",
       date = "3/17/2002",
       currentRevision = 6,
       lastModified = "4/12/2004",
       lastModifiedBy = "Jane Doe",
       // Note array notation
       reviewers = {"Alice", "Bob", "Cindy"}
    )
    public class Generation3List extends Generation2List {
    
    // class code goes here
    
    }
  • Type annotations were created to support improved analysis of Java programs way of ensuring stronger type checking. e.g., @NonNull String str;

anonymous function

class B {

public void function cF( ) {

return new ClassA {

{

setName(“xxx”);

} // inner bracket is for block initializing

}; // outer bracket is for anonymous function

}

}

super class for this anonymous function is class A

outer class is class B

Here’s an example of an anonymous inner class.

    System.out.println(new Object() {
        @Override public String toString() {
            return "Hello world!";
        }
    }); // prints "Hello world!"

This is not very useful as it is, but it shows how to create an instance of an anonymous inner class that extends Object and @Override its toString() method.


Anonymous inner classes are very handy when you need to implement an interface which may not be highly reusable (and therefore not worth refactoring to its own named class). An instructive example is using a custom java.util.Comparator<T> for sorting.

Here’s an example of how you can sort a String[] based on String.length().

    import java.util.*;
    //...

    String[] arr = { "xxx", "cd", "ab", "z" };
    Arrays.sort(arr, new Comparator<String>() {
        @Override public int compare(String s1, String s2) {
            return s1.length() - s2.length();
        }           
    });
    System.out.println(Arrays.toString(arr));
    // prints "[z, cd, ab, xxx]"

Note the comparison-by-subtraction trick used here. It should be said that this technique is broken in general: it’s only applicable when you can guarantee that it will not overflow (such is the case with String lengths).

behavior

don’t bring up the same topic with the same evidence again and again because if it is disagreed yesterday, it won’t be agreed today.

never don’t say you are not good, say you did not put in a good way or don’t say it.

Confidence is key, but it’s important to always have the knowledge and skills to support self-assurance

sour grapes and go

sour grapes = Denial of the desirability of something after one has found out that it cannot be reached or acquired.
go = a board game called wei qi in chinese

gardenia = 栀子花

miscarriage=流产

punch out = 记录下班时间

Can you get the door? [=can you open or close the door for me?]

dilute = 稀释;冲淡 [daɪ’luːt]  

wilt =

  • v.(使)枯萎;(使)萎靡
  • n.枯萎;憔悴

conviction = n.坚信