🕯🕯🕯
今年家里又走了一个老人,奶奶也比之前更容易流泪了,,尤其是我要回深圳的时候


  1. 你认为最完美的快乐是怎样的?
    快乐终究是短暂的,,今年没怎么读书,内心也没有去年平静。。
  2. 你最希望拥有哪种才华?
    还是将问题抽象成代码的能力。今年『稚晖君』火了,因为自己做了一个机械臂,媒体称之为华为天才少年,真好
  3. 你最恐惧的是什么?
    变老,一眼可以望到头儿的那种
  4. 你目前的心境怎样?
    还是焦虑,,关于年龄,关于未来。今年的焦虑比去年来的更猛烈了一些,,又年长了一岁,好像又没有什么进步。头发都抠掉了,也深刻理解光哥的两根食指是怎么抠坏的了。
  5. 还在世的人中你最钦佩的是谁?
    不再是马斯克,是稚晖君
  6. 你认为自己最伟大的成就是什么?
    能照顾好自己就挺伟大的
  7. 你自己的哪个特点让你最觉得痛恨?
    还是不够自律..
  8. 你最喜欢的旅行是哪一次?
    2018年端午节的苏州之旅,,准确来说是喜欢苏州。今年因为疫情没怎么出去玩儿,去了广州张信哲的演唱会,本来还计划再去五条人的专场,票和酒店都定好了,结果突发疫情取消了。嗯,还去了盘尼西林的专场 [狗头]
  9. 你最痛恨别人的什么特点?
    双标,妥妥的双标!
  10. 你最珍惜的财产是什么?
    个人信用
  11. 你最奢侈的是什么?
    父母是如此爱我
  12. 你认为程度最浅的痛苦是什么?
    浅的都不痛苦,痛苦都不浅
  13. 你认为哪种美德是被过高的评估的?
    这个话题一两句说不清楚,,容易引战
  14. 你最喜欢的职业是什么?
    依然程序员(上边提到的『稚晖君』,奈斯!)
  15. 你对自己的外表哪一点不满意?
    右上眼皮可不可以不要内双
  16. 你最后悔的事情是什么?
    大学混沌且不自知
  17. 还在世的人中你最鄙视的是谁?
    每个人应该都不想被别人鄙视的..
  18. 你最喜欢男性身上的什么品质?
    能为自己说过的话、做过的事负责
  19. 你使用过的最多的单词或者是词语是什么?
    本年度是,,我不管,我就要(其实不是我说的)。
  20. 你最喜欢女性身上的什么品质?
    会照顾自己,也会照顾别人
  21. 你最伤痛的事是什么?
    形同陌路
  22. 你最看重朋友的什么特点?
    靠谱儿
  23. 你这一生中最爱的人或东西是什么?
    现在想想,,以前最爱的人是自己,现在不是了,持续付出爱的行为会让人成长。
  24. 你希望以什么样的方式死去?
    安乐死,或者一场猝不及防的意外
  25. 何时何地让你感觉到最快乐?
    代码一遍过!!!
  26. 如果你可以改变你的家庭一件事,那会是什么?
    早点让我知道电脑不光可以玩游戏..
    大家身体健康就好,别的真不奢求
  27. 如果你能选择的话,你希望让什么重现?
    小我:早上被我爸的录音机(装磁带的那个)叫醒,我该起床吃饭上学了。
    大我:太阳系重回三维宇宙。
  28. 你的座右铭是什么?
    经历过就是财富

Extra..
2021年还有什么想说的??

阅读全文 »

关于 Executors.newSingleThreadExecutor()

本以为只是一个简单的单线程线程池,与 Executors.newFixedThreadExecutor(1) 类似,但它的 DOC 注释中又显式提到:

Unlike the otherwise equivalent {@code newFixedThreadPool(1)} the returned executor is guaranteed not to be reconfigurable to use additional threads.

