• 注册了,结果一看要上传身份证就没有继续。 接着晚上就有客服来问,这个是否注册不是应该由我自己决定的吗,为什么我用手机注册,就马上来骚扰啊。

  • 就和开发人员不写需求文档一样。

  • 使用 @lyfi2003 的脚本创建项目后,rails s 运行会出错。我使用的 vagrant,ubuntu 64 位 16.04,ruby 2.3.1,rails 5.0.0 应该是 minitest 的问题,我已经参考网上说的,在 Gemfile 中添加了 require 'minitest',在错误的 rb 文件中,添加了 require 'minitest/autorun'等等的方法,但是还是会出错。不知道问题在哪里。

    /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/test_case.rb:16:in <module:ActiveSupport>': uninitialized constant Minitest (NameError) from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0/lib/active_support/test_case.rb:15:in' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/test_unit/railtie.rb:17:in block in <class:TestUnitRailtie>' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:30:ininstance_exec' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:30:in run' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:55:inblock in run_initializers' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:228:in block in tsort_each' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:350:inblock (2 levels) in each_strongly_connected_component' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:431:in each_strongly_connected_component_from' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:349:inblock in each_strongly_connected_component' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in each' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:incall' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:347:in each_strongly_connected_component' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:226:intsort_each' from /home/ubuntu/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/tsort.rb:205:in tsort_each' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/initializable.rb:54:inrun_initializers' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/application.rb:352:in initialize!' from /home/ubuntu/rails_project/test11/config/environment.rb:5:in' from /home/ubuntu/rails_project/test11/config.ru:3:in require_relative' from /home/ubuntu/rails_project/test11/config.ru:3:inblock in ' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:in instance_eval' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:55:ininitialize' from /home/ubuntu/rails_project/test11/config.ru:in new' from /home/ubuntu/rails_project/test11/config.ru:in' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:in eval' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:49:innew_from_string' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/builder.rb:40:in parse_file' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:318:inbuild_app_and_options_from_config' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:218:in app' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/server.rb:59:inapp' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/rack-2.0.1/lib/rack/server.rb:353:in wrapped_app' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/server.rb:124:inlog_to_stdout' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/server.rb:77:in start' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:90:inblock in server' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:in tap' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:85:inserver' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:49:in run_command!' from /home/ubuntu/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0/lib/rails/commands.rb:18:in' from bin/rails:4:in require' from bin/rails:4:in'

  • 已注册,昵称:鹿鸣

  • 我都是去网上一个一个下载 gem,再一个一个 local 安装的. 公司网络物理隔离,想学习只能麻烦些了。

  • 为何最近在线主播这么火? at 2015年02月11日

    楼主看起点小说不,看的话就知道了. 大众的需求才是最要紧的,想看爽书去起点,想看霸道总裁去晋江. 想看妹子耍宝,当然去看女主播,这些仅仅满足了最大众的需求而已。

  • 我只有 3 本 ruby 的书. lz 的书很杂啊。

  • 我也做过,我的答案是这个。好像是从哪里抄的了 http://www.51testing.com/index.php?uid-7844-action-viewspace-itemid-832538

    
    def score(dice)
        s = 0
        dice.uniq.each do |x|
            array = dice.count(x).divmod(3)
            if 1 == x
                s += array[0] * 1000 + array[1] * 100
            elsif 5 == x
                s += array[0] * x * 100 + array[1] * 50
            else
                s += array[0] * x * 100
            end
        end
        s
    end
    
    
  • 测试

  • 没有人解读吗,感觉槽点不少啊。 前两天不是还流行一个《互联网招聘文案的正确解读方法》https://ruby-china.org/topics/22010

  • 这个是视觉化的,直接就是 html,随便 copy 到哪里都可以。

    在线地址: http://qqrrm.github.io/2048.html

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--原框架作者信息<title>2048网页版(html+css+js) By:黄岩</title> -->
    <title>2048记录反查网页版(html+css+js) By:pyp</title>
    <style type="text/css">
    
    #div {
        width: 318px;
        height: 400px;
        background-color: #f0f0f0;
        margin: auto;
    }
    
    .box1 {
        font-size: 24px;
        text-align: center;
        line-height: 72px;
        width: 72px;
        height: 72px;
        float: left;
        background-color: #CDC2B3;
        position: relative;
    }
    
    #score {
        left: 10px;
        top: 70px;
        position: relative;
        float: left;
    }
    
    </style>
    
    
    
    <script language="javascript" type="text/javascript">
    
    var bg;
    var oBox;//元素
    var result = new Array();   
    var h = new Array();  //根据2的n次方对应的可能得分数组
    
    
    function total(n) { //假设全部的数都是2,2的n次方得到的分数,比如n=10,2**10=1024得到的纪录分数
        if(n == 2)
            return 4 ;
        else
            return 2 * total(n - 1) + Math.pow(2, n);
    }
    
    
    function total_plus(n) { //随机2或4,比例9:1,获得的分数。
        var j = 0;
        var sum = Math.pow(2, n) / 2;
        for(var i = 0; i < sum; i++) {
            if (Math.random() > 0.9)
                j += 1;
       }
        if(total(n) > j * 4)
            return total(n) - j * 4;
        else
            return 0; 
    }
    
    
    function max_n(score){
        for(var i = 2 ; i < 17; i++){
            if( h[i] > score ){
                return i - 1;
            } 
            else if ( h[i] === score){
                return i
            }
        }
    }
    
    
    function divmod(x, y){  //ruby中的函数,就是进行div,形成结果和余数的数组
        var a, b;
        var temp = new Array();
    
        if(x > y){
            a = Math.floor(x / y);      
            b = x - y * a;
        } 
    
        temp.push(a);
        temp.push(b);
        return temp;
    }
    
    
    function score_to_n(score){  //通过得分递归获得拆分组合结果
    
        var max = max_n(score);
        var div = new Array();
    
        if(h[max] == score){
          result.push(max); 
          return result;
        } 
    
        if (h[max] == 0){
            return result;
        }
    
        div = divmod(score, h[max]);
    
        for(var i = 0; i < div[0]; i++){
            result.push(max);
        }
    
        score_to_n(div[1]); 
        return result;  
    }
    
    function initGame(){//游戏初始化
    
        bg = new Array();   
    
        for(var i = 0; i < 4; i++){
            bg[i] = new Array();
            for(var j = 0; j < 4; j++){
                bg[i][j] = 0;
            }
        }   
    }
    
    
    function paintGame(){//游戏绘图
    
        var i, str="";
    
        for(var m = 0;m < 4; m++){
            for(var n = 0;n < 4; n++){
    
                i = m * 4 + n + 1;
    
                oBox[i].innerHTML = bg[m][n];
    
                switch(bg[m][n]){
                    case 0:str="#CDC2B3";break;
                    case 2:str="#eee4da";break;
                    case 4:str="#ede0c8";break;
                    case 8:str="#f2b179";break;
                    case 16:str="#f59563";break;
                    case 32:str="#f67c5f";break;
                    case 64:str="#f65e3b";break;
                    case 128:str="#edcf72";break;
                    case 256:str="#edcc61";break;
                    case 512:str="#edc850";break;
                    case 1024:str="#edc53f";break;
                    case 2048:str="#edc22e";break;
    
                    default:str="#ffc22e";
                }
                oBox[i].style.background = str;
            }
        }   
    }
    
    function btn(){  //按钮事件
    
      var temp = new Array();
      var score = document.getElementById("score_value").value;    
    
      if ((score > 950000) || (score % 1 !== 0))
        alert("大哥大姐,别耍我啊");
      else {    
          initGame();   
    
          for(var i = 2; i < 17; i++){  //生成得分数组
              h[i] = total_plus(i);  
            } 
    
            temp = score_to_n(score);   
    
            bg[3][3] = (temp[0]===undefined) ? 2 : Math.pow(2, temp[0]);  //个人习惯右下角最大,接着按大小蛇形排序,我玩2048就是这样的规律玩的
            bg[3][2] = (temp[1]===undefined) ? 2 : Math.pow(2, temp[1]);
            bg[3][1] = (temp[2]===undefined) ? 2 : Math.pow(2, temp[2]);
            bg[3][0] = (temp[3]===undefined) ? 2 : Math.pow(2, temp[3]);
            bg[2][0] = (temp[4]===undefined) ? 2 : Math.pow(2, temp[4]);
            bg[2][1] = (temp[5]===undefined) ? 2 : Math.pow(2, temp[5]);
            bg[2][2] = (temp[6]===undefined) ? 2 : Math.pow(2, temp[6]);
            bg[2][3] = (temp[7]===undefined) ? 2 : Math.pow(2, temp[7]);
            bg[1][3] = (temp[8]===undefined) ? 2 : Math.pow(2, temp[8]);
            bg[1][2] = (temp[9]===undefined) ? 2 : Math.pow(2, temp[9]);
            bg[1][1] = (temp[10]===undefined) ? 2 : Math.pow(2, temp[10]);
            bg[1][0] = (temp[11]===undefined) ? 2 : Math.pow(2, temp[11]);
            bg[0][0] = (temp[12]===undefined) ? 2 :  Math.pow(2, temp[12]);
            bg[0][1] = (temp[13]===undefined) ? 2 : Math.pow(2, temp[13]);
            bg[0][2] = (temp[14]===undefined) ? 2 : Math.pow(2, temp[14]);
            bg[0][3] = (temp[15]===undefined) ? 2 : Math.pow(2, temp[15]);
    
            paintGame();        
    
                    temp.length = 0;
          }
      }
    };
    
    
    window.onload=function(){
        var j, k = 0;
    
        oBox = document.getElementsByTagName('div');
    
        for(var i = 1;i < 17;i++){
            k = (i-1)%4;
            oBox[i].style.left=((k+1)*6)+'px';
            j = (i-1)/4;
            oBox[i].style.top=((j+1)*6-2*k)+'px';
        }
    
    };
    
    </script>
    </head>
    
    <body>
    <div id="div">
    
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
            <div class="box1"></div>
    
            <div id="score">
                    <input type="text" id="score_value" value="58640" />
                    <input type="button"  value="记录反查" onclick="btn()" />
            </div>
    
    </div>
    </body>
    </html>
    
  • 前面怎么看都是 a 会失败,后面就莫名成功了,这文章到底说明了什么,怎么看怎么像知音体。

  • 如何测试应用所需带宽? at 2014年01月08日

    最好不要用 1 个用户算,使用 loadruuner 或 jmeter,都可以很容易的模拟大规模的用户吧。

  • 我也在长春,但是不是开发人员,做测试,对 ruby 很感兴趣。

  • Web 中文字体应用指南 at 2013年09月11日

    除了 web,大家对 win7 系统下的微软雅黑如何看。特别是在 silverlight 中,真的是参差不齐。

  • 三鲜伊面,便宜。

  • inoreader 不知道为什么,我的 firefox 用 feedly 在读 google 账户确认按钮是灰色的,一直都无法操作。

  • 退役的电脑能做什么? at 2013年06月10日

    网游挂机。

  • cd 明明是床,ls 是龙。

  • oh-my-zsh,还是比较好用的。

  • 没有整理,随手记下的,不知道是否已经修正过一些问题。

    9.1.4 specify { response.should redirect_to(root_path) } 但是 def signed_in_user redirect_to signin_path, notice: "Please sign in." unless signed_in? end

    代码 9.25 用户列表页面的视图

    <%= gravatar_for user, size: 52 %> 没有第 2 个参数 9.33 it { should have_selector('div.pagination') }一直失败 代码 9.39 测试 admin 属性 before { @user.toggle!(:admin) } 一直显示 can not update on a new record object,但是后面的 it { should be_admin }通过了

    9.44 expect { click_link('delete') }.to change(User, :count).by(-1) }多了》

    代码 11.1 在 relationships 表中设置索引 add index :relationships, :follower id 没有_

    代码 11.6 为 Relationship 模型添加 belongs_to 关系,spec/models/relationship_spec.rb 错误

    代码 11.2 测试建立“关系”以及属性的可访问性 end.should raise_error 按照提示,应该是 end.to

    代码 11.7 测试 Relationship 模型的数据验证,没有_

    代码 11.16 通过反转的关系实现 user.followers classname: "Relationship",应该是 class_name

  • xshell 的字体总觉得怪怪的,主要是莫名的就给加粗了字体,感觉还是 putty 看着比较舒服。

  • 我平均一天 12 个小时以上,对着电脑也没事。 但是电视就不行,看半个小时,就头晕眼花的,看来还是距离的问题。 近视觉得近几年的逐渐好转,度数比较稳定甚至降低,是否因为年纪大了,老花把近视顶了。

  • 我平均一天 12 个小时以上,对着电脑也没事。 但是电视就不行,看半个小时,就头晕眼花的,看来还是距离的问题。 近视觉得近几年的逐渐好转,度数比较稳定甚至降低,是否因为年纪大了,老花把近视顶了。

  • 我平均一天 12 个小时以上,对着电脑也没事。 但是电视就不行,看半个小时,就头晕眼花的,看来还是距离的问题。 近视觉得近几年的逐渐好转,度数比较稳定甚至降低,是否因为年纪大了,老花把近视顶了。

  • 我还记得最早的介绍 rails 的资料,是 pdf 版的,里面 rails 就用的铁道翻译,当时看的很惊讶。

  • F5 ruby-china 上癮 at 2012年02月25日

    一直都是固定标签页。

  • 我们直接内网和外网隔离,只有特定位置的公共机器才能上网。。