wolfram-mathematica - 从 webMathematica 提供 CDF

标签 wolfram-mathematica wolfram-cdf

假设我将以下(编辑过的)代码片段输入 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 版本。问题仍然存在。

最佳答案

马克,

您能否尝试将 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

关于wolfram-mathematica - 从 webMathematica 提供 CDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5876191/

相关文章:

wolfram-mathematica - 关于在函数之间传递数据的简单问题

wolfram-mathematica - CDF播放器互联网访问配置

variables - 在 Mathematica 中创建一个带下标的变量

c# - Mathematica 语法的解析器?

wolfram-mathematica - 如何在 Mathematica 中使用 Shapiro-Wilk 检验来检验双变量正态性?

wolfram-mathematica - 优化游戏生活

wolfram-mathematica - Mathematica中有任何简单的机制可以使模块具有持久状态吗?