矩陣轉置
#!/usr/bin/ruby -Kuw |
反正就是一整個好玩!!!(  ̄ c ̄)y▂ξ
矩陣轉置
#!/usr/bin/ruby -Kuw |
#!/usr/X11R6/bin/ruby -wKu
|
第一行移到最後一行
require 'csv'
|
lala
csv 欄位字串變為數值
"1,2,3".split(",").collect{ |s| s.to_i }
=> [1, 2,3]
a = [1,2,3,4]
b = a.map {|x| x*x } #b=[1, 4, 9, 16]
c = a.select {|x| x%2==0 } #c=[2,4]
d=a.inject(0){|sum,x| sum+=x**2} #d=30
tmpCounts[1]='a' elsif (/^\w/).match(articles).to_s.upcase == 'B' tmpCounts[1]='b' elsif (/^\w/).match(articles).to_s.upcase == 'C' tmpCounts[1]='c' else tmpCounts[1]='d' end |
是elsif
兩陣列比較,列出不同者
a=[1,2,3]
|
apache2+php5
sudo apt-get install apache2 php5 libapache2-mod-php5 |
sudo /etc/init.d/apache2 restart cd /var/www sudo touch index.php |
把index.html刪除
index.php的內容如下
<?php |
連線測試吧!