ruby

How to gsub an unicode 0083 with ruby ?

Hi Guys, I have loaded a string from a html.file, and I have writen it to a yaml file with the plugin ya2yaml: - title: 'What a wonderful day!' body: ... # main contents here and I will load the .yml file by YAML::parse_file method. but "\n" in the string will cause load problems, so I tried to gsub all "\n" to "", but the...

Index Stemming to process text in c sharp or ruby

Given this text: "Friends are friendlier friendlies that are friendly and classify the friendly classification class. Flowery flowers flow through following the flower flows" I need to apply stemming to the text to achieve the following outcome: frequency("following") = 1 frequency("flow") = 2 freque...

Outdated Ruby GEM, How Do I Share My Changes?

So I have been playing with a Ruby gem for a work project that manipulates and extracts data from PDF documents. I wanted to change a method to parallel another, since the functionality was limited. I am not a Ruby expert by any stretch, just started learning two weeks ago, but this is boilerplate. I checked the the RubyForge page, an...

How does typekit.com work ? @font-face

How does typekit.com work ? There are many site like typekit allow css designers to use custom fonts ? but how ? How can I make a site like typekit ? What technology is used ? Are there any open source ? ...

spork on Win7-x64/ruby1.9.2p0?

Having trouble getting spork running on Win7-x64/Ruby1.9.2p0: gem install spork ERROR: Error installing spork: ERROR: Failed to build gem native extension. C:/Ruby192/bin/ruby.exe mkrf_conf.rb Actually, there aren't any native extensions. I'm just dynamically installing dependencies based off of your operating system rake RUBYA...

Scaffolding in Rails while defining nullable fields and foreign keys

I'm just figuring out my way around rails but I need a little help with the rails generate scaffold command. Here's the command that I'd like to use rails generate scaffold Expense user:??? name:string description:text I'd like the description field to be nullable and the users field to be linked to another Model — in this case I'd l...

Lightweight Ruby MVC web development framework which plays nicely with ExtJS

I'm looking for a lightweight MVC Ruby framework for developing an ExtJS application. I started with Rails 3.0, but I feel that I'm struggling with the ActionPack (which I don't really need). Since all the UI (view) is done in ExtJS, I don't need any rendering support. What I do need is a routing infrastructure (for REST), session suppo...

is it possible to read the text written in a sticky note using a script in linux?

I am using sticky notes in ubuntu . And was wondering if it would be possible to read the text written in sticky notes using any scripting language . ...

Spawning Ruby programs from Ruby

Say I have a ruby script called hello_world.rb that has one line puts "Hello, world" And I want to call that from another ruby script called spawn_hello_world.rb pipe = IO.popen("ruby1.9.1 hello_world.rb", 'w+') if pipe puts pipe.gets end My question is: Is there a shorthand way of running another ruby process without having to c...

Two-legged OAuth Provider Ruby

Does anyone know of any examples of a two-legged Oauth provider in ruby? Preferably one done using the oauth gem. Thanks. Edit: I was able to solve this, it was surprisingly simple, which explains the lack of examples. ...

writing a wrapper for a programming language

I want to write a ruby wrapper swi-prolog. Can anyone please tell me how to proceed with writing one? I would appreciate if anyone please explain me what steps need to be considered while attempting to write this sort. ...

Writing an API for Rails OAuth provider

I'm having trouble figuring out how to write an REST API using OAuth authentication. The actual authentication part is working fine, but I'm not sure how to access the OAuth token in order to find the associated user. Here is the (barebones) code that I am currently working with in my controller: class UsersController < ApplicationCont...

Add a callback function to a Ruby array to do something when an element is added

I'd like to add something like a callback function to a Ruby array, so that when elements are added to that array, this function is called. One thing I can think of is to override all methods (like <<, =, insert, ...) and call that callback from there. Is there an easier solution? ...

Getting portion of href attribute using hpricot

I think I need a combo of hpricot and regex here. I need to search for 'a' tags with an 'href' attribute that starts with 'abc/', and returns the text following that until the next forward slash '/'. So, given: <a href="/abc/12345/xyz123/">One</a> <a href="/abc/67890/xyzabc/">Two</a> I need to get back: '12345' and '67890' Can anyo...

Why are the gems not showing up?

So this happens to me regularly, where i have gems that are installed but for some reason my rails app is not finding it...here is my example my config/environment.rb config.gem "whenever" my install sudo gem install whenever Password: Successfully installed whenever-0.6.2 1 gem installed gem list | grep when whenever (0.6.2) scr...

Ruby, Qt and third party widgets

I'm learning Ruby and, for this, I'm writing an application in it. My background is in C++/Qt. So I've started writing a Ruby/Qt app. But there's a few previously written widgets (C++) I would like to use, besides qwt. Is this possible? If it is, how should I do it? PS: It seems QtRuby from Korundum bindings do includes Qwt bindings. ...

updating countdown timers

I'm starting to build a script for a Penny Auction site like swoopo.com What framework should I use? Whats the best way to keep the timers updated without using too much bandwidth? This all started when I started looking at all the junk thats currently out there. Most are using PHP and javascript and I feel there is a much better solut...

How can I get today's date where the user currently is?

Does Date.today() return the current date based on the server's date? If so, how can I get the correct date for a user? ...

Best way to refactor after upgrade to 1.9.2

With the change to 1.9.2, the current directory is no longer in the load path. The announcement suggests against relying on the current directory in your code, but gives no suggestions for alternatives. What is a "better" way to keep code constrained than separate files linked with require? ...

ruby method chaining

beginning my foray into ruby, and literally the first thing I tried to do was: var.split('/').delete_at(0) which upon inspection returned "" no matter what the string, however.... var.split('/') var.delete_at(0) gives me no trouble. this is probably a stupid question, but are there some sort of restrictions/limitation...