issue35 zh-CN

691 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
691
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

issue35 zh-CN

  1. 1. full circle
  2. 2. p.21 full circle Ubuntu p.30 p.10 Ubuntu p.32 p.18 MOTU p.27 p.14 p.05 p.16 Milestone/Droid p.25 p.28 Top 5 —— Android p.37
  3. 3. sudo chsh -s /path/to/binary $USER chsh -l
  4. 4. export $VARIABLE="value" [lswest@lswest-laptop:~] - [14:24:29]
  5. 5. status >>> for x in data.entries[0] version ... print x encoding ... bozo updated headers yweather_condition etag updated_parsed href links namespaces title entries summary_detail geo_lat summary guidislink title_detail link geo_long yweather_forecast id >>>type(data) <class 'feedparser.FeedParser Dict'> >>> import feedparser >>> url = "http://weather.yah ooapis.com/forecastrss?p=UKXX 0637&u=c" >>> data = feedparser.parse(u rl) >>> data >>> data.entries[0] {'updated': u'Wed, 1 Apr >>>for x in data : 2009 12:50 am BST', ... print x ... 'yweather_condition': u, feed 'updated_parsed': ...
  6. 6. from mutagen.mp3 import MP3 import os from os.path import join,getsize,exists import sys import apsw Dev Graphics Internet M/media System def MakeDataBase(): pass def S2HMS(t): CD/DVD HDD USB Drive Laptop Wireless pass def WalkThePath(musicpath): pass def error(message): pass def main(): pass def usage(): pass if __name__ == '__main__': main()
  7. 7. def error(message): print >> sys.stderr, str(message) def usage(): message = ( '==============================================n' 'mCat - Finds all *.mp3 files in a given folder (and sub-folders),n' 'tread the id3 tags, and write that information to a SQLite database.nn' 'Usage:n' 't{0} <foldername>n' 't WHERE <foldername> is the path to your MP3 files.nn' 'Author: Greg Waltersn' 'For Full Circle Magazinen' '==============================================n' ).format(sys.argv[0]) error(message) sys.exit(1)
  8. 8. def main(): global connection global cursor #---------------------------------------------- if len(sys.argv) != 2: usage() else: StartFolder = sys.argv[1] if not exists(StartFolder): # From os.path print('Path {0} does not seem to exist...Exiting.').format(StartFolder) sys.exit(1) else: print('About to work {0} folder(s):').format(StartFolder) # Create the connection and cursor. connection=apsw.Connection("mCat.db3") cursor=connection.cursor() # Make the database if it doesn't exist... MakeDataBase() # Do the actual work... WalkThePath(StartFolder) # Close the cursor and connection... Print('String that will be cursor.close() printed with {0} number of connection.close() statements”).format(replaceme # Let us know we are finished... nt values) print("FINISHED!")
  9. 9. Dev Graphics Internet M/media System CD/DVD HDD USB Drive Laptop Wireless
  10. 10. Dev Graphics Internet M/media System CD/DVD HDD USB Drive Laptop Wireless wget http://www.kegel.com/wine/win etricks
  11. 11. >>> temp = re.split(r'n',tem p) >>> temp [u, u'Current Conditions:', sh winetricks corefonts u'Haze, 13 C', u'Forecast:', vcrun6 vcrun2005 u'Thu - Rain. High: 14 Low: 9', u'Fri - Light Rain. High: 12 Low: 7', u, u'Full Forecast at Yahoo! Weather', u'(provided by The Weather Channel)'] >>>temp[2] u'Haze, 13 C' >>>summary = data.entries[0]. summary >>>import re >>>pattern = '<.+?>' >>>temp = re.sub(pattern,,sum mary) >>>temp u'nCurrent >>>temp = re.findall(u'[0- Conditions:nHaze, 13 9]+',temp[2])[0] CnForecast:nThu - Rain. >>>temp High: 14 Low: 9nFri - Light u'13' Rain. High: 12 Low: 7nn >>> Full Forecast at Yahoo! >>> temp = int(temp) Weathern(provided by The >>> temp Weather Channel)' 13
  12. 12. change_wallpaper('/home/evil nick/weather/warm.svg') ... else: ... change_wallpaper('/home/evil nick/weather/hot.svg') ... >>> def change_wallpaper(filename): ... cmd = .join(["gconftool- 2 -s /desktop/gnome/background/pi cture_filename -t string "",filename,"""]) ... os.system(cmd) ... >>> change_wallpaper('plop.jpg') >>> if (temp <0) : ... change_wallpaper('/home/evil nick/weather/freezing.svg') ... elif (temp<9) : ... change_wallpaper('/home/evil nick/weather/snow.svg') ... elif (temp<16) : ... change_wallpaper('/home/evil nick/weather/mild.svg') ... elif (temp<26): ...
  13. 13. #!/usr/bin/python # -*- coding: utf-8 -*- import feedparser,re,os def change_wallpaper(filename): cmd = .join(["gconftool-2 -s /desktop/gnome/background/picture_filename -t string "",filename,"""]) os.system(cmd) url = "http://weather.yahooapis.com/forecastrss?p=UKXX0637&u=c" data = feedparser.parse(url) # extract the summary from the data summary = data.entries[0].summary temp = re.split(r'n',re.sub('<.+?>',,summary)) temp = int(re.findall('[0-9]+',temp[2])[0]) if (temp <0) : change_wallpaper('/home/evilnick/weather/freezing.svg') elif (temp<9) : change_wallpaper('/home/evilnick/weather/snow.svg') elif (temp<16) : change_wallpaper('/home/evilnick/weather/mild.svg') elif (temp<26): change_wallpaper('/home/evilnick/weather/warm.svg') else: change_wallpaper('/home/evilnick/weather/hot.svg')
  14. 14. is presented by members of the United Kingdom’s Ubuntu Linux community. We aim is to provide current, topical information about, and for, Ubuntu Linux users the world over. We cover all aspects of Ubuntu Linux and Free Software, and appeal to everyone from the newest user to the oldest coder, from the command line to the latest GUI. Because the show is produced by the Ubuntu UK community, the podcast is covered by the Ubuntu Code of Conduct and is therefore suitable for all ages.

×