《智识分子-做个复杂的现代人》读书笔记

终于读完多年前朋友送我的两本书《智识分子》和《万万没想到》,都是万维钢写的。不禁感叹这个世界上真有如此聪慧的人,既然能学贯中西,纵横千年。

虽然书本里面很多都是零碎的文章,但是作为一个感受“理工科思维”的入门书,这两本还是ok的。

我这边看的比较粗暴,因为已经完成了基本的理科思维启迪,更多的把这本书当作更好的阅读材料索引。讲到这里,就不得不提里面提到的很关键的一个章节,《信息极客的三个功夫》。

在这篇短小的文章里面,作者给出了3个技巧,帮助我们在这个信息爆炸的时代,如何有效的获取信息,发现真知,而不是作为被投喂的那个人。

技巧一,阅读学术论文。区别于大众用的搜索引擎,其实还有学术相关的搜索引擎,包括:google scholar、百度学术、Solidot(科技新闻网站)、果壳网、EurekAlert。

继续阅读

good practice for storing time related objs in mysql with python

I recently wrote a spider for jobs with the scrapy framework, and stored all my items in mysql.

But here the problem comes. If you try to use timestamp type in mysql, several traps may be concerned.

First, how the timestamp being interpreted is affected by your connection timezone.If you do not specify, it may use the mysql server one.But who knows what is the default one.

Second, your mysql client in python layer may not support time_zone param, which is available in mysql c api.Some libraries like MySQL-python==1.2.5 just not support it.
So, if you want to change connection timezone, you may have to specify it explicitly on every sql query.

Third, your mysql database may not be controlled by you, so you would be better to change your logic code timezone.

As for me, i would just use INT for all my time related data, and represent them when necessary.

So, use it explicitly, or just don’t use it.

Or, even better, see discussions on ST.In general,just set your db timezone to UTC, and use local timezone on your logical layers.