ruby
左钦杨
程序员
展开
-
gem install mysql2 -v ‘0.5.2报错: ld: library not found for -lssl
执行:gem install mysql2 -v ‘0.5.2’ – --with-opt-dir="$(brew --prefix openssl)"原创 2020-10-30 14:41:34 · 187 阅读 · 0 评论 -
Unable to require openssl, install OpenSSL and rebuild ruby … on Ubuntu 14 LTS(ruby2.3.0 on ubuntu)
I followed the steps from http://rubyonrails.org/download/ to install ruby but ran into this error:ERROR: While executing gem … (Gem::Exception) Unable to require openssl, install OpenSSL and rebuild转载 2016-07-04 12:00:21 · 4683 阅读 · 0 评论 -
kafka安装使用
下载地址http://kafka.apache.org/downloads.html注意不要下载错了source包就可以了解压包,cd进入文件夹执行命令bin/zookeeper-server-start.sh config/zookeeper.propertiesbin/kafka-server-start.sh config/server.properties原创 2016-02-02 16:17:35 · 480 阅读 · 0 评论 -
ruby中sequel使用dateformat等function
需求是要把select count(*),date_format(task_date,'%Y-%m-%d') from core.user_task_daily_log where task_id = '1450680624310212859' and user_id = '01447898594155699684' group by to_days(task_date)这么一句sql原创 2016-01-30 11:38:55 · 641 阅读 · 0 评论 -
ruby中sequel多进程插入数据主键冲突
# 查询记录,有记录update,没有记录insert# user_collects = CaiQiuService::CoreDao::UserCollects# .where(:device_id => params[:device_id], :match_id => params[:match_id], :lottery_code => param原创 2016-01-26 18:52:30 · 613 阅读 · 0 评论 -
redis in ruby 存取hash
一开始我直接存的hash,然后取值的时候报错cannot convert symbol into interger然后查看了redis的代码,所有的数据类型在被set到redis上的时候都被to_s转成String取出来的自然也是String字符串,然后解析就被当成一个数组,解析期望得到一个[int INDEX],所以报这样的错误然后我存的时候把hash给JSON.generate原创 2016-01-21 10:34:05 · 821 阅读 · 0 评论 -
ruby开发之hash遍历each_with_index
#设置奖励信息 def set_award_info(task_params,award_params) if task_params[:goods_id].to_i == Sequel::Model::TABLE # 更新sys_task_award_account award_params[:account].s原创 2015-11-26 00:06:30 · 8445 阅读 · 1 评论 -
ruby基础总结(二)
#类变量#类变量是该类所有实例的共享变量#从类的外部访问类变量时需要存取器class HelloCount @@count = 0 def HelloCount.count @@count end def initialize(myname = "ruby") @name = myname end def hello @@co原创 2015-10-28 18:28:42 · 505 阅读 · 0 评论 -
ruby基础总结(一)
#ruby#print 正常打印print "hello world\n"#\n 换行print "hello \n world\n"#puts 多个参数换行puts "hello","world\n"#块注释=beginprint puts p pp的区别:print :用于正常打印puts : 多个参数换行p:很好的区分字符串和整型pp:前提需要requi原创 2015-10-24 11:35:37 · 517 阅读 · 0 评论