运行了rails s 后出现了一下的错误:/.rvm/gems/ruby-1.9.3-p374/gems/eventmachine-1.0.3/lib/eventmachine.rb:526:in `start_tcp_server': no acceptor (port is in use or ...
分类:
其他好文 时间:
2014-08-27 00:12:36
阅读次数:
297
ruby_xmalloc ruby_xfree
偶然发现这几个函数, 主要作用是在ruby上声明内存, 而且效率非常的快....
然后踩了一个坑.
当某个客户端的包在服务器累计超过貌似是4.5w * 20 左右个包
就会出现内存申请失败!! 我
一开始记得我全部是用的jemalloc.结果发现用的是ruby的堆...
我就艹了. 第一步才知道有限制, 第二才发现没有用jemal...
分类:
其他好文 时间:
2014-08-26 17:22:18
阅读次数:
151
简体中文(学习阅读来源):http://blog.itpub.net/11379785/viewspace-1199963/英文版:http://ruby.learncodethehardway.org/book/繁体版:http://lrthw.github.io/代码:1 puts "Hello...
分类:
其他好文 时间:
2014-08-25 22:36:24
阅读次数:
219
chomp:去掉字符串末尾的\n或\rchop:去掉字符串末尾的最后一个字符,不管是\n\r还是普通字符to_s:转换成字符串to_i:转换成数值object.nil?:判断是否为空,空返回:true
分类:
其他好文 时间:
2014-08-25 16:37:34
阅读次数:
208
惯例优于配置(Convention over Configuration)来源于Ruby On Rails框架的设计理念,也被认为是Rails大获成功的关键因素之一。这里所谓的惯例,可以理解为框架对编程的一些约束,我们可以根据实现制订的默认准则,通过反射技能完成对象的建立,对象的协作,甚至是使用程序...
分类:
其他好文 时间:
2014-08-25 16:29:54
阅读次数:
160
Problem 34
145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.
Find the sum of all numbers which are equal to the sum of the factorial of their digits.
Note: as 1! = 1 and 2! = 2 are...
分类:
其他好文 时间:
2014-08-25 11:59:14
阅读次数:
243
Problem 36
The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please...
分类:
其他好文 时间:
2014-08-25 10:06:04
阅读次数:
198
Issue:Gem files will remain installed in /tmp/bundler20140825-31835-p0c0p/sqlite3-1.3.9/gems/sqlite3-1.3.9 for inspection.Results logged to /tmp/bundl...
分类:
数据库 时间:
2014-08-25 01:10:23
阅读次数:
284
配置你的服务器 你需要在你的服务器上安装Ruby的环境,你可以使用RVM或者是rbenv. 上传到github 这步需要将你的应用上传到github,在你的github上创建新的repository,然后在你本机代码位置执行下面的命令,初始化g...