14 Sharing and Distributing Notebooks
0 (0 Likes / 0 Dislikes)
This section of Introduction
to Wolfram Notebooks
is about sharing notebooks
with other people
and distributing notebooks
publicly over the internet.
A notebook can be shared
either from a desktop application
or from the Wolfram Cloud.
This happens to be
a notebook in a web browser
that is signed into
a Wolfram Cloud Account.
At the top of this page
are buttons labeled
Share and Publish.
Share is used for sharing
the notebook with specific people
and Publish is used
for making the notebook
more publicly available.
Clicking the Share button
opens a dialog box
where you can enter
an email address.
Clicking Share
in that dialog box
puts a link to this notebook
in the Wolfram Cloud Account
that is associated
with that address
and sends an email notification
to that address.
The contents of that email
will look something like this,
with a button that can be clicked
to see the notebook.
If the owner of that account
is not already signed in
to that Wolfram Cloud Account,
clicking that button
will first bring up a dialog box
for signing in,
and after that
the notebook will be displayed
in that Wolfram Cloud Account.
Returning to the notebook
in the original account,
clicking the Publish button
brings up a different dialog box
for making the notebook
publicly available.
Clicking the Publish button
in that dialog box
opens a second dialog box
with a URL
that anyone could use
to view this notebook.
To see the notebook,
copy the URL, open a web browser
and go to
the corresponding webpage,
which displays the notebook
in a web browser.
The notebook can be viewed here
in the web browser,
and dynamic content also works,
like the controls
in this Manipulate result.
This display is not editable,
but it does include buttons
for making a copy
of the notebook
that can be edited.
For example,
clicking the Download button
would download a copy
of the notebook to the desktop,
where the copy could be opened
and edited in Wolfram Desktop,
just like any other notebook.
There was no need to sign in
to a Wolfram Cloud Account
to see this notebook,
so the notebook is currently
being viewed anonymously,
but the notebook can be copied
to a Wolfram Cloud Account
either by clicking
the sign-in button
or by clicking
the Make Your Own Copy button.
For example,
since this web browser
is not already signed in
to a Wolfram Cloud Account,
clicking
the Make Your Own Copy button
opens a dialog box
for signing in,
and after signing in
the copy is displayed
in the web browser,
where it can be edited
just like any other notebook
in this account.
As noted earlier, this notebook
can also be published or shared
from the desktop.
For example,
starting now with this notebook
on the desktop,
the notebook can be made
publicly available
by selecting Publish to Cloud
from the File menu,
which opens a dialog box
much like the dialog box
that came up earlier
for choosing a file name
and for choosing whether
or not to require a password.
Clicking the Publish button
copies the notebook
from the desktop
to the cloud and displays a URL.
As before, anyone with that URL
and a web browser
connected to the internet
could see the notebook.
The dialog box
also includes code
for embedding the notebook
in another document.
As a simple example
of how that can work,
here is a text editor
with raw HTML code
for a webpage.
The code from the dialog box
can be pasted into the HTML file
in the text editor,
then save the HTML file
and open it in a web browser,
which shows the notebook
rendered in the web browser.
This webpage also includes
a button near the bottom
that can be clicked
to download the notebook
or copy it
to a Wolfram Cloud Account.
You could also include
your own link
for downloading the notebook
directly from your computer.
Either way,
the downloaded notebook
can be displayed on the desktop
using a Wolfram Desktop
application
or using
the free Wolfram Player,
which can be downloaded from
the Wolfram Research website.
For example, this shows
the downloaded notebook
in Wolfram Player.
From the desktop,
you can also share the notebook
with specific people,
like the sharing
that was shown earlier
from my Wolfram Cloud Account.
For example,
evaluating CloudShare
with an email address
in this notebook
uploads the notebook
to Wolfram Cloud
and sends an email notification
to that address
with a link to the notebook
in the cloud.
The CloudShare function
is essentially
just a different way
of doing the same operations
that were done earlier
using the Share dialog box.
The return value
from the CloudShare function
is a cloud object expression,
which represents
the uploaded notebook.
CloudObject expressions
are useful to know about
in part because the permissions
for accessing the notebook
are stored as options
of that expression.
For example,
the Permissions option
of this CloudObject expression
includes the email address
where the notebook was shared
and a list of permissions.
This works much like
Permissions for files
and common operating systems,
where their permissions
are typically associated
with each file,
a difference here being
that you can specify
different permissions
for each individual user.
The default permissions
give Read, Write
and Execute permission
to the owner,
and permission to read
and interact with the notebook,
which permits the use
of interactive controls
in the account
where the notebook is shared.
Those permissions
can be changed.
For example, this input
gives that account read, write
and execute permission
for the notebook.
To see that notebook
in the account
where it was shared,
you could click the link
in the email notification,
but a link to that notebook
will actually already be
available in that account.
Here, for example,
is a web browser
that is logged into
that account.
Clicking either the Files button
or the My Files icon
opens a file browser
where you can navigate
to a directory of files
that have been shared with you.
Right now the most recent file
in that directory
is the notebook
that was just shared,
which you can open
for viewing in this account.
As expected from the permissions
that were set earlier,
the notebook can be viewed here
and interactive controls work
and the notebook can be edited.
The notebook cannot, however,
be shared or published,
since the notebook
is not owned by this account.
There is not a Share button
or a Publish button
at the top of this window,
but the notebook
can be duplicated here,
by choosing Duplicate
from the File menu,
which creates a new notebook.
Clicking Open new file,
opens the new notebook,
which is owned
by this Wolfram Cloud Account
and which can be shared
or published.
For example,
clicking the Share button
opens the dialog box for sharing,
where you can enter the name
of another account,
indicate edit permission
for that account
and click the Share button
to share the notebook.
One important feature
of this system
is that the shared notebook
will be a link to this notebook,
so both accounts will,
in effect,
be viewing the same notebook.
Here is that notebook
in the other account.
Since the notebook is still open
in the owner's
Wolfram Cloud Account,
this display includes a message
indicating that the file
is currently locked,
since it is already open
for editing in another account.
If the other account signs out,
then since the notebook was
shared with editing permission,
the notebook could be edited
in this account
and any changes
would affect both notebooks.
This is convenient if two
or more people are working
with the same notebook,
but you could also make
your own copy of the notebook.
That's the end of the examples
for this section.
This section is mostly about
sharing and distributing
entire notebooks,
but you can also share
pieces of notebooks.
For example, clicking this icon
within a cell
opens a menu
where you can choose
to share this cell,
which leads to a dialog box
with a URL
that can be used to view
the contents of that cell
in a web browser.
More generally,
the Wolfram Cloud
supports a whole range of tools
for putting data
and apps and APIs
and things other than notebooks
on the internet.
You can find more information
about the operations
in this section
and about all
of those other features
by following links
to cloud-related topics
in the Wolfram documentation,
starting with this guide page
on cloud functions
and deployment.