Exceptional Halt

豆瓣属于上个时代最优雅的网站群体,也是这个时代最跟不上节奏的网站之一。

直到现在,我还是理解不了豆瓣为什么在移动App刚刚兴起的时候毫无反应,只慢慢做了好几个用不顺手的小App,很少维护。很迟之后突然幡然悔悟地想起要做一个整合的“大豆瓣”,浪费了优质的UGC。

豆瓣的最好玩的地方,其实不在于影评书评,反而是“小组”。那是超过百度贴吧趣味的东西,无论文艺与否,任何人都可以找到自己感兴趣的一片天地。或者说,即使一个人不用“小组”(比如我),也总能在友邻的分享中窥探到其中的乐趣。

Thoughts on Flask, Python and Node.js

Recently I’ve been working on a software design competition held in my university. This year’s theme has something to do with GPS/LBS application, which requires candidates to use designated toolkits provided by the sponsor. Since the toolkits is not mature, my team decided to focus on the other option: anything as long as it’s attractive because it’s not mandatory to conform to the theme.

Anyway, we decided to write an app which enables people to draw their interactive models. Since I have experience in former CMS work, I am in charge of server this time. In CMS, I used Node.js and Express for all of the development so I’d like to try something new, like Python, in this project.

Above is the prelude of my thoughts. Initially I set up a virtual environment using pyenv and pyenv-virutualenv. Compared to Node.js ’s NPM, Python’s PIP is not that user-friendly.

CMS带来的思考:项目管理方式

本次问题

从这次的CMS来看,项目管理很难…

  • 任务分配
  • 进度追踪
  • 错误修正

目前都是靠微信和邮件交流来的。前者几乎是唯一的”及时”的沟通渠道。但是这也造成了

  • 信息冗余(同一个消息和不同人说),
  • 无法定位(因为相关信息都是在对话中),
  • 误解(通过语言/文件解释一个接口必然不精确)

等多个问题。

为什么array.sort(function(a, b){return a-b})是从小到大排序

根据mozilla的官方说明文档

  • If compareFunction(a, b) is less than 0, sort a to a lower index than b, i.e. a comes first.

  • If compareFunction(a, b) returns 0, leave a and b unchanged with respect to each other, but sorted with respect to all different elements. Note: the ECMAscript standard does not guarantee this behaviour, and thus not all browsers (e.g. Mozilla versions dating back to at least 2003) respect this.

  • If compareFunction(a, b) is greater than 0, sort b to a lower index than a.

  • compareFunction(a, b) must always return the same value when given a specific pair of elements a and b as its two arguments. If inconsistent results are returned then the sort order is undefined

简而言之,如果比较函数 function(a, b)结果是小于0的,那么第一个参数a就一定是在第二个参数b的前面。如果结果是大于0的,那么第二个参数b就在第一个参数a的前面。

在Mac上安装Angular.js找不到chromedriver的解决办法

本次安装按照Angular.js官方教程

前面的安装由于用到git等,建议自备梯子。

进行到这一步时:

npm run protractor

会一直报错:

Error: Could not find chromedriver

这一步的关键在于,虽然在Mac系统上,但仍要有chromedriver.exe。你没有看错,就是exe…而教程里给的npm指令下下来的chromedriver.zip是无法解压的。所以我们需要手动下载下来,解压,并加上.exe后缀。