'Program/RUBY'에 해당되는 글 6건
- 2007/08/07 Test-First Development for Rails
- 2007/07/10 Ajax on Rails
- 2007/05/19 Ruby를 이용한 Directory 보는 구문
- 2007/05/07 Ruby, ADO 이용한 SQL Server 연결
- 2007/05/06 Ruby App. CD-ROM 열기
- 2007/04/29 루비(Ruby) 로 초간단 프로그램 작성 (2)
http://topfunky.com/clients/peepcode/previews/peepcode-004-testing-tips.mov
http://topfunky.com/clients/peepcode/REST-preview.mov
Test-first development can improve your workflow, improve the quality of your software, and give you confidence.
If you have looked at the “test” directory sitting at the bottom of your Rails applications and have wondered what it’s there for, this is the screencast for you!
This screencast walks through the basics of writing a simple application with the principles of test-first and behavior-driven development. You’ll use the features already built into Rails and learn how to extend it for your own needs, too.
The download includes the actual code discussed in the screencast (recently updated for Rails 1.2.2). Rails 1.2.2 is used for the project but most of the content applies to any current version of Rails.
NOTE: Advanced or cutting edge topics such as rSpec and Test::Rails are not discussed in this screencast but will be covered in a future episode.
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |
자주보는 Ajax 관련된 사설입니다.
Ajax on Rails 시간날 때 한번 해석해 보시길..
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |
# directory access
# list all files but .*/*~/*.o
dirp = Dir.open(".")
for f in dirp
case f
when /^\./, /~$/, /\.o/
# do not print
else
print f, "\n"
end
end
dirp.close
PHP 할때같은 기분이 든다.
상당히 짧은 코드
정규표현식도 바로 사용하는 것이 참 마음에 든다.
.*과 *~, *.o는 보안상 제외시킨다.
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |
RUBY로 win32 OLE 를 이용해 ADO 연결하는 방법을 아래 소개합니다.
출처 : http://rubyonwindows.blogspot.com/search/label/sqlserver
require 'win32ole'
class SqlServer
# This class manages database connection and queries
attr_accessor :connection, :data, :fields
def initialize
@connection = nil
@data = nil
end
def open
# Open ADO connection to the SQL Server database
connection_string = "Provider=SQLOLEDB.1;"
connection_string << "Persist Security Info=False;"
connection_string << "User ID=USER_ID;"
connection_string << "password=PASSWORD;"
connection_string << "Initial Catalog=DATABASE;"
connection_string << "Data Source=IP_ADDRESS;"
connection_string << "Network Library=dbmssocn"
@connection = WIN32OLE.new('ADODB.Connection')
@connection.Open(connection_string)
end
def query(sql)
# Create an instance of an ADO Recordset
recordset = WIN32OLE.new('ADODB.Recordset')
# Open the recordset, using an SQL statement and the
# existing ADO connection
recordset.Open(sql, @connection)
# Create and populate an array of field names
@fields = []
recordset.Fields.each do |field|
@fields << field.Name
end
begin
# Move to the first record/row, if any exist
recordset.MoveFirst
# Grab all records
@data = recordset.GetRows
rescue
@data = []
end
recordset.Close
# An ADO Recordset's GetRows method returns an array
# of columns, so we'll use the transpose method to
# convert it to an array of rows
@data = @data.transpose
end
def close
@connection.Close
end
end
You can then use this class as follows:
db = SqlServer.new
db.open
db.query("SELECT PLAYER FROM PLAYERS WHERE TEAM = 'REDS';")
field_names = db.fields
players = db.data
db.close
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |
이하 내용은 구글의 루비 그룹에서 발췌한 내용입니다. ^ ^
CD-ROM을 여는 흥미로운 내용이 있어서 가져와봤네용~
Windows App.를 개발하실 일 있을때 사용하시면 될 것 같습니다.
On May 5, 8:15 pm, "Eder Quiñones" wrote: > Hi, anyone knows what is the problem with this function, i believe i did > everything right, but it just does not open the cd-rom, maybe the > problem is in the part "InvokeVerb". Any help would be highly > appreciated. > > def ejectDrives > > @wbem = WIN32OLE.new('WbemScripting.SWbemLocator') > @a = @wbem.ConnectServer > @b = @a.InstancesOf('Win32_LogicalDisk') > cdroms = Array.new > > @b.each do | object | > if object.Description =~ /cd/i > cdroms << object.Name > end > end > > @shell = WIN32OLE.new('Shell.Application') > > cdroms.each do | name | > > @ej1 = @shell.NameSpace(name) > @ej2 = @ej1.Self > @ej3 = @ej2.InvokeVerb("Expu&lsar") > > end > > end > > This is another version using "WMPlayer.OCX" that actually work. > > def ejectDrivesWMP > > @wmp = WIN32OLE.new('WMPlayer.OCX') > > @cdromCol = @wmp.cdromCollection > @cdromCount = @cdromCol.Count > > i = 1 > while i <= @cdromCount > @cdromCol.Item(i - 1).Eject > i += 1 > end > > end > > -- > Posted viahttp://www.ruby-forum.com/. You might try a variation of the following (where D is the CDROM drive)... WIN32OLE.new("Shell.Application").NameSpace(17).ParseName("D:\ \").InvokeVerb("E&ject") ...or perhaps... WIN32OLE.new("Shell.Application").NameSpace(17).ParseName("D:\ \").InvokeVerb("Expu&lsar") David Mullet http://rubyonwindows.blogspot.com
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |
루비로 아직 할줄 아는게 없어서
99단만 한번 짜봤다..
for i in 2..9
print i, "단\n"
for j in 1..9
print i, " * ", j, " = ", i * j, "\n"
end
print "\n"
end
역시나 짧은 코드 -_ ;;
'99단.rb' 처럼 파일로 저장한 후
ruby 99단.rb위 코멘드로 실행해 보자~
'Program > RUBY' 카테고리의 다른 글
| Test-First Development for Rails (0) | 2007/08/07 |
|---|---|
| Ajax on Rails (0) | 2007/07/10 |
| Ruby를 이용한 Directory 보는 구문 (0) | 2007/05/19 |
| Ruby, ADO 이용한 SQL Server 연결 (0) | 2007/05/07 |
| Ruby App. CD-ROM 열기 (0) | 2007/05/06 |
| 루비(Ruby) 로 초간단 프로그램 작성 (2) | 2007/04/29 |




Prev



