1:在虚拟机设置中添加两个新的磁盘,1个2G,1个5G(我挂载两个是因为另外一个我要做swap的实验,如果只用Lvm的话挂载一个5G即可) 2:登录系统,使用fdisk -l查看磁盘信息(看不到的请重启) 3:lvm管理 a)创建逻辑分区 fdisk /dev/sdc #因为磁盘是空的,所以我先创建了一个主分区玩玩,大小是1G n (新……
标签目录:旧博客迁移
以下是与标签 “旧博客迁移” 相关联的文章如何通过acl 让其他组的某个用户拥有读写权限
Fedora21启用iptables服务及使用firewalld服务注意事项
yum downgrade
shell中使用while循环ssh读取一行纪录
ruby regular Expressions
ruby block each
attr_reader,attr_writer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#!/usr/local/bin/ruby -w # class Song attr_reader :name,:artist,:duration attr_writer :name def initialize(name,artist,duration) @name = name @artist = artist @duration = duration end #same as attr_reader:name #def name # @name #end #same as attr_writer:artist def artist=(new_artist) @artist=new_artist end def to_s "Song:#@name--#@artist(#@duration)" end def duration_in_minutes @duration/60.0 end def duration_in_minutes=(new_duration) @duration = (new_duration*60).to_i end end song=Song.new("Bicyclops","Fleck",260) puts song.to_s puts song.name song.name = "abc" puts song.name puts song.duration_in_minutes song.duration_in_minutes = 6 puts song.duration_in_minutes puts song.duration puts song.artist song.artist="gaga" puts song.artist |
Reason: java.io.IOException: Failed to create dir
python 读取yahoo 天气api 获取北京天气情况
代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#!/usr/bin/env python # coding=utf-8 import urllib2 import xml.dom.minidom try: url="http://weather.yahooapis.com/forecastrss?u=c&w=2151330" request = urllib2.Request(url) response = urllib2.urlopen(request) print "Geting data from yahooapis...." data = response.read() #print data dom = xml.dom.minidom.parseString(data) root = dom.documentElement location = root.getElementsByTagName('yweather:location') city = location[0].getAttribute("city") weather_conditions=root.getElementsByTagName('yweather:condition') weather = weather_conditions[0].getAttribute('text') temp = weather_conditions[0].getAttribute('temp') print "City:",city print "weather:",weather print "temp:",temp except Exception: print("there is something wrong") |