与类似功能的 newFixedThreadPool(1) 不一样,该方法返回的线程池执行器不可以被重新配置以使用额外的线程。

关键在于不可以重新配置。来看看它的构造器:

1
2
3
4
5
public static ExecutorService newSingleThreadExecutor() {
// FinalizableDelegatedExecutorService 装饰器
return new FinalizableDelegatedExecutorService
(new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()));
}
阅读全文 »

事务隔离-高低水位

最近在复习丁奇大大MySQL实战45讲 - 08 | 事务到底是隔离的还是不隔离的?中关于 RC 隔离级别的实现时,以前好像读懂的地方又读不懂了。尤其是对下👇图:数据版本可见性规则 中高低水位『当前事务』的理解。

疑问

在可重复读隔离级别下,事务在启动的时候就『拍了个快照』。

按照可重复读的定义,一个事务启动的时候,能够看到所有已经提交的事务结果。但是之后,这个事务执行期间,其他事务的更新对它不可见。

阅读全文 »

🕯🕯🕯
向在这场疫情中去世的奉献者们致敬!


  1. 你认为最完美的快乐是怎样的?
    内心的平静,,上周日,在普宁美佳乐一层的大厅了,等大象-的时候,百无聊赖在按摩椅上休息了15分钟。整个人躺在上面,外面熙熙攘攘(音乐美食节,同时有四家在卖臭豆腐…),我看着天花板,完全放空了。想起了去年夏天去外伶仃岛,返程等船的时候,在树荫下的一块裸石上边,盘腿进入冥想状态。大抵就是这种『没有意义』的一刻钟吧。
  2. 你最希望拥有哪种才华?
    还是将问题抽象成代码的能力。今年突然发现了『稚晖君』,好生羡慕。
  3. 你最恐惧的是什么?
    变老..
  4. 你目前的心境怎样?
    有点焦虑,,关于年龄,关于未来。做总结的时候总是焦虑的,一年一年,,上周五的时候,在公司加班写代码,周婶儿发起视频,还有大松,光哥没接。没说几句,松突然提到『腿儿,你三十啦?!』,周婶儿说『没事儿,三十岁一事无成很正常,嫑伤心哈』,接着就是一阵坏笑,[扶额]。
  5. 还在世的人中你最钦佩的是谁?
    工作上还是硅谷钢铁侠,生活上是冯唐
  6. 你认为自己最伟大的成就是什么?
    (一声叹息..)
  7. 你自己的哪个特点让你最觉得痛恨?
    还是不够自律..
  8. 你最喜欢的旅行是哪一次?
    2018年端午节的苏州之旅,,准确来说是喜欢苏州。去年的双月湾和外伶仃岛也不错,如今想起的都是美好~
  9. 你最痛恨别人的什么特点?
    双标,妥妥双标!
  10. 你最珍惜的财产是什么?
    个人信用
  11. 你最奢侈的是什么?
    爸妈是如此爱我(我爸刚嘟噜玩说白养我了,看得见摸不着指不上[笑哭])
  12. 你认为程度最浅的痛苦是什么?
    浅的都不痛苦,痛苦都不浅
  13. 你认为哪种美德是被过高的评估的?
    这个话题一两句说不清楚,,容易引战
  14. 你最喜欢的职业是什么?
    依然程序员(上边提到的『稚晖君』,奈斯!)
  15. 你对自己的外表哪一点不满意?
    右上眼皮可不可以不要内双
  16. 你最后悔的事情是什么?
    大学混沌且不自知
  17. 还在世的人中你最鄙视的是谁?
    每个人应该都不想被别人鄙视的..
  18. 你最喜欢男性身上的什么品质?
    能为自己说过的话、做过的事负责
  19. 你使用过的最多的单词或者是词语是什么?
    本年度是,,**easy, man~**(想表达的是,Easy tiger.)
  20. 你最喜欢女性身上的什么品质?
    会照顾自己,也会照顾别人
  21. 你最伤痛的事是什么?
    形同陌路
  22. 你最看重朋友的什么特点?
    靠谱儿
  23. 你这一生中最爱的人或东西是什么?
    现在回答这个问题还是有些早,,现在希望大象-能够再胖一点。
  24. 你希望以什么样的方式死去?
    安乐死,或者一场猝不及防的意外
  25. 何时何地让你感觉到最快乐?
    Give Me Five!!!
  26. 如果你可以改变你的家庭一件事,那会是什么?
    早点让我知道电脑不光可以玩游戏..
    大家身体健康就好,别的不奢求
  27. 如果你能选择的话,你希望让什么重现?
    小我:早上被我爸的录音机(装磁带的那个)叫醒,我该起床吃饭上学了。
    大我:太阳系重回三维宇宙。
  28. 你的座右铭是什么?
    经历过就是财富

