I installed the youtube_it version(2.0.1) gem but I cannot seem to get it to work in the rails console or in irb. I follow all the steps shown here for establishing a client, but when I perfore the query:
client.videos_by(:query => "penguin")
I get
<YouTubeIt::Response::VideoSearch:0x101f1c460 #max_result_count=nil, #updated_at=nil, #offset=nil, #feed_id=nil, #videos=[], #total_result_count=nil>
I have tried it from inside my App's directory and out; with irb and rails console and I get the same thing every time. Any ideas would be greatly appreciated.
this is working for me, did you try whit the last version of the gem (2.1.3)?, I'm using this and works nice
irb(main):004:0> client = YouTubeIt::Client.new
=> #<YouTubeIt::Client:0x007fc5a0116a58>
irb(main):005:0> client.videos_by(:query => "penguin").videos.count
http://gdata.youtube.com/feeds/api/videos?max-results=25&q=penguin&start-index=1&v=2
=> 25
tell me if this works for you
cheers!
Related
Getting this error from the rails console:
a = Author.first
Neo4j::Server::CypherResponse::ResponseError: LockClient[12] can't wait on resource RWLock[SCHEMA(0), hash=1915081964] since => LockClient[12] <-[:HELD_BY]- RWLock[SCHEMA(0), hash=1915081964] <-[:WAITING_FOR]- LockClient[3] <-[:HELD_BY]- RWLock[SCHEMA(0), hash=1915081964]
Server is up and runing, able to execute any query from the database console, or from the database browser interface.
What is wrong here?
After looking a bit I realized/remembered that there are some changes on master which deal with this:
https://github.com/neo4jrb/neo4j/issues/732
Try changing your Gemfile to this:
gem 'neo4j', github: 'neo4jrb/neo4j'
gem 'neo4j-core', github: 'neo4jrb/neo4j-core'
We're planning on cutting a release candidate next week, so if this works for you you won't need to run off master for long
I am trying to wrap my brain around Rack::Cache, Rails 3.2, Memcache, and Heroku. I think I've got it all working together, as outlined here: http://myownpirateradio.com/2012/01/01/getting-heroku-cedar-and-rails-3-1-asset-pipeline-to-play-nicely-together/
All that said, I am unsure if Memcached is actually doing what it should. Is there any way to get stats on Memcached or to see if a request was cached by Memcached? I put the current time on a page, and can see that it is getting cached (headers look good too), but how do I know it is all working with Memcached, as opposed to the file store?
Thanks.
You can get stats on memcached by doing:
$ heroku run console
Running console attached to terminal... up, run.1
Loading production environment (Rails 3.1.3)
irb(main):001:0> Rails.cache.stats
Dalli/SASL authenticating as app590983%40heroku.com
Dalli/SASL: Authenticated
=> {"mc5.ec2.northscale.net:11211"=>{"evictions"=>"0", "curr_items"=>"627",
"total_items"=>"1257", "bytes"=>"2294318", "reclaimed"=>"0",
"engine_maxbytes"=>"5242880", "bucket_conns"=>"2", "pid"=>"319",
"uptime"=>"6710022", "time"=>"1330731177", "version"=>"1.4.4_207_g19c6b9e",
"libevent"=>"1.4.11-stable", "pointer_size"=>"64",
"rusage_user"=>"34354.590000", "rusage_system"=>"31381.520000",
"daemon_connections"=>"10", "curr_connections"=>"1211",
"total_connections"=>"14127919", "connection_structures"=>"1764",
"cmd_get"=>"9476", "cmd_set"=>"1257", "cmd_flush"=>"0", "auth_cmds"=>"24",
"auth_errors"=>"0", "get_hits"=>"8093", "get_misses"=>"1383",
"delete_misses"=>"0", "delete_hits"=>"0", "incr_misses"=>"0",
"incr_hits"=>"0", "decr_misses"=>"0", "decr_hits"=>"0", "cas_misses"=>"0",
"cas_hits"=>"0", "cas_badval"=>"0", "bytes_read"=>"21983909",
"bytes_written"=>"85267718", "limit_maxbytes"=>"67108864",
"rejected_conns"=>"0", "threads"=>"4", "conn_yields"=>"0"}}
PS: I think you might need to be using the Dalli gem for this to work, but that is the recommended client anyway.
You can also run Rails.cache.class to see which backend is Rails using.
I'm developing an app using event_calendar plugin to build a calendar with some events. Everything works fine in development and test environment but when i try to switch to production env trying to open the calendar page the server returns a 500 error page.
What is really weird for me is that event_calendar worked well until today, and i didn't touch a line of code related to this plugin.
So, that's what i made to debug with no success:
Migrate database and precompile assets on production env.
Opened log/production.log to find some error, but nothing was there, non error logged.
Uncomment this line on production.rb config.log_level = :debug, still no error logged.
Modified the index action of Calendar Controller with a dummy empty index action to make sure that was not the problem.
Opened rails console on production env and try to make a get request to /calendar:
1.9.3-p0 :001 > app.get '/calendar'
=> 500
1.9.3-p0 :002 > app.response
=> #<ActionDispatch::TestResponse:0x007ff53607d298 #body=["<!DOCTYPE html>\n<html>\n<head>\n ... HTML CODE OF 500 ERROR PAGE ... </html>\n"]
,#header={"Content-Type"=>"text/html; charset=utf-8", "Content-Length"=>"643", "X-Request-Id"=>"d47e6d869dd8e215a0741430ee2eacae", "X-Runtime"=>"0.036510"}, #status=500, #sending_file=false, #blank=false, #content_type=text/html, #charset="utf-8", #cache_control={}, #etag=nil>
Apart from this everything works fine, even in production env. So i guess the issue depends on something wrong on event_calendar but i think the problem of ghost error is more general.
I really hope that error is somewhere!
Hope someone can help me! Thanks
Marco
Im trying to get below github repo in my app
https://github.com/mtodd/geoip
Ive tried adding it like
gem "geoip", :git => "git://github.com/mtodd/geoip.git"
Error =
Could not find gem 'geoip (>= 0) ruby' in git://github.com/mtodd/geoip.git (at master).
Source does not contain any versions of 'geoip (>= 0) ruby'
Is there are ruby gem wrapper for GeoIP that is compatible with the LATEST GEOIP?
Ive searched very long for one, the one above seems to be sort off compatible with 1.4.7 and higher but I can't get it installed, any other suggestion? Thx !
I have this in my Gemfile:
gem "geoip-c", '~> 0.7.1', :git => "git://github.com/mtodd/geoip.git"
As far as I know, it's totally compatible.
I know this was posted a few years ago, but I recently had trouble finding a good up-to-date gem for this. What I found was Geoip2 by YotpoLtd.
In my Gemfile
gem 'geoip2'
Setting/Configuring
Geoip2.configure do |conf|
# Mandatory
conf.license_key = 'Your MaxMind License Key'
conf.user_id = 'Your MaxMind User Id'
# Optional
conf.host = 'geoip.maxmind.com' # Or any host that you would like to work with
conf.base_path = '/geoip/v2.0' # Or any other version of this API
conf.parallel_requests = 5 # Or any other amount of parallel requests that you would like to use
end
Using
data = Geoip2.omni('0.0.0.0') #this call is synchronous
*note: I believe you can replace 'omni' with the name of the product tier: city, country, etc
Errors
If there is an error, the returned hash will have an error object, so simply check for its existence
if data.error
# error handling
else #still might want to check for data's existence ( if data )
#access object as you will
data.city.names.en
data.postal.code
end
For more information about the returned hash, see the MaxMind Web Services Documentation
I want to use cache-money but I don't want to start automatically caching everything (I'm working with a large production app, terabytes of data etc). How do I use it for only the models that I specify? Right now I've got:
# initializers/cache_money.rb
require 'cache_money'
config = (cfg = YAML.load(IO.read(File.join(RAILS_ROOT, "config", "memcached.yml"))))[RAILS_ENV] || cfg["defaults"]
$memcache = MemCache.new(config)
$memcache.servers = config['servers']
$local = Cash::Local.new($memcache)
$lock = Cash::Lock.new($memcache)
$cache = Cash::Transactional.new($local, $lock)
and then in the model I want to cache with cache-money:
# my_model.rb
class MyModel < ActiveRecord::Base
is_cached :repository => $cache
# ...
end
But this doesn't work; the call to is_cached gives the following error: NoMethodError: undefined method `create' for Config:Module
Any ideas? Failing that, is there anywhere I can go for help with cache-money? I couldn't find a mailing list or anything.
I think this is a bug in the cache_money code.
There are forks available on github that fix this bug, eg:
http://github.com/quake/cache-money
The fix can be seen with this commit:
http://github.com/quake/cache-money/commit/54c3d12789f31f2904d1fe85c102d7dbe5829590
I've just experienced the same problem trying to deploy an application. Running on my development machine it was fine, but it failed with this error on the production machine.
Apart from the architecture (OSX vs CentOS) the only difference i could see was that the ruby versions were different (1.8.6 p114 vs 1.8.6 p0). After upgrading the server to the latest 1.8 version (1.8.7 p160) this error went away.