I am working on learning Enterprise CDF development. I developed a simple example. I am working with packages for I can encode my codes eventually. When I use Needs command and save the package in one of the folder in the Path I dont have a problem.

But when I use the following approach and save the package in the same folder as the .nb file I get an error.

Manipulate[DynamicModule[{f = Sin[x], xR = 1, xL = 0, Res = 0.4596976941318603`16}, Column[{Style["1D Definite Integral Calculator", "Function"] logo, 
Row[{"Lower Limit ", InputField[Dynamic[xL], Number]}, Spacer[5]],
 Row[{"Upper Limit ", InputField[Dynamic[xR], Number]}, 
Row[{"Function  ", InputField[Dynamic[f]]}, Spacer[20]], 
Button[Style["Calculate", Green, Bold], 
 Dynamic[Res = TFPackage`WD1Int[f, xR, xL, np, nw];]], 
Row[{"Result", InputField[Dynamic[Res], Enabled -> False]}, 
Row[{"Plot the Function ", 
  Checkbox[Dynamic[fp], {False, True}]}],
If[fp == True, 
  Dynamic[Plot[f, {x, xL, xR}, Dynamic[PlotLabel -> f], 
    ImageSize -> Full]], FieldSize -> {30, 15}]], 
Button[Mouseover[Style["http://www.wolfram.com", "Hyperlink"], 
  Style["http://www.wolfram.com", "HyperlinkActive"]], 
 NotebookLocate[{URL["http://www.wolfram.com"], None}], 
 Appearance -> None]}]], {{np, 16, "NumberFormat"}, ControlPlacement -> Bottom}, {{nw, 16, "WorkingPrecision"}, ControlPlacement -> Bottom}, Initialization :> (Get[

and the package is

BeginPackage["TFPackage`"];WD1Int::usage="";Begin["`Private`"];WD1Int[f_,xR_,xL_,np_,nw_]:=Module[{xLcheck,xRcheck},xLcheck=NumberQ[xL];xRcheck=NumberQ[xR];If[xLcheck==True&&xRcheck==True,WResultTF=SetPrecision[NIntegrate[f,{x,xL,xR},WorkingPrecision>Re[IntegerPart[nw]]],Re[IntegerPart[np]]],"Enter numeric inputs for Lower and Upper Limits"]];SetAttributes[WD1Int,{ReadProtected,Protected,Locked}];End[];EndPackage[];

and this is error

enter image description here

  • 1
    $\begingroup$ The package has to be on $Path for Needs to find it. So you have to modify $Path before Needs or put the .m file in appropriate place e.g. $UserBaseDirectory / Applications. You can also inject encoded package to the cdf, but you need: package into a CDF file and, for password protected package, [Encode->Import->StringToStream->Get ](mathematica.stackexchange.com/a/78428/5478) $\endgroup$ – Kuba Apr 23 '16 at 17:50
  • $\begingroup$ I am not sure that is my problem. I was able to follow the Wolfram tutorial with no problem and I did not make any changes in the path. Also I made a simpler example compare to mine and it worked. I will post the simple example also $\endgroup$ – Erdem Apr 25 '16 at 13:03
  • $\begingroup$ Applications path, mentioned in this video is on $Path. Are your notebook and the package on path too? Where are you opening your CDF? In FreePlayer? I suspect you are grenerating Enterprise CDFs but you don't have that info in each of your recent questions. With addition to those things, please tell us how do you export your cdf, programmatically or via menu? $\endgroup$ – Kuba Apr 26 '16 at 6:38
  • $\begingroup$ I think you are right about the path, sorry for the confusion. But when I created CDF I read in wolfram's page that having the package and CDF file in the same directory should have been enough. I need to put the package(s) under applications folder where cdf player installed and that is kind of a hassle for every CDF file. In addition having a folder where everything self contained makes much more sense than one part is there the other part is somewhere else. You are right, I am generating Enterprise CDF. I am using via menu and I am not familiar with generating programmatically. $\endgroup$ – Erdem Apr 30 '16 at 10:06
  • $\begingroup$ I updated my question $\endgroup$ – Erdem Apr 30 '16 at 17:55

Your Answer

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

Browse other questions tagged or ask your own question.