Message Boards Message Boards

1
|
16294 Views
|
13 Replies
|
11 Total Likes
View groups...
Share
Share this post:

Deploy a dynamic notebook to the Wolfram Cloud?

POSTED BY: Jorge Manrique
13 Replies
POSTED BY: Imre Pazsit

Hello Imre, I would do something like this (where you might want to be careful with the additional trick "?_view=frameless" in order to get more interactivity, since it also needs more cloud credits). Rolf

Clear[f1, f2, q1, q2, \[Beta], \[Nu], m]; \[Nu] = 2.42; m = 5; 
f1[z_, \[Beta]_] := (1 - (1/5)*(\[Nu]*(1 - \[Beta]))*(1 - z))^5; 
f2[z_, \[Beta]_] := 1 - \[Nu]*\[Beta]*(1 - z); 
q1[z_, \[Beta]_, \[Rho]_] := f1[z, \[Beta]]/(\[Nu]*(1 - \[Rho])) + 1 - 1/(\[Nu]*(1 - \[Rho])); 
q2[z_, \[Beta]_, \[Rho]_] := f2[z, \[Beta]]/(\[Nu]*(1 - \[Rho])) + 1 - 1/(\[Nu]*(1 - \[Rho])); 
dyn = Manipulate[Plot[{y, q1[y, \[Beta], \[Rho]]*q2[y, \[Beta], \[Rho]]}, {y, 0, 1}, 
    BaseStyle -> {FontFamily -> "Helvetica", FontSize -> 16, 
      FontWeight -> "Plain"}], {\[Beta], 0., 100*0.0065}, 
   {\[Rho], 0, 1 - 1/\[Nu]}, SaveDefinitions -> True]
CloudDeploy[dyn, CloudObject["dynamic.nb?_view=frameless"], 
  Permissions -> {All -> {"Read", "Interact", "Evaluate"}}]
POSTED BY: Rolf Mertig
Attachments:
POSTED BY: Imre Pazsit

One option is to create a duplicate version of the notebook that will be for other users. In that notebook, you can delete the input cell (click on the cell bracket, then delete key), leaving only the output cell.

Programmatically, you can deploy just the output cell by doing something like this:

CloudDeploy[Notebook[{Cell[ToBoxes@Manipulate[Plot[Sin[k x],{x,-Pi,Pi}],{k,1,2}],"Output"]}], CloudObject["dyn.nb"], Permissions-> {All->{"Read","Interact"}}]
POSTED BY: Jorge Manrique

One option is to create a duplicate version of the notebook that will be for other users. In that notebook, you can delete the input cell (click on the cell bracket, then delete key), leaving only the output cell.

Programmatically, you can deploy just the output cell by doing something like this:

CloudDeploy[Notebook[{Cell[ToBoxes@Manipulate[Plot[Sin[k x],{x,-Pi,Pi}],{k,1,2}],"Output"]}], CloudObject["dyn.nb"], Permissions-> {All->{"Read","Interact"}}]
POSTED BY: Chad Knutson

I did not know that I can delete the input without affecting the output.
That's the solution, thanks agai

POSTED BY: Jorge Manrique

Permissions are flexible. In my example above, I used 'All' for the list of users. This means everybody, whether they have an account or not (or are not logged in to the Wolfram Cloud). Here is an example of a deployed nb that can be viewed by everyone. They are also allowed to interact with the manipulate and evaluate the input cell [However, there appears to be a bug preventing this from working. I will investigate that further]:

CloudDeploy[
   Notebook[{Cell[ToBoxes@Manipulate[Plot[Sin[k x],{x,-Pi,Pi}],{k,1,2}],"Input"], Cell["10+10","Input"]}], 
   CloudObject["dynamic.nb"], 
   Permissions->{All->{"Read","Interact","Evaluate"}}
]

If you have already deployed the notebook, you could use SetPermissions on the CloudObject:

SetPermissions[CloudObject["dynamic.nb"],{All->{"Read","Interact","Evaluate","CellCreate"}}]

If you want a list of users to view the nb, try something like this:

SetPermissions[CloudObject["dynamic.nb"], {{"boo@foo.com", "foo@foo.com"} -> {"Read", "Interact", "Evaluate"}}]
POSTED BY: Chad Knutson

Hello Chad, now it works without entering any userid.
I still wish that the dynamic code (Manipulate, DynamicModule, etc,) can not be seen.
I hide it (only the output can be seen) but it can be opened with double click on the cell right bracket.
I can not find how to avoid it with "Permissions", can it be avoided?

POSTED BY: Jorge Manrique

Hello Chad, now it works without entering any userid.
I still wish that the dynamic code (Manipulate, DynamicModule, etc,) can not be seen.
I hide it (only the output can be seen) but it can be opened with double click on the cell right bracket.
I can not find how to avoid it with "Permissions", can it be avoided?

POSTED BY: Jorge Manrique

The 'Home' folder in the cloud interface is misleading. That folder is actually your root directory ($CloudRootDirectory). I suspect that your notebook can be found with this evaluation:

CloudObject["mynb.nb"]

You can get a list of the files in your current cloud directory (default is $CloudRootDirectory, and it can be changed with the SetCloudDirectory function) by evaluating

objs=CloudObjects[];
CloudObjectInformation /@ objs
POSTED BY: Chad Knutson

Thanks Chad, now it works.
Another question: can my nb file only be seen and / or executed by another cloud user?
I ask because when I use the URL requires entering userid and password
What I want is to make it public to anyone who has the URL, is it possible?

POSTED BY: Jorge Manrique

You can edit the deployed notebook because you are its owner. The Wolfram Cloud has a number of settings that determine the allowed interactions of other users. See the Permissions documentation page for more details. Here, I just note a few of them: "Evaluate" would enable a user to do a shift-enter evaluation of a cell. "Interact" allows a user to change dynamic settings.

To update the permissions for your notebook, you evaluate something like this (either in a cloud notebook or a desktop Mathematica notebook):

SetPermissions[CloudObject[- your cloud object name or url-], {All->{"Evaluate", "Interact"}}]

Wolfram Language also has PermissionsGroups for a group of users, or you could have a list of usernames (instead of 'All') that would have these permissions.

POSTED BY: Chad Knutson

Hi Chad, thanks for your help.
I did the following:

In[10]:= CloudObject["/home/mynb.nb"]  
Out[10]= CloudObject["https://www.wolframcloud.com/objects/user-9c1598c7-xxxx-yyyy-bf3f-82b79605c5fc/home/mynb.nb"]  
In[11]:= CloudObjectInformation[%]  
Out[11]= $Failed  

I do not know what I'm doing wrong.

POSTED BY: Jorge Manrique
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract