I'm just a newbie to ruby. I've seen a string method (String).hash .
For example, in irb, I've tried
>> "mgpyone".hash
returns
=> 144611910
how does this method works ?
Hi,
I'm building a download manager in python for fun, and sometimes the connection to the server is still on but the server doesn't send me data, so read method (of HTTPResponse) block me forever. This happens, for example, when I download from a server, which located outside of my country, that limit the bandwidth to other countries.
How can I…
the extracted source is below
Showing /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/templates/rescues/diagnostics.erb where line # raised:
private method `gsub' called for #<NoMethodError: undefined method `closed?' for nil:NilClass>
Extracted source (around line #):
RAILS_ROOT:…
In my view, if I have a situation where I need to use a dynamic method (such as Domain.findByName("name")) in multiple places, would it be better to define a variable with and refer to that, rather than have the dynamic method in multiple places? I know this seems like an obvious answer, but I just wanted to…
I'm very new to Ruby (and OOP as well) and I don't know why the following thing doesn't work in Ruby
I extended the String class with a new method. Easy enough. Now I want to extend the Fixnum class. A String object appears somewhere in the class, but I can't use the method that I defined earlier. Why? Is…
I have a service which is defined as ConcurrencyMode.Single:
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,
UseSynchronizationContext = false,
InstanceContextMode = InstanceContextMode.PerSession,
IncludeExceptionDetailInFaults = true)]
public class MyService : IMyService
This…
I am writing a Ruby on Rails app and I want a method to be called every time the database is modified. Is it possible to do this without inserting a method call in every location where the database is modified?
I have issue "The caller was not authenticated by the service." when calling service method from IIS7 in client side. The client and service are in different machines. But when I am giving credentials its work fine. So, is any way to call service method without credentials and without this issue?
…
Hello,
I have a value range from 0 to 255.
There is a method that returns an array with a min and max values within this range, i.e: 13, 15, 20, 27, 50 ... 240
where 13 is the min and 240 is the max
I need to scale these values so that 13 becomes 0 and 240 becomes 255 and scale all the other…
Hi All,
I have a asp.net page which is checking a UNC path on a listbox item change event using Directory.exist method.
This works fine in Internet explorer.
But when i use firefox and debugging this method returns false even though the directory exists.
What could be the reason for this…
My form has several numeric up down controls. All of these controls, when changed, call the same method:
private void SetColors(object sender, EventArgs e)
How do I determine which control called the method?
2 Interfaces with same method names and signatures. But implmented by a single class then how the compiler will identify the which method is for which interface.In java.
I have several classes that extend C and I would need a method that accepts any argument of type C. But in this method I would like to know if I'm dealing with A or B.
*
public A extends C
public B extends C
public void goForIt(C c)()
If I cast how can I retrieve the type in a clean way…
i have to create a program to login on facebook using example http://code.google.com/p/facebook-java-api/wiki/Examples but
when i run project then i get my doFilter method does not call after complete init method please give me solution
Whenever the user scrolls map or zooms in/out, this method gets called instantaneously. I want to delay the call to this method by say 2 secs. Is it possible to do that?
So I just tried excluding String[] args from the main method
It compiled alright !
But JVM is showing an exception
Why did it compile when String[] args HAS to be included every time ?
What is going on here ? Why won't it show a compilation error ?
typing this made me think that may be…
I have several classes that extend C and I would need a method that accepts any argument of type C. But in this method I would like to know if I'm dealing with A or B.
*
public A extends C
public B extends C
public void goForIt(C c)()
If I cast how can I retrieve the type in a clean…
I have some pages, which work fine locally(using WAMP and error_reporting E_ALL in php.ini), but once I upload them, I get the following error:
Fatal error: Call to undefined method DB::exists()
The method is there, and I don't know why it can't be seen.
Do you have an idea what went…
I'm trying to learn and understand more about mapping and displaying values on a map. (GIS)
At the moment I'M looking to take some values and apply those values to a tile or bin on a map.
Ideally I'd like the tile sizes to be uniform, like 100 meters, 500 meters, etc.
Is there a…
I'm implementing paging on an mvc view, and I want to call a method in the controller from the view
view:
>a href=">%= Url.Action("Search", new
{ page =
NextPage(Request["exactPage"])).ToString()})
%"
controller:
public string NextPage(string
currentPage)
…
2 Interfaces with same method names and signatures. But implmented by a single class then how the compiler will identify the which method is for which interface.
I'm trying to declare a method for my program that takes only a 5 digit integer and for each digit of the integer, reads a value from the program and prints it out. I understand this isn't very clear but im having trouble relaying what I mean. I understand it will be some sort of…
I'm trying to redefine the File.dirname method to first change %20s to spaces. But the following gives me an error
class File
old_dirname = instance_method(:dirname)
define_method(:dirname) { |s|
s = s.gsub("%20"," ")
old_dirname.bind(self).call(s)
}…
I am working with ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux] and I get
undefined method `bytes' for #<String:0x2a95ec2268> (NoMethodError)
even though my code works on ruby 1.8.7. patchlevel 249
I saw somewhere that you need to add require "jcode" for a similar…