Çë½ÌRubyµÄÒ»¸öÎÊÌâ¡£
RubyµÄÒ»¸ö¹ØÓÚÇóÊý×éµÄËùÓÐ×Ó¼¯µÄ³ÌÐò£¬
ÏÂÃæµÄforÑ»·ÖеĶÔÏóÇø¼äÅжϣ¬»áÐÞ¸ÄjµÄÖµÂ𣿻¹ÓÐj+a..j+bµÄ¶ÔÏóÇø¼äÊÇÔõô±ä»¯µÄ£¿
ÎÒÔö¼Ó´òÓ¡¿´ÖµµÄ±ä»¯±È½ÏÆæ¹Ö¡¡
class Array
def powerset
num = 2**size
ps = Array.new(num, [])
self.each_index do |i|
a = 2**i
b = 2**(i+1) - 1
j = 0
while j < num-1
for j in j+a..j+b
ps[j] += [self[i]]
end
j += 1
end
end
ps
end
end
x = [1, 2, 3]
y = x.powerset
p y
j+a..j+b ÊÇÒ»¸öÇø¼ä¡£ÔÚrubyÖУ¬Èç¹ûÄãÏë´Ó1µ½10Ñ»·
¾ÍÊÇ1..10.each
Ϊʲô»áÕâÑù£¬ÒòΪÔÚrubyÖÐËùÓÐÄÚÈݶ¼±»¿´×÷¶ÔÏó£¬ËùÒÔ³öÏÖÄã¸Ð¾õÆæ¹ÖµÄµØ·½¡£
j+a..j+bÔÚʲôʱºò¼ÆËãÄØ?ÿ´ÎjÖµµÄ±ä»¯¶¼»áÒýÆðÇø¼äµÄ¸Ä±äÂð?
Õâ¸öµØ·½±È½ÏÄÑÒÔÀí½â¡£
ÒѾÃ÷°×ÁË£¬¶àл£¡
´úÂëÊÇThe Ruby WayÖеÄÀý×Ó¡£
RubyÖеÄforÀàËƵü´úÆ÷£¬ÏȼÆËãÇø¼ä±í´ïʽµÄÖµ£¬½«Çø¼äµÄÿ¸öÖµ¸³¸øÑ»·±äÁ¿£¬ÔÙÖ´ÐÐÑ»·Ìå¡£
ÖØÒªµÄÊÇ£ºÑ»·±äÁ¿²»ÊÇÑ»·µÄ¾Ö²¿±äÁ¿£¬Í˳öÑ»·ºó£¬ÈÔÈ»ÓÐÒâÒå¡£Òò´ËÔì³ÉÁËÀý×ÓÖеÄj±äÁ¿µÄ±ä»¯¡£
¸Ð¾õRubyµÄForÑ»·ºÍC/C++ÍêÈ«ÊÇåÄÒìµÄ¡£
Ïà¹ØÎÊ´ð£º
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
¸øJavascriptºÍRuby¿ª¸öÂÛ̳רÀ¸°É!
JavascriptÓÐרÀ¸µÄ£ºhttp://forum.csdn.net/SList/JavaScript
×ð¾´µÄÓû§deping_chen£¬ÄúºÃ£º ......
ÐÂÄê¸Õ¿ªÊ¼,ÒѾÓÐһЩÉúÃ͵ÄÅóÓÑÒª¿ªÊ¼ÐµÄÖ°³¡ÉúÑÄÁË,
²»ÖªµÀ»á²»»áÓöµ½ÕâÑùµÄÎÊÌâ: ÏëÕÒÒ»·ÝRuby on railsµÄ¹¤×÷,ÎÒÓ¦¸ÃÖªµÀÄÄЩ֪ʶ ?
»¹ºÃ,ÎÒ²¢²»ÊÇÏëÖ¸µãÄãʲô,Ö»ÊÇÏë°´ÎÒµÄ˼ά·½Ê½Õ¹ ......
ÎÒÔÚruby on railsÉÏÖ´ÐÐϵͳÃüÁµ«ÊǸÃϵͳÃüÁÔÚÎÒĬÈϵÄ·¾¶ÉÏÖ´Ðеģ¬¼´/var/www/my¡£ÏÖÔÚÎÒÓÃrubyÓïÑÔ±à³Ì£¬¿É´´½¨ÁËÒ»¸öÐÂĿ¼aaa£¨system "mkdir aaa"¼´¿É£©£¬µ«ÊÇÎÒ²»ÄܽøÈëaaaĿ¼Ï½øÐвÙ×÷ ......
require 'app/configuration'
module RubyAMF
module Configuration
#set the service path used in all requests
# RubyAMF::App::RequestStore.service_p ......
ÎÒÏÖÔÚ²»µÃ²»ÃæÁÙÒ»¸öÑ¡Ôñ£º A£¬Ìø²Û¼ÌÐø×öJ2EE. B,תÐÍ×örailsµÄ¿ª·¢
ÔÚй«Ë¾¹¤×÷ÒѾ°ëÄ꣬Õâ±ßµÄ·ÕΧ±È½ÏÇáËÉÓä¿ì£¬µ«ÊÇÎÒ¸ºÔðµÄÒ»¸öJavaÏîÄ¿ÒѾÉÏÏߣ¬°´ÕÕpmµÄÒªÇó£¬ÈÃÎÒתÐÍ×örails¿ª·¢¡£¾ÍÎÒѧϰrailsµÄ¹ý³ ......