¼Ç¼ÏÂ×Ô¼ºUbunt 10.04 ´î½¨ruby on rails»·¾³
1¡¢°²×°ubuntu
һ·next£¬¼Çס°²×°Ó¢Îİ档´ý°²×°Íê±Ïºó£¬Ê×ÏÈÑ¡Ôñ“Èí¼þÔ´”£¬ÏµÍ³--ϵͳ¹ÜÀí-Èí¼þÔ´£¬¹úÄÚÒ»°ãÑ¡ÔñµÄÊÇ£ºhttp://ubuntu.cn99.com/ubuntu;½Ó×Ű²×°ÖÐÎİü£¬Ñ¡ÔñÈí¼þÔ´¾ÍÊÇΪÁËÏÂÔØÈí¼þµÄËٶȸü¿ì£¬°²×°Íê³ÉºóÖØÆôubuntu£¬ÖØÆôºó»áÌáʾÊÇ·ñ¸Ä±äijЩÎļþ¼ÐÃû³Æ£¬Ñ¡Ôñ“·ñ”£¬·Àֹϵͳ¶ÔÖÐÎÄÖ§³ÖÒý·¢µÄÎÊÌâ¡£
2¡¢¸üÐÂϵͳÈí¼þ
sudo apt-get update
3¡¢°²×°Ruby
sudo apt-get install ruby
4¡¢°²×°gem
sudo apt-get install rubygems
sudo gem update
5¡¢°²×°rails
sudo apt-get install rails
6¡¢°²×°mysql
sudo apt-get install mysql-server
µ±ÊäÈëÖ¸Ásu Òâͼ½øÈëunix²Ù¿Ømysqlʱ£¬ÌáʾÊäÈëÃÜÂ룬ÈôÌáʾʧ°Ü£¬ÔòÐÞ¸ÄÃÜÂ룬ÊäÈësudo passwd root£¬ÊäÈëÐÂÃÜÂ룬ȷÈÏ
7¡¢°²×°jdk£¨Æäʵ¾ÍÊǽâѹ£©
ÏÂÔØjdk£ºhttp://java.sun.com/javase/downloads/index.jsp£¬ÎÒÏÂÔØµÄÊÇjdk-6u20-linux-i586.bin
½¨Á¢Ä¿±êĿ¼£ºsudo mkdir /usr/lib/jvm
cd jdkµÄÎļþĿ¼£¨±ÈÈ磺cd Downloads£©
¿½±´Îļþ£ºsudo cp ./jdk-6u20-linux-i586.bin /usr/lib/jvm
cd Îļþ¿½±´ºóÎļþ¼Ð£ºcd /usr/lib/jvm
Ìí¼ÓÖ´ÐÐȨÏÞ£ºsudo chmod +x jdk-6u20-linux-i586.bin
Ö´ÐУºsudo ./jdk-6u20-linux-i586.bin
½ÓמÍÊÇÒ»¶ÑµÄÐÒ飬һ·¿Õ¸ñ£¬Ö±µ½³öÏÖѯÎÊ£¬×ÔÈ»ÊäÈ룺yes»Ø³µ¾Í¿ªÊ¼°²×°£»
°²×°ºóµÄJDK¾ÍÔÚ/usr/lib/jvm/jdk1.6.0_20Ŀ¼Ï£»
ͨ¹ýgeditÉèÖû·¾³±äÁ¿£ºsudo gedit /etc/profile
ÔÚÎļþµÄ×îºó¼ÓÉÏ£º
export JAVA_HOME="/usr/lib/jvm/jdk1.6.0_20"
export JRE_HOME="$JAVA_HOME/jre"
export CLASSPATH=".:$JAVA_HOME/lib:$JRE_HOME/lib"
PATH="$PATH:$JAVA_HOME/bin:$JRE_HOME/bin"
±£´æÍ˳ö£»
ʹÓãºsource /etc/profile ÖØÐ¼ÓÔØ
²âÊÔÏ£ºjava -version
³öÏÖ£ºjava version "1.6.0_20".......¹§Ï²jdk°²×°³É¹¦£»
8¡¢ÏÂÔØ°²×°netbeans
ÏÂÔØµØÖ·£ºhttp://netbeans.org/downloads/index.html
ÏÂÔØºóÌí¼ÓȨÏÞ£ºsudo chmod +x netbeans-6.8-ml-linux.sh
°²×°£ºsudo ./netbeans-6.8-ml-linux.sh
ʣϵľͺܼòµ¥£¬¶¼ÊÇͼÐλ¯½çÃæ£»
Ïà¹ØÎĵµ£º
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(' ......
Ruby ÀàµÄ¼Ì³Ð
¹Ø¼ü×Ö: Ruby ÀàµÄ¼Ì³Ð
Ò»¡¢ÆÕͨ·½Ê½µÄ¼Ì³Ð
RubyÖ»Ö§³Öµ¥¼Ì³Ð
ruby ´úÂë
class
Child < Father
......
end
ObjectÊÇËùÓÐÀàµÄÊ¼×æ£¬²¢ÇÒObjectµÄʵÀý·½·¨ ......
¿ª·¢»·¾³
Ruby: Ruby1.9.1
Rails: Rails2.3.5
Mysql:Mysql5.0.9
Driver:mysql-2.8.1-x86-mingw32.gem
IDE:Rubymine2.0.1
Ò»¡¢´´½¨Êý¾Ý±íUsers
ÀûÓÃRubyMine×Ô´øµÄScaffold¹¤¾ß´´½¨Êý¾Ý±íUsers£¬Ò²¿ÉÒÔÊÖ¶¯´´½¨
¶þ¡¢´´½¨ControllerºÍView
RubyÏîÄ¿—>ÓÒ¼ü—>Create Model
Íê³Éºó½«×Ô¶¯Éú³ÉÏàÓ¦µÄÎ ......
http://www.robertsosinski.com/2008/12/21/understanding-ruby-blocks-procs-and-lambdas/
Understanding Ruby Blocks, Procs and Lambdas
Blocks, Procs and lambdas (referred to as closures
in Computer Science) are one of the most powerful aspects of Ruby, and
also one of the most misunderstood. This ......
ÓÐÒ»¸öȫеÄÏîÄ¿£¬ÒòΪ¿¼Âǵ½½«À´µÄÊý¾ÝÀ©Õ¹ÐÔÄÜ£¬ËùÒÔ¿¼ÂÇÓÃCassandra×öÊý¾Ý´æ´¢£¬Ç°¶ËÓÃLighttpd + FastCGI + Rails¡£ÔÚʹÓÃCassandraµÄʱºò£¬¾õµÃÓÐһЩ¶«Î÷¿ÉÄÜ´ó¼Ò¶¼ÐèÒª£¬¾ÍдÁËÒ»¸ö¼òµ¥µÄÖ¸ÄÏ¡£ÒòΪÄÚÈݱȽϳ¤£¨16Ò³£©£¬¾ÍŪÁ˸öPDFÎļþ¸ø´ó¼ÒÏÂÔØ¡£
Cassandra in Action with Twitter's Ruby Client.pdf
Èç¹ûÏÂÔ ......