4
$\begingroup$

I don't know if I have asked the question the right way:

As CDF is essentially a simple text file, I would like to create it "on the fly" without saving it to the hard drive.

I would like to give a little bit of background: I process SQL data within Mathematica an create a little CDF containing some animated graphics and tables. Currently, the process is triggered from the SQL server and the resulting CDF is saved back to the database in compressed, binary form. The CDF is embedded into the web application as a popup.

This is my code (example):

deployobj = 
  Manipulate[
   Column[{Rationalize[Pi, 10^-n], N[Rationalize[Pi, 10^-n], 48], 
     N[Abs[Pi - Rationalize[Pi, 10^-n]], 48]}, Frame -> All, 
    Spacings -> 1.5], {n, 0, 10, 1}, FrameMargins -> 50, 
   Deployed -> True, SaveDefinitions -> True];
file = ToFileName[{$TemporaryDirectory}, "CDF_Embedded.cdf"];
CDFDeploy[file, deployobj];
fnMyExportToSQLFunction[Import[file, "Text"]]

The code works well. Is there any way to create the CDF "on the fly" without saving it to the hdd? Thanks!

$\endgroup$

1 Answer 1

2
$\begingroup$

The format isn't exactly the same, notably there is extra spacing, but this seems to work:

ExportString[deployobj, "CDF"]
$\endgroup$
4
  • 1
    $\begingroup$ Thanks, it's working. But I had to remove "Deployed -> True", otherwise it was throwing an error message: "INTERNAL SELF-TEST ERROR: Files2|c|1713 Click here to find out if this problem is known, and to help improve the Wolfram System by reporting it to Wolfram Research." $\endgroup$
    – 32u-nd
    Commented Jul 22, 2014 at 14:36
  • $\begingroup$ It always throws this message, independant from "Deployed -> True" $\endgroup$
    – 32u-nd
    Commented Jul 23, 2014 at 8:22
  • $\begingroup$ @akm Is the result still correct, despite the error? Either way you should report it to Wolfram Research. $\endgroup$
    – Mr.Wizard
    Commented Jul 23, 2014 at 8:23
  • $\begingroup$ I have reported it yesterday. The result is okay. $\endgroup$
    – 32u-nd
    Commented Jul 23, 2014 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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