ruby-1.9.3

Thinking sphinx doesn't start - “Failed to start searchd daemon”

一世执手 提交于 2020-01-12 07:33:27
问题 I try to start thinking sphinx on my server but it doesn't want to work. I do: $ rake thinking_sphinx:index && rake thinking_sphinx:start And i get: Generating Configuration to /vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf Sphinx 2.0.3-release (r3043) Copyright (c) 2001-2011, Andrew Aksyonoff Copyright (c) 2008-2011, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/vol/www/apps/ror_tutorial/releases/20120202111730/config/development

Ruby Float#round method behaves incorrectly with round(2)

风流意气都作罢 提交于 2020-01-10 05:43:28
问题 I learned that it's recommended to use BigDecimal instead of Float , but this one is either a bug or highlights the esoteric nature of Float . It seems that Float#round(2) has a problem with "1.015", "1.025" and "1.035". 1.015.round(2) => 1.01 # => WRONG .. should be 1.02 1.025.round(2) => 1.02 # => WRONG .. should be 1.03 1.035.round(2) => 1.03 # => WRONG .. should be 1.04 1.045.round(2) => 1.05 # => CORRECT 1.016.round(2) => 1.02 # => CORRECT round(3) works fine. 1.0015.round(3) => 1.002 #

User model won't update

时光毁灭记忆、已成空白 提交于 2020-01-06 06:53:51
问题 I try to update an existing user: Controller-Snippet def account_settings @user = current_user end def set_account_info old_user = current_user # verify the current password by creating a new user record. @user = User.authenticate_by_username(old_user.username, params[:user][:password]) # verify if @user.nil? @user = current_user @user.errors[:password] = "Das eingegebene Passwort ist falsch." render :action => "account_settings" else # update the user with any new username and email @user

After installing ruby 1.9.3 rails 3.2.1, getting OpenSSL::SSL::SSLError: on simple requests

情到浓时终转凉″ 提交于 2020-01-03 05:46:33
问题 Got ruby 1.9.3/rails 2.3.1 installed via rvm (finally worked after installing openssl via rvm pkg.) but now getting OpenSSL::SSL:SSLError trying to connect to github (and probably anything else): -->irb 1.9.3-p0 :001 > require 'open-uri' 1.9.3-p0 :002 > open('https://github.com/') OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed -- Tried the solution in "Certificate verify failed" OpenSSL error when using Ruby 1.9.3 but

Merge arrays if not nil and not empty

时光毁灭记忆、已成空白 提交于 2020-01-01 13:38:05
问题 There are some arrays in Ruby (is this case there 4 array) array1 = [{key="label1.1", value="label1.2"}, {key="label1.2", value="label1.2"}] array2 = [{key="label2.1", value="label2.2"}] array3 = [] array4 = nil result_array = array1 | array2 | array3 | array4 Each of arrays has the same structure as others: it's hash values. How many elements in it, if it's nil or empty - it's not known. So I need result_array to look: [{key="label1.1", value="label1.2"}, {key="label1.2", value="label1.2"},

Cannot install Ruby 1.9.3 on a clean Lion Install

大憨熊 提交于 2019-12-31 04:58:11
问题 Trying to install 1.9.3 using RVM. Getting these errors in my make.log compiling readline.c readline.c:1499:9: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'? rl_username_completion_function); ^ readline.c:69:42: note: expanded from macro 'rl_username_completion_function' # define rl_username_completion_function username_completion_function ^ /usr/local/include/readline/readline.h:443:14: note: 'rl_username_completion

How the Look-ahead and Look-behind concept supports such Zero-Width Assertions concept in Regex of Ruby?

一曲冷凌霜 提交于 2019-12-30 04:39:05
问题 I just gone through the concept Zero-Width Assertions from the documentation. And some quick questions comes into my mind- why such name Zero-Width Assertions ? How the Look-ahead and look-behind concept supports such Zero-Width Assertions concept? What such ?<=s , <!s , =s , <=s - 4 symbols are instructing inside the pattern? can you help me here to focus to understand what is actually going on I also tried some tiny codes to understand the logic, but not that much confident with the output

Passing Multiple Parameters in a form_tag

久未见 提交于 2019-12-25 06:36:29
问题 I'm using Rails and jqPlot to display some data on a webpage. The graph needs to be flexible by date (as in, the user can select a time range, and the graph will update itself). Here's my code so far (in my View): <%= form_tag home_event_trends_path(params[:timePeriod]), :method => 'post' do %> <p> <%= select_tag :timePeriod, options_for_select(["2 Hours Ago", "1 Week Ago", "3 Months Ago"], :selected => params[:timePeriod]) %> <%= submit_tag "Refresh", :name => nil %> </p> <% end %> Home is

bundle install and ruby versions?

自闭症网瘾萝莉.ら 提交于 2019-12-24 14:03:57
问题 I'm using rbenv to set the ruby version. ruby -v produces the expected 1.9.3 I can do gem install paperclip without a problem. However, when I do bundle install it says: Installing paperclip (3.1.2) Gem::InstallError: paperclip requires Ruby version >= 1.9.2. An error occured while installing paperclip (3.1.2), and Bundler cannot continue. Make sure that `gem install paperclip -v '3.1.2'` succeeds before bundling. but, ruby -v says I'm running 1.9.3. Is bundler runnign as sudo? Have anyone

How to play a wav file in Ruby?

守給你的承諾、 提交于 2019-12-23 20:03:55
问题 What is a good way to play an audio file from Ruby that is wav format? OSX or Ubuntu... Ruby 1.9.3 回答1: I've used Gosu to play audio in a simple game context, so I imagine it would work fine for you... @tune = Gosu::Song.new(window, "tune.wav") @tune.play(true) 来源: https://stackoverflow.com/questions/14993412/how-to-play-a-wav-file-in-ruby