I'm trying to interface with a 3rd party website, and the communication goes as follows.
Send this request
POST /Service/LabelService.asmx/GetLabelXML HTTP/1.1
Host: www.host.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
labelRequestXML=<LabelRequest> ... </LabelRequest>
Receive this response
HTTP/1.1 ...
I'd like to write my own ActiveRecord adapter for the HBase database since none currently exist. However, I've been searching for a while online and can't find any good resources on how to write an ActiveRecord adapter. How would you go about doing this, or are there any links you can recommend?
...
I would like to build a simple standalone solitaire game in ruby. Are there any libraries I should use? Do I even need game libraries to have cards moved from one stack to another? I have never written any games, and I haven't built a standalone app for a long time, that's why I'm lost :)
...
Given the code below, how can default values be defined for the Model.
(let's say the default for :name should be 'Thing').
require 'pp'
require 'sequel'
DB = Sequel.sqlite
DB.create_table :items do
primary_key :id
String :name
end
items = DB[ :items ]
class Item < Sequel::Model
end
Item.create :name => 'foobar'
Item.create
...
Hi,
I'm thinking about learning ruby and python a little bit, and it occurred to me, for what ruby/python is good for? When to use ruby and when python, or for what ruby/python is not for? :)
What should I do in these languages?
thanks
...
I am trying to compile Ruby on HPUX but get the following:
cc: "transcode.c", line 1489: error 1588: "SIZE_MAX" undefined.
cc: "transcode.c", line 1489: error 1563: Expression in if must be scalar.
...
Is there a gem or a library to get ruby 1.9 methods like
[1, 2, 3].combination(2)
[1, 2, 3].permutation(2)
[1, 2, 3].product([1, 2, 3])
[1, 2, 3, 4, 5].cycle
...
Is this the DRYest way to do it in ruby?
<% for item in @items %>
<%= n = n + 1 rescue n = 1 %>
<% end %>
which initializes "n" to '1" and increments it as the loop progresses (and prints it out) since this is in one my app's views
...
I'd like to send plain text emails from a Rails app. In my mail sending config I have:
ActionMailer::Base.default_content_type = 'text/plain'
Nonetheless, when I send a test email from the Rails console, I get:
>> GeneralAppMailer.deliver_test
# ...
Content-Type: text/html; charset=utf-8
And looking at it in Gmail, it does seem t...
I have values returned by unknown function like for example
# this is an easy case - parabolic function
# but in my case function is realy unknown as it is connected to process execution time
[0, 1, 4, 9]
is there a way to predict next value?
...
I would like to open OSX windows (and Windows windows) from a ruby script. If I do
system "touch /Users/apple/Documents/thekbase-temp-files/test5.txt"
it works (creates an empty file), but this
system "mate /Users/apple/Documents/thekbase-temp-files/test5.txt"
does not open TextMate, even though it does if I type it. I feel this mi...
<% form_ tag user_path(@user), :method => :put do %>
That's my form, so I want it to access the update method of my UsersController, I set the map.resources :users , and the RESTful paths generated:
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:a...
I'm working on a windows machine and trying to get the curb plugin to work, first thing I realized was I needed the curl library installed on my machine, so that's what I'm looking to do.
I simply downloaded a curl library, a curllib library, and have them located at c:/curl and c:/curllib respectively. I setup my environmental variabl...
Hello,
what plugin or gem do you recommened for tagging?
There are many of them, acts_as_taggable, acts_as_taggable_on_steroids, acts_as_taggable_on,...
What do you say?
...
(Disclaimer: I asked this question yesterday on HN http://bit.ly/m6onk. While responses were good, there was a notable lack of technical discussion and more of a "you should use rails because that's what you know". Since Joel and Jeff state clearly they don't mind reposts of questions from other sites...and since I really enjoy the answe...
hi! I have an Event class which holds start and end times for an event. Each Event object can have a number of associated ChildEvent objects representing each recurrence of the parent Event. Each of those classes needs to take a different action based on how they are being edited e.g.
Deleting just one Event:
Event: make the first ch...
As I write some scripts, I usually reach a point where my code looks like this :
end
end
end
end
end
end
I don't know about you, but this look very ugly to me. Can something be done about this?
...
Assume I have a family of related modules:
module Has_Chocolate
def has_chocolate?
true
end
end
module Has_Cake
def has_cake?
true
end
end
.
.
.
How would I construct a template module Has_*Something* where Something would be a parameter to the module?
...
I've got this piece of Shoes app:
flow :top => 10, :left => 10 do
flow :width => 0.3 do
para @board.deck.card
click do
if @board.source_pile
@board.source_pile = nil
@deck_border.hide
else
@board.source_pile = @board.deck
@deck_border = border yellow, :strokewidth => 2
end
...
I'm trying to block all non-localhost attempts to access a Webrick process. This is my current code
def do_GET(req, res)
host_name = "localhost:3344".split(":")[0]
if host_name != "localhost" && host_name != "127.0.0.1"
puts "Security alert, accessing through #{host_name}"
return
else
puts "we're fine, #{...