| Home | Trees | Indices | Help |
|---|
|
|
Misc code useful for the notebook
|
|||
|
|||
|
|||
|
|||
|
|||
Print a message on the screen suggesting that the user open their
web browser to a certain URL.
INPUT:
address -- a computer address
port -- a port number
secure -- bool (default: False); whether to put http or https
path -- path after the port.
EXAMPLES:
sage: sage.server.misc.print_open_msg('localhost', 8000, True)
****************************************************
* *
* Open your web browser to https://localhost:8000 *
* *
****************************************************
sage: sage.server.misc.print_open_msg('sagemath.org', 8000, False)
******************************************************
* *
* Open your web browser to http://sagemath.org:8000 *
* *
******************************************************
sage: sage.server.misc.print_open_msg('sagemath.org', 90, False)
****************************************************
* *
* Open your web browser to http://sagemath.org:90 *
* *
****************************************************
sage: sage.server.misc.print_open_msg('sagemath.org', 80, False)
**************************************************
* *
* Open your web browser to http://sagemath.org *
* *
**************************************************
|
Find the next port that is available to be used, where available means that
currently trying to connect to it gives a 'Connection refused'
error message.
INPUT:
start -- integer; a port number to start scanning for a new port at
max_tries -- integer (default: 100); how many ports to try
verbose -- bool (default: True); whether or not to print out info about scanning results.
OUTPUT:
an integer, or if no port is found, raises a RuntimError exception
EXAMPLES:
sage: sage.server.misc.find_next_available_port(9000, verbose=False) # random output -- depends on network
9002
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:29 2008 | http://epydoc.sourceforge.net |