易截截图软件、单文件、免安装、纯绿色、仅160KB

RUBY 实现SOAP

SOAP 服务端:
#!/usr/local/bin/ruby
require 'soap/rpc/standaloneServer'
module MySOAP
 class Timer
  def now
   Time.new.strftime("%Y-%m-%d %H:%M:%S")
  end
 end
 class Add
   def add(i, j)
  return i.to_i + j.to_i
   end
 end
end
class TimeServer < SOAP::RPC::StandaloneServer
 def on_init
  time = MySOAP::Timer.new
  add = MySOAP::Add.new
  add_method(time,"now")
  add_method(add,"add")
 end
end
NS = 'http://localhost/soap'
port = 4000
svr = TimeServer.new('timer',NS,'0.0.0.0',port)
trap('INT') { svr.shutdown }
puts "My SOAP is starting... port:#{port} (Ctrl+c to quit)"
svr.start
puts "My SOAP is stop."
SOAP客户端:
require 'soap/rpc/driver'
proxy = SOAP::RPC::Driver.new("http://localhost:4000","http://localhost/soap")
proxy.add_method('now')
proxy.add_method('add','i','j')
puts "Server time now is : #{proxy.now}"
puts "9 + 2000 = #{proxy.add(9,2000)}"


相关文档:

ruby 语法

本文转自:
http://hi.baidu.com/24xinhui/blog/item/9f52dd34382e11325ab5f553.html
ruby-语法
2009年06月20日 星期六 上午 00:21
http://www.blogjava.net/xxllnnn/archive/2009/01/18/251762.html
http://www.cnblogs.com/cnblogsfans/archive/2009/01/24/1380804.html
__setobj__ (2009-7-14)
  &nbs ......

Ruby Ruport实践—中文PDF报表之FPDF

Ruport中pdf_writer对中文的支持并不好,输出的中文显示的是乱码。上网查了很多资料,也没有找到好的解决方案,无奈只好查看源代码,到底为什么Ruport自带的PDF工具不支持中文输出。
Ruport::Formatter::PDF::Writer中找到以下代码
   metrics = load_font_metrics(font)
   metrics = PDF::Writer: ......

Install ruby 1.9 on Windows using zip binary

Update:  This post is outdated. All in one installer for 1.9
is ready now, you should use it if you need 1.9 on windows. Get it here
http://rubyforge.org/frs/?group_id=167
Ruby has “all-in-one” installer for Windows, but it is outdated. As
of May 2009, Ruby 1.9.1 is released, ......

Ruby语言学习系列 基本的ruby语法


Ruby语言学习系列--基本的ruby语法
 
1.     基本的ruby语法
1.1      变量、常量和类型
1)      定义变量
变量类型
描述
示例
局部变量(或伪变量)
以小写字母或下划线卡头
var    _var
全局变量
以$开头
$ ......

Ruby Ruport实践—报表参数实现(二)

本例在  Ruby Ruport实践—报表参数实现 的基础上进行改造,实现报表执行定义时报表参数的增、删、改操作
一、修改views/report_executions/edit.html.erb
不仅显示在新建报表执行时保存的报表参数,还可动态显示剩余的参数(这里控制参数最多可定义5个),这样可避免遗忘定义报表参数或需要增加报表参数� ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号