Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : Ruby

RUBY ʵÏÖSOAP

SOAP ·þÎñ¶Ë£º
#!/usr/local/bin/ruby
require 'soap/rpc/standaloneServer'
module MySOAP
 class Timer
  def now
   Time.new.strftime("%Y-%m-%d %H:%M:%S")
  end
 end
 class Add
   def add(i, j)
  return i.to_i + j.to_i
   end
 end
end
class TimeServer < SOAP::RPC::StandaloneServer
 def on_init
  time = MySOAP::Timer.new
  add = MySOAP::Add.new
  add_method(time,"now")
  add_method(add,"add")
 end
end
NS = 'http://localhost/soap'
port = 4000
svr = TimeServer.new('timer',NS,'0.0.0.0',port)
trap('INT') { svr.shutdown }
puts "My SOAP is starting... port:#{port} (Ctrl+c to quit)"
svr.start
puts "My SOAP is stop."
SOAP¿Í»§¶Ë£º
require 'soap/rpc/driver'
proxy = SOAP::RPC::Driver.new("http://localhost:4000","http://localhost/soap")
proxy.add_method('now')
proxy.add_method('add','i','j')
puts "Server time now is : #{proxy.now}" ......

ruby & rails

rails
¡¡¡¡Rails¿ò¼ÜÊ×´ÎÌá³öÊÇÔÚ2004Äê7Ô£¬ËüµÄÑз¢ÕßÊÇ26ËêµÄµ¤ÂóÈËDavid Heinemeier Hansson¡£²»Í¬ÓÚÒÑÓи´ÔÓµÄWeb ¿ª·¢¿ò¼Ü£¬RailsÊÇÒ»¸ö¸ü·ûºÏʵ¼ÊÐèÒª¶øÇÒ¸ü¸ßЧµÄWeb¿ª·¢¿ò¼Ü¡£Rails½áºÏÁËPHPÌåϵµÄÓŵ㣨¿ìËÙ¿ª·¢£©ºÍJavaÌåϵµÄÓŵ㣨³ÌÐò¹æÕû£©£¬Òò´Ë£¬RailsÔÚÆäÌá³öºó²»³¤µÄʱ¼äÀï¾ÍÊܵ½ÁËÒµÄڹ㷺µÄ¹Ø×¢¡£
¡¡¡¡2008Ä꣬Rails¹Ù·½Õ¾ÒѾ­ÍƳöRails¿ò¼Ü2.1Õýʽ°æ¡£
¡¡¡¡Rails¿ò¼ÜÖ÷ÒªÓÐÈçϵÄ6´óÌص㡣
¡¡¡¡1£®È«Õ»Ê½µÄMVC¿ò¼Ü
¡¡¡¡RailsÊÇÒ»¸öȫջʽµÄMVC¿ò¼Ü£¬»»¾ä»°Ëµ£¬Í¨¹ýRails¿ÉÒÔʵÏÖMVCģʽÖеĸ÷¸ö²ã´Î£¬²¢Ê¹ËüÃÇÎÞ·ìµØЭͬÔËתÆðÀ´¡£
¡¡¡¡ÔÚʵ¼Ê¿ª·¢Ò»¸öMVCģʽµÄWebÓ¦ÓÃÏîĿʱ£¬Èç¹ûʹÓÃJava¿ª·¢£¬ÐèÒªÓõ½Struts£¨Controller ²ã£©¡¢Hibernate£¨Model²ã£©ºÍSpring 3¸ö¿ò¼Ü£¬¶øÇÒÐèÒª¶îÍâÕûºÏ3¸ö¿ò¼Ü¿ª·¢³öµÄÄÚÈÝ¡£¶øʹÓÃRubyÓïÑÔ¿ª·¢ÏàͬµÄÏîĿʱ£¬Ö»ÐèÒªÓõ½Rails¿ò¼Ü¾Í¿ÉÒÔÍê³É¡£
¡¡¡¡2£®Ô¼¶¨ÓÅÓÚÅäÖÃ
¡¡¡¡ÎªÁË˵Ã÷¸÷¸ö¶ÔÏóÖ®¼äµÄ¹ØÁª¹Øϵ£¬Ò»°ãµÄWebÓ¦Óÿª·¢¿ò¼ÜÍùÍù²ÉÓÃдÈëXMLÅäÖÃÎļþµÄ·½·¨¡£ÕâÖÖ·½Ê½ËäÈ»¿ÉÒÔ½â¾öһЩÎÊÌ⣬µ«ÊÇÈ´´øÀ´Á˹ÜÀíÉϵĻìÂÒ¡£
¡¡¡¡Rails ¶Ô´ËµÄ̬¶ÈÊÇÔ¼¶¨ÓÅÓÚÅäÖã¬ÕâÒâζ×ÅÔÚRailsÖв»»á³öÏÖXMLÅäÖÃÎļþ¡£Rails ......

