• #56 楼 也就是又拍云比阿里云快的样子?

  • 实际跑了下 Benchmark 对比发现其实不是算快……网速很快倒是真的:

    angularjs.cn

    Benchmarking www.angularjs.cn (be patient).....done
    
    
    Server Software:        Tengine/1.5.1
    Server Hostname:        www.angularjs.cn
    Server Port:            80
    
    Document Path:          /
    Document Length:        4725 bytes
    
    Concurrency Level:      5
    Time taken for tests:   0.495 seconds
    Complete requests:      20
    Failed requests:        0
    Write errors:           0
    Total transferred:      99960 bytes
    HTML transferred:       94500 bytes
    Requests per second:    40.43 [#/sec] (mean)
    Time per request:       123.672 [ms] (mean)
    Time per request:       24.734 [ms] (mean, across all concurrent requests)
    Transfer rate:          197.33 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:       51   54   2.0     54      59
    Processing:    54   64  15.6     59     101
    Waiting:       53   61  13.2     57      99
    Total:        108  118  15.6    112     155
    
    Percentage of the requests served within a certain time (ms)
      50%    112
      66%    114
      75%    116
      80%    117
      90%    154
      95%    155
      98%    155
      99%    155
     100%    155 (longest request)
    
    Benchmarking www.angularjs.cn (be patient).....done
    
    
    Server Software:        Tengine/1.5.1
    Server Hostname:        www.angularjs.cn
    Server Port:            80
    
    Document Path:          /api/article/AOmJ
    Document Length:        129 bytes
    
    Concurrency Level:      5
    Time taken for tests:   0.450 seconds
    Complete requests:      20
    Failed requests:        0
    Write errors:           0
    Total transferred:      8460 bytes
    HTML transferred:       2580 bytes
    Requests per second:    44.40 [#/sec] (mean)
    Time per request:       112.617 [ms] (mean)
    Time per request:       22.523 [ms] (mean, across all concurrent requests)
    Transfer rate:          18.34 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:       50   54   2.5     54      59
    Processing:    55   57   2.0     57      62
    Waiting:       55   57   1.9     56      62
    Total:        105  112   3.6    111     120
    
    Percentage of the requests served within a certain time (ms)
      50%    111
      66%    112
      75%    114
      80%    115
      90%    117
      95%    120
      98%    120
      99%    120
     100%    120 (longest request)
    This is ApacheBench, Version 2.3 <$Revision: 1430300 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    

    ruby-china

    Benchmarking ruby-china.org (be patient).....done
    
    Server Software:        nginx/1.4.2
    Server Hostname:        ruby-china.org
    Server Port:            80
    
    Document Path:          /
    Document Length:        33423 bytes
    
    Concurrency Level:      5
    Time taken for tests:   1.197 seconds
    Complete requests:      20
    Failed requests:        9
       (Connect: 0, Receive: 0, Length: 9, Exceptions: 0)
    Write errors:           0
    Total transferred:      686786 bytes
    HTML transferred:       668486 bytes
    Requests per second:    16.71 [#/sec] (mean)
    Time per request:       299.260 [ms] (mean)
    Time per request:       59.852 [ms] (mean, across all concurrent requests)
    Transfer rate:          560.29 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:       26   36  11.0     30      65
    Processing:   145  238  86.7    221     471
    Waiting:      107  162  66.4    142     340
    Total:        177  274  83.9    250     499
    
    Percentage of the requests served within a certain time (ms)
      50%    250
      66%    288
      75%    317
      80%    325
      90%    465
      95%    499
      98%    499
      99%    499
     100%    499 (longest request)
    

    google

    Benchmarking www.google.com (be patient).....done
    
    
    Server Software:        gws
    Server Hostname:        www.google.com
    Server Port:            80
    
    Document Path:          /
    Document Length:        376 bytes
    
    Concurrency Level:      5
    Time taken for tests:   0.563 seconds
    Complete requests:      20
    Failed requests:        0
    Write errors:           0
    Non-2xx responses:      20
    Total transferred:      18480 bytes
    HTML transferred:       7520 bytes
    Requests per second:    35.55 [#/sec] (mean)
    Time per request:       140.635 [ms] (mean)
    Time per request:       28.127 [ms] (mean, across all concurrent requests)
    Transfer rate:          32.08 [Kbytes/sec] received
    
    Connection Times (ms)
                  min  mean[+/-sd] median   max
    Connect:       41   43   1.8     43      46
    Processing:    87   91   6.4     90     117
    Waiting:       87   91   6.3     90     116
    Total:        128  134   7.1    133     160
    
    Percentage of the requests served within a certain time (ms)
      50%    133
      66%    135
      75%    136
      80%    137
      90%    141
      95%    160
      98%    160
      99%    160
     100%    160 (longest request)
    
    
  • 洗钱的刚需

  • High performance Rails at November 19, 2013

    #17 楼 @lgn21st 最近发现这不是 nginx 的 bug,而是 feature…… http://forum.nginx.org/read.php?2,240120,240127#msg-240127 因为开启了 gzip,nginx 把 rails 生产的 strong etag 给去掉了……

  • softtab 是什么?难道不都是编辑器自动格式化缩进 2 空格的么……原来还真还有手敲空格/tab 缩进的人啊……三观被刷新了

  • 说起量子力学就想起传说中的 Heisenbug……

  • 实际需求到底是啥?md5 本来不就是个数么……

  • #23 楼 @nightire 我回复里都说了

    不管是戏谑版还是 正经版本

    我还是解释一下为啥我觉得这篇文章写的不好,为什么用 CoffeeScript 就能避免遇到文章中说的那些坑吧……

    写代码前,先想好(或约定好)要支持的 JavaScript 版本及执行环境;

    这个原则太大其实跟 strict mode 没有直接关系,用不用严格模式都得这样

    确保你所使用的任何 JavaScript 特性都是运行环境所支持的;

    大部分严格模式和非严格模式上有兼容问题的特性,用 CoffeeScript 来写的话,要么根本不能编译通过,要么是写不出来,比如用const,with之类的保留字,比如未声明就赋值什么的,比如函数参数重名什么的,比如对象 key 重名什么的……别说严格模式,就连function foo()这样可能遇到浏览器兼容问题的函数声明,都没法写出来,只能写出var foo = function()这样的……

    总是在兼容 ES5 的执行环境下测试开启严格模式的 JavaScript 程序;

    这点说了跟没说一样……实际上不会遇到这个坑, 实际上不兼容 ES5 的主流浏览器只剩下低版本 IE,难道你认识有只用 IE 做调试的奇葩么,就介绍……然后 CoffeeScript 没有涵盖到的严格模式可能出现的剩下那些问题,在现代浏览器上调试的时候也会显式报错的

    小心处理文件合并时对于严格模式可能造成的各种影响及后果。

    CoffeeScript 编译出来的文件自带闭包,想因合并顺序出问题也出不了……

    所以我才说用 CoffeeScript 基本能避免那些坑…… 你看人家 Github JavaScript Styleguide 第一条就是

    Write new JS in CoffeeScript.

  • 这个例子不怎么好,不管是戏谑版还是正经版本,都嫌篇幅太长太罗嗦太没有重点……

    大概因为 "use strict";本身没啥好讲的,实践上一句话就结了:用 coffeescript 写,然后在每个用严格模式的文件开头加一句 'use strict'

    用 coffeescript 写已经过滤了大部分问题,比如根本就写不出const,然后文件合并也不会出任何问题

  • 默认的当然满足不了需求,但是难道你就不会把它变得能满足需求?convention over configuration 意味着总是可以自定义的嘛,包括脚手架: http://guides.rubyonrails.org/generators.html

  • 程序员装逼指南 at October 26, 2013

    #29 楼 @cassiuschen 即时通讯类的及格线感觉是 IRC 什么的……

  • 这问题跟 code review 有个毛线关系,分明是写测试的问题,修 bug 的时候怎么不写相关测试代码……

  • 开发环境禁止了远程访问吧……毕竟这么不安全……

  • #31 楼 @Victor API 设计的时候显然要参考 GitHub 的 API,人家做的是相当标准…… 分页信息放在 Response Header 里应该算是最佳实践了吧,这样不需要给每个 index 模板都重复塞个 json.page 之类什么的,至于缓存,返回的 Response Header 应该没影响啊,而 Request header 本来就不应该放对缓存有影响的参数吧……

    然后 set_pagination_headers 这方法是这里挖到的:

    http://metabates.com/2012/02/22/adding-pagination-to-an-api/

    上面这个是用 will_paginate 的,kaminari 应该需要稍微改一下

  • 那啥,习惯上 API 设计的时候分页信息这种通用的东西不是应该放在 HTML 头里面的么,然后在 application_controller 里弄个after_action: :set_pagination_headers, only: :index 什么的

  • 号外,XX 开房记录查询 at October 16, 2013

    #33 楼 @ouyang cat 党……

  • 有关 Rails 的 link_to () at October 13, 2013

    #5 楼 @small_fish__ 用 slim 写就愉快多了,连 do 都省了

    = link_to edit_coursepath(course)
      span.glyphicon.glyphicon-wrench
    
  • 有关 Rails 的 link_to () at October 13, 2013
    <%= link_to edit_course_path(course) do %>
         <span class="glyphicon glyphicon-wrench"></span>
    <% end %>
    

    试试这样 话说 course 不应该是@course 么,还是说这是 partial 里的? 有 ctags 的话跳转去看看 link_to 的源码

  • #20 楼 @Rei 他这个要合并的两个分区间有个 swap,然后/etc/fstab 里面还是用 UUID 挂载的,分区合并后 UUID 会变的,懂得弄当然不难,不懂怎么跟着改的话,就开不了机了……

  • 看起来分区顺位和安装时候都不一样了……算了下分区大小,E 盘应该是 fdisk 显示的 /dev/sda8 如果用挂载的方法的话,一种是 直接挂载 ntfs 分区 ,好处是 windows 下也能用,坏处是 linux 下权限会很乱,另一种是 格式化为 ext4 分区 再挂载

    直接挂载 NTFS 分区:

    新建挂载点 sudo mkdir -p /windows/sda8

    然后在/etc/fstab 里添加一行

    /dev/sda8 /windows/sda8 ntfs uid=1000,auto,user,nls=utf8,umask=0027,exec   0 0
    

    然后执行sudo mount -a应该就能在 /windows/sda8文件夹下直接用这个分区了,其他windows分区也同理

    格式化为 EXT4 分区:

    先备份 E 盘里的数据(如果有的话),然后将它格式化成 ext4 分区 sudo mkfs.ext4 /dev/sda8

    然后根据自己需要建个目录作挂载点,比如sudo mkdir /sda8 或者 mkdir /home/$USER/your_mount_point_name

    然后把它添加到 /etc/fstab里 比方说如果刚才新建的挂载点是 /sda8的话,就在 fstab 里添加一行

    /dev/sda8   /sda8 ext4 defaults  0  2
    

    如果是/home/你的用户名/你的挂载点的话,就应该是

    /dev/sda8  /home/你的用户名/你的挂载点  ext4 defaults  0  2
    

    注意根据自己实际需要改

    然后执行sudo mount -a应该就可以用上了,然后可以把挂载好的文件夹所有权该成自己的用户方便使用

    当然也可以直接挂载到/home/,不过有几个坑,具体就不说了……

  • 恭喜你重新发明了 WM……

  • #7 楼 @gaicitadie 后端没技术含量你不妨去搞个搜索引擎试试,能完爆掉 baidu 就行,解救一下国内水深火热中的小白网民也好……

  • 光 Windows 下看的结果不太靠得住……重启 linux 下分别执行 cat /etc/fstabsudo fdisk -l贴下结果呗 所谓的 50G 就是那个新加卷(E:)盘么?是的话调整分区大小和/合并看起来不太好弄,中间间隔个 3.81G 的是什么? /boot 还是 swap

  • #14 楼 @karma 必然需要,随便脑补了一下,不懂原理的人按照上面说的操作至少有四五种可能会搞砸

  • 在没搞清楚硬盘分区结构是怎么回事的情况下(要是 LZ 搞明白了也就不会整出这样的情况了),还是建议不要用 gparted 或者什么 Win PE 里坑爹的盗版软件 最安全的做法还是直接挂载……

  • 你需要 dvorak 键盘…… 用 dvorak for programmer 也可以,各种符号不需要按 shift 就能打,排位也合理不少。不过从键位设计上看,它是给写 C like 语法的程序员用的,我们用起来其实有点别扭,比方说 { } () ruby 用得比较少,而@ $用得多却需要用小指来按,总的来说只是敲代码的话将就下还行,毕竟不用按 shift……

    我试用 dvorak for programmer 一个多月,单纯敲代码是解放不少,问题在于编辑器之外的其他软件对这样的键位支持不好,大部分都不能支持自定义 ctrl / shift /alt 直接加符号的快捷键组合,于是各种蛋疼,结果最后又换回经典 dvorak……

    话说我们应该搞个统计脚本,利用各个开源的 rails 项目,统计里面需要敲的各种 js coffee css scss rb 等等文件中需要敲的各个字符的出现频率,然后设计个dvorak for rubist 什么的……

  • #26 楼 @libuchao 竟然质疑人家高富帅……

  • 页面中是不是有啥空的 audio tag 之类的……

  • #4 楼 @bhuztez 其实直接支持 Chrome 的,放弃 Firefox 支持就好了,反正 IE 也用不了 WebRTC,Firefox 用户相对 IE 用户又少的可怜