Extra..
2020年还有什么想说的??

阅读全文 »

🕯🕯🕯
今天给阿妈打电话的时候,得知三奶奶也走了,你们要好好的,互相照顾喔。


  1. 你认为最完美的快乐是怎样的?
    内心的平静
  2. 你最希望拥有哪种才华?
    还是将问题抽象成代码的能力
  3. 你最恐惧的是什么?
    变老
  4. 你目前的心境怎样?
    有点焦虑,,关于年龄,关于未来
  5. 还在世的人中你最钦佩的是谁?
    工作上还是硅谷钢铁侠,生活上是冯唐
  6. 你认为自己最伟大的成就是什么?
    本期拒绝回答,,立Flag!
  7. 你自己的哪个特点让你最觉得痛恨?
    还是要更自律一点,,自律即自由
  8. 你最喜欢的旅行是哪一次?
    2018年端午节的苏州之旅,,准确来说是喜欢苏州
  9. 你最痛恨别人的什么特点?
    这样不好..
  10. 你最珍惜的财产是什么?
    个人信用
  11. 你最奢侈的是什么?
    爸妈是如此爱我
  12. 你认为程度最浅的痛苦是什么?
    浅的都不痛苦,痛苦都不浅
  13. 你认为哪种美德是被过高的评估的?
    这个话题一两句说不清楚,,容易引战
  14. 你最喜欢的职业是什么?
    依然程序员
  15. 你对自己的外表哪一点不满意?
    右上眼皮可不可以不要内双
  16. 你最后悔的事情是什么?
    大学混沌且不自知
  17. 还在世的人中你最鄙视的是谁?
    无法控制自己情绪的人
  18. 你最喜欢男性身上的什么品质?
    能为自己说过的话、做过的事负责
  19. 你使用过的最多的单词或者是词语是什么?
    本年度是,,同一个世界,同一个梦想(大家都是同事,都想把事情做好)
  20. 你最喜欢女性身上的什么品质?
    会照顾自己,也会照顾别人
  21. 你最伤痛的事是什么?
    形同陌路
  22. 你最看重朋友的什么特点?
    靠谱儿
  23. 你这一生中最爱的人或东西是什么?
    28岁回答这个问题有些早,,现在我希望自己有长期稳定的住所,可以无所顾忌的买书,纸质的。
  24. 你希望以什么样的方式死去?
    安乐死,或者一场猝不及防的意外
  25. 何时何地让你感觉到最快乐?
    Give Me Five!!!
  26. 如果你可以改变你的家庭一件事,那会是什么?
    早点让我知道电脑不光可以玩游戏..
    大家身体健康就好,别的真不奢求
  27. 如果你能选择的话,你希望让什么重现?
    小我:早上被我爸的录音机(装磁带的那个)叫醒,我该起床吃饭上学了。
    大我:太阳系重回三维宇宙。
  28. 你的座右铭是什么?
    总之,经历过就是财富

Extra..
2019年还有什么想说的??

阅读全文 »

Context

