vendredi 8 mai 2015

This is error redmine when it load web redmine

Anyone can help me :(

This is error my redmine when i load web redmine

We're sorry, but something went wrong.

We've been notified about this issue and we'll take a look at it shortly.

vi /etc/httpd/logs/error-log:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/http.so' - /usr/lib64/php/modules/http.so: undefined symbol: php_persistent_handle_abandon in Unknown on line 0
[Fri May 08 22:53:08 2015] [notice] Apache/2.2.15 (Unix) DAV/2 mod_fcgid/2.3.9 Phusion_Passenger/5.0.7 mod_ruby/1.3.0 Ruby/1.8.7(2013-06-27) mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
App 16448 stderr: Cannot execute "/usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/buildout/support-binaries/PassengerAgent": Permission denied (errno=13)
[ 2015-05-08 22:53:45.6201 16404/7f9d4c49e700 App/Implementation.cpp:287 ]: Could not spawn process for application /storage/www/redmine.vieter.vn: An error occured while starting up the preloader.
  Error ID: ae4aaf6b
  Error details saved to: /tmp/passenger-error-oXXkpt.html
  Message from application: Cannot execute "/usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/buildout/support-binaries/PassengerAgent": Permission denied (errno=13)


[ 2015-05-08 22:53:45.6293 16404/7f9d4cee0700 age/Hel/Req/CheckoutSession.cpp:252 ]: [Client 1-1] Cannot checkout session because a spawning error occurred. The identifier of the error is ae4aaf6b. Please see earlier logs for details about the error.

ruby 2.1.5 / gem 2.4.3 / passenger 5.0.7

vi /etc/httpd/passenger.conf

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
    PassengerRoot /usr/local/rvm/gems/ruby-2.1.5/gems/passenger-5.0.7
    PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.1.5/wrappers/ruby
</IfModule>

Ruby Error: koala no such file to load LoadError

I have installed Ruby (not Rails) on a machine and am trying to run some code based off the koala framework for Facebook.
When I run

    gem list

koala is mentioned but when I run the file, I get this error. Rubygems is already installed, I'm not sure what else to do. Any ideas?

Edit:

    require 'koala'
    require 'json'

    @graph = Koala::Facebook::API.new("CAACEdEose0cBANb7YuygrBflSkBrpdalb4e70T5lJgdLPYEh0Uxy5JLPVdukKSiwZAK8g27DnwscSUWNaC0s53ogq6h562LETjYO4sB5lZAMAy8tC0SM9UzqXkk7GKYpaLrkQlgj1oLTdOJhBfq5KJtFxZBkOkpz8HaVPLYp66OnuGkaGOogVseR1tUNXVxToKl6ZCmwHL0i5RHNvMnd")




    url = File.open("urls.txt","r")
    url.each_line do |line|
        id = /[\d]+/.match(line)
        begin
            temp = @graph.get_object(id)
            list = File.open("working.txt", "a")
            list.write(id)
            list.write("\n")
            puts "Worked for #{id}."
        rescue
            puts "Didn't work for #{id}."
        end      
    end 

puts "nil" if it is not in range

def binary_search(num, test_array)
  counter = 0
  low = 0
  high = test_array.length

  while (low <= high) do
    i = ((low + high) / 2).floor;
    if num == test_array[i]
      return i
      break
    elsif num < test_array[i]
      high = i
    elsif num > test_array[i]
      low = i
    end
    counter += 1
  end
end

test_array = [13, 19, 24, 29, 32, 37, 43]
# binary_search(35, test array)?
# binary_search(11, test array)?

in this code, how can I make sure it will return "nil" if it is binary_search(35), or binary_search(11)?

RSpec "retest broken tests from last time" flag

Is there any way to retest previously broken tests?

So, say, I run rspec and several tests in different files and directories fail. I fix something and now I have to manually specify all files and folders I want to retest or run tests for whole project again(It takes considerable amount of time for big projets).

What I was looking for is something like a flag

rspec --prev-failed-only

I realize that such flag would require considerable amount of additional actions from rspec, like storing results of previous tests and so on. But I think it would be super convenient to me.

Is there any such(or similar) tool/gem?

How to add extra param on best_in_place field update in ruby

I am using best_in_place gem for In-line edit for a field in active admin. Please look at my code below,

column "Badge ID", :number do |event|
   best_in_place event, :number, :type => :input, :path => [:admin, event]
end

This is what the parameters sent to the controller action.

Parameters: {"event"=>{"number"=>"499"}, "authenticity_token"=>"xxxxxxxx", "id"=>"995"}

Now, I want to send additional parameter along with the number either inside or outside the event hash.

Anyone, Please help me resolve this.

How do I include a ruby gem's code into main rails project?

Let's say that I need to change the functionality of a certain ruby gem that I need in my rails project. I would like to place all the content of the ruby gem inside the main project.

Is this possible? Are there alternative methods?

Thank you

How do I ignore the nil values in the ruby loop with parsed values from Mechanize?

In my text file are a list of URLs and with Mechanize I'm using that list to parse out the title and meta description. However, some of those URL pages don't have a meta description which stops my script with a nil error.

undefined method `[]' for nil:NilClass (NoMethodError)

I've read up and seen solutions if I were using rails, but for ruby I've only seen .reject and .compact as possible solutions to ignore nil values. I added .compact at the end of the loop, but that doesn't seem to do anything.

require 'rubygems'
require 'mechanize'

File.readlines('parsethis.txt').each do |line|
    page = Mechanize.new.get(line)
    title = page.title
    metadesc = page.at("head meta[name='description']")[:content]
    puts "%s, %s, %s" % [line.chomp, title, metadesc] 
end.compact!