rubyËæ»úÔÚ¿ØÖÆ̨ÏÔʾ×Ö·û´®
require 'curses'
module Curses
def self.program
main_scr=init_screen
noecho
cbreak
curs_set(0)
main_scr.keypad=true
yield main_scr
end
end
Curses.program do |scr|
max_x=scr.maxx
max_y=scr.maxy
100.times do
scr.setpos(rand(max_y),rand(max_x))
scr.addstr("hi")
end
scr.getch
end
Ïà¹ØÎĵµ£º
¿ª·¢»·¾³£º
Ruby:1.9.1
Rails:2.3.5
Rake:0.8.7
Rack:1.0.1
Mysql:5.0.9
Ruby-mysql:mysql-2.8.1-x86-mswin
IDE:RubyMine2.0.1
Êý¾Ý¿â×¼±¸£º
database:dbdevelopment
user:crystal
password:crystal
Ò»¡¢´´½¨RubyÏîÄ¿RorTest
¶þ¡¢ÐÞ¸Ädatabase.yml
ÕâÀïÖ»ÆôÓÃdevelopment»·¾³Êý¾Ý¿â£¬ÐÞ¸ÄÅäÖÃÎļþÈçÏ£º
dev ......
RESTfulµÄ»¯Éí----resource
µ±È»£¬¹â°ÑRESTfulºÍresource³¶µ½Ò»ÆðËƺõÏ൱ÏÁÒ壬ÔÚRailsÖУ¬ActionController::Resources³éÏóÁËRESTÖеÄResource£¬ÕâÀÎÒ²»Ì¸RESTµÄÏà¹Ø¸ÅÄÍøÉÏ×ÊÁÏÒ»´óÛç¡£ÎÒÃǾÍÀ´¿´¿´RailsÖÐÊÇÈçºÎͨ¹ýResourceÀ´ÇáËÉ£¬¼ò±ãµÄÍê³ÉRESTfulÓ¦Óõİɡ£
resources.rb
Ô´´úÂë ......
ruby³£¹æ·ÃÎÊaccessÊý¾Ý¿âµÄ·½·¨Ó¦¸ÃÊÇʹÓÃDBI¿â
£º
require 'dbi'
DBI.connect("DBI:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;")
¿ÉÊÇ
¼òµ¥³¢ÊÔÖ®ºóûÄܳɹ¦£¬ÌáʾÕÒ²»µ½Çý¶¯Æ÷ADO,ÀÁµÃÔÙÊÔ£¬ËìÕÒÆäËû·½·¨¡£
Ò»·¬ËÑË÷Ö®ºó£¬·¢ÏÖ¿ÉÒÔÓÃWIN32OLEÀ´·ÃÎÊaccess,дһ¸ö¼òµ¥µÄÀà°ü×°Ö®:
......
require 'open-uri'
$NAME_CHARS= (?a..?z).to_a+(?0..?9).to_a
def is_name_used(name)
str=open('http://passport.csdn.net/UserExist.aspx?UserName='+name)
str=str.read
#str=str.encode('GBK','utf-8')
return true if str[/Red/]
end
def enum_names(len=2)
return if len<2
f=File.open(' ......