0%

我的微信读书11月阅读时长
我的微信读书11月阅读时长

11月平均每日阅读43分钟,最高一天阅读4小时,总共21个小时。这意味着,这30天里,我大约有一整天的人生活在书里的世界。幸甚至哉!

这些时间最大头还是花在了《奇鸟行状录》里(不太值),其次应该是钱钟书的《宋诗选注》和黑格尔的《小逻辑》里。看上去好奇怪的组合,不过不然。这其实很符合我的阅读习惯,一般是不同类型的书同时阅读,每次依当天的状态和心情去择一本翻开。实际上,想读《小逻辑》的时候,和想读《奇鸟行状录》的时候,整个人的状态是完全不一样的。据我观察,当我精神状态极佳、心情大好的时候,最想读哲学类的书;情感泛滥(高涨或者低落)的时候,最想读诗;感到疲乏的时候,想读小说来消遣。我倒也根据这么一点小习性,大言不惭地自觉“随性”,除了读书随心所欲以外,生活中大大小小的事上,心态也大抵类似。(主要是小事,大事实际上还是有点优柔寡断的,还想改呢。)

不过呢,这个月挑来读的这几本书,跟我之前的阅读惯性相比还是比较突兀的。一方面,小说上,我已经挺久没读日本小说了。虽然以前也喜欢村上春树,但这次是带着一些“怀旧”的心情去读他的。根据我的规划,在这个人生阶段,我是想读一些陀氏和海明威的,再往后也想涉猎一些不太熟悉但十分严肃的作家。

另一方面,这是我头一次迈入哲学原著的门🚪,精挑细选之后,才决定从黑格尔读起:人们说黑格尔是最后一个拥有完整的大哲学体系的哲学家;人们还说要想真的了解哲学,首先应该好好了解黑格尔。另外,黑格尔的辩论法,是想了解后世大多数哲学家,绕不过的一个话题。至于选择《小逻辑》,纯粹是贪图它比较短小精悍,但也完整包含了黑格尔整个逻辑学的思想,想来比较容易上手……然而读起来也不枉“晦涩”一词。我读得确实缓慢,但只要是一眼小小的泉眼,也总会源头活水慢慢来的。

宋诗嘛,是头脑一热想读古诗试试。之前喜欢的是现代诗,对古诗颇感敬畏。读起来其实很有趣,我以前对古诗的印象,是觉得所有诗都主题雷同,用的意象翻来覆去那几个。但捧起读来,才能真的体会到个中妙处。就是那么一板一眼的格律,那么受限的意象,那么几个主题,然每首诗都有实在的新意。我发现我渐渐开始喜欢起写景的诗来。

阅读全文 »

读后感

微信读书上花了整整22个小时读了《奇鸟行状录》,感受不佳,读完的时候甚至感到愤懑,胡说一通。

读完我竟然有生气的感觉。尤不喜欢这个隐喻大乱炖式结尾。早知道这本小说通篇暗喻,一件事也没直接地、好端端地讲明白,我是断不会选择阅读的。生气大概是对我这二十多个小时感到不值。

我从来不讨厌隐喻,过去也从村上的《海边的卡夫卡》《挪威的森林》之类长篇里收获了村上式魔幻现实的趣味,也因此是喜欢村上春树的。

但是,不一样的地方在于,本书是所谓「村上春树转型之作」,开始触及更严肃、更宏大的议题,我原本也是对此颇有期待的。可是用他特有的轻飘飘的方式来探讨爱情、人生我尚能接受,照样探讨暴力、战场,我只有不理解。(剥皮那一段写得倒是很沉重,也很好。)

我认为隐喻该是为了更清楚、更深刻的表达而存在的,而这本书里的大量隐喻根本无益于表达。本书最大的一个主题,即暴力会以各种形式对人造成损害,完全是有更直截了当的方式可以表达清楚的,我一直在期待更直白深入的探讨。可是整本书被细枝末节的、含义不明的隐喻占据了篇幅,以悬疑的情节、跌宕的故事走向来吸引人,我只觉得是挂羊头卖狗肉。

阅读全文 »

互联网冲浪对于我来说最浪漫的事情之一,就是顺着一篇搜来的技术文档,随手点开博客主页时,发现博客中记满了朴素但真挚的生活感想。有哲思,有小故事,有少年得意的成就记叙,也有人到中年的感怀伤时……每个人的博客都是独一无二的,网站名字和独特装饰极力彰显着个性;但所有博客又有一个共同的特点,就是毫无保留的文字和期待被造访的心情。这就好像在漠然的大城市里,却有一些不起眼的小屋子,真诚地敞着所有的门窗,等待像我这样的,可能会来,也可能不会来的旅人。

