Posts

Showing posts with the label ror

Getting Local ip Address

require 'socket' def local_ip orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily UDPSocket.open do |s| s.connect '64.233.187.99', 1 s.addr.last end ensure Socket.do_not_reverse_lookup = orig end p= local_ip puts p

image science requirement

.ruby_inline/Inline_ImageScience_aa58.c:2:23: error: FreeImage .h: No such file or directory getting such an error?? just install freeimage, http://www.urbanpuddle.com/articles/2008/01/22/install-freeimage-imagescience-on-ubuntu-gutsy#comments the above link will guide u in installing.. thanks,

calling JS from form in rails

"report"},{:method => :post, :onSubmit => "return isNumeric(document.getElementById('premium_user'))"})%>

CSV

hi, any work under csv?? here s something interesting which makes ur csv work easier. http://fastercsv.rubyforge.org/ Thanks.

concat multiple arrays

hi, joining multiple arrays is easy using "+" we can do that using a single method as follows, class Array def concat_multi *lists lists.each {|list| self.concat(list) } end end a = [1, 2, 3] b = [4, 5, 6] c = [7, 8, 9] d = [10, 11] a.concat_multi(b, c, d) p a