is there a library for ruby or php that is able to parse html pages and extract unique data by comparing it with other similar pages....should use some sort of text mining to identify which texts are more likely noise and repetivie, while other texts are more unique and useful...
...
note i made up the term horizontal depth to measure the sub-dimension of a node within a tree.
so imagine a which would have xpath something like /html/table/tbody/tr/td, and "horizontal depth" of 5
i am trying to see if there is a way to identify and select elements based on this horizontal depth.
how can i find the maximum depth ?
...
Retreiving the URL http://www.google.com/reader/api/0/token returns a token, which is periodically updated. What's required to generate this token? Apparently, and I'm guessing a, or some, cookies are accessed by Google for authentication.
Here are my results so far:
thufir@ARRAKIS:~/projects/curl$
thufir@ARRAKIS:~/projects/curl$ rub...
I need to make some instance methods private after registering that object in another object.
I don't want to freeze the object because it must remain editable, only with less functionality. And I don't want to undef the methods since they are used internally.
What I need is something like:
class MyClass
def my_method
puts "He...
Hi, I have a ruby script inside a Rails project. The script includes environment.rb so that Rails gets loaded etc. It then listens to data on a TCP socket of another server, parsing it to keep a mysql database up to date.
I'm using the daemons gem to be able to start and stop the process easily. Iv had the script running in production w...
Hi,
I built Ruby 1.9 from scratch in Windows using MinGW, now I am trying to set up the environment and am having great difficulties getting the 'gem' command to work.
First not even 'irb' would work, so i added a bunch of paths to the RUBYLIB environment variable and now that works ok. But whenever i run 'gem' i get this error:
http:/...
Hi, I need some help.
I have a model Journey which has many Users (drivers). I want to be able with help of accepts_nested_attributes_for to add and remove drivers from a journey. When I add a driver I want to show the user a <select> where she can select one of the users to be one of the drivers belonging to that particular journey. I ...
Is there a way that I can deploy my locally made rails app on a shared host that has Ruby installed?
...
Does anyone know of a Ruby library that can list all of the colors in a photo, as well as listing them in order of frequency? Or is it possible that RMagick already can do something like this?
If no one knows of one, how exactly could I get started on making such a tool? I have a great idea for a program I'd love to try, however I jus...
Hello
Can't find any gem or class which can help to made a non-blocking/multithread server.
Does anybody know where to find any ?
...
Is there a ruby idiom for "If do-this," and "do-this" just as a simple command?
for example, I'm currently doing
object.method? a.action : nil
to leave the else clause empty, but I feel like there's probably a more idiomatic way of doing this that doesn't involve having to specify a nil at the end. (and alternatively, I feel like ta...
In a haml partial I have:
=@date = DateTime.now
and it's returning' invalid date':
/usr/local/lib/ruby/1.9.1/date.rb:809:in civil'
/usr/local/lib/ruby/1.9.1/Date.rb:1810:innow'
Any ideas why?
...
To get the last n characters from a string, I assumed you could use
ending = string[-n..-1]
but if the string is less than n letters long, you get nil.
What workarounds are available?
Background: The strings are plain ASCII, and I have access to ruby 1.9.1, and I'm using plain old ruby objects (no web frameworks).
...
cart.rb:
def vendor3name
@items.first { |item| item.vender.name }
end
When I call the method, I'm looking for the vendor name but it returns the vendor ID#. What am I doing wrong?
<%= @cart.vendor3name %>
CartItem:0x264c358
...
Hi All,
I am using Feedzirra to parse my RSS feeds and it works very well -- it is twice as fast Feed Normalizer in my initial testing. More importantly, it has nice wrappers that check for updated entries inside a feed. When I was using its feed-update approach, I ran into some issues:
require 'feedzirra'
feed = Feedzirra::Feed.fetc...
I need to write a regular expression in ruby for finding a string like 'some' and then replace it with say 'xyz.some'. How do I go about it?
...
How do I target one form from another when there are 2 forms in the same page like this page?
http://screener.finance.yahoo.com/stocks.html
Here's my sample code:
require 'rubygems'
require 'scrubyt'
extractor = Scrubyt::Extractor.define do
fetch 'http://screener.finance.yahoo.com/stocks.html'
select_option('prmin', '5')
select...
First of all, i want some clarification :)
1) Is RoR like a server scripting language?
2) Can it be used as an alternative to php?
I started learning Ruby from The Ruby Programming Language book and haven't yet come across something which relates to the web. Is Ruby for desktop apps and Rails for web apps?
Thanks
...
I am on Rails 2.3.5 and use oracle 10 as my database,use oracle_adapter ,ruby-oci8 to connect oracle host.
But I often got exception as the log info show:
Completed in 463ms (View: 18, DB: 166) | 200 OK [http://192.168.30.128/auctions?page=1]
/!\ FAILSAFE /!\ Mon Feb 01 19:02:11 +0800 2010
Status: 500 Internal Server Error
ORA-12...
I have started using xml builder templates for most of my model. I need to find a generic way to build XML outside of a render which uses the .xml.builder template instead of the generic .to_xml method provided in the model
I gather that I will have to override the default to_xml (or add a to_my_xml), but I am unable to see how to get X...