rubyµü´úÆ÷»ù´¡

“Ñ­»·”»áÓÃÔÚ³ÌÐòÖеĸ÷Öֵط½¡£¶øÔÚÑ­»·µÄµØ·½ÉÆÓÓµü´úÆ÷”£¬ÔòÊÇÊìÁ·½øÐÐRuby³ÌÐòÉè¼ÆµÄÖØÒª¹Ø¼ü¡£
²»¹ý£¬µü´úÆ÷ȷʵÓбȽϳéÏóµÄµØ·½£¬Óï·¨Ò²Óеã¹ÖÒ죨ÓÈÆäÊÇyieldµÄÓ÷¨£©£¬¹âÊÇÒÀ¿¿ÎÄ×Ö˵Ã÷¡¢¿´Ò»Á½¸öʾÀý£¬»¹ÊDz»Ì«ºÃ¶®¡£Æäʵ£¬µ±³õ±ÊÕß¿ªÊ¼Ñ§Ï°Rubyʱ¾Í¿¨ÔÚÕâÀºÜ¾Ã¶¼¸ã²»¶®¡£
ËùÒÔÔÚ±¾ÕÂÖУ¬½«Í¨¹ýºÜ¶àµÄʾÀý£¬À´ÂýÂý̽Ë÷RubyµÄµü´úÆ÷¡£
20.1   µü´úÆ÷ÓëÇø¿éµ÷ÓÃ
Ê×ÏÈÀ´ÕûÀíÒ»ÏÂÓôʺÍÊõÓï¡£ÔÚRubyÖÐ˵µ½“µü´úÆ÷”£¬Í¨³£¿ÉÄÜÓÐÁ½ÖÖÒâÒå¡£
ËùνµÄ“µü´úÆ÷”£¬±¾À´ÊÇÖ¸ÔÚ·´¸´£¨iterate£©µÄ´¦ÀíÖУ¬ÓÃÀ´¿ØÖÆ·´¸´·½Ê½Õâ¸ö“¹¦ÄÜ”¡£¶øÔÚRubyÓïÑÔÀµü´úÆ÷Ò²±íʾʵÏÖÕâ¸ö¹¦Äܵķ½·¨£¬»òÕßÕâÖÖ·½·¨µÄ½Ó¿Ú¡£
È»¶øRubyµÄµü´úÆ÷½Ó¿Ú£¬ÓÐʱºòÓÖ±»ÓÃÔÚÑ­»·ÒÔÍâµÄµØ·½£¬ÀýÈ磬ÈÃʹÓÃÕß×Ô¶¨Òå·½·¨Ò»²¿·ÖµÄ¹¦ÄÜ£¬Õâ¸öÓÃ;ÒѾ­ºÜÄѳÆ×÷Êǵü´úÆ÷ÁË¡£
Ãû³ÆÓ빦Äܲ»Ò»Ö£¬Êǵ¼ÖÂÈÝÒ׸ã»ìµÄÔ­Òò¡£ËùÒÔÓÖÓÐÈ˳ÆÕâЩʹÓõü´úÆ÷µÄÓï·¨µ«ÄÚÈݲ¢Ã»ÓнøÐз´¸´´¦ÀíµÄ¶«Î÷½Ð×ö“Çø¿é”»ò“´úÂëÇø¿é”¡£µ«ÊÇÕâÓÖºÜÈÝÒ×ÓëwhileµÈÓï¾äµÄdo¡«end²¿·ÖÄÇÖÖ³ÌÐòÓïÑԹ淶ÉϵÄÇø¿é¸ã»ì£¬Òò´ËÕâÖÖÓôʻ¹Ê ......

Ò»²½Ò»²½Ñ§Ruby(Ê®¶þ):RubyÀà