上周六看『寄生虫』的时候,有个片段,,下暴雨的时候,男主一家人居住的半地下室被水淹之后,父子俩和受灾群众去体育馆过夜的时的对话👇

寄生虫-没有计划

虽然关于计划的逻辑极端了些,,但在那一霎那我还是被击中了!突然意识到人生的意义和所谓自由意志根本是两个互斥的东西!!

人生的意义

阅读全文 »

节选自 王宝令-Java变法编程实战,欢迎大家订阅~

什么是管程

不知道你是否曾经思考过这个问题:为什么 Java 在 1.5 之前仅仅提供了 synchronized 关键字及 wait()notify()notifyAll() 这三个看似从天而降的方法?在刚刚接触 Java 的时候,我以为它会提供信号量这种编程原语,因为操作系统原理课程告诉我,用信号量能解决所有并发问题,结果我发现不是。后来我找到了原因:Java 采用的是管程技术,synchronized 关键字及 wait()notify()notifyAll() 这三个方法都是管程的组成部分。而管程和信号量是等价的,所谓等价指的是用管程能够实现信号量,也能用信号量实现管程。但是管程更加容易使用,所以 Java 选择了管程。

管程,对应的英文是 Monitor,很多 Java 领域的同学都喜欢将其翻译成“监视器”,这是直译。操作系统领域一般都翻译成“管程”,这个是意译,而我自己也更倾向于使用“管程”。

所谓管程,指的是管理共享变量以及对共享变量的操作过程,让他们支持并发。翻译为 Java 领域的语言,就是管理类的成员变量和成员方法,让这个类是线程安全的。那管程是怎么管的呢?

阅读全文 »

本文摘自吴翰清-世界需要什么样的智能系统(节选)


科技的进步是为了解放生产力

我将生产力的进步分为五个阶段:体力劳动,机械化,电气化,信息化,智能化。其中每一次科技的进步,都会带来生产力的解放,对社会的改变是巨大的。

在140年前发生的第二次科技革命,让电力深入到各行各业。自从中央发电站和交流电变压器等关键技术构建的电力基础设施成型后,获取电力的成本逐渐降低,各种各样的电气应用开始涌现,人们获取到了新的、稳定的能源。

阅读全文 »

以下内容节选自『存在主义心理治疗』-欧文・D・亚隆


存在主义观点强调一种不同类型的基本冲突: 既不是与被压抑的本能抗争之间的冲突,也不是与内化了的成人之间的冲突。而是,在个体面对存在的既定事实时引发出来的冲突。而我所说的存在的“既定事实”,意指某些终极关怀、某些人之所以为人的必然特质。

怎样发现这些既定事实的性质?在某些意义上来说,这个任务并不困难。方法就是深度的个人反思。条件很简单:从充斥着我们每个人经验世界的日常琐事中抽离出来,给自己以独处、沉默、时间以及自由。如果我们能够清除或者“囊括”日常生活,如果我们对于自己在世界上的“处境”,对于我们的存在、我们的界限、我们的潜力进行深刻的反思,如果我们深入到所有层面的最底层,我们必然会面对存在的既定事实,面对“深度结构”,我之后将称之为“终极关怀”。这些反思过程常常为某些紧急体验所催化。这些常被称作“边缘”或者“临界”状态,包括如下体验:面对自己的死亡、面临某些重大不可逆转的决定或者某些深具意义的图式在眼前坍缩。

本书涉及四个终极关怀:死亡、自由、孤独和无意义。个体与这些生命真相的正面交锋,构成了存在主义动力性冲突的内容。

阅读全文 »

HashSet 的 DOC 注释

