I'm grabbing an XML feed that claims to be
<?xml version="1.0" encoding="ISO-8859-1"?>
with Nokogiri and inserting the text into mysql with activerecord (OUTSIDE of rails). Using HTMLEntities to decode.
Here is an example
(“LON: SDM”)
I can't seem to handle some of these html special characters properly. When redisplaying...
i know there is a convert -swirl effect in imagemagick but can i create other effects for text like curved, arched, wedged, pinched etc.. just like wordart in word.
i am open to other packages that might help me get this thing done.. php or ruby..
...
I'm attempting to get Rails to play nice with the Digg API's OAuth. I'm using the oauth gem (ruby one, not the rails one).
My code looks approximately like this:
@consumer = OAuth::Consumer.new(API_KEY, API_SECRET,
:scheme => :header,
:http_method => :post,
:oauth_callback => "http://locahost:3000",
:request_token_url => 'http:...
Having sorted the tag_counts hash via the following code:
sorted_tags = Contact.tag_counts.sort{ |x,y| x.name.downcase <=> y.name.downcase }
what is the easiest/most efficient way to display the tags in my view grouped by letters?
i.e
A - "Alpha", "Apple", "Aza"
B - "Beta", "Bonkers"
.
.
.
Z - "Zeta", "Zimmer"
Any ideas?
...
We have the rails app, content served from the database. Now we need to translate that to multiple languages. What is the best way to the internalization of the ruby on rails application?
...
Hey there,
I am trying to build a simple nested html menu using HAML and am not sure how to go about inserting the elements with the correct indentation, or the general best way to build nested trees. I would like to be able to do something like this, but infinitely deep:
- categories.each_key do |category|
%li.cat-item{:id => "ca...
I came from a C, php and bash background, it was easy to learn because they all have the same C structure, which I can associate with what I already know.
Then 2 years ago I learned Python and I learned it quite well, Python is easier for me to learn than Ruby. Then since last year, I was trying to learn Ruby, then Rails, and I admit, u...
I have periods table that has start_at:datetime end_at:datetime .
Because each period begins and end at the same date, I want to separate the in three fields instead of two.
field 1: the date
field 2: the time "00:00" of start
field 3: the time "00:00" of end
I started and done this. But unfortunately, I faced a problem.
So please tak...
I was trying to send a GET request to Twitter (user ID replaced for privacy reasons) using Net::HTTP:
url = URI.parse("http://api.twitter.com/1/friends/ids.json?user_id=12345")
resp = Net::HTTP.get_response(url)
this throws an exception in Net::HTTP:
NoMethodError: undefined method empty?' for #<URI::HTTP:0x59f5c04>
from /Sy...
Hello!
Just for fun, I wrote a very small rails blog (just a hello world).
Now I want to create a post using mechanize.
So I created a Ruby Prog and started coding.
Here is my problem:
Rails creates my form element including all inputs.
In HTML my inputs look like this:
<input type="text" size="30" name="post[title]" id="post_title">
...
I am trying to create a simple ruby mail server ( SMTP server) just or fun. I tried the code in the http://snippets.dzone.com/posts/show/3932
I am not able to sendmail from my machine. I also posted comment there but no reply ;(.
Can any you please help me by giving a pointer or a simple ruby smtp server that can send mail to my gmail...
Hello there,
I'd like to change the minimum for the id of created objects from 1 to 1000.
So when I create in rails my first model object it gets the ID 1000 and not 1.
Is there a way to set this in the schema/migration files?
...
Hello guys,
I'm developing two Ruby gems, one is a framework, the other is an application.
My main app's class inherits from a framework's class.
The class defined in the framework have some file loading methods that rely on __FILE__ so subclasses can load resources relative to their path.
What I want is for the subclasses to be able ...
Having trouble installing the nokogiri gem under rvm ruby 1.9.1.
gem install nokogiri
I'm getting ...
/usr/include/libxml2... no
libxml2 is missing. try 'port install libxml2' or 'yum install libxml2-devel'
*** extconf.rb failed ***
but i checked:
sudo apt-get install libxml2
and i got:
Reading state information... Done
libxm...
I am trying to dynamically define methods based on xml mappings. This works really well. However I want to create an instance variable that is a array of the dynamically defined methods.
My code looks something like this
def xml_attr_reader(*args)
xml_list = ""
args.each do |arg|
string_val = "def #{arg}; " +
...
Hi there!
I'm trying to debug a simple BDD test using cucumber. In order to do that, I inserted a debugger statement where I would like to break the control flow. But it seems that cucumber ignores this statement.
I'm running the tests executing:
rake cucumber:wip
It's rather simple, so I think the code isn' t worth pasting here. T...
Is there some way to run 2 threads at the same time?
I want to have my app run its current function and then bring up another thread running another function, that can change variables in the first thread.
...
Hello!
I'm developing a new site based on Ruby on Rails 3 beta. I knew this might be a bad idea considering it's just beta, but I still thought it might work.
Now though I'm having HUGE problems with Rails consuming huge ammounts of memory.
For my application today it consumes about 10 mb per request and it doesn't seem to release it ...
I'm migrating some websites over to another server. One of the websites is built with Ruby Enterprise Edition and Passenger. I'm trying to make the website run on Ubuntu 9.10, Apache 2 and mysql 5. I've never worked with ruby or ruby on rails before.
When I go to the website built with ruby, I get an error. I've attached a copy of...
I'm writing a simple ruby sandbox command-line utility to copy and unzip directories from a remote filesystem to a local scratch directory in order to unzip them and let users edit the files. I'm using Dir.mktmpdir as the default scratch directory, which gives a really ugly path (for example: /var/folders/zz/zzzivhrRnAmviuee+++1vE+++yo...