I have:

Fence[content_, length_] := Column[{
   Grid[Partition[Characters[content], UpTo[length]]],
          UpTo[length]], {Ceiling[Length[Characters[content]]/length],
           length}, "@@"]]], # != "@@" &]}]
Mani[content_] := 
 Manipulate[Fence[content, x], {x, 1, Length[Characters[content]], 1}]

Then test it in my desktop Mathematica and everything goes well:

enter image description here

So I deploy:

CloudDeploy[Mani["0123456789"], Permissions -> "Public"]

But it seems doesn't evaluate my function(Fence):

enter image description here


Documentation and Details ans Options section for CloudDeploy are saying:

CloudDeploy[expr,...] automatically deploys all definitions needed to evaluate expr, much like CloudSave.

and as we can see, it's not the case here. Or, it's a feature of Manipulate which boxes definitions are got by FrontEnd so maybe evaluation doesn't apply here.

At the end, you can force them to be remembered by using SaveDefinitions:

Mani[content_] :=  Manipulate[
  Column@{Fence[content, x], DownValues@Fence}, 
  {x, 1, Length[Characters[content]], 1}, 
  SaveDefinitions -> True

enter image description here

  • $\begingroup$ Thanks! I find you changed my code a little(Looks cleaner than mine). Could you please post it in your answer? $\endgroup$ – Sayakiss Jan 24 '16 at 9:11
  • $\begingroup$ @Sayakiss I only added Column with Fence definitions for preview. $\endgroup$ – Kuba Jan 24 '16 at 9:16
  • $\begingroup$ I find my cloud app is very slow, how to optimize my code to get an more fluent app? $\endgroup$ – Sayakiss Jan 24 '16 at 9:16
  • $\begingroup$ @Sayakiss You can't, each time something is meant to be updated it has to call cloud and send results to you. $\endgroup$ – Kuba Jan 24 '16 at 9:16
  • 1
    $\begingroup$ It's really disappointing... I think I should deploy a simple HTML page with a single JavaScript to do that task.. $\endgroup$ – Sayakiss Jan 24 '16 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.