I'm trying to get a Ruby script to download a file off a server, but I'm getting a 401.2 from IIS:
You do not have permission to view
this directory or page using the
credentials that you supplied because
your Web browser is sending a
WWW-Authenticate header field that the
Web server is not configured to
accept.
I've ch...
I am trying to do some Cucumber testing like the following:
Given I am logged in as admin
When I go to the article page
Then I should see "Edit Article"
And I should see "Article Title"
where the path to the article page is "articles/1" or some known id.The problem is that when I insert my data using my step definition
Article.create...
Question: Does anyone have an example of a "filter as you type" dropdown control using Shoes?
Examples: If you are looking for examples of what i am talking about, see these.
http://docs.jquery.com/Plugins/Autocomplete
http://stackoverflow.com/questions/706906/jquery-filter-dropdown-list-as-you-type
...
I would like to implement a simple Bayesian classification system to do rudimentary sentiment analysis on short messages. Practical suggestions for implementing in Ruby would be welcome. Suggestions for other approaches besides Bayes would also be welcome.
...
Hey,
How do I write a route that maps a path like this?
/powerusers/bob/article-title
This is what I got so far:
map.resources :users, :as => "powerusers" do |users|
users.resources :articles, :as => ''
end
This gives me the following route:
/powerusers/:user_id//:id
How do I get rid of the double backslah? /powerusers/admin//f...
Alright, this one's interesting. I have a solution, but I don't like it.
The goal is to be able to find a set of lines that start with 3 periods - not an individual line, mind you, but a collection of all the lines in a row that match. For example, here's some matches (each match is separated by a blank line):
...
...hello
...
...hel...
What's the best way to implement a Hash that can be modified across multiple threads, but with the smallest number of locks. For the purposes of this question, you can assume that the Hash will be read-heavy. It must be thread-safe in all Ruby implementations, including ones that operate in a truly simultaneous fashion, such as JRuby, an...
I'm implementing a Rails application in which users will be able to store snippets of code for later reference. I'm planning to use Markdown for text entry and will probably use the wmd markdown editor. (The very one Stackoverflow uses.)
I'm a little concerned about the idea of people entering code into the edit box. From what I underst...
Is $PROGRAM_NAME same as $0 in ruby?
...
Hey,
Is there a platform-independent way of writing the EOF symbol to a string in Ruby. In *nix I believe the symbol is ^D, but in Windows is ^Z, that's why I ask.
Cheers
Pete
...
This is more a general question but my particular case involves a ruby/rails app using the Google map APIs (v2).
I'd like to take a lat/long point and get an address (standard rev geocode) and then take that address one step further to see if there is a specific business name associated with it.
So, as an example say (numbers pulled ou...
Let's say I have a model class called Project, but instead of this:
class Project < ActiveRecord::Base
I wanted to write this:
class Project < ORM
so that the specific ORM implementation is not present in my model class.
How would I need to write my ORM class so that the Project class above is able to act as a subclass of ActiveRe...
Dependency Injection frameworks in Ruby have been pretty much declared unnecessary. Jamis Buck wrote about this last year in his LEGOs, Play-Doh, and Programming blog post.
The general accepted alternative seems to be using some degree of constructor injection, but simply supplying defaults.
class A
end
class B
def initialize(option...
I want to format a date object so that I can display strings such as "3rd July" or "1st October". I can't find an option in Date.strftime to generate the "rd" and "st". Any one know how to do this?
...
I'm trying to learn Ruby as well as Ruby on Rails right now. I'm following along with Learning Rails, 1st edition, but I'm having a hard time understanding some of the code.
I generally do work in C, C++, or Java, so Ruby is a pretty big change for me.
I'm currently stumped with the following block of code for a database migrator:
d...
So, I am using Google Contacts API to let users import their contacts from GMail.
I want the users to be able to select the contacts they want to import in my app, So currently I -
GET a XML feed of all the contacts a user has.
Parse it, and for each contact create a record in the imported_contacts table.
Display the list to the user,...
Hi there, I am experimenting with several languages (Python, Ruby...), and I would like to know if there is a way to optimize my Apache Server to load
certain modules only in certain VirtualHost, for instance:
http://myapp1 <- just with Ruby support
http://myapp2 <- just with Python support
http://myapp3 <- just with Php support
...
...
Trying to understand the options for will_paginate's paginate method:
:page — REQUIRED, but defaults to 1 if false or nil
:per_page — defaults to CurrentModel.per_page (which is 30 if not overridden)
:total_entries — use only if you manually count total entries
:count — additional options that are passed on to count
:finder — name of th...
What do you guys use for debugging in ruby 1.9? rdebug doesn't seem to be compatible.. is there anything out there?
...
I have a pgp-encrypted file that I need to extract data from at runtime.
Can this be done by decrypting to memory only (as opposed to creating a decrypted file and deleting it when done)?
...