Skip to content

Instantly share code, notes, and snippets.

@prem
prem / sockets.rb
Created August 28, 2008 00:52 — forked from dyoder/sockets.rb
require 'socket'
require 'rubygems'
require 'monitor'
include Socket::Constants
class YPCSocket
def initialize( port, ip )
@socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
@address = Socket.pack_sockaddr_in( port, ip )
module Minerva
module Resources
class ParseQuery
include Waves::Resources::Mixin
include Minerva::Resources::ParseHelper
Formats = [ :json, :html ]
$:.unshift( 'waves/lib' ) if File.exist? 'waves'
require 'waves'
require 'foundations/compact'
gem 'dyoder-autocode'
require 'autocode'
module Minerva
include Waves::Foundations::Compact
I, [2008-09-30 00:10:13 #3493] INFO -- : undefined method `json' for Minerva::Resources::ParseQuery:Class
NoMethodError: undefined method `json' for Minerva::Resources::ParseQuery:Class
./waves/lib/ext/module.rb:21:in `[]'
./waves/lib/resources/mixin.rb:81:in `eval'
./waves/lib/ext/module.rb:21:in `[]'
./waves/lib/resources/mixin.rb:81:in `to'
./startup.rb:16:in `__instance_exec_14737240'
/usr/local/lib/ruby/gems/1.8/gems/dyoder-functor-0.5.0/lib/object.rb:11:in `send'
/usr/local/lib/ruby/gems/1.8/gems/dyoder-functor-0.5.0/lib/object.rb:11:in `instance_exec'
/usr/local/lib/ruby/gems/1.8/gems/dyoder-functor-0.5.0/lib/functor.rb:28:in `get'
request = Net::HTTP::Post.new( scenario['url'] )
request.body = File.read( "data/#{sample[:path]}" )
request.content_type = 'audio/amr'
response = nil
t = Benchmark.realtime do
response = Net::HTTP.new( url.host, url.port ).start { |http| http.request( request ) }
end
smm_url = 'http://irvsrddev2.flight.yellowpages.com:8080/smm/ypc?field=city_state_business&imei=353763.01541827.6&grammar=/data1/lm/test.lm'
audio = '/Users/pmani/projects/cicero/20080911/test/data/20080725/audio-220417.amr'
url = URI.parse( smm_url )
request = Net::HTTP::Post.new( url )
request.body = File.read( audio )
request.content_type = 'audio/amr'
response = nil
t = Benchmark.realtime do
response = Net::HTTP.new( url.host, url.port ).start { |http| http.request( request ) }
end