This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PythonistaConsoleTests.py | |
# This script uses the custom console module and all exposed methods. | |
import console | |
# Clears all content from the console. | |
console.clear() | |
console.show_activity() | |
# Display a clickable web link which is opened in default browser or a specific one | |
# for atypical protocols. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console | |
import speech | |
title = "Text 2 Speech" | |
message1 = 'This Text to Speech application will speak the words you enter.' | |
speech.say(message1, "en-US", 0.2) | |
message2 = "Enter the text you want me to say, then click the 'Speak it!' button" | |
speech.say(message2, "en-US", 0.2) | |
textToSpeak = console.input_alert(title, message2,"Hello!","Speak it!") | |
speech.say(textToSpeak, "en-US", 0.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
HttpServetInvocationRequests.py | |
This script aims to demonstrate the same servlet invocation using a basic | |
REST architecture but instead of using the urllib2 which is part of the | |
standard Python library it uses Requests (which Pythonista supports) | |
library which is intended to be far less verbose and a much simpler api. | |
The target servlet represents the entry point of any sevice or extension | |
of the web server. in this simple use case it simply prepares a Java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
HttpServletInvocationTests.py | |
A simple test harness to invoke servlet on web server to provide a simple | |
REST architectured service, in this simple test case a servlet that simply | |
returns the string format of a Java Date object instance. this is chosen | |
because of its simplicity but also because re-running it clearly shows | |
that the output is dynamic and not static and so fits nicely with the | |
REST architecture I am attempting to build serverside and the REST client | |
running on the mobile device. for this test case/Usecase I am using |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
RestTimeClient.py | |
This script provides s simple one-function REST client to a "Date and Time | |
Service" running as as REST service on a remote server. It uses the Requests | |
api and the various alert dialogs in the Pythonista console module to both | |
get input and recieive output from thid 'service'. in addition it uses the | |
clickable link method of the same console module to invoke the same service | |
whose output is simply written to the console. Thus it provides two simple | |
frameworks to build REST clients for ios. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console # for clear() method | |
# Notice you can list multiple files/compostion units with a single from..import statement. | |
# if the package is small you can accomplish same thing with: | |
# from calc import *. For a large package that you are importing a small subset, it is probably | |
# more efficient to import individual files either as below or with multiple imports, very similar | |
# to the way its done in Java. | |
from calc import add, subtract, multiply, divide | |
#from calc import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import console # for clear() method | |
# Notice you can list multiple files/compostion units with a single from..import statement. | |
# if the package is small you can accomplish same thing with: | |
# from calc import *. For a large package that you are importing a small subset, it is probably | |
# more efficient to import individual files either as below or with multiple imports, very similar | |
# to the way its done in Java. | |
from calc import add, subtract, multiply, divide | |
#from calc import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
test_aima.py - this is a simple test harness to test making a module | |
out of the aima python library (the library used in the book "Artificial | |
Intelligence - A Modern Approach, 3rd Edition, 2010") then calling a | |
single method in the logic.py composition unit in a Pythonista script. | |
If successful, I plan to do further experiments of machine learning. Note | |
that aima python is a pure python module with no special dependencies and | |
therefore is a module Pythonista can currently handle without numpy and | |
scipy which are not pure python libraries and Pythonista v1.4 cannot | |
make use of modules that have non-python dependencies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HelloWorld |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
ImportNltkData.py - This scriot is a wrapper to invoke the NLTK downloader | |
in an interactive commanline format. It will first try to, by default, call | |
the graphical downloader, but once it finds no support for the graphical | |
mode it, which is currently the case for Pythonista, it falls back to the | |
non-graphical, interactive mode which is still quite useful to list and | |
download some or all of the data sets or copora. When the downloader | |
comes up it presents the following to the user: | |
<open file 'NLTK_DATA', mode 'r' at 0x5c7c338> |
OlderNewer