ruby

RMagick Rounded Corners

Need a simple a way of rounding off an Image. I need the corners to be transparent. This link shows how to do it via command line: http://www.imagemagick.org/Usage/thumbnails/#rounded What I need is the corresponding RMagick\Ruby code... Thanks! ...

How do I render a site out on my own domain with Ruby on Rails or anything?

This is what I'd like to achieve: User input URL (http://google.com for example) GET the page, and render it on my own domain Traverse the DOM (Using JS) and all that jazz The problem is I don't want to use an iFrame, because then I can't traverse the DOM of the page loaded. The only solutions I can think of is to parse the page for...

How to install mysql gem on Mac os 10.6 ?

i just installed MAMP on this iMac and the rubygems but when i run: sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config gives me Building native extensions. This could take a while... ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Ver...

Radius of multiple latitude/longitude points

I have a program that takes as input an array of lat/long points. I need to perform a check on that array to ensure that all of the points are within a certain radius. So, for example, the maximum radius I will allow is 100 miles. Given an array of lat/long (coming from a MySQL database, could be 10 points could be 10000) I need to fi...

Recording Audio through RTMP/Rails

I am in the process of building a rails/flex application which requires audio to be recorded and then stored in our amazon s3 account. I have found no alternative to using some form of RTMP server for recording audio through flash, but our hosting environment will not allow us to install anything like FMS, Red5, etc. Is there any existi...

rails mysql BLOB type - to_xml returns binary, would like to force to string

I am running RoR, Ruby 1.8.6/Rails 2.3.2. I am persisting a String within a model object to MySQL to a Blob field. For a number of reasons, I have to use MySQL Blob data type instead of a Text data type, yet I want Rails to treat the field as a regular String (instead of a binary String - which is what I think it is doing?). How can I...

Most optimal way to detect if black (or any color pixels) exist in an image file?

What's the best and most flexible algorithm to detect any black (or colored pixel) in a given image file? Say I'm given an image file that could, say, have a blue background. And any non blue pixel, including a white pixel, is counted as a "mark". The function returns true if there are X number of pixels that deviate from each other at ...

Is anyone using Paypal's Adaptive Payments API with Ruby?

I'm running into multiple issues trying to access Paypal's Adaptive Payment API from Ruby. The main issue I ran into initially was that Paypal requires their HTTP headers to be in all caps but Net::HTTP does not preserve the case of HTTP headers (it stores them 'downcased' and then outputs them 'capitalized' -- so if you set the header ...

How does RoR's reloading content on refresh work?

RoR allows you to, as long as the env is development, change parts of the your application code and then just refresh the browser--and everything is changed, without having to restart Mongrel. How does this work, and where in the Rails codebase is this done? (Or, alternatively, is there some easy way to do this with Rack+Mongrel?) Tha...

process all links but external ones (ruby + mechanize)

I want to process all links but external ones from the whole web site. Is there any easy way how to identify that the link is external and skip it? My code looks so far like (the site url is passed through command line argument) I am using mechanize (0.9.3) and ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] Please note that the...

How are SaaS applications organized?

Consider web (MVC, for example Rails) application for multiple clients as a service. How to design this? one application instance per client? (+ one database per client) one instance for all clients (+ one database for all clients) Former one is simple, but... "inefficient". How about the latter? (best practices, design patterns) H...

List of attributes from class and include module

I have a class (ActorClue) that has three attr_accessor defined within it. There are a couple other common fields needed by other classes, so I put those common fields in a module (BaseClueProperties). I am including that module within my ActorClue class. Here's the code sampling : module BaseClueProperties attr_accessor :image_u...

How do I broadcast a hostname using Ruby's net-mdns?

Hi there. I'm new to net-mdns and mDNS in general, so I have just a basic understanding of how the protocol works for now, and I hope the question is pretty self-explanatory. So far I've seen some examples of how to advertise a service with net-mdns, but what I really need is to broadcast a hostname alias, so that my machine can be reso...

jquery multiple select x rails edit action

Hi, i'm using the JQUERY multiselectable plugin. Because it's get one select box and transform it in two, where you can move one selected option to another select box. The problem is that i'm facing some problems with the edit action. When i load the form, the selected values (that are saved in my model) are not being populated in th...

Two files with the same name pointed by RUBYLIB ?

I have two files with the same name "Foo.rb" in the directories pointed by my RUBYLIB env variable. This causes the interpreter to fail, when 'require "Foo"' is invoked. It cannot know which to use. How to solve this without renaming the files ? ...

Ruby: convert string to date

In Ruby, what's the best way to convert a string of the format: "{ 2009, 4, 15 }" to a Date? ...

win32 ruby1.9 regexp and cyrillic string

#coding: utf-8 str2 = "asdfМикимаус" p str2.encoding #<Encoding:UTF-8> p str2.scan /\p{Cyrillic}/ #found all cyrillic charachters str2.gsub!(/\w/u,'') #removes only latin characters puts str2 The question is why \w ignore cyrillic characters? I have installed latest ruby package from http://rubyinstaller.org/. Here is my output of r...

Vimeo x Ruby OAuth issues

Setting my domain pointing locally to a rails app for development, just can't get authorized using the oauth gem (v.0.3.3, not even mentionning the latest 0.4). Everything works smoothly almost the same way with Twitter; I might miss a bit something here, so if anybody had experienced the same problems; thx in advance. ...

Local install of sqlite3-ruby

On my current system i dont have root-access and i want to install sqlite3-ruby. I can compile it and i know how to set custom install-folder, but how does my ruby-installation can recognize/find that installed gem for usage? I tried prefix of my custom RUBYLIB-Folder but that didnt work either. Any suggestions? Thanks skully ...

Parsing SOAP response using libxml in Ruby

I am trying to parse following SOAP response coming from Savon SOAP api <?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt; <soapenv:Body> <ns:getConnectionResponse xmlns:ns="http://webservice.jchem.chemaxon"&gt; <ns:return> &lt;Co...