-
Ruby 使用 TkEntry
所属栏目:[百科] 日期:2020-12-17 热度:137
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'tk'top = TkRoot.new {title "Label and Entry Widget"}lb1=TkLabel.new(top){ text 'Hello World' background "yellow" foreground "blue"[详细]
-
判断 拼音的正则
所属栏目:[百科] 日期:2020-12-17 热度:170
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #区分拼音和英文的代码#拼音正则1R = /(b|p|m|f|d|t|n|l|g|k|h|j|q|x|zh|ch|sh|r|z|c|s|y|w)(a|o|e|i|u|ao|iu|ei|ui|ou|iu|ie|an|en|in|un|ang|eng|in[详细]
-
Ruby 调用 IE 解析页面,并获取解析结果
所属栏目:[百科] 日期:2020-12-17 热度:127
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'win32ole'web_browser = WIN32OLE.new('InternetExplorer.Application')web_browser.visible = trueweb_browser.navigate('http://www.oschi[详细]
-
去掉文件里重复的行
所属栏目:[百科] 日期:2020-12-17 热度:91
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 old = File.open(ARGV[0]).collect new = File.open(ARGV[1],"a+") for i in 0..old.length-1 new.write(old.uniq[i]) end 以上是编程之家(jb51.cc)为[详细]
-
打印Ruby所有类在阵列
所属栏目:[百科] 日期:2020-12-17 热度:184
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 ObjectSpace.each_object(Class).to_aObjectSpace.each_object(Class).to_aObjectSpace.each_object(Class).to_a 以上是编程之家(jb51.cc)为你收集整[详细]
-
Ruby 的 UDP 客户端一例
所属栏目:[百科] 日期:2020-12-17 热度:157
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'socket's = UDPSocket.news.send("hello",'localhost',1234) 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所[详细]
-
Ruby:简单的插入排序
所属栏目:[百科] 日期:2020-12-17 热度:160
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #Insertion Sort Method def insertionSort(list) list.each_with_index do |data,i| j = i - 1 while j = 0 break if list[j] = data list[j + 1] =[详细]
-
Ruby GServer 设置允许客户端的同时连接数
所属栏目:[百科] 日期:2020-12-17 热度:133
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'gserver'class HelloServer GServer def serve(io) io.puts("Say something to me:") line = io.gets io.puts("You said '#{line.chomp}'")[详细]
-
Ruby 连接到 Oracle 数据库并执行SQL查询
所属栏目:[百科] 日期:2020-12-17 热度:74
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require "dbi"URL = "dbi:Oracle:oracle.neumann"dbh = DBI.connect(URL,"scott","tiger")rows = dbh.select_all("SELECT * FROM EMP")p rowsdbh.disc[详细]
-
github认证
所属栏目:[百科] 日期:2020-12-17 热度:52
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #coding: utf-8require 'sinatra'require 'omniauth'require 'omniauth-github'use Rack::Session::Cookieuse OmniAuth::Builder do provider :github[详细]
-
Ruby 设置 Excel 单元格数据并读取
所属栏目:[百科] 日期:2020-12-17 热度:191
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'win32ole' excel = WIN32OLE.new("excel.application") excel.Workbooks.Add excel.Range("a1").Value = 10 excel.Range("a2").Value = 20 e[详细]
-
Ruby中类的一部分转为单独的类
所属栏目:[百科] 日期:2020-12-17 热度:169
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 ClassPart = proc do copy here code you want to move out of the main class end 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能[详细]
-
Ruby 将哈希数据转成 YAML
所属栏目:[百科] 日期:2020-12-17 热度:144
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'yaml'puts ({ 'measurements' = 'metric' }.to_yaml)puts ({ :measurements = :metric }.to_yaml) 以上是编程之家(jb51.cc)为你收集整理的全[详细]
-
ruby调用telnet,远程运行命令
所属栏目:[百科] 日期:2020-12-17 热度:134
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'net/telnet' # 连接到远程主机 foobartelnet = Net::Telnet.new("Host" = "foobar") {|c| print c} # 登陆telnet.login("your name","your p[详细]
-
Ruby 进行 FTP 文件传输时,每传输100k进行提醒
所属栏目:[百科] 日期:2020-12-17 热度:68
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'net/ftp'ftp = Net::FTP.new('ftp.domain.com')ftp.passive = trueftp.loginftp.chdir('/your/folder/name/here')count = 0ftp.putbinaryfil[详细]
-
检查SSH
所属栏目:[百科] 日期:2020-12-17 热度:52
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'net/ssh' def test_ssh_connect(address,username,password) begin Net::SSH.start(address,:password = password) rescue Exception = e lo[详细]
-
Ruby 使用 Berkeley DB 数据库
所属栏目:[百科] 日期:2020-12-17 热度:112
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'dbm'DBM.open('r') do |db| db['t'] ="W" db[23] = "F"endDBM.open('r') do |db| puts db['t'] puts db['23']endp Dir['r.*'] 以上是编程之[详细]
-
Ruby 使用 pstore 的简单例子
所属栏目:[百科] 日期:2020-12-17 热度:54
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require "pstore"db = PStore.new("employee.dat")db.transaction do db["params"] = {"name" = "Fred","age" = 32,"salary" = 48000 }end# retriever[详细]
-
让 screen -r 更方便
所属栏目:[百科] 日期:2020-12-17 热度:67
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env ruby# 自动查找所有 screen 并 -r,参数是第几个screen .# 比如 scr.rb 0 或 scr.rb 1,# 可以 alias s="scr.rb"# alias s1='scr.rb 1'#[详细]
-
Rails 一对多映射
所属栏目:[百科] 日期:2020-12-17 热度:77
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 drop database Contact;create database Contact;use Contact;CREATE TABLE Employee ( id int unsigned not null auto_increment primary key,Name V[详细]
-
Ruby 完整布局管理示例
所属栏目:[百科] 日期:2020-12-17 热度:145
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require "tk"$top = { 'side' = 'top','padx'=5,'pady'=5 }$left = { 'side' = 'left','pady'=5 }$bottom = { 'side' = 'bottom','pady'=5 }$temp = 7[详细]
-
利用Google API实现翻译功能
所属栏目:[百科] 日期:2020-12-17 热度:129
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 // Find quickly the translation of something without having to go to the browser// Example (translate 'my name is Lloyd Moore' from english[详细]
-
简单的文本加密
所属栏目:[百科] 日期:2020-12-17 热度:100
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require "jcode"$KCODE="u" #使用utf-8的字符集,解决中文会出现乱码的问题TEST_OJ="C:/BJ.txt"puts "请输入文件的路径:"TEST_FILE_NAME=gets.chompif[详细]
-
Ruby 使用 Hpricot 搜索 HTML 中的元素
所属栏目:[百科] 日期:2020-12-17 热度:77
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'rubygems'require 'hpricot'require 'open-uri'doc = Hpricot(open('http://www.rubyinside.com/test.html'))puts doc.search("h1").first.i[详细]
-
WEBrick 的基本例子
所属栏目:[百科] 日期:2020-12-17 热度:71
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 require 'webrick'server = WEBrick::GenericServer.new(:Port = 1234)trap("INT"){ server.shutdown }server.start do |socket| socket.puts Time.no[详细]