Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: External packages, Manipulate, and MathPlayer

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92340] Re: External packages, Manipulate, and MathPlayer
  • From: Jeff Bryant <jmbryant12 at comcast.net>
  • Date: Sat, 27 Sep 2008 22:23:44 -0400 (EDT)
  • References: <g9qipl$4hv$1@smc.vnet.net> <200809060606.CAA19715@smc.vnet.net> <FC0D8812-2AB3-473D-A606-49DAAC521720@lemma.ca> <200809240732.DAA13678@smc.vnet.net> <gbjm9m$39p$1@smc.vnet.net>

   Yes, but you shouldn't use both SaveDefinitions and Initialization, 
the reasons are subtle. The reason is that SaveDefinitions "slurps" in 
all necessary definitions and stores the results in the output via the 
Initialization option (unformat the output to see this). This means, 
with packages, you manage to get things like *`Private`* which don't 
play nice with the security system on the upload server which doesn't 
trust such things. Also SaveDefinitions may not be able to slurp in all 
necessary definitions if the package uses things like ReadProtect, etc.

By using the Initialization option only, you are only storing the 
Needs/Get input command and not the results and so there is no problem 
with hidden contexts and the security system. These package loading 
commands get loaded at run time and aren't pre-evaluated.

In short, when using standard add-on packages, manually populate the 
Initialization option and avoid SaveDefinitions.

-Jeff Bryant
Wolfram Research, Inc.

Mitch Murphy wrote:
> for future reference to others, here's the punchline: you need to load  
> standard packages using the Initialization option of Manipulate.
> 
> Manipulate[
>   	Regress[Table[{x, 2 + b x + Random[]}, {x, 100}], {1, x}, x],
>   	{b, 1, 9, .1}, SaveDefinitions -> True,
>   	Initialization :> Needs@"LinearRegression`"
>   ]
> 
> note that only standard packages (BarCharts, LinearRegression, ...)  
> are available for nbp files intended for the mathematica player.
> 
> also, the option is given using ":>", not "->".
> 
> cheers,
> Mitch
> 
> 
> On Sep 24, 2008, at 03:32, Jeff Bryant wrote:
> 
>> The following should be useful. Near the end, there is an advanced
>> section that deals with this topic.
>>
>> http://library.wolfram.com/infocenter/Conferences/7138/
>>
>> Hope this helps.
>> -Jeff Bryant
>> Wolfram Research, Inc.
>>
>> Mitch Murphy wrote:
>>> On Sep 06, 2008, at 02:06, Jeff Bryant wrote:
>>>
>>>>  I'm not sure from your message exactly what form your authoring
>>>> notebook is in, but some elements of your message seem suspect.
>>>>
>>>> 1) Packages require special attention in Demonstrations.
>>>>
>>> please provide details. i couldn't find documentation for this  
>>> topic on
>>> wolfram website.
>>>
>>>
>>>
>>>> 2) All code, except that which ships with Mathematica, must reside  
>>>> in
>>>> the author notebook itself. You can't use Get or Needs on a third  
>>>> party
>>>> package (the user may not have this package).
>>>>
>>>
>>> that's a reasonable restriction, but we should be able to use  
>>> standard
>>> packages somewhat transparently.
>>>
>>> right now, i'm trying to figure out how to use the LinearRegression
>>> package with an nbp file.
>>>
>>> cheers,
>>> Mitch
>>>
>>>
> 
> 


  • Prev by Date: Re: copying a variable
  • Next by Date: Re: How to debug init.m?
  • Previous by thread: Re: Re: Re: External packages, Manipulate, and MathPlayer
  • Next by thread: Re: Re: animated faces of polygon