In IT5003, I am studying data structures and algorithms. The language we learn with is Python. So I take notes about what I learned, and how to use them in Python. I struct my notes based on data structures, and all the ADTs that are implemented by the data structures are discussed within. I focus on their usage, key design, and sometimes problems. In the future maybe I will append all the implementation codes.


  • ADT: Abstract data type, from the point of view of a user, defined by its behavior.
  • Data Structure: from the point of view of an implementer, concrete representations of data.

Linear Data Structures

Array:

Continuous space to store fix-sized elems.

阅读全文 »

Searching and Sorting

Searching algorithms

Search things in a list:

  • if the list doesn't change frequently, better to sort first, then use binary-search everytime.

Divide and conquer

divide the problem into subproblems, solve them, merge them.

阅读全文 »

Function

Function Decorator

1
2
3
4
5
6
7
8
9
10
11
def track(fn):
def h(x):
print('the fn {} has x {}'.format(fn, x))
return fn(x)
return h

@track
def foo(x):
return x ** x

print(foo(3))

decorator equals to: foo = track(foo)

Lambda

1
2
     lambda            x            :          f(g(x))
"A function that takes x and returns f(g(x))"
阅读全文 »

Iterable/Sequences

Strings, ranges, lists and tuples.

“An iterable which supports efficient element access using integer indices via the __getitem__ special method and defines a __len__ method that returns the length of the sequence.”

  • use one index to fetch item in a list, the index can't out of the range; but if use slice method, then you can do it out of the range, because the slice will autolly find the greediest indexs.

  • assigning a list to another list, like a = b, makes a and b refers to the same list. And a list is mutable. So if we change a, then b will also be affected. It's called alias. Do avoid this.

  • Tuple also has order. Just it's immutable.

  • Fxxxk, Tuple and Set are different things! A set is like {1, 2, 3}, that is what I thought as not ordered and not duplicated. And a set has intersection() union() difference() symmetric_difference().

    To delete items in a set:

    1
    2
    3
    set1.discard(6) # If the item doesn't exist, no exception
    set1.remove(6) # Raise an exception if doesn't exist
    set1.pop() # randomly delete one item.
  • you can insert an interable in a list's slice, though they have different length!

    1
    2
    3
    4
    >>> a = [1, 2, 3, 4, 5]
    >>> a[3:3] = [6, 7]
    >>> a
    [1, 2, 3, 6, 7, 4, 5]
  • list() takes an iterable, and makes it a list;

    str() shows you the whole object's look.

  • range() is also an iterable. It can be slicing, and len()

  • a, b = b, a: the b, a on the right firstly is packed into tuple: (b, a), then it is unpacked and individually assigned to each var on the left

Sequence operations

All: (list tuple str range)

阅读全文 »

Short Circuit

  • a and b evaluates to a if a is falsey, otherwise it evaluates to b
  • a or b evaluates to a if a is truthy, otherwise it evaluates to b
  • not a evaluates to True if a is falsey, otherwise it evaluates to False
1
2
3
4
5
>>> 0 and 'Hello' 0
>>> 'x' and 'y' 'y'
>>> '' or 0
0
>>> -23 or False -23
  • True is represented as 1, and False is represented as 0.
1
2
3
4
5
6
>>> True == 1 
True
>>> False == 0
True
>>> False == ''
False # because False == 0, but 0 != '', because '' == ord('')

Different Behavior in shell/script

阅读全文 »

Type System

What are types:

  • 意义的逻辑含义
  • 一个契约,要求所有成员有共同的特性
  • 所有值、变量都有type
  • 所有对象object都有type
  • 所有class、trait都type

value types & reference types

  • 有9种value types,它们不能为空:Byte Short Char Int Long Float Double Boolean Unit
  • 其他都是reference types:objects functions 等等

Type Hierarchies

阅读全文 »

image-20211022172413814
image-20211022172413814

The Clustrmaps widget can show the visitors' map of my website. It is nice, but its 3D global version is buggy when put on the Hexo website. So I put its .js file locally, and modified several parts in it, to make it displayed normally on Hexo websites.

Maybe one day the .js file will be updated by Clustrmaps, and I'll need to revise it again. So I record what I did here.

  1. Download the js file, put it here:/themes/next-new-version/source/js/clustrmaps.js, then the script label in the sidebar.swig is change as: <script type="text/javascript" id="clstr_globe" src="/js/clustrmaps.js?d=gWCOZyJlHF_Sc1eqXROD53yLLxxfC2y7Ytvw9JUfmFg"></script>. This way, I can modify codes in the .js file, or it would cause the following bugs.

  2. The variable's name velocity is duplicated with that of Hexo😂😂. So I replaced all with velocityD in the .js file.

  3. When the .js script is executed, the Hexo hasn't rendered the page yet, so the container of this widget still has width of 0. However, in the script, it fetches parent's width and sets it at that time! So it will disappear since its width is 0😅. To fix that, I changed the 302 line as:

    1
    pw = $("#clstr_globe").parent().parent().parent().width();

    The parent of parent of parent of the script label has normal width... This is funny but useful...