0%

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

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

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

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

阅读全文 »

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

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

阅读全文 »

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

阅读全文 »

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.
阅读全文 »

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...

阅读全文 »