Python RAPID PROTOTYPING: SOFTWARE Examples of rapid prototyping in - - PowerPoint PPT Presentation

python
SMART_READER_LITE
LIVE PREVIEW

Python RAPID PROTOTYPING: SOFTWARE Examples of rapid prototyping in - - PowerPoint PPT Presentation

Python RAPID PROTOTYPING: SOFTWARE Examples of rapid prototyping in Python: pure software case studies System-dependent metrics Write a program to get basic information about the operating system status, the current load average,


slide-1
SLIDE 1

Python

RAPID PROTOTYPING: SOFTWARE

Examples of rapid prototyping in Python: pure software case studies

slide-2
SLIDE 2

System-dependent metrics

  • Write a program to get basic information about

the operating system status,

– the current load average, – the operating system version, name, architecture, – the total and the free memory

  • Suggestion

– Assume that the host operating system is Unix/Linux – The os module allows to access operating system facilities (e.g., bash commands)

3/20/2014 Python basics 2

slide-3
SLIDE 3

Text To Speech

  • Write a program to make the computer «speak»

text strings given by users on the console

  • The program must ask for new words until the

word «exit» is entered, in such a case it should greet the user by saying «Goodbye»

  • Suggestion

– check how the Google’s tts service works

  • http://translate.google.com/translate_tts?tl=en&q=hello

3/20/2014 Python basics 3

slide-4
SLIDE 4

System-independent metrics

  • Write a program to

– Provide a set of system metrics in a system- independent way

  • Start from the same values shown in the system-dependent

metrics exercise

  • Add some information on CPU and disk usage

– Monitor the CPU percentage value and trigger a vocal warning if the CPU goes over a given threshold

  • e.g., 10%
  • Suggestion

– The psutil module offers system-independent access to the O.S. Performance metrics

3/20/2014 Python basics 4

slide-5
SLIDE 5

MP3 player

  • Write a program for playing a given mp3 audio

file

  • Exploit a portable python library for playing the

music

  • Suggestion

– Use easy_install module_name to add missing modules (pyglet in our case) – Check dependencies (e.g., external services such as AVBin in our solution)

3/20/2014 Python basics 5

slide-6
SLIDE 6

Vocal mailbox

  • Write a program that

– Monitors your inbox folder for unseen messages – Provides a vocal summary of newly received messages including the message count, and for each message the sender(s) and the title

  • Suggestion

– Assume that the mail server is accessible through IMAP – The Python modules that enable mailbox access and mail reading are: imaplib and email

3/20/2014 Python basics 6

slide-7
SLIDE 7

Solutions?

  • Check exercise solutions on GitHub

– http://github.com/AmI-2014/Python-Lesson- Software

3/20/2014 Python basics 7

slide-8
SLIDE 8

Questions?

01PRD AMBIENT INTELLIGENCE: TECHNOLOGY AND DESIGN

Dario Bonino dario.bonino@polito.it