`
yanzilee9292
  • 浏览: 545126 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论
文章列表
1. 主进程main.rb ENV["ttt"]="yanzilee9292" system 'ruby t.rb'   2.子进程t.rb puts ENV["ttt"]   3.运行 ruby main.rb 这样控制台会打印出yanzilee9292 参考: http://ruby.about.com/od/rubyfeatures/a/envvar.htm Environment variables are variables passed to programs b ...
1.在使用ruby的命令行参数的时候, 实际上是引用的赋值方式   测试代码, 保存为test.rb:   arg = ARGV[ 0 ] arg.gsub!( /\r\n?/, "\n" )   运行test.rb会报错:   ruby test.rb string_to_test test.rb:3:in `gsub!': can't modify frozen string (RuntimeError)         from test.rb:3:in `<main>'   有点不是太明白, ruby为什么要这样做     ...
在Linux系统下, 可以用一个命令很容易批量删除.svn的文件夹   find . -name .svn -type d -exec rm -fr {} \;   SVN相对于GIT的最大缺点, 可能就是每个文件夹都会有一个隐藏的.svn文件夹, 新手在使用的时候会容易就会遇到复制文件夹带来的错误. 不能说GIT比SVN要好, 至少要知道怎样去处理这个SVN的缺陷.
可以通过windows特有的ADO来连接, 需要借助于WIN32OLE, 不是最好的方法, 但是够用.   require "win32ole" class MssqlDb attr_accessor :mdb, :connection, :data, :fields def initialize(host,mdb,user,pass) @host= host @mdb=@database= mdb @username= user @password= pass @connection = ni ...
1. FreeTDS(TDS协议的一种开源实现方式) FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases. Technically speaking, FreeTDS is an open source implementation of the TDS (Tabular Data Stream) protocol used by these databases f ...
在网上Google了一翻, 很多解决方案都是围绕的ODBC, 这种方法配置麻烦, 在操作系统的不同版本之间也有细微的差异, 依赖的东西很多, 按着步骤配都会一路error.         Ruby官方推荐的解决方案是用ActiveRecord, 由于文档很少, 很少有人配置成功过, 这里给出详细步骤:   1. 安装brew工具, 类似于port 或者Linux的 apt-get https://github.com/mxcl/homebrew/wiki/installation   2. 安装freetds(官方说可以直接brew install freetds了) br ...
假设用户名是yanzi, 密码是 123456   1. 创建用户 create user yanzi identified by '123456';   2. 授权 左边的星号表示database,右边的星号是table. grant select, insert, update,delete on *.* to yanzi @"%";   如果需要限定IP地址, grant select, insert, update,delete on *.* to yanzi @localhost;   3. 查询所有用户和IP限制 select host, ...
转自: http://blog.chinhai.com/index.php/archives/149     由于想使用php合并成文件,而又想它可以缓存。所以使用了客户端请求头的If-Modified-Since,和服务器端文件最近修改的一个文件的last-modified,通过这两个时间的比较从而实现是否缓存。代码如下: //中国$client_time = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ? strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) : 0); $css = ' ...
问题引出:  很多网站的flash应用系统,做的很好看, 但是也没多少用户群体, 因为服务器的SWF文件很大. 很多用户, 面对超过了20秒都还没有下载完成的东西, 一般不会去看第二次了.  在国内, SWF文件如果超过了2MB, 就基本悲剧了.   ...

水浒传人物结局

《水浒传》是我国第一部章回体小说。 是中国描写中国封建社会农民起义的章回体长篇小说。 《水浒传》在文学成就上受到后世不少文学评论家的赞许: 金圣叹将《水浒传》与《离骚》、《庄子》、《史记》、《杜诗》、《西厢记》合称为“六才子书”。冯梦龙将《水浒传》与《三国演义》、《西游记》、《金瓶梅》定为“四大奇书”。与《三国演义》、《西游记》、《红楼梦》共列“中国古典四大名著”。 水浒传人物排名及结局 三十六天罡星 天魁星·及时雨 (呼保义)·宋江. (得胜后被高俅毒死) 天罡星· 玉麒麟·卢俊义. (得胜后被奸臣灌水银身死) 天机星· 智多星·吴用. (宋江死后与花荣上吊) 天闲星· 入云 ...
NOTE: We’re currently working on documenting these sections. We believe the information here is accurate, however be aware we are also still working on this chapter. Additional information will be provided as we go which should make this chapter more solid. In addition, we will be proof ...

ruby语句块和闭包

    博客分类:
  • ruby
  原文来自: http://www.cnblogs.com/ToDoToTry/archive/2011/08/14/2137897.html Block 不是对象,是Ruby的语言特性,近似于闭包(Closure)。 范例: def meth   res=  yield

RUBY处理时间格式

    博客分类:
  • ruby
最常用的情况: t = Time.now t.strftime "%Y%2m%2d-%2H%2M%2S" => "20120429-133448"       我们可以使用Time类来生成一个当前时间的对象: t = Time.new或t = Time.nowTime类有类方法mktime(同义方法是local方法)来根据传入的参数生成时间对象,并且它使用的是当前的时区:t1 = Time.mktime(2001)                # January 1, 2001 at 0:00:00t2 = Time.mk ...
Introducing Test Design We’ve provided in this chapter information that will be useful to both, those new to test automation and for the experienced QA professional. Here we describe the most common types of automated tests. We also describe ‘design patterns’ commonly used in test ...
  Introduction This page details how to build and test the Ruby code in Selenium. Details The CrazyFunBuild runs on a bundled JRuby jar and is based on Rake. Use the 'go' Rake wrapper to run the targets. Unfortunately, rvm sets GEM_HOME and causes trouble for our jruby-complete.jar. If y ...
Global site tag (gtag.js) - Google Analytics