-Basic JDK7

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* This class implements the <tt>Set</tt> interface, backed by a hash table
* (actually a <tt>HashMap</tt> instance). It makes no guarantees as to the
* iteration order of the set; in particular, it does not guarantee that the
* order will remain constant over time. This class permits the <tt>null</tt>
* element.
* 该类是由 hash table(实际上是 HashMap 实例) 支持的 Set 接口的实现类。它不能保证 set 的迭代顺序;特别是,它不保证 set 内元素的顺序随着时间的变化不会改变。该类允许(添加) null 元素。
* <p>This class offers constant time performance for the basic operations
* (<tt>add</tt>, <tt>remove</tt>, <tt>contains</tt> and <tt>size</tt>),
* assuming the hash function disperses the elements properly among the
* buckets. Iterating over this set requires time proportional to the sum of
* the <tt>HashSet</tt> instance's size (the number of elements) plus the
* "capacity" of the backing <tt>HashMap</tt> instance (the number of
* buckets). Thus, it's very important not to set the initial capacity too
* high (or the load factor too low) if iteration performance is important.
* 该类的基本操作(add,remove,contains 和 size)提供O(1)的级别的性能表现,假设 hash 方法将元素均匀的分布在桶中。遍历整个 set 所需的时间与 HashSet 实例的 size(元素数量) * (底层 HashMap 实例的 capacity(桶的数量)) 成正比。
* <p><strong>Note that this implementation is not synchronized.</strong>
* If multiple threads access a hash set concurrently, and at least one of
* the threads modifies the set, it <i>must</i> be synchronized externally.
* This is typically accomplished by synchronizing on some object that
* naturally encapsulates the set.
* 参见 HashMap
* If no such object exists, the set should be "wrapped" using the
* {@link Collections#synchronizedSet Collections.synchronizedSet}
* method. This is best done at creation time, to prevent accidental
* unsynchronized access to the set:<pre>
* Set s = Collections.synchronizedSet(new HashSet(...));</pre>
* 参见 HashMap
* <p>The iterators returned by this class's <tt>iterator</tt> method are
* <i>fail-fast</i>: if the set is modified at any time after the iterator is
* created, in any way except through the iterator's own <tt>remove</tt>
* method, the Iterator throws a {@link ConcurrentModificationException}.
* Thus, in the face of concurrent modification, the iterator fails quickly
* and cleanly, rather than risking arbitrary, non-deterministic behavior at
* an undetermined time in the future.
* 参见 HashMap
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
* as it is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
* Therefore, it would be wrong to write a program that depended on this
* exception for its correctness: <i>the fail-fast behavior of iterators
* should be used only to detect bugs.</i>
* 参见 HashMap
* <p>This class is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
* Java Collections Framework</a>.
*
* @param <E> the type of elements maintained by this set
*
* @author Josh Bloch
* @author Neal Gafter
* @see Collection
* @see Set
* @see TreeSet
* @see HashMap
* @since 1.2
*/
public class HashSet<E>
extends AbstractSet<E>
implements Set<E>, Cloneable, java.io.Serializable

HashSet 的类属性、构造方法及 add() 方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
private transient HashMap<E,Object> map;

// Dummy value to associate with an Object in the backing Map
// 由 Map 接口支持的虚拟对象
private static final Object PRESENT = new Object();

/**
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
* default initial capacity (16) and load factor (0.75).
* 构造一个新的空的 set;提供底层支持的 HashMap 实例的 默认初始 capacity 为 16,负载因子为 0.75。
*/
public HashSet() {
map = new HashMap<>();
}

/**
* Constructs a new set containing the elements in the specified
* collection. The <tt>HashMap</tt> is created with default load factor
* (0.75) and an initial capacity sufficient to contain the elements in
* the specified collection.
* 构造一个包含指定 collection 中的元素的新 set 实例。
* @param c the collection whose elements are to be placed into this set
* @throws NullPointerException if the specified collection is null
*/
public HashSet(Collection<? extends E> c) {
map = new HashMap<>(Math.max((int) (c.size()/.75f) + 1, 16));
addAll(c);
}
/**
* {@inheritDoc}
* 该方法继承自 AbstractCollection(即,HashSet 没有重写 addAll(),直接指向的是 AbstractCollection.addAll()方法)
* <p>This implementation iterates over the specified collection, and adds
* each object returned by the iterator to this collection, in turn.
* 该方法实现遍历整个指定的 collection,并且将 collection 的 iterator 返回的每个 对象按顺序添加到 set 中。
* <p>Note that this implementation will throw an
* <tt>UnsupportedOperationException</tt> unless <tt>add</tt> is
* overridden (assuming the specified collection is non-empty).
* 需要注意的是,这个方法实现会抛出一个 UnsupportedOperationException 异常,除非 add() 被重写(假设指定的 collection 是非空的)。
* @throws UnsupportedOperationException {@inheritDoc}
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
* @throws IllegalArgumentException {@inheritDoc}
* @throws IllegalStateException {@inheritDoc}
*
* @see #add(Object)
*/
public boolean addAll(Collection<? extends E> c) {
boolean modified = false;
for (E e : c)
if (add(e))
modified = true;
return modified;
}
/**
* Adds the specified element to this set if it is not already present.
* More formally, adds the specified element <tt>e</tt> to this set if
* this set contains no element <tt>e2</tt> such that
* <tt>(e==null&nbsp;?&nbsp;e2==null&nbsp;:&nbsp;e.equals(e2))</tt>.
* If this set already contains the element, the call leaves the set
* unchanged and returns <tt>false</tt>.
* 添加指定元素到 set 中,如果 set 中还没有该元素。严谨来说,添加一个元素 e 到该 set 中,如果 set 中不存在一个满足这样条件的 (e2: e==null ? e2==null : e.equals(e2)).如果 set 中已经存在一个这样的元素,当次调用不会改变 set,并且放回 false。
* @param e element to be added to this set
* @return <tt>true</tt> if this set did not already contain the specified
* element
*/
public boolean add(E e) {
// map.put() 返回 null,说明添加新值成功;否则说明添加的元素发生哈希碰撞,或者是重复添加相同元素。
// 另外,需要注意到的是 PRESENT,即影子对象,没有实际意义,纯粹为了填充 value。
return map.put(e, PRESENT)==null;
}

/**
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
* the specified initial capacity and the specified load factor.
* 构建一个新的空的 set;指定构建由底层提供支持的 HashMap 实例时的初始容量,和负载因子。
* @param initialCapacity the initial capacity of the hash map
* @param loadFactor the load factor of the hash map
* @throws IllegalArgumentException if the initial capacity is less
* than zero, or if the load factor is nonpositive
*/
public HashSet(int initialCapacity, float loadFactor) {
map = new HashMap<>(initialCapacity, loadFactor);
}
/**
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
* the specified initial capacity and default load factor (0.75).
* 构建一个新的空 set;指定构建由底层提供支持的 HashMap 实例时的初始容量,负载因子默认为 0.75.
* @param initialCapacity the initial capacity of the hash table
* @throws IllegalArgumentException if the initial capacity is less
* than zero
*/
public HashSet(int initialCapacity) {
map = new HashMap<>(initialCapacity);
}
/**
* Constructs a new, empty linked hash set. (This package private
* constructor is only used by LinkedHashSet.) The backing
* HashMap instance is a LinkedHashMap with the specified initial
* capacity and the specified load factor.
* 构建一个新的空 Linked Hash set。(这个包级作用域私有的构造器只能被 LinkedHashSet 使用)。底层提供支持的 HashMap 实例是一个 由指定初始容量和指定负载因子的 LinkedHashMap。
* @param initialCapacity the initial capacity of the hash map
* @param loadFactor the load factor of the hash map
* @param dummy ignored (distinguishes this
* constructor from other int, float constructor.)
* @throws IllegalArgumentException if the initial capacity is less
* than zero, or if the load factor is nonpositive
*/
HashSet(int initialCapacity, float loadFactor, boolean dummy) {
map = new LinkedHashMap<>(initialCapacity, loadFactor);
}
阅读全文 »
0%