Wiki » History » Version 19
Version 18 (Chris Cannam, 2014-02-13 02:43 PM) → Version 19/27 (Chris Cannam, 2014-02-14 03:25 PM)
h1. Wiki
!/projects/human-echolocation-java-webapp/repository/raw/doc/matlab-webapp-50alpha.png!
* [[Deployment runthrough]]
h3. Some issues on building the compiled version of the MATLAB code
h4. Reading config files (m files using eval)
When reading/writing files - such as config files - not everything will behave like in the matlab console.
The way the config files were being read was not working - was simply using eval. It was necessary to read the file manually, adapting the suggestion found here: http://stackoverflow.com/questions/185461/reading-input-m-file-in-a-main-m-file#185660
> (...)in a function we would create a text file, INP, containing our parameters.
> We create this file in the directory returned by the ctfroot function.
> Then, in MAIN, we would use the following to retrieve these parameters:
>
<pre>
eval(char(textread(fullfile(ctfroot, INP), '%s', 'whitespace', '');
</pre>
See commit:d9262cdbfb38d9262cdbfb38 on the jabuilder-int branch.
h4. Other input/output files
At the moment the input/output is done in the same folder where the the java class is being called from (hrir_final.mat and binsimecho.wav...).
h3. Building the isvr jar
<pre>
> /Applications/MATLAB_R2013b.app/bin/mcc -W "java:uk.ac.soton.isvr,HumanEcho" -d ./scratch -T "link:lib" -v "class{HumanEcho:./webapp/WEB-INF/mcode/gen_echo.m}"
</pre>
h4. Contents of the isvr jar
<pre>
> jar tvf scratch/isvr.jar
0 Tue Nov 26 16:47:42 GMT 2013 META-INF/
68 Tue Nov 26 16:47:44 GMT 2013 META-INF/MANIFEST.MF
0 Tue Nov 26 16:47:30 GMT 2013 uk/
0 Tue Nov 26 16:47:30 GMT 2013 uk/ac/
0 Tue Nov 26 16:47:30 GMT 2013 uk/ac/soton/
0 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/
3895 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/HumanEcho.class
336 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/HumanEchoRemote.class
168802 Tue Nov 26 16:47:30 GMT 2013 uk/ac/soton/isvr/isvr.ctf
1798 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/IsvrMCRFactory.class
</pre>
h3. Configuration
The app configuration file can be found in @WebContent/WEB-INF/classes/myapp.properties@
h3. Logging
We are using log4j for logging. The log4j jar (1.2.17) is included in the repository. The configuration file is in @webapp/WEB-INF/classes/@
h2. Building the webapp with Javabuilder/MATLAB (using the precompiled isvr.jar)
* [[Development notes]] Download MATLAB MCR 2013b (8.2) version from this page:
<pre>
http://www.mathworks.co.uk/products/compiler/mcr/
</pre>
h2. Tomcat
* Using Tomcat 7 (Catalina). Download from
<pre>
http://tomcat.apache.org/download-70.cgi
</pre>
!/projects/human-echolocation-java-webapp/repository/raw/doc/matlab-webapp-50alpha.png!
* [[Deployment runthrough]]
h3. Some issues on building the compiled version of the MATLAB code
h4. Reading config files (m files using eval)
When reading/writing files - such as config files - not everything will behave like in the matlab console.
The way the config files were being read was not working - was simply using eval. It was necessary to read the file manually, adapting the suggestion found here: http://stackoverflow.com/questions/185461/reading-input-m-file-in-a-main-m-file#185660
> (...)in a function we would create a text file, INP, containing our parameters.
> We create this file in the directory returned by the ctfroot function.
> Then, in MAIN, we would use the following to retrieve these parameters:
>
<pre>
eval(char(textread(fullfile(ctfroot, INP), '%s', 'whitespace', '');
</pre>
See commit:d9262cdbfb38d9262cdbfb38 on the jabuilder-int branch.
h4. Other input/output files
At the moment the input/output is done in the same folder where the the java class is being called from (hrir_final.mat and binsimecho.wav...).
h3. Building the isvr jar
<pre>
> /Applications/MATLAB_R2013b.app/bin/mcc -W "java:uk.ac.soton.isvr,HumanEcho" -d ./scratch -T "link:lib" -v "class{HumanEcho:./webapp/WEB-INF/mcode/gen_echo.m}"
</pre>
h4. Contents of the isvr jar
<pre>
> jar tvf scratch/isvr.jar
0 Tue Nov 26 16:47:42 GMT 2013 META-INF/
68 Tue Nov 26 16:47:44 GMT 2013 META-INF/MANIFEST.MF
0 Tue Nov 26 16:47:30 GMT 2013 uk/
0 Tue Nov 26 16:47:30 GMT 2013 uk/ac/
0 Tue Nov 26 16:47:30 GMT 2013 uk/ac/soton/
0 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/
3895 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/HumanEcho.class
336 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/HumanEchoRemote.class
168802 Tue Nov 26 16:47:30 GMT 2013 uk/ac/soton/isvr/isvr.ctf
1798 Tue Nov 26 16:47:36 GMT 2013 uk/ac/soton/isvr/IsvrMCRFactory.class
</pre>
h3. Configuration
The app configuration file can be found in @WebContent/WEB-INF/classes/myapp.properties@
h3. Logging
We are using log4j for logging. The log4j jar (1.2.17) is included in the repository. The configuration file is in @webapp/WEB-INF/classes/@
h2. Building the webapp with Javabuilder/MATLAB (using the precompiled isvr.jar)
* [[Development notes]] Download MATLAB MCR 2013b (8.2) version from this page:
<pre>
http://www.mathworks.co.uk/products/compiler/mcr/
</pre>
h2. Tomcat
* Using Tomcat 7 (Catalina). Download from
<pre>
http://tomcat.apache.org/download-70.cgi
</pre>