Ò»¡¢ÀàµÄ¶¨Òå¡¢ÀàµÄʵÀý·½·¨ ¶þ¡¢Ìض¨¶ÔÏóµÄ·½·¨ ÔÚRubyÀÎÒÃÇ¿ÉÒÔΪһ¸ö¶ÔÏ󵥶À¶¨Òå·½·¨ Èý¡¢Öض¨Òå·½·¨ ´ÓÏÂÃæ´úÂë¿ÉÒÔ¿´³ö£¬ºóÃæµÄ¶¨Òå»á¸²¸ÇÇ°ÃæµÄ¶¨Òå ËÄ¡¢ÖØдò¿ªÀà RubyÀïÎÒÃÇ¿ÉÒÔÔÙ´ò¿ªÒ»¸öÀ࣬ÏòÕâÀàÌí¼Ó·½·¨£¬ÓеãÏñC#ÀïµÄ·Ö²¿À࣬µ«²»ÓüÓÌرð±ê¼Ç. ÎÒÃÇÒ»°ã²»Òª²ð¿ªÀàµÄ¶¨Ò壬ÒòΪÄÇÑù²»ºÃÀí½â£¬²ð¿ªÀàµÄÒ»¸öÔ­ÒòÊǽ«ËüÃÇ·ÖÉ¢µ½¶à¸öÎļþÀï¡£ Î塢ʵÀý±äÁ¿ Õâ¸öÇ°ÃæÓÐ˵¹ý£¬ÕâÀï²¹³äһϠʵÀý±äÁ¿Ö÷ÒªÊÇÓÃÀ´¼Ç¼µ¥¸ö¶ÔÏóµÄ״̬¡£RubyµÄʵÀý±äÁ¿ÓÐÒÔÏÂÌصã ÒÔ@¿ªÍ· Ö»¶Ôµ¥¸ö¶ÔÏó¿É¼û ²»¹ÜÔÚÀàµÄÈκεط½¶¨Ò壬ÔÚ±ðµÄµØ·½Ê¹Óö¼ÊÇͬһ¸ö Áù¡¢³õʼ»¯¶ÔÏó״̬ ÀàËÆÆäËüÓïÑԵĹ¹Ô캯Êý Æß¡¢¸üºÃµÄÊôÐÔ¶Áд£¬=ºÅµÄÍþÁ¦ ÉÏÃæÎÒÃÇ¿ÉÒÔ¿´µ½¿ÉÒÔÓöàÖÖ·½·¨¶ÔÊôÐÔ¶¼Ð´²Ù×÷£¬µ«×îÊìϤºÍ·½±ãµÄ£¬»¹ÊÇÏòÆäËüÓïÑÔÒ»Ñù£¬¶ÔÊôÐÔÖ±½Ó¸³Öµ£¬È»ºó¶ÁÈ¡ Óï·¨ÌÇ Óï·¨ÌǾÍÊÇÖ¸ÌرðµÄ¹æÔò£¬²»·ûºÏ³£¹æµÄд·¨£¬RubyÌṩÁ˵÷ÓÃд·½·¨µÄÓï·¨ÌÇ£¬µ±½âÊÍÆ÷¿´µ½age = ʱ£¬»áºöÂԵȺÅÇ°ÃæµÄ¿Õ¸ñ£¬²¢ÇÒµ¥²ÎÊýµÄ·½·¨ÊÇ¿ÉÒÔÊ¡ÂÔÀ¨ºÅ£¬ËùÒÔÒ²¿ÉÒÔÕâÑù ÒòΪÓÐÁË=µÄÍþÁ¦£¬ÎÒÃÇ¿ÉÒÔÔÚ¸³ÖµÊ±×ö×Ô¼ºµÄ´¦Àí£¬ÓеãÏñ.netÀïµÄ{get;set;} °Ë¡¢×Ô¶¯Éú³ÉÊôÐ﵀ ......

¸øjsµÄÊý×éʵÏÖÒ»¸öÀàËÆrubyµÄµü´úÆ÷


