从 webMathematica 提供 CDF

发布于 2024-11-05 01:51:22 字数 1111 浏览 0 评论 0原文

假设我将以下(编辑过的)代码片段输入到 Mathematica 中。

manip = Manipulate[x, {x, 0, 1}];
nb = Developer`UseFrontEnd[
    CreateDocument[manip, ShowCellBracket -> False, 
    Visible -> False]];
nbTest = ExportString[nb, "NB"] =!= $Failed;
cdfTest = ExportString[nb, "CDF"] =!= $Failed;
version = First[StringSplit[SystemInformation["Kernel", "ReleaseID"]]];
{{nbTest, cdfTest},version}

我发现 nbTest 和 cdfTest 都是 True。如果我在 webMathematica 中运行相同的命令,则 nbTest 为 True,但 cdfTest 为 False。您可以在这里看到结果:

http://www.cs.unca.edu: 8082/webMathematica/generateCDF.jsp

您可以在此处查看生成该结果的代码:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp .txt

我搜索了 webMathematica 的安全配置以找到启用 CDF 导出的方法,但没有找到。有谁知道如何启用此功能?当然,在这种情况下可能会故意禁用它。

我的目的是提供从通过 HTML 表单访问的 JSP 页面动态生成的 CDF 文档。这应该允许与文本输入结合的良好 CDF 交互。

编辑:我已经更新了服务器上的 Mathematica 版本,并更新了上面的代码,以便显示完整版本字符串。因此,我们可以看到它的版本是8.0.1。问题仍然存在。

Suppose I enter the following (edited) snippet of code into Mathematica.

manip = Manipulate[x, {x, 0, 1}];
nb = Developer`UseFrontEnd[
    CreateDocument[manip, ShowCellBracket -> False, 
    Visible -> False]];
nbTest = ExportString[nb, "NB"] =!= $Failed;
cdfTest = ExportString[nb, "CDF"] =!= $Failed;
version = First[StringSplit[SystemInformation["Kernel", "ReleaseID"]]];
{{nbTest, cdfTest},version}

I find that both nbTest and cdfTest are True. If I run the same command from within webMathematica, nbTest is True but cdfTest is False. You can see that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp

You can see the code that generates that result here:

http://www.cs.unca.edu:8082/webMathematica/generateCDF.jsp.txt

I have searched the security configuration of webMathematica to find a way to enable CDF export but have found none. Does anyone know a way to enable this? Of course, it might be disabled in this context intentionally.

My intention is to serve CDF documents generated dynamically from a JSP page accessed via an HTML form. This should allow nice CDF interaction in conjunction with textual input.

Edit: I've updated the version of Mathematica on our server and updated the code above so that the full version string appears. Thus, we can see that it is version 8.0.1. The problem persists.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谷夏 2024-11-12 01:51:22

马克,

您可以尝试将 ExportString[ ..., "CDF" ] 包装在UsingFrontEnd 中,看看是否有帮助?

C:\Users\arnoudb>math.exe
Mathematica 8.0 for Microsoft Windows (64-bit)
Copyright 1988-2011 Wolfram Research, Inc.

In[1]:= nb = CreateDocument[ Manipulate[x,{x,0,1}] ] // UsingFrontEnd

Out[1]= -NotebookObject-

In[2]:= ExportString[ nb, "CDF" ]

FrontEndObject::notavail:
   A front end is not available; certain operations require a front end.

Export::nofe: A front end is not available; export of CDF
     requires a front end.

Out[2]= $Failed

In[3]:= ExportString[ nb, "CDF" ] // UsingFrontEnd // Head

Out[3]= String

In[4]:= $Version

Out[4]= 8.0 for Microsoft Windows (64-bit) (October 7, 2011)

In[5]:= $ReleaseNumber

Out[5]= 4

Mark,

Could you try wrapping the ExportString[ ..., "CDF" ] in UsingFrontEnd and see if that helps?

C:\Users\arnoudb>math.exe
Mathematica 8.0 for Microsoft Windows (64-bit)
Copyright 1988-2011 Wolfram Research, Inc.

In[1]:= nb = CreateDocument[ Manipulate[x,{x,0,1}] ] // UsingFrontEnd

Out[1]= -NotebookObject-

In[2]:= ExportString[ nb, "CDF" ]

FrontEndObject::notavail:
   A front end is not available; certain operations require a front end.

Export::nofe: A front end is not available; export of CDF
     requires a front end.

Out[2]= $Failed

In[3]:= ExportString[ nb, "CDF" ] // UsingFrontEnd // Head

Out[3]= String

In[4]:= $Version

Out[4]= 8.0 for Microsoft Windows (64-bit) (October 7, 2011)

In[5]:= $ReleaseNumber

Out[5]= 4
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文