I tried the following
Net::HTTP.get_print URI.parse(URI.encode('https://graph.facebook.com/me/likes?access_token=mytoken', '|'))
(My Token is my actual token in code)
I get a EOFError: end of file reached error
If I visit the page with my browswer it loads up a JSON page. Any idea what could be causing the error? It was working a fe...
I've managed to make it play sound but it never gets EOS message.
And thus script never exits.
require 'gst'
main_loop = GLib::MainLoop.new
pipeline = Gst::Pipeline.new "audio-player"
source = Gst::ElementFactory.make "filesrc", "file-source"
source.location = "/usr/share/sounds/gnome/default/alerts/bark.ogg"
decoder = Gst::El...
I am exploring an big controller method, with about 10 or so instance variables. Some of them are set in before_filter methods, and some others inside the method itself. I want to inspect them with puts, but dont want to write all of them out example:
puts "var1: #{@var1.inspect}....var15: #{@var15.inspect}"
Is there a generic method ...
I have a ruby array that looks something like this:
my_array = ['mushroom', 'beef', 'fish', 'chicken', 'tofu', 'lamb']
I want to sort the array so that 'chicken' and 'beef' are the first two items, then the remaining items are sorted alphabetically. How would I go about doing this?
...
This will probably just be a simple problem and I am just blind or an
idiot but I could use some help.
So I am going over some basic guides in Rails, reviewing the basics
and such for an upcoming exam. One of the guides included was the
sort-of-standard getting started guide over at guide.rubyonrails.org.
Here is the link if you need i...
Given a minimum integer and maximum integer, I want to create an array which counts from the minimum to the maximum by two, then back down (again by two, repeating the maximum number).
For example, if the minimum number is 1 and the maximum is 9, I want [1, 3, 5, 7, 9, 9, 7, 5, 3, 1].
I'm trying to be as concise as possible, which is w...
I have stated using the protobuf-net lib to communication between some of the programs I'm maintaining. I have also been able to decode messages from C# to Ruby. My ruby ProtoBuf lib is using a .proto file to generate the ruby code. In the interest of having to make changes in as few places as possible I would like to have protobuf-net u...
I would like to scrape the search results of this ASP.NET site using Ruby and preferably just using Hpricot (I cannot open an instance of Firefox): http://www.ngosinfo.gov.pk/SearchResults.aspx?name=&foa=0
However, I am having trouble figuring out how to go through each page of results. Basically, I need simulate clicking on links l...
Today I am going to get as far as I can setting up my testing environment and workflow. I'm looking for practical advice on how to setup the test environment from you guys who are very passionate and versed in Ruby Testing.
By the end of the day (6am PST?) I would like to be able to:
Type one 1-command to run test suites for ANY proj...
I see a couple dozen gems that relate to svn, but what little documentation I can find on any of them shows that they are command-line wrappers and misc helpers. (svn-command, svn-hooks, etc.)
I've seen code in the wild that does things like: require 'svn/core' and SVN.Repos.add(...), but the author of that module pulled his svn ruby t...
I recently installed postgresql using homebrew.
When trying to use the 'pg' or 'postgresql' gem irb just hangs.
Any ideas?
...
How do I add information to an exception message without changing its class in ruby?
The approach I'm currently using is
strings.each_with_index do |string, i|
begin
do_risky_operation(string)
rescue
raise $!.class, "Problem with string number #{i}: #{$!}"
end
end
Is there a better way?
...
And which one should I use?
...
I'm using the inherited resources plugin in a 2.3.5 Rails application and was wondering how to change the flash[:notice] (or any other flash) based on the success OR failure in my create and update actions.
So given the below, how do I add flash[:notice] = "All good" if success ... and flash[:notice] = "All bad" if failure?
Thanks
cla...
I have a Ruby on Rails site that was only needed for a short period of time during which users added various objects to a mySQL database, commenting on them, associating themselves with them, etc. etc. etc.
The question is this: the site is no longer needed until a week next year around this time when I will clear the database and use ...
I just want to let watir attach embedded browser, and control it. I
find this topic: http://groups.google.com/group/watir-general/browse_thread/thread/479...
and read all that reference. It seems someone has solved this problem.
But I can't let it work yet. I can't understand all those details.
My problem is as following:
In an Eclips...
We need to import large amount of data(about 5 millions records) to the postgresql db under rails application.
Data will be provided in xml format with images inside it encoded with Base64.
Estimated size of the xml file is 40GB.
What xml parser can handle such amount of data in ruby?
Thanks.
...
I'm trying to assign Pantone colors to some text in Prawn. Ideally I'd like to be able to do this
pdf.text_color = pdf.pantone(:485U)
pdf.text "Whatever"
I know this isn't possible. I considered calling pdf.raw and specifying the color manually but the PDF spec (ISO32000:2008) is way too complicated.
I need either a simpler way or so...
Hi all,
In response to this blog post: http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/
I have three questions:
Can anyone confirm if the recipe there works?
Where and how do I put that recipe?
I have two folders need to stay across each revisions: /products and /public/images/site_images what recipe should I run...
I'm just diving into Datamapper (and Sinatra) and have a question about associations. Below are some models I have. This is what I want to implemented. I'm having an issue with Workoutitems and Workout. Workout will be managed separately, but Workoutitems has a single workout associated with each row.
Workout - just a list of types...