·ÖΪÈçϼ¸½Ú:
·»ù±¾ÊµÏÖ
·ÔÚµü´úÖÐÒýÓÃÔ­À´µÄ¶ÔÏ󣬻òÕßÖ±½Ó¸Ä±äÊý×éµÄÖµ¶ø²»ÊÇ·µ»ØÒ»¸öÐÂÊý×é
·Ïòµü´ú´«ÈëÎÞÏÞ¶àµÄ²ÎÊý
·»ù±¾ÊµÏÖ
½ñÌìͻȻ·¢ÏÖjsµÄÊý×é´¦ÀíÆðÀ´ÕæÊÇÂé·³,´úÂëһЩ¾ÍÊÇÒ»´ó¶Ñ,Ïà±ÈÆðrubyµÄµü´úÆ÷À´ÕæÊÇÑ·É«²»ÉÙ,Ö÷ÒªÊÇҪдµÄ´úÂëÌ«¶àÁË,Ò²ÐíÊÇjsÓÐÌØÊâµÄ´¦ÀíÊý×éµÄ·½Ê½,ÕæÊÇÎÒ²»ÖªµÀ¶øÒÑ,µ«ÊÇÎÒÕæµÄÏë×Ô¼º¸øjsʵÏÖÒ»¸öÀàËÆrubyµÄµü´úÆ÷µÄ¶«¶«,¶øÇÒʵÏÖÆðÀ´Ò²²»ÄÑ,ÄǾͿªÊ¼¶¯ÊÖ°É.
ÕæµÄÓ¦¸ÃÇìÐÒjsÊǶ¯Ì¬ÓïÑÔ°¡,Èç¹ûÊǾ²Ì¬ÓïÑÔ,ʵÏÖÆðÀ´ºÜ²»·½±ã(±ð˵ҪÎÒÖØж¨ÒåÒ»¸ö¼Ì³Ð×ÔarrayµÄÀà),²»¹ýÓÃjsʵÏÖÆðÀ´¾Í¼òµ¥¶àÁË,Ö±½Ó¸øArray¶ÔÏó¼ÓÒ»¸ö·½·¨¼´¿É,ÈçÏÂ:
¶îºÇºÇ,µü´úÆ÷ÆäʵÒѾ­ÊµÏÖÁË......ºÃ¼òµ¥°¡,ÊÇ°¡,²»¹ýÕâÑùµÄÈ··½±ãÁ˲»ÉÙŶ,¿´ÏÂÃæµÄÓ÷¨¾ÍÖªµÀÁË:
Ê×ÏÈÎÒÃǶ¨ÒåÒ»¸öÊý×é:
1:Ó÷¨Ò»:
µü´úʹÓÃÿ¸öÊý×éÔªËØ:
ÉùÃ÷:ÕâÀï¿ÉÒÔËõд³É:aa.each(function(val){alert(val)});,ÒÔϵÄҲͬÀí,ΪÁËÇåÎú,·Ö¿ªÐ´µÄ 
Ö´Ðнá¹ûÊÇÒÀ´Îµ¯³öÿ¸öÊý×éÔªËصÄÖµ,ŶºÇ,¾ÍÊÇÕâô¼òµ¥,²»ÓÃд¿É¶ñµÄfor,Èç¹û´úÂëºÜ¶àµÄʱºò,Õâµã½ÚÊ¡Ò²»áÊ¡³ö²»ÉٵĴúÂëÁ¿Å¶
2:Ó÷¨¶þ:
µü´ú´¦Àíÿ¸öÊý×éÔªËز¢·µ»ØÒ»¸ö´¦ÀíºóŶÊý×é:
½á¹ûÈçºÎ?ÈçÄ ......

ruby ÖÐʹÓà Dom¼¼ÊõÀ´²éÕÒÒ³ÃæÔªËØ


ÓÐЩʱºò¿ÉÄÜ»á¸ù¾ÝһЩÓÐÏÞµÄÐÅÏ¢£¬À´²éÕÒÒ³ÃæµÄÔªËØ£¬ÕâÀï¾ÙÒ»¸öÀý×ÓÀûÓÃÒ³ÃæÎÄ×ÖÀ´²éÕÒËùÔڵıêÇ©£¬ÒÔÌÔ±¦µÄµÇ¼ҳÃæΪÀý£¬Ê¹ÓÃÒÔÏ´úÂë¿ÉÒÔʵÏÖ¸ù¾ÝÕË»§ÃûÀ´Ê¶±ð¶ÔÓ¦µÄ½ÚµãÃû³Æ£º 
require ‘watir’
#ie = Watir::IE.attach(:url, /member1.taobao.com/)
ie = Watir::IE.start(”http://member1.taobao.com/member/login.jhtml?ssl=false”)
def find_tag_by_text(ie,textName)
  all_elements = ie.document.body.all
  all_elements.each do |object|
    if object.innerText.match(textName)
      flag = false
      all_children = object.children
      #Èç¹û×Ó¶ÔÏóÆ¥Åäµ½£¬ÄÇôÍ˳ö,Í˳öºóflagΪtrue
      all_children.each do |child|
        if child.innerText.match(textName)
          flag = true
          break
        else
       &nb ......
×ܼǼÊý:146; ×ÜÒ³Êý:25; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [16] [17] [18] [19] [20] [21] 22 [23] [24] [25]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