Re: Re: webMathematica, Packages, and hostSRV.com
- To: mathgroup at smc.vnet.net
- Subject: [mg69781] Re: [mg69753] Re: webMathematica, Packages, and hostSRV.com
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Sat, 23 Sep 2006 04:44:00 -0400 (EDT)
- References: <eel2ak$eed$1@smc.vnet.net> <eeof3j$1vc$1@smc.vnet.net> <200609220504.BAA16448@smc.vnet.net>
Wait! Before you go changing all your local files... It sounds like your user folder on the server isn't on $Path. Assuming your Import of myfile=ToFileName[{"webmxxxx"},"myfile.GIF"] actually works, this is what happens: Mathematica goes down the list of $Path, and appends myfile to each path. It imports the first one it finds. To find the absolute path to your user folder within Mathematica, use FileType to detect which entry of $Path contains your user folder, perhaps via something like: Pick[$Path,FileType[#<>$PathnameSeparator<>myfile]&/@$Path,File] (untested) Then just add your user folder to the path in one of the initialization files. I'm sure the person that runs the website could tell you the most appropriate place to do so. On 9/22/06, Fred Klingener <gigabitbucket at brockeng.com> wrote: > Brian, > > Thanks for the response. > > By exhaustive search, I've found that hostsrv evidently uses a common root > for everyone, so I have to prefix my contexts and file specs with my user ID > > Needs["webmxxxx`myfunc`] > > and > > Import[ToFileName[{"webmxxxx"}, "myfile.GIF"]]. > > Relative addressing of *.jsp files from within *.html files needs a > > ../app1/MSPScripts/webxxxx/myfile.jsp. > > Cobbling up my local file structure to make it so the same files will run > both places is a royal PITA. > > At least it runs. > > Maybe answering my own post will save someone else days of pain. > > Thanks again, > Fred > > <bghiggins at ucdavis.edu> wrote in message news:eeof3j$1vc$1 at smc.vnet.net... > > Fred, This is how I do it on my machine: > > > > My layout is as follows: > > > > Tomcat/webapps/webMathematica/myproject > > > > where the folder myproject has my jsp files. > > > > Now suppose I need to load a package called myfunc.m > > > > This package is located in the folder mypackages which is located at: > > > > Tomcat/webapps/webMathematica/WEB-INF/Applications/mypackages > > > > Then in my jsp file I have > > > > <msp:allocateKernel> > > <msp:evaluate> > > Needs["mypackages`myfunc`"]; > > </msp:evaluate> > > etc > > </msp:allocateKernel> > > > > My guess this is how you have things set up on your local server. > > I suggest asking the folks at hostSRV where they recommend locating > > packages. > > > > Not sure this helps much > > > > Cheers, > > > > Brian > > > > > > Fred Klingener wrote: > > > Anyone here with experience with hostSRV? > > > > > > Background: > > > > > > I'm trying to migrate a Mathematica application to webMathematica, > > > ultimately to run on my account at hostSRV.com > > > > > > Success: > > > > > > I have a set of files, *.m packages and *.jsp Java Server Pages, > installed > > > and running happily on my Tomcat localhost. The *.m files are currently > at > > > ../WEB-INF/Applications/ per installation instructions, but they'll work > > > installed in a lot of different places. > > > > > > Failure: > > > > > > When the files are FTP'd to hostSRV, I can't get webMathematica to find > > > the *.m files. Needs["newPackage`"] (or any permutation of the context > path I can think of) > > > returns $Failed. While I can get it to return things like $Path and > > > $ContextPath, and while the responses make sense, they have limited use > > > because of the way the hostSRV FTP server flattens out the directory > > > structure it exposes to the developer. I suppose it works the way it > does to > > > enforce security and webMathematica expectations, but it makes it > extremely > > > difficult to analyze problems when they arise. > > > > > > I'm out of things to try. Any suggestions? > > > > > > I mean besides "Give up. You're obviously not smart enough to try this." > > > > > > TIA, > > > Fred Klingener > > > > > > -- http://chris.chiasson.name/
- References:
- Re: webMathematica, Packages, and hostSRV.com
- From: "Fred Klingener" <gigabitbucket@brockeng.com>
- Re: webMathematica, Packages, and hostSRV.com